#multiplayer
1 messages Β· Page 730 of 1
My setup looks very similar to defaylt thirdperson template movement code. I only switched from ControlRotation to char->GetActor Forward/Right Vector.
Does that make sense?
That makes absolutely zero sense
Show how you're doing rotation. Show the actual nodes
I got it working. I had to set the rotation rate properly.
guys any idea why this wont replicate on clients? class is set to replicate
client does change the material as intended but only server can see the change
the arrays are actualy connected i just disconected it for a moment when i took the capture haha
I don't think materials are replicated. You probably need to have it hooked to an enum or do a multicast
any eBPF/XDP specialists in chat
yeah i only have this problem with materials for now, how would you do it so it works? if its not too much trouble, i tried making a multicast but it wont work either
The ideas it to broadcast only the material index, and each client looks up the material and sets it on their end.
Once you get comfortable with multicast, you can take a look at on_rep_notifies, which would utilize the variable rep instead of Multicasts
Also, keep in mind that you need to execute the multicast on server, otherwise it does nothing
i tried with the multicast but it still wont change the material on client side
Is the mutlicast triggered on clients?
i mean i did just like you, i made a function to run on server conected to the multicast
nevermind
i run wrong compiled version
my bad it actually works with the multicast xD
Good to hear
i really thought i had already tried that but still glad it works now thank you very much^^
FYI, while multicast works greatly now, it won't if a client joins late, or the actor isn't relevant to the client when you do the multicast
That's why an OnRep is needed in such case
Read first pinned message - OnRep vs RPCs
@robust scroll My apologies for pinging you directly, but I am trying to replicate your work from https://forums.unrealengine.com/t/replication-graph-fast-shared-path-starting-guide/518575 and I have so far found noone else who knew fast shared path from Rep Graph and could help me.
As the character movement replication is not trivial, I am not sure about the details on how to replicate it via the fast path. I assume I should wrap FCharacterNetworkMoveData (or FCharacterServerMovePackedBits) in a custom struct and send it via the fast-path.
But do I need to prevent the ServerMovePacked_ClientSend from executing as it would be redundant?
Once on the client I assume I would pass it to ClientMoveResponsePacked(const FCharacterMoveResponsePackedBits& PackedBits)?
Did you handle everything from the RepGraph or did you have to make changes to the CharacterMovementComp as well?
I'm not actually sure on the answer for you, as I just posted the article, not wrote it. Let me reach out to some folks and see if I can help you get some clarification.
That is very kind of you, thank you!
:triangular_flag_on_post: iam_Raavanan#3756 received strike 1. As a result, they were muted for 10 minutes.
Shouldn't need to do anything for this. FRepMovement is already using Shared Serialization.
And you don't modify the movement component at all, the shared stuff is for replicated properties only.
What do you mean by "shared stuff"?
FastPath aka "SharedSerialization"
The difference is instead of replicating the actors' FRepMovement via normaly property replication, you define an unreliable NetMulticast like "ReplicateMovement" or something, and that sets the replicated movement data. You also need to disable the replicated movement property
But unless you have hundreds of actors or connections, the complexity almost certainly isn't worth it
My apologies for the confusion, but isn't character movement rep done mainly via function rep calls? void ClientMoveResponsePacked(const FCharacterMoveResponsePackedBits& PackedBits); and void ServerMovePacked(const FCharacterServerMovePackedBits& PackedBits) instead of property replication?
No
I am trying to push Rep Graph to it's limit and have 250 connections at once, all sharing basically the same replication data.
Movement replication for non-controlling pawns is done through property replication. Those client functions are for the controlling player only
The reason being prediction/rollback etc.
The Character Class ignores replicated movement data on the owning connection
Also shared replication only works in very limited case, e.g. you're sending plain-old-data only. You can't send object references or other per-connection data on the fast/shared path
Just getting 250 characters moving in an offline game will be expensive enough, I doubt serialization will be the bottleneck
Thank you, it makes much more sense now.
Disable replication for struct FRepMovement ReplicatedMovement and it send as a parameter via the mutlicast (via Fast-Path) and on client manually trigger OnRep_ReplicatedMovement
I have worked on movement optimisations for couple of months now and I think I can support 250 characters with very limited physics.
Something like this yeah:
void ReplicateMovementShared(const FRepMovement& MovementData);
{
ReplicatedMovement = MovementData;
OnRep_ReplicatedMovement();
}
You may need to avoid actually using FRepMovement though, as it has some internal edit-only properties required for serialization
You are amazing, thanks!
Doesn't UE collect a group of replicated properties and send them at once instead of one at a time?
So might be best to make your own struct, then update the FRepMovement params directly
(More of an inquisitive question and not trying to solve a problem per-say)
It does but it serializes them individually per-connection by default
So, if you change 5 props in a frame, all of 'em get sent as 1 replicated call, right?
Yeah they get sent in the same bunch
(or however it gets divided up to be networking friendly)
Alright, yeah - that's what I thought.
Just wanted to make sure.
Was just talking with some people last night in my server about networking behavior.
Thanks Jambax π
But fast path sort of means instead of doing this:
{
for (EachActor)
{
Connection->SendProperties(EachActor);
}
}```
It does something like this:
```for (EachActor)
{
EachActor->MulticastSharedProperties()
}```
Jambax is the real MVP
Disclaimer though I've not used the fast path stuff, but this seems to be the idea
I've learned a ton from Jambax. Like, don't ship a BF-esque game with lag compensation or client prediction π
It makes sense I guess, they're abusing how Multicasts are sent in a similar fashion to property bunches
(I kid I kid)
That's a good lesson thf π
It makes sense now. I was stuck on the replication via RPC for clients as well and completely missed that Char Movement is replicated via property (facepalm)
Yeah all the CMC stuff is purely for the controlling client
Who needs client side prediction anyway π
the character just ignores the replicated movement updates when you are the controlling player, as you should get corrections through the Client_Ack / Client_SendCorrection functions etc.
Easy - just check that box that says "client authority" or w/e it's called on an actor.
Gonna give it a go with 100 players s and I will post results for anyone interested in FastPath RepGraph
You need 100 connections to see any benefit really I think
There's a client authority setting?
If it's only one connection, it'll be the same (possibly worse even)
*Players (typo)
Yeah - it should be under the replicated settings. I forget it's actual name.
Also I wonder how this handles different ack states between clients and what happens when the property is not changing.. that would be interesting to know
I think it's really just for location authority though.
Presumably it doesn't just spam the RPC regardless
Not sure.
Try searching for "client"
Do you mean on the CMC?
Maybe that's where I saw it
I thought more things had it though - am I mistaken @chrome bay?
All I see is this on a non-character.
'Cause I'm pretty sure that's how it is generally recommended to do vehicles. Because otherwise, it's a massive PITA
Yeah that particular settings is just on the CMC
But there's also a special option for physics-simulating skeletal meshes
wierdly
bReplicatePhysicsToAutonomousProxy
Requires you to send the physics state to the server from the owning client though ofc
Why this is in USkeletalMeshComponent and not UPrimitiveComponent is anyones guess though
Wonder how well it actually works π€
Can I have one more question about the FastPath? According to the docs, it either executes default path or fast path, but not both in an update. (Makes sense)
But how does it decide whether to do fastpath or default? When I setup fastpath for random boolean (just for testing), clients get replicated values from fast-path and normally replicated variables.
Hmm not sure. UReplicationGraph::ServerReplicateActors calls both functions one after the either (non-shared first)
Ahh, I see
If you replicate any "default" properties in that frame, the fastpath skips
if (UNLIKELY(ConnectionData.LastRepFrameNum == FrameNum))
{
continue;
}```
Oh, gotcha. So the "Default" has priority over fastpath. That complicates things a bit
Thanks again!
Another issue is it seems to "round robin" through shared actors, so there's a chance you might not get a shared update for quite some time
I really hope the performance boost is worth it
Can't imagine it will be π
Never know though. I just feel like you'd have to be throwing out loads of data for it to make a huge difference
Just looking at the profiling graph, Replication for each client just takes forever.
The actual movement/physics is tiny compared to the networking calls
ooof
17ms
Are the clients on another machine though?
Because that would be the server + all of your clients gathered in there no?
Oh nvm actually, insights is probably smarter than that
How many clients is that?
Yeah, using ec2 to spawn couple of xlarge instances to run headless clients on and its connecting to another ec2 instance which runs the server, which reports to Insights running on my local machine. Any tips for improving?
+-80 running in "fallguys" scenario, each player character replicates 10 times/sec
yeah ok, that's pretty trimmed already then
Where fallguys scenario is everyone bumping into each other
Therefore no culling, which is why I was hoping sending everyone the same batch of data would cut down the 17ms if rep time
Be interesting to see what happens if you just dump them into the "Always Relevant" node and ignore spatial culling altogether
But not sure if that would be better or worse since it might affect prioritisation too
Really wish I had some perf stats from HLL to compare
Made no observable difference (had it as spatial and switched to the always relevant bucket to enable fast path)
Looking at HLL I am just wowed how you guys handled it. Massive Kudos
I know we've had to upgrade server hardware a couple of times
But sadly I don't have the specifics
I have been tinkering with the idea of parallelising the Rep Graph/ actor serialisation. I would have to learn a tone about the inner workings but would be amazing feature to have.
If I understand it correctly, right now it's only about single core performance, which on EC2 there are not that many choices. What do you think?
just throw a ParralelFor in and see what happens π
π
Yeah ours are single core, we explicitly set them to only use one core
but multiple running on one box, I think maybe 8?
yeah, that does makes sense with large playerbase and static num of people per game.
We're also pretty bound by physics performance
I am currently using AWS gamelift, but not too happy with it atm
Just the Battle sim was on gpu π π
Can I have one more question about HLL? What service provider are you using for the game servers? AWS or someone more focused on game servers?
Uhhhh good question. I was to say Zues for the official ones
So I am a little confused as to why you would use the online party system over the session system if none of the invite events or acceptance events ever make it to the dedicated server
Just from the perspective of tracking which friends are part of a team in a world that is shared with other players
It seems no matter which system you use, you still have to have the clients send their requested list of friends to the server and have it react to assigning the group to the same team internally
Am I missing something? Are the dedicated servers able to be notified via the session system that a player is being followed by a friend into the session via invite?
or is that all strictly always client-to-client, through P2P and nothing else?
when I was at NWI we also used Zeuz (assuming typo), but they're now owned by Improbable
Never even heard of them to be honest π
Quick question outside GAS. Is there a function, tip to be sure that a variable is the same both on server and client? I want to control the flow of a branch until a integer reaches 0, and I want the client to wait the server before more executions.
Wouldn't OnRep be enough?
Each time the variable is replicated to the client, the OnRep would fire and you could perform validation to ensure that the integer has reached 0 before allowing the client to do whatever it is that it does
OnRep fires once the variable is rep, not when the variable changes on server, correct?
right
for some reason Im getting some sync problems
in big numbers, when loading unloading level instances
only a delay sync them up, but indeed I don't want to do that
so there is a mismatch of 1 in the loaded levels array, even using onrep
just wondering if there was a way of a sanity check function between server and client
bounce a RPC
Zlo!
I'm so glad you are here. I have avoided pinging you directly for a bit, but I've been dying to ask you a follow up question to something you helped me with a month or so ago
And just like that - it's time for Zlo to leave π
rofl
When you told me about the session on user invite accepted/received delegate, I was thinking that the dedicated server would fire off one or all of those events if the player doing the inviting was already in a session (with said dedicated server). Is that not the case? My initial testing is those events only fire off on the clients
if that's the case, how are you linking players together into a party on the dedicated server side once the friend (invitee) joins the other friend's (inviter) session?
no
those come from the steam client
so dedicated server doesn't actually do any invites
as it doesn't run a steam client
So are you just having the game clients tell the server that they want to join up with their inviting friend's party and the server just does the validation and either says "ok, I'll let you party up with them in game" or "no, I won't let you do that"?
That's really the only way forward that I see
there are at least 2-3 ways you can slap together a party without involving the server at all
just using steam
But in my case, the party is in-game and they are part of a squad
in a world with other squads
off the top of my head, steam lobby might do the trick
it doesn't matter
steam hosts the lobby
not your selrver
they would have their own data and text chat
and one player could connect them all to a world/server instance
I thought for lobbies you would have to have the server host a lobby and then call ServerTravel once all players in the lobby were ready
so even if one player is already playing in the dedicated server, and then their friend wants to join 5 minutes later, the lobby would support that?
Hi! one question for instance based games.
I'm doing a multiplayer like POE (single player / local multiplayer)
You have the main "world map" and some instanced areas that can be opened through various means and other players on the session can join.
I'm thinking on creating this instances on the same map and just move them far away, teleport the players to it and deal with closing it and stuff like that.
Do you think this is feasable or already a setup for failure and i should be going with changing to another level for things like this?
the scale of things would be similar to maps on path of exile
we did have a problem connecting via lobbies in china though, probably due to poor steam instractructure
original connection code was using those, we dropped it for sessions and SteamSockets
actually, does the length of an array fire the repnotify of that array?
you mean array.length? no
you need to do array = array to fire the repnotif
Ok, so you have cleared a lot up (thank you), but I am really honing in now on one leftover question - even if one player is already playing in the dedicated server, and then their friend wants to join 5 minutes later, the lobby would support that scenario?
I see
I don't mind researching the interfaces and figuring the system out. I just want to make sure that it can handle that though. Players will be able to play on their own, doing their own missions, and then friends can join in at any time and join in on the fun
i'm using steam sessions for a listen server setup right now and you can create a lobby and move all of them or join later on with no problem
oh ok
We're doing that too. We just create a session at startup
well this is a dedicated server, but it would work the same I would imagine
hi guys im still getting the hang of replicating things, what could be wrong with this? the first repnotify works just fine, but the second one fires but wont do anything, ill get a pic of whats inside that repnotify in a sec
@dark edgeBy creating a session at startup, do you mean an actual session, or a game lobby "session"
?
here
Why do you have 2 variables there? are the 2 always opposite of each other or can you be hidden and have collision enabled?
its because im getting a bit paranoid i only had 1 before
they are opposite anyway yeah
The less state the better, it's more robust.
Just set bIsHidden = !bIsHidden, and in the repnotify, do all the stuff based on bIsHidden
otherwise you might have race conditions or whatever else
but also collision and visibility might be already handled by replication, make sure you rule that out
hmmm
Hey guys, I have a question. I'm trying to replicate an actor's movement by sending a server rpc to update a variable and then have the server do the calculations. All the actors on the server are acting properly but in the client window the controlled actor isnt updating at all.
I set bReplicates and ReplicatesMovement to true so idk whats happening
Show your code, the entire chain from input to whenever stuff is moved.
i guess historically to physx vehicles
void ASpaceship::Boost()
{
if (GetLocalRole() < ROLE_Authority)
{
FString message = FString::Printf(TEXT("called by client"));
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Blue, message);
Server_SetCurrSpeed(MaxSpeed);
}
else
{
CurrSpeed = MaxSpeed;
}
}
``` is the rpc call to update the speed variable
and ```void ASpaceship::MoveForward(float AllowedSpeed)
{
//if you are an actor on the server
if ((GetLocalRole() == ROLE_Authority))
{
// find out which way is forward
const FRotator Rotation = GetActorRotation();
const FRotator PitchRotation(Rotation.Pitch, 0, 0);
// get forward vector
const FVector Direction = FRotationMatrix(PitchRotation).GetUnitAxis(EAxis::X);
FVector Pos = GetActorLocation();
FMath::Abs(GetActorQuat().Y) < .707f ? Pos.X += Direction.X * AllowedSpeed: Pos.X -= Direction.X * AllowedSpeed;
Pos.Z += Direction.Z * AllowedSpeed;
SetActorLocation(Pos, true);
FString message = FString::Printf(TEXT(" loc is currently %f, %f, %f"), GetActorLocation().X, GetActorLocation().Y, GetActorLocation().Z);
//GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Blue, FString(TEXT("SERVER:"))+GetName() + message);
}```is the function to handle the movement
i call MoveForward in Tick
@nocturne sageAre you sure that nothing else anywhere is setting the actor location?
Yea
when i print the location values for the actors the server says both are moving, but the client says that the one it controls stays in place
Just to be sure :
PlayerController -> Present for local controlled player + present for every player on the authority
PlayerState -> Same as PC
Correct ?
PlayerStates are everywhere
Oh thanks.
Can even be in AI!
i checked if it replicates without the repnotify and it will work only when run from server and i also tried making a run on server event but still not working
@dark edge This is what the position values look like for the actors
my biggest question is how to set the clients values to be the servers besides a client rpc
shouldnt it be handled by Replicates Movement
That is quite difficult to read π
Should, that's why I'm asking if any other bit of code is setting the position
Do you have a movement component or anything?
No, I thought it'd be simple enough to just use SetActorLocation
and the client can see the other players positions just fine, it just cant see
Should be, check your replication settings
even though the server says its moving
I mean it'll be janky but it should work
So apparently when i set the Sprite Component to replicate it works
But the other actors start looking super jittery
@dark edge
replicating movement is jittery
you're just sending new location
client gets an update, teleports the component
not sure what you were expecting without a network enabled movement component
Also there a replication movement smoothing for meshes but not for sprites (if I remember correctly)
@winged badger do you know why the sprite needs to be set to replicate as well
i would never replicate a sprite
as in sprite component
i would move an actor using a movement component that can do networking
and sprite would be attached to it
Hey! is there any command, hotkey to add a network player in PIE at runtime, but just at anytime?
Need to debug new connections
ah cool
then it will replace the play button while PIE session is active
thanks! useful!
its "experimental" but works just fine
yeah, needed to check if all rep variables go through for joiners, etc
There are so many things in UE that are "experimental" but actually work.
haha, yup
How many people are relying on the experimental feature that is EQS? π
hey, that one works, unless epic does a live stream about it
then they run out of time π
I'd add "even though actors that are replicated and exists in both server and client, they can't call their server counterparts from the client" to that, because most of my mistakes were about that.
Can anyone point me in the direction of setting up dedicated server(s).
Wait really the host/client doesnt count? That's cool
Can you replicate DestroyActor without turning it into a blueprint (ie. static mesh actors in world)? Or would I need to use multicast?
If static mesh exists in the world it is a StaticMeshActor. Which can turn replication on
I don't see an option to turn replication on in the details panel.
Nvm, found it. It's called "Static Mesh Replicates Movement"
Tested that replicates movement works, but it might be an overkill for just Destruction tracking...
Itβs only being fired once on an unmoving object so it shouldnβt be too huge of a deal. Would OnRep/multicast be better?
The issue with that is relevancy
Since the object will be far away from the client
And Iβm not sure how to set it on a staricmeshactor
Using Multicast would be pain in the butt to track. You would need to rebroadcast it when a new player joins the game session or if the part of the map was not loaded for client but now is...
You could just wrap StaticMeshActor in a custom BP with bReplicates enabled.
Looked into the source for StaticMeshActor and you can't just wrap it in custom BP as I initially thought.
The replication in that class is a bit wonky (as per this comment
// This is a short term fix until we find a better play for SetReplicates to be called in AActor.
I would recommend making a new BP class with static mesh component and setting bReplicates to true.
I have an issue with my sprint / stamina system (that I'm trying to make working with multiplayer). Everything works perfectly on the server (so the sprint / stamina system + UI (progress bar)) but on the client the system works perfectly too but the UI doesn't somehow π€ Here's my code :
Please ping me if any answer π
make ur stamina variable replicate with notify
Stamina and MaxStamina aren't replicated
So the client has no idea what they are
max stamina only needs replicate if the max changes
Yes, right, which doesn't happen usually, so he should know what works best for his game
@fathom aspen @potent coral What should I put in the OnRep_Stamina function ?
it works perfectly with "Replicated", thank you π
Is my code good or could it be improved ? π
You don't, you just need to make it replicated so the client knows of the changes
if I have a replicated array of actors, and I spawn that actor on the server, and add it to the array, how do I know when any actor added to the array this way is valid on the client? preferably through the array somehow
Is that GetPercentStamina a bind property?
not sure whats the deal with these, i have put nothing there
yes
What should I replace it with ?
Updating the value on tick is even better
Well I would make it event driven
Wouldn't do it on tick
Tell me more π
You change the property on server->the client knows of the change(OnRep for example)-> You tell the UI to update
As simple as that
I am sending FRepMovement over an RPC (Multicast) and its Location is not deserializing properly. (floating point is messed up)
Client Received X=-32914.000 Y=51865.000 Z=6050.000```
I assume it's due to the Quantized vector, ` SerializeQuantizedVector( Ar, Location, LocationQuantizationLevel );` but I thought that would be auto-handled when deserializing from bits
You have the array linked with an OnRep, so you know it changed on client when that happens
but my progressBar is on another BP so how do you connect the WidgetBP to the BP_ThirdPerson through the OnRepNotify ? π€
Event Dispatcher
How do I use Event Dispatchers in Unreal Engine 4?
Source Files: https://github.com/MWadstein/wtf-hdi-files
Or interfaces
They are kinda the same
You make the UI widget listen to the changes on Character/PlayerState, so when they happen, the widget updates
Event dispatcher and interface are not the same.
kindaβ’οΈ
Nope. Not even "kinda".
Let me get this straight: Interfaces need to be called on a targed, dispatchers call all of instances, right?
Ok I get how they are different, and I know why I call them kinda same
An interface is like a contract. It is saying that this object has a certain method. It is a 1:1 relationship. Events are more like radios. Many objects could be listening for an event. It is a 1:many relationship.
That seems quite interesting, does anybody have an explanation for the issue?
So, rephrasing what I said: you need a target to call an interface which will be executed on that specified target. While dispatchers call all objects with that dispatch event.
I would also be interested π
The RPC is made via FastPath in RepGraph, but I don't think that changes anything. Wanted to mention it just in case that's important
Hmm quick question, are u occur this on editor or standalone game
Editor, but I can give it a go at standalone real quick
It seems the issue is in both
try uncheck "run on one process" from advanced play settings, does that change anything?
So do I do it like this : Set my Stamina variable from Replicated to RepNotify, and in the OnRep_Stamina function just add a node "Call Stamina Dispatcher", does it sound good ?
Or something like "run on single process"
Yes sounds good
Still the same. Here are 2 clients and server.
The SENDING is what server sends and client prints received location
I just found out you can't debug client instances of blueprints from that debug object list with this option unchecked in case anyone has any problem with that too.
try compiling the char first
Oh yeah π
Yeah, simulates more accurate as actual dedicated server setup but debugging is not available cuz of seperated processes from editor
Works perfectly π Except the progress bar isn't as smooth as I would like, what do I need to make it smoother ? Like right now it feels like it's running at 12 fps π
At least we know now its not an interval problem, so can you change it to server notifies the clients instead of multicast
That's probably as good as replication would serve you (I'm really guessing here, I'm no pro dev). For smoother animations and stuff like that, I like to use some kind of "client buffer" (I really don't know if that's a good name convention) which is basically changing value first in the client, then sending it to server and then replicating it to other clients.
The call is made in fastpath of Rep Graph.. I don't think I am able to track down what exactly is happening there today
Oh boy are you decreasing the value with small caps or without any cap?
Also, this values in the client are only used by the UMG or to properly position some particle FX or something more visual.
1 unit every 0.2 sec
Send it with larger caps and use ease on umg side to fake it
ooh, that's brilliant
Finterp Stamina_Displayed towads Stamina
That way it's nice and smooth even if the underlying value isn't
Cant u customize it?
I don't understand what you mean here π€
You can do all that inside the widget, I wouldn't bother interpolating a value for display inside the actual thing
FinterpTo
Just add an FInterpTo node to something that's ticking, have the target be Stamina, and have it drive Stamina_Smoothed
If you want it smooth, and the underlying data isn't smooth, that's how you do it.
Honestly, fast path rep feel like a bloody magic to me.
In a nutshell, as far as I understand it, I provide a function (that at some point should call a netmulticast). The function runs but the netmulticast is intercepted and instead of executing, it stores the bits to send in a buffer. We do that for all functions provided and collect everything in a buffer, which we send as a one big netmulticast.
Just the fact that the netmulticast is intercepted is beyond me at this point of my knowledge.
But I can try outside the Rep Graph easily tomorrow
Notify me with the result!
Will do, thanks for the interest in this a bit advanced problem.
I should thank to u
This is not correct, it's the reverse.
Why would an event be like a radio
isn't an event just a returnless function that can do latent actions?
I'd call a dispatcher more like a radio
and an interface is more like a protocol or language
Yeah he meant the event dispatcher I guess
"hey do you speak Damage?"
Interfaces are 1 to all relationship
Obviously I'm talking about event dispatchers because that was literally the topic
On that topic, what's the simplest way to make a global message bus
Event Dispatchers vs interfaces
Use the old local message system
Yeah. That's all an event bus is.
I saw a plugin where theyre gettable anywhere, Subsystem I'd guess right?
Yup.
That's how I'd do it these days.
Pre-subsystem, enjoy a bloated GameInstance π
Subsystems are β€οΈ
Yeah I love them, everything I've done in C++ land has been around them
WTB Networked subsystem tho, paying 5gp
They should make a way where network support is just there with 0 effort
It's not reverse. You call a method on a single object with interfaces. With event dispatchers, you call a method on many objects.
Event Dispatcher is just UE's way of the Observer pattern
Haha I'm feeling insane that I'm discussing something I know better than my name ^^
Think about it the way you see best
I look at this different. With interfaces, many objects could be implementing the interface without the object calling the interface function even knowing about them, and they get called
With event dispatchers you need to bind it per object
huh
how does that work
So event dispatchers is more of a 1 to 1 kind of thing
you're saying you can call an interface function on nothing and have a bunch of things respond?
Nope. The object should clearly implement that interface
What do you mean by "without knowing about them"?
without knowing anything about them beyond the fact that they implement the interface?
That is still completely incorrect when it comes to expressing if it is a 1:1 or 1:many relationship.
Casually redefining something to be incorrect is not something you should want to be doing
I meant you don't need to bind per object like you would with Event Dispatchers
I mean you still need to get at them right? One of the participants needs to know about the other
Or rather, both need to know about the dispatcher in that case
Yes correct
That's the thing that tripped me up about dispatchers to begin with. It'd be cool if there was no dynamic binding or it was automagic.
just pub/sub
Yes that's what makes them a bit funky
Event Dispatchers is geared towards more specialised inter-BP communication, while Blueprint Interfaces is more one-for-all solution, as you can apply it to many classes at once without having to get the reference to it first.
Quoting my dear friend Makoto
The way people use them in BP is irrelevant to what the concept they embrace is
If you call an interface method on an object - it will affect only that object (unless it intentionally touches other objects). If you broadcast the dispatcher, it will affect all of the objects that are listening for that broadcast.
The interface makes the object of type interface (w/e you decided to name your interface)
And because it is an interface, and an interface is a contract, you know that if the object is of type interface - it will have that method.
Agreed. So again, this is more of a what the relation really means. As long as we know how to use them then we're good. This whole conversation started on that they aren't not "kinda" same. I still believe the concept is kinda similar in one way or another, and that usually you can achieve your goal with using one of them
What relation means is already defined.
Wait what? What do you mean by applying it to many classes without getting a ref
In event dispatchers you get a ref to bind, in interfaces you don't. You still need a ref to call the function on. The terms here are so misleading I agree 
i know this is a bit dumb but i cant get a button of a character select to work for multiplayer to disable whenever a client or server clicked it.. any idea
RPC -> Disable ?
Hi!
Having a hard time with stream variables and seeds. I'm Setting up a replicated stream variable on the game state, later I call a custom actor that spawns foliage using that seed in every single random choice, only on client.
If I test this with i.e the listen server and three clients. All the three clients will see exactly the same sequence, hence, the same procedural foliage, however, the server sees a different sequence and a different procgen foliage. What is even more interesting, is that an small percentage of spawned foliage match server and client.
Is there a sort of precision mismatch should I consider in big numbers when using a seed? (millions)
or is there a chance that sequences from the same seed give diferent results server/client over time? any hard coded limit?
surprises me, that all 3 clients will get the same random results > millions, while the server sees a different one. So the clients are indeed using the rpc seed, the server apparently too, thou the chain looks like losing precision somehow
here is the example, both clients agree in the procgen using the replicated stream seed, server doesn't.
btw, the number 79 that prints on server and the two clients is a random integer from seed to see if they are indeed using the same seed
You should never use Floats for a Seed
Always use an Integer
You should also probably have the Server store the Seed in a Replicated Property.
Dont RPC the Seed. Wait for the Replicated value to come down to Clients before the Client generates anything.
so far so good, Im using a rpc that fires the event and Im using a random int on server
repnotify
no sorry, corrected, repnotify I meant
So how do streams work, they give the same numbers IN ORDER given a seed?
they give you random numbers but always the same sequence if the seed is the same
and they do, in all clients
server almost, so is like losing precision
So you would want a separate stream for everything that would be called out of order then right?
Like say you generate foliage around you, the server has to generate more foliage in a larger area
So you might get an ordering mismatch
yeah, being testing that a lot, to be sure that the order is correct
and while there is some dependencies, there is no parallel operations or delays, etc.
all waits until gets done
instanced levels, first generation, the second, etc
all using the same stream
the only thing that might scares me, is the linetrace results
that choses where to add an instance, thou it shoudn't affect the rest
but anyway, what clicks me is that infinite clients will have the same result, while server doesn't
if every client has different results, ok, order of events, maybe not replicated, etc. But clients see the same
and that little 79 on print (clients and server) is a random int from the stream, right before the procgen starts.
@olive kraken What does it do with only 1 client
I will go through objects, and being block by those that are on server and not my client
2 clients, will both see the same, same effect, etc
that is the pattern, all clients same stream sequence
Is the number of hits to that stream the same?
I noticed the lenght of the hits a little bit different in high numbers, indeed
by 1, or 2
however, when was equal, got also different results
but yeah, was thinking about it
What's your algorithm, do you do the exact same thing on server and client or do they both vary in the location where they start or something
all happens on client, only the seed is set on server, in the game state
the actors, spawners, get that reference of the seed and run the same sequence, on client
I can clean the bp a post it tomorrow if I still stuck
been messing around a couple of days and I feel something odd, might be related with ownership of the spawner
but yeah, they all run the same simulation/algorithim, and they all have the same ref point, i.e the origin of the raycasting, etc.
that is the spawner first raycasting
Why are you passing the Stream through an RPC?
I thought you said you have a RepNotify that sends the Seed Integer?
ah yeah
Dont use an RPC
got that too
Wait for the Seed Integer RepNotify to fire.
Then set the Seed
Of the local Stream
Then initiate Proc Gen
Remove the RPC
Gate it with HasAuthority
You only want the Server to set the Seed variable
the rpc in the stream variable?
this is actually the repnotify of the variable
thou I dont fire the procgen actor yet, happens after loading all instanced levels, which gets that seed from the repnotify and fires this
thanks that flow, yeah, the procgen happens instead in a different actor that most likely needs to wait for the seed
I will refactor, problem is that between the repnotify and the actuall procgen other things have to happen, like the level instances... etc
which they all work nicely, using the seed
so I believe something else is happening when getting the seed from this specific actor, that is not happening within the gamestate
Do not use the same Stream for different Proc Gen operations.
Because if something increments the Stream unexpectedly you can desync it.
uh, nice tip
You can use the same Seed for multiple Streams
so integer is what matters, I regen seeds per actor using the same int?
Have the Server create just 1 Seed Integer.
ok
Do not change the Seed Integer
game state is the correct class for this, or game instance?
Increment the Stream instead
Where ever you want
GameInstance wont work because it is not Replicated
correct
ok
cool tips
I will get my head around, you gave me great pointers
thanks!
Please look at the documentation on Streams as well.
yeah, checked all and more π¦
even tickets, etc
sadly nothing quite related to network, at least in-depth
working nicely!
yeah! grass is the 4th generation, cool to see now is working, thanks again π
ive got to ask... cant a single dedicated server create multiple game instances on different ports? i know its not recommended for preformanc but aint it possible?
No
UE DedicatedServers can only have one GameInstance each
You can start multiple ones though
my player is stuck in the air and giving **isfalling **always true.Although everthing is working in listen server or as standalone mode.Please help me.I use is falling to drive my jump animations.
Alright guys im newbie to unreal engine still so sorry for the stupidish question,
I'm making my first player character (followed the tutorial from UE documentation) and im gonna add all the systems then finally animate the model and animations etc so for right now im using the free asset one from the character movement tutorial in the documentation.
My question is this: I want to implement it so you can only sprint when running forward, I made some boolean values within the event graph of the BP_PlayerCharacter to determine if the player is either running forward (solely forward not backwards or standing still) and if they are strafing left and right (or not) along with one for crouching since I intend to implement a stamina system and I don't want people to be able to drain stamina while crouching by accident.
I plan to make this be multiplayer as well and im wondering if i should redo what I have to avoid cheating [since ive watched a few tutorials on replication from my understanding having the server override certain variables that player characters have would be vital for integrity, like player health, stamina, etc.] So my question essentially is how do I set up those variables to be server side so they aren't easily editable and cheatable. Also while I'm here, how should I set up the stamina system [coding wise not gameplay design wise]?
Also I think I know how to fix the issue of people sprinting and then strafing (as in bypassing the booleans) wherein ill just reset it to walking if they do that when sprinting
Sorry for the lengthy question just wanted to give context as to what im trying to achieve etc. (If nobody responds to this its fine but asking for help is worth a shot yknow).
P.S
Attaching screenshots of the Event Graph for the basic player character made from following the UE Player Character tutorial:
Sorry for the word essay lmao
If it's #multiplayer, then movement is far more complicated than you might think. If you're a newbie, I'd suggest not doing multiplayer right out the gate.
I appreciate your suggestion, but if you have any resources or methods that would lead me in the right direction regarding my question I'd love to know. (I already watched a few replication tutorials etc)
why wont the last part of this onrep work? the only thing not replicating is the enable collision
im not able to change that collision from client no matter what
Try my C++ Survival Game Course:
http://bit.ly/unrealsurvival
Discord:
https://discord.gg/meFRZfm
Business Email: contact@reubs.io
does this work for UE5? (Im guessing yes, just asking ahead of time in case)
quick noob question, if i want to call a function to run on server as a client from a bp owned by the server do i have to change owner first or it will work just the same?
You can't change the owner from the client.
You have to call a function on an actor already owned by the client.
i was really confused but i started reading about ownership
and i think i really get multiplayer now
i was calling everything from the client and didnt realised
This was probably the most confusing thing for me about learning how to call from client to server. In other games/engines, you can normally arbitrarily send network messages from the client. I'm guessing in unreal you would normally go through the player controller right? Like you would have an RPC that maybe you would pass an actor to to call some function on and have it execute on the server
I'm taking incorrect location of linetraceing when I'm executing linetrace on the Server. CameraComponent is replicated but the location seems wrong on Server side. Linetrace hitting up to the upwards instead of the character's camera location.
Why is your "CameraComponent" variable a replicated property in the first place? If the location of the camera is wrong on the server it sounds to me like the setup there went wrong. Does the trace move at all on the server if you move around or is it always the same position where it starts / ends?
Also do you manually assign something to the camera component variable or is it the one that's already there if you attach it to the actor?
PC is just one of them. Any client owned actor really that is related to the context.
Right. I should have mentioned something about actors which aren't owned by the player, but the player wants to do some interaction from the client side and have it execute on the server (eg opening a door from a widget)
So it's interaction. I would have interactions in Character probably. So you can't interact when you're dead
I solved the problem getting the control rotation of the pawn, i guess it's replicated in anyway. So you are right, the camera component's movement is not correctly setups the location position.
@twilit radish
The camera's position should be just fine. The rotation is not by default properly synced.
But why is the camera component replicated?
^
Yeah it's a mistake, i just replicated it because i though the movement or location will be replicated
Nope. PlayerCameraManager actor isn't even replicated
It exists on both server and client though
That does however not mean that the position of the camera component it self is wrong.
The rotation is a different case though xD
Also btw. You could remove the entire networking part for this specific piece if all you want to do is trace on tick. There's no point in having a RPC being send to the server every tick if all it does is server side logic, then you can just place it on a tick method that's specific to the server representation π
Yeah, it's right @twilit radish . I'll use that method on player pressed on the key and reliability is unreliable
Ah alright.
π
Oh yeah. RPC on tick that's reliable 
No idea if it's reliable or unreliable. But in a lot of cases you don't need a RPC in tick on the client. If it's an interaction as an example you want it to be event driven and even in a lot of other cases you would likely be able to get away with a timer for example and some smoothing.
Is it possible to 'tick' the engine manually, instead of relying on the built in timing?
Why do you need to manually tick the entire engine?
Unless you limit the frame rate on purpose the engine already runs as quick as it possibly can.
It's not to limit frame rate, it's to implement a fixed step system for multiplayer
To execute all game logic on a fixed step, including prediction, etc.
UE5 has an optional fixed physics loop. UE4 by default does not, but there are engine modification posts you can find out there. No idea how well they work though.
I want more than just the physics to run at a fixed step, maybe I have to use UE5 and see if I can make it do what I want
Define "more" π
General gamelogic, i.e. just not stepping the physics engine
I haven't nailed any designs for how this is supposed to work. I don't even have a proper playable demo for it but afaik in mine, the client PC calls a server RPC on itself saying which actor it wants to interact with it with some optional parameters and it's executed on the server. Or maybe it is the character like you say.. I haven't worked on my game for ages :'(
If you want the entire engine to run at a certain rate just limit the FPS.
That's all that really is in the end, forcing the entire engine loop to run at a certain rate.
I tend to split game logic and rendering in two separate steps, instead of having them tied together as in unreal
So you can run your game logic at a reliable fixed step rate, but still render at whatever blistering speeds modern GPUs can do
The interaction should prolly happen on some input firing. I would have the input on Character as that where it should be(character specific)
Anyway, not here to argue about how to implement this or that, just wanted to ask about unreal specific stuff
I'll poke about UE5 a bit and see if i can make it do what I want
Search for "Async physics UE5" and you can see what it has to offer π
Thanks thom!
It's not really inputs that are the problem though. Having a generic interaction system that is also robust is tricky. For example if you have a control panel widget or a physical button to open a door, it's not an input issue anymore, it's a "what class do I put this in" issue, which doesn't have a correct answer
Okay fair enough, it doesn't have to be an input. But why on earth would the PlayerController be able to open doors. That means dead players(spectators) would be able to open doors
You can do a check that the interacting player isn't dead, but that's just one system
π Pretty sure mine is character so I think I'm safe
The less the checks, the better. Otherwise your systems are error prone
They don't call me "error prone system integrator" for nothing
lol
@twilit radish So async physics moves the entire physics sim to a separate thread, the main loop still sticks to the frame-dependant Tick, etc.
From what I understood yes. The physics engine ticks at a fixed interval while the regular tick system is still frame dependent. Which gives you the option to either hook into the physics engine 'tick' or the regular frame rate 'tick'.
But if I understand the docs/posts i found correctly, the code that hooks into that executes on a background thread, which makes it... well, most game logic doesn't mix well with multi-threading and interacting with the engine
but okey, thanks for the link, absolutely helped... i got some pondering to do
I haven't messed around too much with it yet so I'm unsure how exactly it does things. It's something I wanted to look into more deeply at some point because the fixed rate sounds in theory very great to work with.
I just know the functionality exists π
fixed rate game logic makes client side prediction for basically any object/action in the world extremely simple
you just run exact same code on server and client for the entire world/parts of the world the client is in
and client can touch and poke anything he wants and have it be predicted
Also makes rollbacks much much easier.
I am trying to Mutlicast a FRepMovement, but I have a problem during deserialization step.
Pawns have FRepMovement.LocationQuantizationLevel set to RoundTwoDecimals which is not replicated information. When I use FRepMovement as a replicated variable, the RoundTwoDecimals information is already set in the FRepMovement struct and it deserializes properly. But when I use it as an RPC call, the deserialization step assumes FRepMovement.LocationQuantizationLevel is RoundWholeNumber (default) and the numbers are 1000x larger (with some rounding errors).
Any idea how to Multicast a FRepMovement properly?
@hearty arrow
Gaming is now the worldβs favorite form of entertainment, with Newzoo reporting that by 2023 there will be more than three billion gamers across the planet. With the growth of multiplayer games, however, the number of cheaters has also increased. A study by The New York Times found that almost 50% of computer gamers admit [β¦]
shouldn't APawn::IsLocallyControlled be true after APlayerController::AcknowledgePossession happens?
it isn't true with high latency
It will be true after SetPawn runs
ty
Not sure if you wrote the article or just found it interesting? I do find it really generic though, very few examples and just listing the basics of authoritative networking. Also things like this is not really a choice people often have, dedicated servers are expensive.
Use dedicated servers as the only valid authority. Other multiplayer architectures, like listen servers or P2P, may be good enough for development but not for production. Game decisions should only be made on trusted and protected servers.
The article doesn't really mention that for a ton of games cheating also just mostly doesn't matter. The PVP games that really need to care about this kind of stuff is not the majority of games π
These were my thoughts exactly when I read it.
Yeah. Don't get me wrong I love people sharing / making stuff though. There's plenty of concepts that are just difficult to figure out on your own ^^
Anyone working with oculus quest 2 and shared spaces? Second full game (last was DragonRideVR on PCVR and PSVR) so used to working out problems. , but this is my first multiplayer and while I have the shared spaces (example) working in my project , any actor replication - like a basic physics based ball is not replicating correctly, and client is not in sync. The actor in client view will jump back when server interacts. Very slow dev because need to build and deploy to two HMDs to test. I have posted questions on meta forums but no is replying or is asking how I got the basic example to work. Has anyone else done any multiplayer on quest2 here? Thanks
Thanks will post there too!
At the beginning of the game I'm calling a reliable server RPC, but with high ping it doesn't seem to execute reliably I call this function after PlayerController::PawnSet and APlayerController::AcknowledgePossession happens
when do I know 100% that a client owns a pawn/character? like what function do I need to override so I can trigger a server RPC from the player's pawn/character
Which diagram with the added red circles is correct? First, second or neither?
@chrome bay As promised, here is a first run of the FastPath on Rep Graph with 160 clients. This is already heavily cut down system with quite a lot of client-server desync and teleporting issues... Wanted to share it just in case you might be interested
2nd
GameInstance is local and has the lifetime of the process
Game instance is always there and is persistent from startup to shut down
Is there a difference between GameInstance and Game Instance? or did you and I both just randomly add a space in there by accident lol
Okay thanks, that makes more sense @dark edge
still need help please π
This function is most likely what you are searching for
Anyone know how to cache vfx for multiplayer? Every time I see a particular blood effect for the first time it hitches
I already checked, and the moment I try to call a server RPC from the player character the role is autonomous proxy, the RPC still doesn't execute on the server
the node is reached client-side :/
good good
Maybe you could write an article about your findings
Thanks, but so far my findings are "Don't use FastPath, its slower than default path" π
But I am sure I made a lot of mistakes along the way
sure anything is worth to document
mainly because these do work for people to get a better idea on when to use the tools and what not to do
ie: parallellising a small number of entities
True, I will most likely write something up once I understand it a bit better, not to provide flawed stats and misguided principals
Btw. nice writeup about the network managers 10/10
guys how could I improve the lag when the states of my animations in multiplayer
I want to optimize the animations
That's good I'll be supporting whatever you write, R&D and sharing is all what this is about :)
Thank you so much I kindly appreciate your words :)
Zlo helped there
you want them to feel more responsive?
What is your approach now?
Currently my animations for example to attack with a sword I have it in the pawn with a multicast but when I do the lag simulation the states change abruptly
Animations are either - inferred or you should use replicated enum.
Inferred - Let's say client jumps and is in the air. That means we want to play falling animation by just having AnimBP look at the character.
Enum - You can use enum (Idle/Attacking/Jumping) and have AnimBP driven from that.
Mostly it's combination of the two, so if the character is falling and Enum is jumping, we want to have "Air attack" animation.
then you recommend that we make use of all the animations in the animbp and pass it the state that is replicated on the server
AnimBP should "read"/"observe" pawn. You don't pass data to the AnimBP
yes of course I mean that the anim bp must read the variable that its pawn has in order to decide
That is the most common practice usually yielding good results
Thank you very much for the clarification because I am optimizing and it is giving me problems when replicating when I have a lot of latency π
is 20% packet loss percentage too much? I've been debugging all day and I must be doing something really wrong because this simple feature isn't working reliably
That's a lot
but shouldn't reliable rpcs work regardless?
Yeah but if 20% of your packages are dropped then 20% of your game isn't working every update basically :D
1% is more realistic. More than that and it becomes a hell already
They do work. Eventually. Eventually is a really long time if your internet is coming by smoke signals
But I'm sure even they have some sort of sanity check
hmmm the default "Bad" profile has 5%, I just wanted to reliably reproduce the bug
How much better it's to have stats like "hp, mp, etc" on the actual pawn instead of the player state?
your regular rpg with pets and stuff
It makes more sense for hp to be on Pawn really. As it related to the pawn. More generic stuff, that can persist the pawn death usually go to the PlayerState
yap, i moved everything to the pawn, made more sense like that
I mean you can always get the pawn from PS(PawnPrivate it's called)
So it's not a matter of accessibility
Hi - I'm trying to load a level using Execute Console Command, it loads in singleplayer but not in multiplayer. Any way to debug that
What happens?
also how are you loading, open LEVELNAME?
Probably calling ServerTravel client side
Would never work
The logs would tell you why it's not working
Using servertravel.
anyone run into the issue where when you try to run more than one client on a single machine through PIE the other screens go black and the newest client is the only one that's visible?
i finally got two clients to work... somehow
but there's still one that's completely black
oh weird i think it has something to do with my loading screen
yeah it'st he loading screen disregard
lol
Nice - 60ms for a single network frame though. Damn.
Was reading your article on network managers, do you think it would be sensible overriding GetLifetimeReplicatedProps in my character class and not calling super, then using a network manager to replicate everything including stuff like DOREPLIFETIME_WITH_PARAMS_FAST(AActor, Owner, SharedParams); to the point they replicate nothing? Of course replication would need to remain enabled for RPCs
How do i change a property rep condition at run time?
There's a conditional rep macro, isn't there? Put something in that which you change
In the lifetime replication props
as far as i know they're used in GetLifetimeReplicatedProps() and GetLifetimeReplicatedProps() is executed once
COND_Custom = 8 UMETA(DisplayName = "Custom"), // This property has no particular condition, but wants the ability to toggle on/off via SetCustomIsActiveOverride
Give it a try and you tell me if it is worth the pain π
Spoiler: not so much...
You can't change them at runtime
And you can only change them at the class level, not per-instance
The method I linked seems to indicate otherwise, though the comment might be misleading.
GetLifetimeReplicatedProps() is only called on the CDO to create the FRepLayout, it's not called for any runtime instance
The only per-instance control you get is to turn them on/off globally in PreReplication()
So what does that method do then?
SetCustomIsActiveOverride() only works during PreReplication
So you can turn them on/off, but you can't change the condition or which connections they replicate to
Well, turning them on/off is conditional, so might do what he wants.
@chrome bay Your guide on replicating UObject was very helpful, thanks alot π
If youβre referring to true βpeer 2 peerβ where there is no real authority then no. Unreal is all based around a server / client model. You can have a client be the βhostβ however (the βListen Serverβ model).
thank god
and thank you
my heart sank thinking i have to drop unreal and do unity
i think unreal is so cool xD
So only variables set on the server will be replicated right? to confirm
Yes. Replication is only from Server to Clients. One of the use cases for RPCs is to go from Client -> Server if you want to communicate something towards the server.
yΔs
I have a loop that runs on client that calls a run-on-server event 4 times. The event is called but the effect is not always happening. Is it a bad idea to call a server event in a loop?
@twilit radish @pallid mesa thanks
Are you calling it 4 times in the same moment or is there like a delay in the loop?
no delay
Why not just use 1 RPC after the loop finished?
You can do 4 RPCs if you want, it's not necessarily wrong but I believe there's also a limit by default on how many RPCs can be called on an actor per I believe frame.
That might be the way to go. The player actor is telling other things to run but I might do a single rpc to then have the server tell the actors there to run
Basically I am trying to have an animation variable be set on multiplayer. The player hits a button which should have the BP send the rpc to set the bool to trigger the animation
I am going to make a single rpc to have the server do the 4 calls
I can't figure out why the run animations are replicated across multiplayer but the variable I added doesn't
The default third person stuff
When I RPC an event to the server and there call an event on another bp that event is run 3 times. I have confirmed the the event is only called once and it fires 3 times. Behavior is the same when not on multiplayer. Anyone know whats up with this?
is there any way i can spawn an actor for everyone BUT the owner? i'm spawning a projectile from a gameplay ability and i want it to spawn for the local player immediately and replicate for all others. but if i replicate it for the local player too, two projectiles spawn
I don't know of a way to handle that through replication logic, but I know it's common to just do the trashy approach and make the owner disable the duplicate actor on begin play (turn off tick, visibility, etc)
post some pics of that
k
Well I simplified the logic to take a simple pic but it fixed the behavior. sooo thanks? i guess haha I now have a new thing to look into
I have a bit of code here that sets a replicated variable, and then calls out the OnRep
the OnRep just fires a delegate
if (CurrentAngle <= MinRotationAngle + Deadzone || CurrentAngle >= MaxRotationAngle - Deadzone) {
if (bLimitReached == false) {
bLimitReached = true;
OnRep_LimitReached();
}
}
else {
if (bLimitReached == true) {
bLimitReached = false;
OnRep_LimitReached();
}
}
When playing as a client this works fine, but when playing on the server the delegate fires twice. I'm assuming because setting the variable fires it once, and specifically calling out the OnRep function fires it twice.
I haven't yet found a combination that fires correctly when playing as a client, and playing as the server
Commenting out the OnRep_LimitReached() works fine when playing as a client, but then isn't called when playing as the server
is there a way to listen on a single port for all dedicated server instances ?
Replicated variables don't trigger the OnRep automatically in C++ on the server and considering this should be on the server the manual OnRep call won't be called on any clients. Are you sure with some prints / debugging you aren't just setting the variables twice?
If you mean several Unreal processes listening on the same port on the same physical server then I believe no. In theory one process can listen to it and then pass it on to different processes but it doesn't really make any sense to do it.
so you mean can i do that using docker container?
its not physical
What I'm saying is that you could make your own program that forwards the data to specific processes, but I really don't see why you would want that.
You can only bind one process at the time to one port.
What is not physical?
Docker containers
Docker containers have the exact same issue. The only thing different with docker containers if I remember correctly is that you can map an 'external' port to an 'internal' docker container port but it doesn't change the problem that you can only have one process per port. Why can't you just use multiple?
The server provider limits me for opening ports on their switches
so port 7777 on host(Server) can not be mapped to multiple ports on ducker ?
Then I would really look at if you can solve that with them or switch to a different host that does not give you so little ports. Normally you should definitely have a few ports.
Not easily no.
Thats true .
Really thanks π
π
Just ran some tests, and from what I can tell, I'm not setting the variable twice
this entire function is already being called on an OnRep, so I'm unsure if that adds to the issue
There's a bit of added complexity since this is on an actor that I've set to be owned by the player interacting with it
I think it should be just fine to have it inside an OnRep but all I can really think of is it just being called twice. The OnRep_LimitReached(); also doesn't accidentally call the delegate twice?
yeah there's very little going on in there
void URotationInteractableComponent::OnRep_LimitReached_Implementation() {
if (bLimitReached) {
if (CurrentAngle <= MinRotationAngle + Deadzone) {
OnLimitReached.Broadcast(false);
}
else if (CurrentAngle >= MaxRotationAngle - Deadzone) {
OnLimitReached.Broadcast(true);
}
}
}
Fair enough, worth doing only for all the bools I'm replicating on my character at least?
Maybe that Unreal doesn't like the _Implementation? It's not needed for ReplicatedUsing stuff.
I'm confused why that even compiles π€

I forgot that OnRep functions don't need to be marked as Server, Reliable
That makes it an RPC.
yeah. silly mistake
I would remove the Server & Reliable thing and the _Implementation and see how it then goes.
Thank you. let me play around with that for a bit, and see where I get
might be more worth and less of a PITA in such case to use push based
in fact net mans are worther to use when you want to avoid replicating actors
and in your case the character is already replicated
Also if it's about just saving bandwidth with a ton of bools use bitpacking instead π
well when speaking about netmans we are speaking about a cpu optimization
same goes for the push based net model
Ah alright then I misunderstood, woops.
bandwidth optimizations are almost never needed π€
awesome. that did it. Thank you!
Truly depends on your game I would say.
Awesome! π
just dont do dumb I'd say
If you're building the next Factorio as an example you should definitely care about your bandwidth π
But at that point you likely already know what you're doing I guess.
In that case I'll reserve net managers for other actors. Thanks for the advice
well... you'll be bond by cpu much earlier
You'll be bound by everything honestly x)
also cpu optimizations usually bring bandwidth optimizations alongside
for example more controlled update frequencies
creativity is usually the bound in those games lol
its pretty cool to see what people can build sometimes
and these create use cases almost impossible to find out in QA
Also I'm kind of surprised that in your blog post you are able to achieve better performance by quite a bit over Epic xD
Although I suppose this is more for when you have a massive amount of actors right?
you can see speedup on the hundreds
just think that the sparse actor update now gets compiled in one single actor which favours linearity. Also it is scoped down to the minimal struct you'd like to replicate
so I wouldn't be surprised to see scalability already at a low count
But yeah if I were you I'd use push based by default
net mans will help for high counts
One thing I do wonder about on the topic of saving CPU is your FindByPredicate method.
You mention in the post you have 720 actors in the manager. What I'm wondering about is how much CPU power now actually goes towards the updating?
Because all the post mentions is the Net tick method.
With the FindByPredicate I'm referring to the internals of ANetMan::UpdateActor, sorry. Not entirely clear from my side π
Mhm, its a linear search, so O(n), its not actually needed in every instance if you can figure out a smarter way to identify your elements... and such update is event driven so it wont eat much CPU.
the idle time is what we'll benefit from the most
property comparison and all the fuss
You do have a good point that regardless it's always better than constantly having it checking yeah. Even if lets say the Update method is slower, because it is event based it can never persistently be a bottleneck. At most for a single frame.
And you can indeed spend some time on optimising the FindByPredicate part if really needed ^^
aye, its a point to consider aswell, I might want to add a line or two about that in the post
its a lot of information
but its all about tools for our toolbox
we gotta know when to use them and for which use cases
That for sure yeah. Didn't mean anything bad with it, don't worry. But I was just curious about this in specific π
Thats good, that means you did your homework
these points also help me to understand what's lacking from the post
I could simply create an example without a linear search function
but i think its interesting to keep it and to comment on it
π
I wouldn't worry too much about providing a different example for it. It's also kind of on people them selves to test out what works and what doesn't. If they find that this in specific for them still eats a bit too much CPU they can optimise it. It's for sure a really good blog post though. But just like with anything else you should always make sure it actually benefits your project π
You're never satisfied without hitting that 10mins read time
btw what's the plural form of NetMan, is it NetMen? π
I donβt normally do this but I figured Iβd cross post in #multiplayer for anyone who has experience with GAS. Iβm executing an effect and thereβs a noticeable delay in the UI (it has delegates bound to the attributeset). Is there any way I can locally predict this? I thought GAS was supposed to handle a lot of that for me. Hereβs the link #gameplay-ability-system message
lmao I feel like a Youtuber now XD
if you are applying the effect predictevily your ui can be set and rolled back predictevily
So I do need to do some custom UI work for this?
you should be able to find examples of this on Lyra
I just saw a tutorial where someone is setting
[/Script/Engine.NetworkSettings]
n.VerifyPeer=False
for beacons. That seems like a very dangerous setting. Am I wrong here?
Or I meant to say, that seems very dangerous to flip off.
They couldn't explain why they had to turn it off, which means that they just did it "because it worked"
hello, how can i find multiplayer rts type fog of war plug in for 4.26 project?
How to pause replication of actor to specific player without destroying actor?
Take a look at IsNetRelevantFor
Hi! does anyone remember the name of the sequence to get a random point in some area with a certain dispersion pattern?
Not just random, but with some space between them.
I'm redoing the algo to position the monster spawn points on my game and i remember seeing a sequence like that
do you mean EQS?
No, it's some sort of sequence like fibbo
sounds like EQS can help u a great deal with that though
environment query system = eqs?
yes
not the one i'm looking for but that one may work, gonna check it
Sobol sequence ! that is it
Sobol sequences (also called LPΟ sequences or (t, s) sequences in base 2) are an example of quasi-random low-discrepancy sequences. They were first introduced by the Russian mathematician Ilya M. Sobol (ΠΠ»ΡΡ ΠΠ΅Π΅ΡΠΎΠ²ΠΈΡ Π‘ΠΎΠ±ΠΎΠ»Ρ) in 1967.These sequences use a base of two to form successively finer uniform partitions of the unit interval and then reor...
If you have a replicated AActor* as part of a struct and it is null, will you still pay the full bandwidth cost for that pointer when the struct replicates initially?
Or will only non default values replicate even if it's the first time the struct ever is replicated?
How hard is hooking in to or extending EQS?
We have our own vision system
It's quite easy assuming you can query things from your vision system like GetCanSeePlayer
EQS only cares about specific inputs (location to query from, location to query etc.) that can be filtered by conditions and then returns a nice location or actor as an output
It's minimal code / work. The only annoying thing is you need to create separate classes for contexts but I just do it all in a single contexts helper class and switch via an enum π
Man why do they gotta bake so much implied game design into their naming
We care about seeing pawns. The player's pawn is just a pawn, nothing special.
This is for a roguelike with teams/factions, so AI can and will engage with each other just like they do with the player's pawn.
EQS is indeed a lifesaver so would def recommend it
A location behind the pawn that is in cover but visible from the waist up that is neither too near or far that is also cheap to pathfind to?
Easy!
There's fairly robust debugging tools too to make sure you are filtering correctly
Nice to see how it filters and scores
I'm guessing it's not too hard to also build threat and distance into it?
"Find a location above 20m from TargetPawn but within 30m of my allies"
Hmm that's interesting. I def. want to have functionality for AI to think about their capabilities and estimate others capabilities, so a dude with a shotgun might try to rush someone with a sniper, and a dude with a sniper might try to keep his distance.
I think I can bake it all down into a few dimensions like firepower, importance, range, etc
Yeah! you can also quickly build complex behaviors by having enemies switch out their queries (I usually randomly alternate between 3 in battle)
I need to figure out how to do heatmaps in the same way as our vision system.
sorta like influence maps. Something like
"find a position that maximizes (Firepower - Risk)"
Firepower being a 2d scalar field of my teams damage capabilities, with Risk being a 2d scalar field of my enemies capabilities
Yeah this kind of stuff florishes with EQS but you'd of course have to run tests from candidate points like potential firepower from this location is very high but it's risky as it is far away or whatever
But EQS makes running these tests and filtering / scoring stuff very easy
And it's very fun to finetune the score factors
Yeah so it'd be more like
"find a position that maximizes (Firepower - Risk - TimeToGetThere)"
We also want to do hidden information for AI too, so they don't know everything aobut the map until they've explored it.
same as what players see, an expanding field of visible and explored areas
If you can query that at any given world position point per AI then it'll be simple to filter out any points that haven't been discovered yet
Or give them high risk scores!
A lot of fun to make rich queries full of surprising outcomes!
So it seems that EQS would just give me the querying framework, since I'm doing all the senses and scoring on my own
Well assuming your senses give things like can I see or hear this player, you'd still be scoring the points that EQS generates no?
EQS will determine the score for each of the points it generates based on your inputs (what can be seen / is it within a preferred radius? etc.)
The filtering / scoring tools in EQS are a big reason to use it as you can nicely stack filter rules based on each test
How does it generate the points?
This is effectively a 2d game so generating a point to score isn't that hard, it's just a point on the navmesh
Which function or variable to use to check if the game is in muliplayer or single player?
I found another one. IsStandalone?
Is standalone is for single player yeah
There's also is dedicated server
@chrome bay "Fast"Path with 365ms per tick... I needed to share this beauty (80 players)
Just set the network tick speed to 2 and call it a day π€£
I'm sure no one will mind like at least ~500 milliseconds of delay by default.
Let's just say that the player has bad ping.. done
Getting the fast path to work is a f**** nightmare
What does it even do?
You know Rep Graph?
Never used it no.
Basically checking if each actor should be replicated is expensive.. Lets say you have 250 players and 10_000 replicated actors, that's 2.5 m checks you need to do each tick. So Rep Graph groups actors into buckets (aka nodes) and makes the whole process faster.
But you still need to package each actor for each client. That is again redundant work, so Fast Path will serialize actor once, and reuses those packaged bits for other connections.
Ah alright. I can imagine that's not really efficient by default yeah.
@split siren hey that's cool. is it a plugin?
Technically yes, but it's official part of the Engine
i'm guessing it's used in fortnite? lol
Fortnite was a clear motivation for that plugin, true.
Aka, it was made for Fortnite
Hey! I have a mixed animation/tech question that I'm going to be exploring in the coming months, but was wondering if someone here has some advice before I get started. Basically, is Motion Warping replication-friendly? Considering dynamic environmental data is fed into a root motion animation montage (kind of like the many vaulting examples), would the setup with motion warping achieve the desired root motion effect in a replicated environment with the built-in CharacterMovementComp, or is there a lot more setup required? Is that even possible with the built-in tools, or would there need to be additional work done on supporting motion warping in a replicated environment (or would you recommend avoiding it entirely in that context)?
Just for more context, this was kinda confirmed to work via an Inside Unreal, but the vid is a year old so I'm wondering if there are updates or if someone has had a proper run at it?
https://youtu.be/SM_AR-oZ-1k?t=3229
Full-Body IK (FBIK) provides you with the tools to create reactive, dynamic characters, and Motion Warping is a new Experimental feature which allows you to manipulate root motion animations to adapt them to the world with fewer custom assets. Join us as we explore Unreal Engine 5βs new animation features!
ANNOUNCEMENT POST
https://forums.unrea...
Just projects points down in various formations that you can determine like a ring of X width around the player
Maybe you already have all you need and EQS isn't required
But it's very handy at least for my cases
the main point I was getting at is the power of EQS is in how it can score and filter the points based on any number of tests which is the main reason you'd use it
As you give it loads of conditions and then tell it to spit out the best 5% of points or whatever
There's loads of nice weighting options to easily hone in on certain responses (which you'll see with the testing pawn)
Is there any way to authoritatively ignore movement input for a specific world axis? Without constraining the entire cmc ofc, since that would also kill all external force and impulse applications, which I want to keep for said axis
Or is the server completely unable to filter out movement input from the client requests?
What's the use case?
I'm following step 3 of this guide to setup dedicated servers: https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/Networking/HowTo/DedicatedServers/. I have a server level that's running, but I'm having some confusion on how to set up a session from the server level. Somehow this has been asked many many times online but nobody answers
How do I switch from one threaded dedicated server to multithreaded dedic server?
@dark edge I'm manually adding height on tick during flight via add actor world offset, so that the player always has the same max distance from the floor. Basically a max height limit, so I don't want the player to add his own height input, potentially exceeding the height limit or fighting with it.
The only authoritative way to shut off Z axis input for good seems to disable flight movement mode as necessary...
But maybe there's a better way
I basically don't wanna leave a loophole for cheating that would go beyond max flight height
i have set the controller and the character classes to replicating, still the ai isnt simulated on the server. I remember that the ai is normally fully simulated on the listen server and the client just gets all the information. What did i do wrong?
TLDR: Ai does move on the server but is standing still on the client
Yes I did create the base classes in c++ maybe i have to set something there?
AIControllers exist only server. Setting them to replicate wouldn't do anything probably.
Just save the TargetActor as a variable in the BlackBoard and MoveTo it in the Behavior Tree
ill try and replicate all the variables
the most basic behavior i have currently is patroling a spline path, still the ai does move along on the server but not on the client
oh and i did everything with controller and behavior tree
thats why i dont understand why its not doing it
AI stuff exist only on server. There is no replication here
Only AI Pawn replicates
so if the ai exists only on the server and the server simulates the ai to move to xyz then the ai should also do that on the client right?
BehaviorTree automagically does that. It's the "engine" of AI Pawns, it's what makes the pawn decide on what to do and what not.
AI Controller just tells the BT to run
so then my setup must be fine
I haven't seen it, and most likely it's not. There is nothing special about it really
altough my ai seems to be fine on the server i get errors that it failed to run the bheavior tree. Could that be because of client side or something?
It's probably because you replicated the AI Controller
did disable and still same result
i did use the bool return value of the run behavior tree node. it just returns false
nvm it works fine
but still the location is completly different
behavior tree gets run but ai just stands still on client side
It could return false for two reasons: first being a BT not existing, second being a BlackBoard isn't linked
it does work tested it again
it seems like the location isnt even replicated at all
is there any better way than this to know if an actor is controlled by the current unreal instance AND this instance is not a server? this seems a bit cumbersome to me
basically trying to get true out of it only if the actor is controlled locally and if this isn't a server only instance
it's the player character
And you can wrap that in a macro or function library so it is usable anywhere.
@fathom aspenyou ever had that kind of a problem?
Ah then this should work
Nope
wouldn't is locally controlled also return true on like, an AI controlled character on the server as well?
Show how you move your AI?
sure gimme a sec
Probably
Then use IsPlayerControlled?
that might do it, thanks
this all happens after the behavior tree is run.
the defined patrol path variable is set in the editor and references a spline actor
and this is the real moving logic
@fathom aspeni guess you dont know either
hi, does a property not replicate to anyone if it's set to COND_OwnerOnly but has no owner?
ok so now im literally only using the move to node and the ai is still standing still on the client side
is ur ai replicated? i assume if they're derived from acharacter the movement should automatically replicate.
yes it is replicated
I don't use AIMoveTo so I can't tell how it works. I normally use MoveTo task node inside the BehaviorTree and it works fine
yes same here
it does not work in any way for the client
im pretty its because of something that i have to add to the base classes in cpp