#multiplayer
1 messages Β· Page 599 of 1
never spawned manually, i normally put all my logic in FindPlayerStart and GetDefaultPawnClassForController
(BP)
basically
and again thank you.
if you override HandleStartingNewPlayer and add call to Parent function and connect it
you are at the point where you have (for the first time) valid PlayerController, PlayerState and PlayerPawn, which is Possessed at this point
spawning manually would omit the Parent function call
have you spawn Pawn via SpawnActor at FindPlayerStart transform, then Possessing it (PC provided as input on the event)
ok again to learn :)
what if I just set None to default Character, then when server has loaded the streams manually spawn and possess them?
to manual spawn you mean
as it would be called only after server has finished loading streaming levels
in this setup
what would I have to do to make this happen?
- set default character to None
- manually spawn in the
HandleStartingNewPlayercall
but how can I ensure that the server has loaded the streaming levels?
you already did
you prevented server from calling HandleSeamlessTravelPlayer
HandleSeamlessTravelPlayer calls HandleStartingNewPlayer
ah so this needs bits of the previous setup
bonus with HandleStartingNewPlayer
wait wait π
so for this last option of manually spawning after setting default character to none
what of the previous overrides do I need to keep
Hello, any specific reason for my player states's property showing up as null or zero on the clients?
It is set a replicated
What kind of property is it?
at first was a Character but I found out it doesn't work with floats either
Wanted to store the reference to the character in the world that a player is in control. like a moba character
PlayerState already has that, but only in C++
on my current framework, the player pawn is actually a camera pawn that follows the controlled character
You're certain you're setting it only on the server?
ah good call. was using Init Start Spot to spawn the character and assign it to the player state
maybe is client side only
being on game mode, is on the server. just checked
ah found the issue!
was using GetPlayerController to get the player state on that function in the game mode
my bad π
Haha, happens. I do definitely avoid that function when not dealing with client only stuff like getting the HUD for that client or whatever.
lol, that's a strange architectural choice
why is that? I want to have the player camera separate from the actual character
how would you do it?
subclass the player camera manager and write your camera code there?
the normal UE4 way is to possess the character you're actively controlling, not some separate camera actor
and is the camera actor something you actually have to have network relevant?
ah good call on the camera manager. I'm going to check that one out
no, the player camera isnt replicated
yeah, even more bad stuff then
even if you have a separate actor, the thing you should possess is the character
^
but I want to have it working kinda like in an RTS
what are you trying to achieve?
if you mean rotating the camera around the player and such, you definitely donβt need to reinvent the wheel
I want to have multiple hero characters that are controlled by AI or by a player
the player acts as a god or spectator in the game, taking "control"/giving orders of a given hero
and the camera just moves around the map like in a RTS or follows the current selected character
Well, for like an RTS a separate CameraPawn is perfectly fine. Specially if you need like Behavior trees for the character.
help, my movement speed seems to be directly proportional to my number of players 
empirically guessing
that is actually the very first time i heard that one π
I mean I could just divide by number of players but not sure so robust...
now time to stop adding X to speed of GetPlayerCharacter[0]
which is what im assuming you did
other possible causes: not accounting BeginPlay, Tick and Overlaps run for every character on every machine
idk Im using projectile movement so I thought it might be some complicated physics stuff to do with time stepping
to achieve that you have to be adding some float to current max speed somewhere
or some vector to projectile movements velocity
Yes
your bug is there
THis is in the character blueprint
i don't seew what goes into velocity pin
that is unusual, since it doesn't technically accelerate, it just overwrites velocity vector
hows float velocity set?
you mean the projectile movement settings?
the one visible on top screen
doesn't seem to be number of players related
unless you're doing PIE and your FPS drops
because that speed is framerate dependent, the worse your performance the faster it goes
yeah but its not linear like
I have 6 players vs 3
my fps drops from 30 to 25
but the characters move 2x as fast
and I am multiplying by time scale
is Execute Console Command BP node of the "servertravel" command going to be blocking? EG, can I use the exit pin to do something after the travel/level load is successful?
What is the best way to test a dedicated server locally? I heard of something called "cloned client" or something like that, to test it. I need to test a game session; before I can start using AWS
Hey all, learning how to do seamless travel. I am missing a basic understanding of how to return or execute a function after server travel is complete. Really, when Streaming is complete in the next level.
After this:
@tidal crown no, it will execute synchronously right after you init travel
@sly violet fine control over seamless travel usually requires c++
but BP can usually gimmick something up
depending what you need really
I went hunting and found OnPostTravel could be overridden from C++ so I just tacked a multicast delegate to it.
PostSeamlessTravel you mean?
yeah that one π
its funny how much of this stuff i really want in BPs that they just kinda leave to myself
there are some things they didn't expose but really should had
on the other hand, there are few things they exposed that is just insane to expose to BP
I've been experiencing an error I haven't been able to resolve for about a week, after getting into the GameDev.tv course on Unreal Engine 4 networking.
If anyone could provide some insight I'd be grateful. screenshots below.
Basically:
I setup logmein Hamachi computer A, copy the ipv4 address of computer A, then start the server on computer A.
I start LogMeIn Hamachi computer B, Join Computer A's server.
I use this command to join Computer A's game instance"C:\Program Files\Epic Games\UE_4.23\Engine\Binaries\Win64\UE4Editor.exe" "E:\Unreal\LearningUnrealNetworking\NetworkingProj\MyProject3.uproject" {IP} -game -log
Error
Log
Command
@zinc charm it's not making the connection (timing out), so if they are on the same network (via hamachi), you'll probably need to open the right port. I went through this exercise not long ago.
TL;DR: open up private port 7777 in your windows firewall
win key -> firewall -> advanced settings -> right click inbound rules -> new rule -> "Port" -> UDP 7777 -> finish going through that wizard thing
sometimes these rules don't immediately take place, so might need to reconnect to your network or restart or something. Not sure why they don't always take place immediately.
Thanks a ton dude, i been struggling with this for a week.
Imma try it and let you know.
Yeah you're where I was a few days ago and it took a while to figure out what was going on. Hope it works for you.
Do I need to create a dedicated server build to test ded. server connection while I'm debugging stuff ya think?
Doing my head in jumping between the server debugging and the 'client' (which is the same stuff, just different builds)
yeah cool. I was just wondering if there was any wildly different behaviour
But that's fine.
Could not find SuperStruct TestGameMode to create BP_TestGameMode_C
This error only occurs after packaging and running my dedicated server (on startup)
does your server Target.cs contain the module that has the TestGameMode in it?
It does, however, I do notice that my Server target cs looks slightly different than my editor target cs
ExtraModuleNames.Add("GameName"); vs ExtraModuleNames.AddRange( new string[] { "GameName" } );
The former is the server cs
this makes no difference
but the class is missing from the server build for sure
and you must use a source build to properly build a dedicated server
Yeah, I'm using a source build. I guess I will try to re build again and see if that fixes it
Whats the way to make a friend list without Steam? I am working with mobile, so I cant use Steam, and I dont understand what EOS is stands for. I mean, Steam has its own accounts, database etc. Should I make my own account system for EOS?
Thanks, ignore my 2nd question if you saw it π
Does anyone have experience or an idea on how to set a UWidgetInteractionComponent's Virtual user index for an online game?
Are there good examples of this? In your experience is there a fundamental line in the sand between code and blueprint, or is it just black boxing for safety and stability?
"does a designer touch it?"
and with OSS stuff, a designer wouldn't
black boxing is kind of important for us too, since we have a moddable game
ugh, I'm an idiot - There's no such thing as a Server HUD.
any tips on implementing an RPG inventory "grabbing" item in an authoritative multiplayer setting?
do you guys have a "grabbed item" replicated property, or do you use client-side tricks?
right now when I pick up the item out of my inventory to equip it, that only happens client side. and I send a "swap items" RPC when the user clicks to place the item
i made my life harder by doing a jigsaw style inventory where items can be different sizes
this makes it possible to swap a large weapon for a smaller weapon and the large weapon doesn't fit anymore in the inventory
what happens if I call a Client RPC on AIControlled pawn, I wonder why client get the rpc. it dosent have owner.
@barren patrol
I may not be able to answer your question. But please can I ask if your inventory is UMG based or based on "pure" logic.
E.g I also made a jigsaw inventory but the code for mine is in an Actor Component. It also supports containers within containers
Most of the tutorials I found were based on Widgets which I didn't like because UMG exists only client side
yeah mine is UMG. Personally im fine with it, I have an actor inventory component that manages the data and replication. the UI should just listen for events and call RPCs on that component
Oh. I only use widgets to move items within and out of the container.
anyone familiar with an issue where a struct is not being replicated from server to client?
@barren patrol
How I handled replication is to replicate the array of structs holding the item data. Any interactions with the items in the inventory is done using RPCs in the owning actor that in turn call regular functions in the component.
E.g to equip an item from the inventory. I have a RPC in the character that calls an equip item function in the inventory component. The function then handles removing the item from the inventory. I also use the item data to spawn an actor on the server. That attaches itself to the character.
It's sound convoluted but it uses no more than two functions
sequencer vs code and timelines for moving platforms/elevators? THoughts?
Hi guys anyone know why when we run the dedicated server , sometimes the pc deleted in client automatically , and sometime they not delete it , is that an issue for ue4 4.26
that would be an excellent one, that has no business being exposed to BP
lost more then a day recently tracking down "breaking GC cluster assumption" crashes because someone accidentally ticked that on on one of the BP actor bases
Wow, no kidding!
basically, editor does no GC clustering, so it won't break
but packaged debug/dev game what happens
those actors get added to the root set
now, some of our actors inheriting from it could take damage, and the handling for it was done in BP (just a window glass shattering, nothing gameplay critical)
which meant it had a PointDamageEvent node, which had a DamageSource pin on it
and the way BP pins work, that window kept the reference to the last weapon that damaged it forever
but because its in a root set, its not allowed to reference anything outside root set, or it breaks GC cluster assumptions
which brings us to the crash
so... yeah
exposing that to blueprint is positively insane
If I do 'ServerTravel' i.e. World->ServerTravel(FString("/Game/Maps/Track2"),false,false);
I don't need to tell the Player Controllers to do the OpenLevel on their end too, right?
also getting this on my server. LogNet: NotifyAcceptingConnection: Server Lobby refused
Basically, my clients aren't changing their maps. It's like the Server has travelled and hasn't taken the clients with em
Any ideas would be appreciated.
check if game mode on that level has bUseSeamlessTravel=true
is there any way to see what code is not replicating? I am running into issues where my character does the jitters which means something is not replicating correct
No, it doesn't really work like that
Character jittering just means something in your network code is wrong
Usually it means divergent behaviour between server and client
For example, different velocity on both
or replicating the skeletal mesh when using CMC
hi guys , anyone know why if my client connect to the dedicated server
if I have a lot of client connect to the server at the same time, it will remove some of client's pc
I using replication graph not sure , is it related to that
hey i am wondering, if i have a quest system that i want to replicate and it has features like accept, decline, abort, track quest, interacting with NPCs and destroying objectives after they have been completed what parts of the above should i replicate?
I dont understand why this is happening but I have an event dispatcher that calls a code thats suppose to open a door but if I have more then 1 door on the map, it only opens door_example if there is a door_example 2 it wont open even though I told it to open what else do I need to do to get the other doors to open?
this is my door code
@halcyon totem what do you expect to happen when?
hi guys, i just upload a gameserver build on the aws gamelift service, and create the fleet, im following a tutorial to setup aws and in the next step the guy crate the queue list and the matchmaking flow, my question is, there is a way to start joining the server from the client? i would like to make join a friend and test some stuff, it is possibile? if yes, can you point me in the right path? thanks
i need to create the flexmatch system like in this tutorial? or i can just join? im not interested in matchmaking atm just wanted to join randomly if possible
Watch Part 3 here: https://youtu.be/_A4JiDY24gM
This video is the fourth part of an extensive and informative tutorial on how to integrate Amazon GameLift with Unreal Engine, going over concepts such as creating a FlexMatch matchmaking configuration, attaching a matchmaking rule set to the matchmaker, and making an SNS topic for receiving match...
Get the IP and port of the dedicated server instance from the fleet and execute command.
open ip:port
in the server fleet i put as ip 0.0.0.0/0 and port 7777-7778
the ip if you know is getting assigned automatically or i need to request it? cannot find probably the right settings
Not fleet execute command at client side
@meager spade the problem I have is that only 1 door opens the first door I put on the map the others won't open
@twin juniper
mmm but for ip i should set 0.0.0.0?
why?
you want to connect to your gamelift fleet or some else's network where your dedicated server doesn't exist?
to the gamelift fleet
lol well i don't have anything on there
nah its all good
is a simple build lol
if you don't mind , then post it publicly. π
you scare me ahahah yeah i don't have anything and it's the free tier but ok better to not you have right
btw cannot find the server ip for some reason
address range say just 0.0.0.0/0
free tier doesn't mean you won't be charged at all, there are few services which aren't free in free tier, few services have quota in free tier, if quota exceed you will be charged
yes i will terminate the fleet or just stop the service once i get connected
it is just a test basically
i have never worked with gamelift, ideally if you use ec2 instance, if spin one instance you get an IP allocated like 110.56.95.125 and client can connect to that IP
and gamelift is no exception to this rule
i have given you the idea how to connect. in console you should be able to find the running fleet and its IP
ok thanks i will search deep, they hidden probably somewhere and i cannot see it
Anyone used the enhanced vehicles plugin with replication? Cant seem to get a smooth movement without bumps each second
is anim instance class is replicated?
or should i need create custom event inside that class to run logic on client side?
no
@twin juniper You need something to create a player session for you and pass it to the client. For example, I have a Lambda function that I call using a REST call to "log in" which also returns the session details to the client which contains the appropriate IP address of the server.
https://docs.aws.amazon.com/gamelift/latest/apireference/API_CreatePlayerSession.html
Reserves an open player slot in an active game session. Before a player can be added, a game session must have an ACTIVE status, have a creation policy of ALLOW_ALL , and have an open player slot. To add a group of players to a game session, use
all the necessary information needed to accurately reproduce animation on the client should be networked via the pawn
huh? if you're spawning a replicated actor this needs to be done on the server only
I'm using newobject to make an object inheriting from uobject
That should be created on the server right?
@mighty zinc Should be created where ever you need to use it. I don't believe you can replicate UObjects by default, so they'd be per machine only just like a non replicating actor.
I only want it on the server
But it should play anims on the client
I've overridden a func
Is supported for networking
But it is only playing anims on the server
You're gonna need to do that via replicating Actor or a replicating ActorComponent of a replicated Actor. UObjects don't have the ability to RPC or Replicate by default.
I mean you could have an object on the server that tells server versions of the actors to tell their client versions to do stuff? But the object itself cannot connect to clients.
Hmm
There are some people who've went to the difficulty of making UObjects replicatable. But I wouldn't have the first idea where to start with that. Most likely editor source.
What are the animations for?
Im makeing an attack component type thing
I have an attack component
Whick contains a u object which has all the anims in it and the imfo about combos and stuff
If your Component itself could replicate the state in some simple variables, your clients could play their animations that way. Either via RPCs, Repnotify, or doing simple replication and letting an animblueprint pick it up.
Then both client and server could have it's own UObject and query it for the correct animation to do.
Nah. I believe that only actors technically replicate. I know that you can make a replicating actor component as well, but it also has to be added to a replicating actor to actually replicate, so it likely goes through the actor class somehow.
@lost inlet Thanks and setting location of obects need to happen on server as well right
well yeah, you pass the location to SpawnActor anyway
No after spawning the actor. Let's say I have a ref to it
Yes and also make sure you have replicate movement enabled
On the actor default settings
Hey all, I'm trying to speed up projectiles on the server in order to mimic blizzard's profectile lag compensation. Speeding up so it catches up to where the projectile would be if spawned when the initial player cast it.
My projectile right now is NOT replicating back to the original owner, so it's spawned on the client, and then spawned on the server and that one is replicated to proxy clients.
I can't seem to figure out how to speed it up only on the server. Has authority check before change speed still changes both projectiles. Anyone know how I can check that the projectile is just the one on the server and speed only that one up?
@tidal quarry If I read that correctly, you basically want to know if the code you're running is on the server version of the object?
yes
Blueprint or C++?
blueprint
Use IsServer.
has authority node still runs the code on both.
so does "run on server"
Then you're replicating it somehow.
is it being replicated back anyway? even though I have net relevancy set to not owner?
It won't run on both if it's behind that check unless you're doing something that's replicated, which would then run on the server, and afterwards run on the client anyhow.
If i put a print in the function that's behind the authority check, it shows both client and server
What event are you doing this on and can I see your logic train?
this is begin play
I'm using GAS and gameplay task to spawn the projectile, then setting owner
my projectile parent is a class with this set
Hmm. I wonder if that's being spawned on the client as non replicated as well? Let me test that quick. Cause I'm semi certain that HasAuthority will return true if it's a client spawned actor and the check is on the client.
Yeah, authority doesn't = server
Client will indeed return true if client is authority
Yeah, just confirmed that for client spawned actors.
ok i can set speed on server now, but it doesn't actually speed up ^_^
does setting initial speed after begin play not speed up an object? i thought it did. or is something else going on
I have a scene component that is parented to my character's head bone. This way, the scene component follows where the player is looking.
However, the SERVER version of a client's scene component does not update location when the client looks around, UNLESS the server player is physically looking at that client character. There is some sort of relevancy at play here, and I'm not understanding
@tidal quarry I don't believe so. I think that's just for setting the initial velocity via the length 1 vector. I'm fairly sure for a projectile movement component, you'll have to set the velocity.
Basically just turn velocity into a normalized vector, then multiply it by your new speed.
Thanks! it works
Now just need to set correct velocity based on client ping π
and we have overwatch projectiles i think
I think I've honestly scared myself to actually start a real multiplayer project. I love the multiplayer theory crafting and have a nice design and scope I'd love to do, but thinking of actually doing it is terrifying.
Ahhh, my client spine rotation isn't updating on the server when the server isn't looking at the client. π Anyone know why this is?
That reminds me though. I'm still looking for a solid way to manage collectible foliage in multiplayer.
FFastArraySerializer
single replicated actor
and all foliage is not replicated
your FFastArraySerializerItem would look something like
UPROPERTY() int32 FoliageID; // something you can use to grab a DT row or DataAsset, doesn't have to be int32
UPROPERTY() FTransform SpawnTransform;
UPROPERTY() FFoliageStatus Status;
TWeakObjectPtr<ACollectableFoliage> FoliageActor;
PostReplicatedAdd
{
causes actor to be spawned, sets the Foliage Actor
}
PostReplicatedChange
{
if FoliageActor use Status to update it
}
PostReplicatedRemove
{
causes FoliageActor to be destroyed
}
you can use multiple AFoliageNetworkManager?s to cover areas of the level if its large enough to warrant it, in that case server would find closest NetworkManager to SpawnTransform and add a new Item to it
performant, reliable
And this is the struct that inherits from FFastArraySerializerItem?
If I just read the example correctly.
Gonna try setting up a quick test of this.
@kindred widget you FFastArraySerializer will need the Actor that holds it to push a reference to itself into the fastarray
or you'll have to setup delegates from the fastarray
because you won't be able to spawn those actors without world context
one important note is
if you go for pushing a TWeakObjectPtr<AFoliageNetworkManager> Owner; into the fastarray
do not UPROP it
and use a weak pointer
otherwise if you derive a BP from BP from the c++ base that has that fastarray
the UPROP will get serialized
and owner will end up being the CDO of native base class
β€οΈ unreal
(talking about doing MyFastArray->Owner = this; from constructor
you can also get away with nor replicating the entire tranform, just netquantized location/rotation
I probably won't even care that much about rotation. Location is enough most likely.
and if there is no scale, you can just do a single FVector_NetQuantize instead of transform
Not exactly sure why, but this is throwing a fit from the example I was following.
struct FFoliagePlacementArray : public FFastArraySerializer
{
GENERATED_BODY()
UPROPERTY()
TArray<FFoliagePlacement> FoliagePoints;
bool NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms)
{
return FastArrayDeltaSerialize<FFoliagePlacement>(FoliagePoints, DeltaParms);
}
};```
Specifically the return.
Ohh, he was literal about that. I thought that was just to line that up with the other one.
Changed it back, but I'm still getting this?
FastArrayDeltaSerialize<FInteractionInstigator, FInstigatorContainer>(Items, DeltaParms, *this);
from one of mine
its also not just the Placements you replicate with it
so the naming could use an upgrade
Probably. What is the last parameter in that? It seems to be what was missing from this example.
*this
its the FastArray itself
its this in the context of its member function
where did you pull the example from?
Here. I know it's a little dated just because he's still using GENERATED_USTRUCT_BODY
NetSerialization.h header, engine
very much worth a read, it has most of unreal's docs for net serialization in it π
Do I actually still use the old GENERATED_USTRUCT_BODY even in mine, or should I keep using GENERATED_BODY ?
you can always use GENERATED_BODY
the header is old-ish but not as much as that guide you found
UPROPERTY()
TArray<FExampleItemEntry> Items; /** Step 3: You MUST have a TArray named Items of the struct you made in step 1. */
its why i never attempted to call it anything else
Fair enough. I just assumed it was to match up with the return below.
we run ~1500 actors via somewhat more complicated version of this through fastarrays instead of replicating them
our network manager actors are made to run in conjunction with interaction interface
and interactable actors are not replicated, but are net addresable, so we also replicate a pointer to them
you will probably need to make your foliage netaddressable as well, come to think of it
if your interaction is just harvest anything in range, you won't
as server can then find foliage in range and harvest it
if you want to send a pointer to specific collectable through an RPC you will need net addressable foliage
I was mostly just considering sending an RPC to the server to have the change the array, and then remove the instance via the replication. Thankfully it's just a little coop game though, so I'm not that crazy about cheat prevention or such.
that is achieved by making sure each foliage actor is spawned with exact same name on server/clients
and overriding IsFullNameSupportedForNetworking to return true
you can set the name via FActorSpawnParameters::Name
any foliage that is preplaced on the level is easier
i gave you the fastarray pattern for procedurally spawning it
Well, I'll likely be using the fastarray in other places too. So it's good to learn it. I've been meaning to for a while.
for pre-placed foliage
you just need a pointer to foliage actor and status of foliage
and you also don't need to add their items to array server-side before you actually change something
I made a little actor that did that at one point. Literally just an array of points, which updated only when the foliage was collected, and it'd remove any of the foliage for that type at that point on all clients, and eventually remove the entry, which respawned it on all client.
On a side, note, what do I need to include for the FastArray? Is that just UnrealNetwork?
this is a much more precise beast
NetSerialization.h
we don't even use TArray replication anymore, except for super simple small stuff
Actors running those fastarrays can (because they drastically reduce number of actors considered for replication) run with high priority and high net update frequency
makes your network respond beautifully
we have interaction wheels networked and shown over our players heads while they are interacting
Hmm. This include is being a dick.
before we switched to fastarrays that was horribly choppy
Do I need a module included to use this?
#include "Engine/NetSerialization.h"
and no
missing module includes are linker errors
that happens only after a successful compile π
Nope, just me derping. Got so excited to compile I ignored the green squigglies and didn't add the functions to the .cpp file.
Yeeeeah. It's aliiiive!... At least as much as a static mesh. It exists.
i imagine they would be slower then normal TArrays in SP, although not by a significant margin
about the same as if you were to wrap your array in a struct
So this is just specifying the array's structure. Do I need to add a Uproperty of the FFastArraySerializer with the Items in it to my class now?
and it needs to be a replicated one
Just a normal property of that, not an array of it, right? Since the array is actually inside of that as the Items?
UPROPERTY(Replicated) FFoliagePointArray FoliagePoints;
in tha actor that replicates it
Okay. Now that I'm done derping with getting that actually replicated...
Do I simply modify the Items array in it and mark the new entry as dirty?
AHA! Victory. So using Add_GetRef is an easy way to also mark the item as dirty. That was oddly easy. I've been putting off learning that for months.
What's the best way to replicate swimming? This is what I have. It doesn't work well. THe overlaps are just box collision on my character above waist. https://gyazo.com/db5ed27a1f7ac14ab55f00ad5f75eebb
Doesn't that just happen automatically? Won't both the server and client's CMC set the movement to swimming when it's character enters a water volume?
also you would not want to multicast a state
that is terrible
MovementMode should only ever be set on local client and server, never on simulated proxies.
also overlaps fire on client and server
so multicast seems a bit weird.
and server rpc seems weird
Yea thought so that's why not working. So to fix it. I have to move movementMode out of it
I honestly just assumed it was automatic since the volume is on server and client. No networking would have been needed.
no you dont need to multicast or server rpc anything
just set movement mode to swimming
in the overlap, and back to walking on overlap end
no need for the rpc's
I think i tried it didn't work. ok let me try that quickly
overlaps ALWAYS fire on client and server
if it exists on them
its how automatic doors work in our game
we do 0 replication on the door open/closed state
the overlap handles that
What about the physics volume? DO I have to place one in the world or not needed?
Out of curiosity. How big is a FastArray allowed to be? Is there a general limit?
not really
i heard in fortnite they have 1000's of items
that is the beauty of them
it only replicates the new, changed or removed item. Also has client side callbacks PER item.
So no issues with one having four to six thousand entries possibly?
nope
Brb, making multiplayer game.
Anyone know how I can make my client animBPs always relevant on the server?
My modify bone transform nodes for the spine don't change on the server for simulated proxies unless the server player is looking at the skeletons
It's super strange
There is a setting somewhere that changes the update rules for skeletons.
You sound like you have it set to update only when rendered
Not sure cant remember.
Its most likely on the SkeletalMeshComponent of the Actor thats using the Skeleton.
Hmm, the only modified property that i have is UpdateJointsFromAnimation. I will look around and see if the animBP has any variables that work
Unless the default behavior is what I am experiencing, in which case I may play around with some mesh settings
VisibilityBasedAnimTickOption must be what you were referring to
I have it set to always tick pose
Ayyyy
Setting it to AlwaysTickPoseAndRefreshBones worked
I wonder if that was the default setting. It doesn't even show a modified icon next to that option when changed
π
Trying to learn the Pre and Post replication settings for the FastArray. I assumed the argument from this was the array with the Items in it, but I can't seem to get the struct's properties out of the Items in the Items array from that argument. Do I need to cast that somehow?
void FFoliagePlacement::PreReplicatedRemove(const FFoliagePlacementArray& InArraySerializer)
But what is the argument for? Isn't that the array that it's a part of?
it is
i generally use it to broadcast a delegate in the array
then actor that listens to it responds by making changes
losing track of scopes i take it?
I was trying to do InArraySerializer.Items.Location, not InArraySerializer.Items[Index].Location. >.< This week has frazzled me.
i usually end up implementing a ton of QOL stuff on my fastarrays
operator[] (int32 Index)
iterators
add/remove functions
and so on
basically just wrapping TArray stuff + some fastarray specific stuff if needed
Yeah. I'm definitely going to play around with this most of tomorrow most likely. Thank you for the help on the understanding it though! Going to make some design work a lot easier.
@meager spade So I have placed one physics volume in the level. When one of the players is in the water, the other one appears get its volume enabled prior entering water. Is the overlap issue or flaw how it was done
So I have two box collisions one above waist and one below waist. They are used to check begin and end overlaps to enter and exist water.
https://gyazo.com/022f73169d8edde047938ac1f5df280c
How can i replciate this? https://gyazo.com/863699aa9a84f57e3f48bb3aa4669ade
So I have this object and I want to set its location so that both can see it
How do I disable Render Main (mesh) for the owner only? Running it through a custom event with Owning Client doesn't work. It also disables it for everyone else
Okay so apparently it does work... Just not when I access the custom event through Begin Play for some reason.
I wonder.. should a 'use / interact with' action be predicted? 
Or can it just be handled by a player controller?
I made a really dumb "fix" that applies whenever the player moves the character and then it only happens once. It works though π
@winged badger just curious... you seem like you know a lot about ue4 multiplayer, and I hope you dont mind me asking, but do you freelance? And if so how much is your rate?
you can PM me if you dont feel like replying here
or just dont if you dont feel like replying at all π
@vocal cargo unless you can drag him from his current job, i doubt that π
Anybody knows how to replicate a cable component to an actor? https://gyazo.com/7257537d34988e8f56417ad3f54a19b2
@bitter swift What is that even doing? That shouldn't even need networked. Control input is always local on the client. So that RPC isn't going anywhere.
But besides that, be very careful about using reliable RPCs on tick like that.
"Improvement: Consolidated client-server character movement RPCs to a simple function signature using a new extensible struct, to more easily support custom data in RPC parameters without having to change engine source. This allows for customized serialization that can more efficiently pack the data over the wire, and solves some previous ordering issues with ServerMoveOld being sent as a separate RPC function. See the feature docs for more details."
anyone know where to find those "feature docs"?
what is the best way to have a lot of servers
the only servers i made are a big mc server and some tf2 and csgo servers
wanna add on the swihmhmhing conversation above,in your custom cmc how would you handle swhimming?i'd imagine making a fucntion that hhshwitch the movhehmehnt mode to swimming
@turbid crest Well, you just rent them I guess.
oh
If you want dedicated servers, you simply host them somewhere yourself. Otherwise you might allow community servers. Let players host/moderate their own. Depends on game.
Mad typing skills
Does a variable that is exposed on spawn need to be replicated, or will that be passed to the client as part of being spawned?
Would need to be replicated
okay thanks. I knew if it was set in the defaults it was fine, but I wasn't sure what happened with those when an actor was spawned.
yeah, the engine assumes serialized properties are the same on both ends
I guess that makes sense. I guess there are times when you might want to spawn an actor and not have some exposed value replicated to the clients.
Hey Jambax. How do you normally have a replicated FastArray have the actor holding it do something? I stuffed a reference to the actor in the FFastArraySerializer itself and used that on PostReplicatedAdd, but I'm assuming there's a better way than this?
Hmm I mean you could just use an OnRep callback
I don't think there's anything wrong with holding an Owner property though
It seems to be working at the moment. I'll stick with it I guess. I just didn't want to iterate over the array each onrep to get the deltas to do stuff just with those.
@kindred widget simplest approach is weak non-UPROP pointer to owner in FastArray, that owner just sets to this in its constructor
What is the Weak pointer for? I fully understand hard pointers. Physical memory address. But what is the difference between that and a Soft/Weak pointer?
Weak pointer has the benefits of UPROPERTY (gets nulled on deletion of object) without taking memory ownership as a hard pointer does
and it doesn't need the UPROPERTY to get nulled if what its pointing to is explicitly destroyed
and you don't want the Owner in fast array to be UPROP because of a blueprint serialization bug
blueprint derived directly from native class will work fine, but anything derived from that blueprint will break
and have the Owner pointer point to CDO of the native class, instead of the Owner's instance
I'll test that out. First time ever using weak object pointers. What is a Soft Object then? Someone once described it as some form of address that can also load the object if it's needed? Isn't that only useful for like static meshes or textures/materials sort of thing?
that is for referencing the assets without having them loaded automatically when the object that has the soft object member is loaded
Ah. There we go. So just this in the FFastArraySerializer? TWeakObjectPtr<AActor*> ContainingActor = nullptr;
Then, set that in the AActor class's constructor?
I did. Just used AActor here for simplicity.
any use of owner strongly couples that fast fastarray with the ac tor containing it anyways
And setting it is the same as a normal pointer, just that property = this?
yes
weak pointer has overloaded operators so you can work with it like a hard pointer
if you need to get the hard pointer from weak pointer, just do .Get()
does anyone know if every blueprint on the level should have an owner? I keep seeing these messages in the output log but dont know what it really means
that is what you get when you send Client/Server RPCs through an Actor not owned by a PlayerController
Hmm. Now I seem to have bugged my HISM component. It's running the replication and add functions all correctly on the client, but no tree.
@winged badger Are you sure that setting it in the constructor is okay? It seems if I set it on beginplay, it's running fine, but the constructor... while registering that it's valid, doesn't seem to want to work for.. some.. reason? That doesn't make any sense.
I'd rather the constructor. Valid earlier... and Like I said, it's valid, but.. Like.. Hmm
Let me post some stuff.
thing is
OnReps go before beginplay
for the initial properties
and it would either not pass a null check or crash, if it wasn't valid
Okay. Had to recompile three times just to be certain it wasn't working.
Right. Images are borked
UHierarchicalInstancedStaticMeshComponent* HISMComponent = nullptr;
UPROPERTY(ReplicatedUsing = FoliageArrayUpdated)
FFoliagePlacementArray FoliagePoints;```
The array thingy with the weak pointer.
struct FFoliagePlacementArray : public FFastArraySerializer
{
GENERATED_BODY()
public:
UPROPERTY()
TArray<FFoliagePlacement> Items;
TWeakObjectPtr<ACFoliageReplicator> ContainingActor = nullptr;
bool NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms)
{
return FastArrayDeltaSerialize<FFoliagePlacement>(Items, DeltaParms, *this);
}
};```
Actor constructor.
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
SetReplicates(true);
bAlwaysRelevant = true;
HISMComponent = CreateDefaultSubobject<UHierarchicalInstancedStaticMeshComponent>(TEXT("HISMComponent"));
FoliagePoints.ContainingActor = this;
}```
The post rep add
{
FVector TestVector = Location;
FString TestString = TestVector.ToString();
UE_LOG(LogTemp, Warning, TEXT("%s"), *TestString);
UE_LOG(LogTemp, Warning, TEXT("THIS IS FIRING!"));
if (ACFoliageReplicator* FoliageActor = InArraySerializer.ContainingActor.Get())
{
UE_LOG(LogTemp, Warning, TEXT("Weak Object Valid"));
FoliageActor->AddMeshToComponent(Location);
}
else
{
UE_LOG(LogTemp, Warning, TEXT("Weak Object NOT Valid"));
}
}```
And the small function it calls
{
// Location passed through correctly.
UE_LOG(LogTemp, Warning, TEXT("Mesh is getting added"));
HISMComponent->AddInstance(FTransform(Location));
}```
and attaching the HISM to anything?
That.. I overlooked.
also, be explicit when you set root component
otherwise BP will pick one at random
But question. Why does that all go through to the Mesh is getting added log if I simply set the array's pointer in beginplay rather than the cosntructor?
Gonna make sure to specify the HISM as the root component and see if that works.
Nada. Still runs all of the way though the logs like it's valid, but no tree.
LogTemp: Warning: THIS IS FIRING!
LogTemp: Warning: Weak Object Valid
LogTemp: Warning: Mesh is getting added```
If I move that one line on the bottom of the constructor to beginplay, it works though?
BeginPlay is too late if you add stuff to array in the tick you spawn the actor
or if you have an array of default instance editable locations for preplaced actor
PreNetReceive works
but
if your mesh is getting added
the fastarray workd fine
problem is later
like, client not knowing what mesh asset to use
also? logging
use breakpoints
I think the mesh is set as a default value for the HISM component. The array is being added to on Beginplay behind a != NM_Client.
well, breakpoint in AddMeshToComponent
step in, see whats going on
check the HISM in locals, that sorta thing
Gonna do that. But what would the array's pointer to it's owner have to do with that, and what would setting it in the constructor vs beginplay have to do with that, if it's still firing and valid on both?
logs only have limited debugging use for debugging blueprints from a packaged version
say i spawn the actor at runtime, the ACFoliageReplicator
and add some foliage to it
immediately after
actor replicates to clients
first its replicated values are set, that includes the fast array
callbacks from items are called, owner hasn't been set yet, so they fail
then comes begin play and you set the owner
bit of a timing problem there
same thing if you were to preplace the ACFoliateReplicator on a level and give it some default foliage locations on the instance
callbacks get called before the owner is set
I would have assumed that setting it on beginplay would drive that to be even worse? Cause Beginplay is much later.
and since its printing "Weak Object Valid" you don't have a problem with fastarray owner
something unrelated to fastarray is failing
as long as this HISMComponent->AddInstance(FTransform(Location)); gets called
fastarray has done its job, correctly
the only possible fastarray related problems are
1 - your FVector Location; in FastArrayItem is not a UPROP or has NotReplicated specifier
2 - you never set the Location on the Item server side
in both cases, when HISMComponent->AddInstance is called, the Location would be 0,0,0
@winged badger isnt this how you set an owner ?
Do I need to set an owner? my doors and stuff open in the game
that causes the owner to be mismatched on every instance of the door on every machine
you don't set the owner on a door in order to open it
and you set the owner only and only on server
and you avoid GetPlayerController[0] like a plague
@winged badger The FastArrayItem's Location property is definitely a UPROPERTY. And if I log the Location coming through the AddMeshToComponent, that runs on the client, it prints correctly at the test spot of 0,0,100. Which is only set from beginplay on the server version of this actor.
@halcyon totem Basically if you want a player to open doors, the true solution is to have the player controller RPC itself from client to server with a "server open door" function that takes the replicated door actor as a parameter, and does the door opening server-side.
then your problem is not in the fast array
Why is this, Zlo?
π€
its a user specific statement
It's only useful client side for client specific things.
he doesn't know enough to use it correctly
Ah, I interpreted it as being generally bad to use. I was gravely concerned for a moment there.
and relative path is always better
well, GetGameInstance()-<GetFirstLocalPlayerController() can do the same job
without ever having unintended sideeffects
GetPlayerController(0) is responsible for almost all cross-wiring bugs on this channel
"why does my host die when my client hits zero health?"
and a million variations of
I've only ever found it particularly useful is to use it from Userwidgets, on multiplayer projects.
the only use i have for it really
is GetGameMode->GetNumPlayers->For (0 to NumPlayers-1)->GetPlayerController[Index]
from blueprints, have better ways to iterate controllers in c++
its also useful for splitscreen
Hmm, I'll keep a critical eye when I find the node in my logic. I think I've used it a fair bit, made me question myself a bit π
its a lazy function that lets epic people that make tutorials create them fast and in such a way that all people new to unreal following them break their network
I'm trying to grasp what would actually cause this issue
Wherein lies the fatal flaw?
Or when you say "cross-wiring bugs"
Different outcome expectations on server vs client?
It just comes down to the machine differences on the call. It's useless to use on a Dedicated server. It'll return the first player connected. On Listenserver it'll return the listenserver player's controller, and on a client or singleplayer it'll return the local client. Since most networking is often done between the server/client version of the same actors and most of that is from server to client, it makes that call very pointless in a lot of cases because you shouldn't ever use it server side for server things. Because most client to server networking is done through the controller or character anyhow, and they have easy ways to RPC already without using those calls.
say you send a ServerRPC to shoot a gun from a Character
and instead of sending a pointer to a character or weapon through the RPC
you just make the RPC shoot for GetPlayerCharacter[0]
Right, I did a dig through my code. It's client side stuff that I tend to use it for.
RPC gets to server, GetPlayerCharacter[0] gets evaluated on server for the shot
in cast of listen server, whenever anyone shoots, listen server host shoots instead of them
in case of dedicated server its not listen server host, but the first player that logged in instead
which works just... great π
You mean, you evaluate GetPlayerCharacter[0] on the server? Versus sending the result of GetPlayerCharcter[0] through the RPC? Meaning you'd send a pointer (?)
yeah
GetPlayerCharacter[0] is not the same on server and client
Right yes
even if its in the same BP
Yeah
which is what often causes problems for network newbies
It gets even funnier when people send GetPlayerController0 through a character RPC rather than simply sending nothing and getting the pawn's controller on the server.
It does. But. Ugh.
Well. I made.... Progress? Now I can't get a tree to spawn no matter where I set the owner. :/
Oh wait, it's also not valid anymore.
You were doing something with foliage right? What was your reason for going beyond standard HISMs and such?
Caught a few messages here and there
Collectible foliage. I'd prefer to have the rendering speed of HISMs. So I can't just replicate foliage actors. So, I'm making a little tool that'll collect foliage data at map load and let the server spawn/destroy foliage at locations on clients too.
Couldn't you just send an RPC to remove an HISM instance across all clients, each time you collect it?
From a level that was seeded beforehand
Could, but that won't hold state. Gets tedious to make sure that happens on new clients who join in. So using replication is much better. And using FastArray is even better. I already did this using normal array replication, but the FastArray allows you to send single structs of data rather than whole arrays for single small changes here and there.
I shall be noting this duly.
and it has per item callbacks
each entry has individual client side callback for add/remove/change
Like, a per item repnotify?
yes
That sounds pretty sexy
fastarray = awesome
TArray best left for simple replication that doesn't require any callbacks
Because the whole thing would be replicated each time, correct?
because you'd have to compare the entire array with the old one
to figure out what changed
Right, to find the difference
Yeah
Clever
Is this all in BP as well? Or C++ only?
FastArrays are C++ only. Technically. I mean you could make blueprint calls to alter it, but the setup is entirely C++
Lolwtf? I just printed the HISM instance count after one add and it's printing three. I have bugs.
@kindred widget I need to hide the mesh from the owner but without removing the shadow.
When I fire it in Begin Play it hides if for everyone - even if I use Owning Client Only.
I tried using a Key Event like Press T - and that works. Somehow I think BeginPlay is inevitably server based. So it has to come from an event that is ClientBased. I'm not even sure if that makes sense, I can only speak from what I have tried.
can someone tell me why this is happening? I have a game that can open doors but if I place more then 1 game on the entire map, the second games cant open any doors, I thought that if I placed them in different streaming levels it would work but it doesnt seem to matter if another is placed somewhere it wont work
3 days you have been working on this
and i already told you, your logic and stuff is completly wrong
I have been fixing stuff
but still I just realized the client can open the first door and game but not the second but the server can....
how in the world can a client open 1 door and not the other?
does steam have any sort of user verification like oculus does, where we can see if the user actually owns the game?
good question @torpid nymph I remember games had CD keys
Yes @torpid nymph though you'll probably need to call the Steamworks API directly
kind of strange we have no protection
Beware though, pirate players will just remove Steam support from your game if you start checking that stuff π
^
been there π
Found that players would just replace the steam.dll with a hacked one that bypassed all the checks.. so turned out to be a total waste of time
I wonder if there's really anything you can realistically do, the only thing that I've heard make good impact is making the OG version more interesting than the pirated one (frequent updates, steam workshop support, etc.)
There's not really
But if someone is going to go to the effort to pirate it, they probably weren't going to buy it anyway
it's not that I want to have denuvo or something, but at least something that would take more than literally just upload your game folder to a torrent website would be great
Not sure that's accurate, weren't there studies that showed piracy increased sales down the line?
Maybe through word of mouth or something, IDK
I heard about that too
yeah, I doubt there's any solid link tbh
but I doubt that is the same for indie games
You can to some extent control it on steam in a multiplayer game, by having the server check if a connecting player owns the game
And boot them out if not
Only really works for a handful of cases though
The main point is that pirates will take a lot less relative time to kill your countermeasures than you will spend time creating them. As an indie, your development bandwidth is constrained already
yeah exactly
If you're doing a competitive game with dedicated servers (why would you do that ??) then you'll need it for cheaters, and it's possible like Jambax said
If not, just don't
If you're doing a competitive game with dedicated servers (why would you do that ??)
I feel personally attacked
π
I have opinions and I use them
Seems to be fairing well for you guys though π
Seriously though, I felt like my biggest problem piracy wise was G2A/Kinguin stuff
It's a much better value for players than piracy because you get a real Steam key to the game
I seem to remember a few devs actively just saying "please just pirate my game rather than buying a key"
Fortunately it's also much easier to prevent (by never giving away Steam keys to anyone who asked for them)
Don't they operate off of stolen creditcards often?
Bit of everything - stolen cards, real money that's being laundered, gamers with a lot of Steam cash from trading stuff
IIRC it was something like: use compromised credicard data, buy a bunch of games, sell them, see how Steam never revokes the keys because they'd hurt the consumer who has plausible deniability.
Fake review key scams and gifting from a cheaper area appeared to be the trend some time ago
(Funnily enough the answer to the G2A fake review scammers is to simply give them a DRM free build to download)
ok this should be pretty stupid... I'm setting a RepNotify Variable on server in a GameState, shouldn't it be replicated on clients?
this is after a seamless travel... so I wonder if for any reason there's an issue there
Gamestates should persist through seamless travel I'd think. Kind of odd behavior if they don't. The value is set before or after the travel, and is it correct on the server afterwards?
yes it's correct on the server, but the client does not have the onrep event triggered.
weird.
i always thought that server can set variables on the GS that will be replicated on clients.
clients of course cannot even send to server.
i really have just a BEGIN PLAY -> SET REP VARIABLE -> print "hello" in the OnRep of the rep variable
doesn't get printed on client
that's all i do
It might not be firing since it's the same on client and server.
Ah, with the switch that would be odd.
.aaaand you were right.
I had the value TEST inside of the LevelNames default array. DUH
not here, I meant really in the variable
dumbass
It probably just assumes you've already done your testing and are doing something complex like prediction.
ehehe
Gamestate travels seamlessly now ?
π€·ββοΈ All assumptions on my part.
well it gets recreated anyways.
but it's a good practice to inherit from the same GS (lobby & gameplay)
hey a quick one, does this make sense?
basically, I want to create the streaming levels ONLY when the level is started (called from the level BP) AND the variable has been replicated
due to race conditions I use this stupid trick
I'm pretty sure game state is not kept when traveling
Player state is, to some extent, depending on implementation
gets recreated, indeed.
AFAIK only the game instance does not get recreated. All others are, even after a servertravel
Game instance persists from game boot to game quit
yep
PlayerState is re-created but can opt in to copy variables
Yeah
what do you think of the trick there stranger, feels naif to me, but are there other options?
For an Ability, I let characters move out of control into a direction for a set time with
PawnToMove->AddMovementInput(WorldDirection, ScaleValue, bForce);
I do this Logic by calling an RPC from the Server to the Client. But this isn't Hacker / Cheat safe right? You can just manipulate the RPC from the Client to not call AddMovementInput right? I'm not to familiar with Hacking / Cheating.
why don't you just move the pawn from the server by setting its transform? It will get replicated on clients, the server is the only authority in terms of location
it's also probably more precise than using movement input
Because AddMovementInput was just the easier solution ^^
For setting the transform I need to take the movementspeed of the character and calculate the distance within each tick. And to be as precise as using the movement input, I also need to calculate the acceleration, because the character doesn't start at max speed. With using movement input, I just simulate inputs ^^ Or am I missing something @ember needle ?
it really depends on what movement you want to add to the character and why
Just normal movement, as you would move him forward
why: Because he get's controlled by some force and that force moves him in a random direction
can't use just use addmovementinput on the character without RPC? Not sure about this though
But he is more mind controlling him, that's why he moves normally
no, unfortunately not
hum
Like a "Disorientation" sort of effect?
yeah
Let me test something really quick.
thank you
@kindred widget is at it again π
Haha. To be fair, this is also how I learn. I've probably learned 80% of what I know just solving other's issues. Saves me from the problem later.
and everybody thanks you for that
good mindset Authaer π
BTW if it's random you probably don't need an RPC, you just have the client do the randomness
if you're going this route, then the client can always ask to move around, that's ok
it doesn't protect you from hacks where this behavior gets disabled on the client though, that's for sure
yeah
there's also this thing but I've never tried it. https://www.unrealengine.com/marketplace/en-US/product/scue4-anti-cheat-solution
even free, cool
Hmm. Does CMC have a simple call to ignore a client's input on the server side?
it might check if it's locally controlled, which returns false on the server
Idk. I right now have a bool that just blocks my "MoveForward / MoveRight" call
I was kind of hoping for something more like Server explicitly ignores all client input, but still allows client to move it's own locally and for the server to move it's own. But the server wouldn't get overridden by client movement.
what would the use case be for that?
^
That way you could just replicate a single direction as a yaw float, and tell the client which direction the server is gonna go. Then have them both move that direction, letting the client do it's own prediction..
that's even better
@meager spade Just brainstorming ideas for a "confused" effect. Aimless wandering that the server only controls.
i don't fully understand @steep flame's issue though or why you would let a player just move without telling server and replicating that to other clients?
The CMC handles that doesn't it? It replicates the movement back to the server and then back to the other clients
CMC does not replicate it to owning client (unless a correction is done)
You wouldn't. I was trying to get the server to ignore the client's input. Like.. disconnect the client and server's CMC, but make them still do the exact same thing.
only simulated proxies
you mean make the player just move where the server wants him to go?
and player can't override?
Without being choppy, yeah.
RootMotion tasks
and disable input
RootMotion Tasks also run on Simulated proxies
and smooth
I did this before, not sure why I changed to AddMovementInput afterwards. Need to try again.
Does disabling it on the server keep the client from reenabling it locally?
re-enabling what?
Input. Cause I thought that was done on the client.
input can just be disabled via a bool from the server right?
either a repl bool or a client rpc
yes
then you can run a root motion task which the server says move to this location
which will produce nearly no corrections
Well, true. Even if they cheated the input back on, the root motion would just override it.
yes
that is how Fortnite do it
they set MoveDisabled tag
and RootMotion move the player
for certain abilities
Okay, thank you @kindred widget @ember needle and @meager spade. RootMotion will probably work.
RootMotionTasks != Root Motion Animation
Runtime/Engine/Classes/GameFramework/RootMotionSource.h
if you want to check it out
Already brainstorming game abilities. Then again I doubt I'll care that much about cheating in the end.
it is c++ only though π¦
it's fine
You could probably jumble up a similar effect in blueprint using timelines and some FintertoConstant with some floor checks on both sides. Might be less effort just to go with the root motion though.
I already have GAS setuped and they already have RootMotion tasks setuped.
I also already had a RootMotion ability just for that, but I just can't remember why I discarded that
they can't
I think that might be one reason I've never cared for starting to use Maps. If I needed one, I just made a simple small struct somewhere.
you can project it into something that replicates, like array of key, value structs
and reconstruct it OnRep on the other side
its a fairly simple setup
Anybody knows how to replicate an actor attachedTo a cable comp? https://gyazo.com/51831ffa19455d8d81fbc76c7f9232cf
I probably would not replicate the cable component. My initial thought is to create a repnotify in an actor that has the component. Make that notify attached to an AActor pointer that points to an actor that is also replicated. Then on the notify, just attach that actor's cable to the newly replicated pointer.
So from the screenshot, I have a variable that I store ref of the spawned actor. I can make that repnotify. Then in the notify Set Attach End To, i assume?
If I'm looking at this correctly. I assume that this is to connect the fishing line to the rod and the lure?
ok now im going crazy, I was working in client mode trying to fix some code, and it worked in client mode finally, but when I run a listen server and play as client its not working!
I was so excited after 3 days of trying only to find out it doesnt work on a listen server client
isnt play as client the same as playing as a client on a listen server?
@kindred widget Yes so I'm spawning the lure at a specific location then attaching the cable. I works in offline mode and in server only.
@summer tide I'd probably end up doing this with components rather than other actors. But sticking with your course. Which actor is the cable component in?
@summer tide sorry Iβve only read this quickly but are you using a rep notify to achieve your result ?
A rep notified delegate function is not called by the listen server which is where some inconsistencies occur switching from dedicated to listen, Iβd try adding a βis listen sever checkβ and if true calling the rep notify function manually
It is in blueprint. Blueprint calls notifies on server too.
Hi, Back again. I'm trying to destroy and actor in multiplayer but having some problems. Theoretically, this should work?
But it never gets called, which i weird, Putting a print string in the Notify doesn't seem to trigger
The initial Event is not sent on server, is that why?
you can't server RPC in an actor
ah
unless its owned by a playercontroller
as the actor is replicated
all the server has to do is call DestroyActor.
and for a client to tell the server that, it has to go through the Pawn or PlayerController of the client.
Okay, so I should send the destroy actor inside of the Player controller?
the Server RPC has to be in the player controller
with a pointer to the actor the client wants to destroy
then server can do Actor->DestroyActor()
and destroy is replicated automatically
no need for Destroy bool and OnRep
ah okay
@kindred widget The fishing rod has all these code including the cable comp.
Just make a RepNotify pointer in the rod. Then spawn the lure and set the lure to that pointer, and use the repnotify to connect the cable component on each client.
@meager spade Thanks Alot! Working now
does PostServerTravel in AGameModeBase get called after the level stream is 100% complete?
meaning is it ok to spawn/posses players then?
@kindred widget Is that what you mean in blueprint? I think you are talking in c++. To connect cable comp on each client, I'd have to use Replicate on Owning Client I guess, but the repnotify should take care of that right.
Nah. I mean BP. Just a normal repnotify, no specific conditions. Then you only spawn the lure on the server, and set that pointer on the server. Lure needs to be replicated as well for the pointer to point to the correct object.
Is this correct? I'm spawning the lure here. Then the variable is repnotify which is in the previou screenshot. https://gyazo.com/969e23feaeb8588d35ee308fd8daa8e6
@kindred widget Based on what you see here. I see the cable only connected on server but still not on client. I think I am doing it wrong.
@summer tide Is BPCube1 actor class set to replicate?
Yes It has replicated checked and spawns on server and client. The spawning is working. But the cable only connect on server
Put a print in the RepNotify, is it running on the Client?
Yes it seems like it
https://gyazo.com/bbfdd3210d82e9196fee3fd3c22bad56
Hmm. That's odd. Is the replicated NewVar0 valid on the client?
Maybe the cable needs to be replicated as well. It has replicate component on cable
Or parhaps the entire fishing rod needs to be replicated comp checked?
Nah, that was the point of doing it between the two actors. Cause the one actor has control over the cable on it's machines. Keeps you from replicating another object.
Is the NewVar0 actually valid on the client though?
yes
O.o That doesn't make any sense. It should attach on client just like it's doing on the server then.
Now I have to doublecheck this. Hold up.
I can't make it not work.
@summer tide
Let me check again.
@kindred widget THe only diff that I see is that I am passing the location instead of getting them directly from the actor
I can spawn it from a client input and pass along a location, but it won't change anything.
@summer tide Ohhhh. Man
I overlooked that, that's my bad.
Wait, so can the client see the server's fishing pole correctly?
Yes
Like if the server player throws a lure, can the client see it attached correctly?
Okay, that wouldn't have changed what I thought it was. I thought it might have been an Owner issue.
This is how I'm passing the location. I get it from an impact point. https://gyazo.com/fc80f0cba0894409f303099517827221
Is the fishing pole owned by the client's controller or pawn?
I should check if the location shows correctly on both
Cause you can't send an RPC from the client through that if the owner isn't set to the client.
That still doesn't make sense for the client not seeing the server's pole cable correctly.
I could understand if the client could not spawn a lure, but where they can't see the lure correctly even if the server player throws it, that's odd.
The lure is seen by both. It's only the client doesn't see the cable attached to the lure for both client and server. I probably screwed up somewhere.
Right. But the repnotify should work for that. It's odd that it's not.
Does anyone know if a Dedicated server can run multiple levels at the same time?
if I have an actor thats a door, will switch have autority nodes have any effect on it when trying to do RPC?
How do I execute functions across all clients, on their individual machines?
from GameState
Multicast
@kindred widget Thanks for going extra miles to help me with this. I got it working.
When there's no framerate cap set, my game takes 99% of my GPU (and I have a brand new top of the line one) and this happens to some of our players as well. For some reason, that causes the game to have what seems like massive packet loss and makes characters teleport and desync a lot -- anybody run into this before?
I'm not sure if I just have some configuration or something wrong?
I just updated from Unreal 4.18 to 4.25 and the problem seems to still exist there
The 99% on GPU would sort of be expected as it's going to try and push out as many frames as it can. What about your CPU usage?
Well, that's normal
No framerate cap = burn at maximum hardware capability
CPU or GPU will be the limiting factor, usually GPU
I get that, but the CPU and frameate is totally fine
Why wouldn't it ?
what is bizarre is that I dont understand why it would cause packet loss
Are you doing some replication during on tick events?
Sending RPCs on tick, specifically
some things happen on tick, sure
even the core movement component unreal code happens on tick
yeah
Don't do that.
lol
again, it only happens when framerate is uncapped. The blueprint tickrate is set and isn't affected by that
Never do that ever
Tick rate is based on the frame rate.
For the performance side : GPU takes say 5ms per frame, CPU 1ms. Right ? Now you've removed the framerate cap, and you're now running at 200fps, GPU is at 100%; CPU is at 20% (200 frames per second, 200ms per second, 20%)
And yeah, one frame = one tick
It's in the engine dude.
I do see your point about they shouldn't be reliable in tick ones though
And never do reliable RPCs on tick
I'll see if I have any reliable ones, and remove that
Either way, if you need to replicate something frequently, you're better off setting a timer on begin play with a pre-defined delay on it, depending on how frequently it needs to be replicated.
ok sounds good
if I have reliable rpcs on tick with 0.0 between ticks, that would make sense that it's causing this
thanks for the help
didn't mean to be rude, if it came across that way
Don't do reliable RPCs continuously, it's wrong
If it's a looping thing, it has to be unreliable
yeah I don't, but I may have one accidentally set
Even if it's like 10 per second it's still terrible
actually, would changing a replicated variable on tick be just as bad?
They have their own rules
ok makes sense
Reliable RPC means "send until receiver has confirmed reception, keep sending until that forever"
So any lag spike turns them into blocking events
yeah that totally makes sense
I'll see if I can find any that fit in that category
thanks!
And seriously
Don't uncap framerate
People who love destroying their GPUs know how to uncap it themselves
well it's just a setting we expose in the settings menu
maybe it's a good idea to not allow uncapped at all
I'd simply have framerate limit options set to reasonable values like 60, 120, 144
I have a dedicated Server that I am attempting to initialize/possses player characters post seamless travel I'm observing that an RPC that is meant for the server which spawns the character and tells the controller to posses the pawn is being called twice. This appears to happen because I'm attached to Event BeginPlay on the PlayerController, but what I can't figure out is why does the server log that that RPC is being called twice? The first time it fails, the second time it works.
Most likely because both the Server and Owning Client are running the RPC.
thats probably true, how do I prevent this?