#multiplayer
1 messages Β· Page 733 of 1
Yeah this might work
It worked lol
Hi there !
In C++, I've created a UPROPERTY(ReplicatedUsing=OnRep_MyVariable), along with a UFUNCTION() virtual void OnRep_MyVariable();
The OnRep_MyVariable is called in C++.
However, if I create a Blueprint based on my C++ Class, I cannot override the OnRep_MyVariable function.
Is there a way to do it ?
It's not in the Override functions dropdown list, and if I try to create a new function with that name, it says I cannot because a function with that name already exist.
I suppose I could fire an Event in the OnRep function, and that Event could be overriden.
Just trying to make things as they should be
I don't think you can override an OnRep in BP
Yes that what you would do
Then I will try that.
Just saw that message : #multiplayer message
Just make that event BlueprintImplementableEvent
Is the "ToggleSpeak 1" command the same thing as StartNetworkedVoice?
ToggleSpeak1? There is no function like that
You probably mean ToggleSpeaking which is yes the same as StartNetworkedVoice, as it calls it
Yep, I meant ToggleSpeaking
Thanks.
Hey guys
pls does anyone know how i can possess a spawned pawn on client
Any time i press a button to spawn a pawn there is a possess code attached to it
but when it happens it does not possess
it just spawns
Doing this in character blueprint
Ok from the sounds of it you are clearly not doing it right
Send code so we are on the same page
Whole code, not parts
Ok input is fired where the local controller exists, which in your case it's on the client
Possess is called only on server
You see the sign up right on the Possess function node
That means it's called for authority, aka server
Yea I do know that
Also you said you are spawning the actor on client. In that case the server has no idea about that actor, so you can't replicate it to clients
Also don't use GetPlayerXXX nodes, they can result in getting a reference to something else literally unexpected
Calling multicast on run on server event
Ok
That's wrong too
Yikes
Would somebody be able to help me with something, I have my movement setup this way cuz the player is a ball, but if my pc is hosting, im alot faster than the client, and if they are hosting, they are faster than before but im still faster still. I just want them both to go the same speed lol
That way your actor isn't synced between clients which most probably you want it to
Find the compendium in this server pinned channel and read it a few times
Spawn the pawn on server and make sure it's replicated
And whenever it's spawned on server possess it
Did this also
Did not work
By looking at your code you didn't seem like you did it honestly
Give it a try after you read the compendium
I tried a lot of things
You shouldn't be
And what I showed you was one of them
Trying totally wrong things doesn't justify what you're facing right now
Really?
I use it everywhere. Only in widgets and run on owning client calls though
Yes
Those are the safe places
If called on server, it returns the first player's thing
But there are always other ways to get that thing you want
For example in UMG you do GetOwningPlayer
Now it only works on server
I have no idea what you changed
All I did was have an event with run on server and passed it to the Input action
The issue is with the posses and not the spawning of the pawn
Ok pls how then would I be able to spawn on client
Again you don't. You spawn it on server and make the spawned actor replicated
That doesn't make it replicated though
Go to the pawn class defaults and make sure Replicates is set to true
It is already
Paste code here so I see what's going on
And not guess
I'm trying to get some delegates to fire, and have the actor update
I'm firing the delegates on the server, and rightfully so, they're not firing on the clients.
I'd rather not multicast since I want the objects updates to remain persistent.
How can I get the delegates to fire on the clients as well?
ah okay, that explains the delegates not firing.
so trying to instead figure out how to do it via RPC 
I can't really do replicated properties cleanly, since I'm updating a value in a struct, and want to fire some event that I can implement in a BP.
the struct contains one of 3 values that I'd like to fire an event off for each one individually if updated
Whenever an update comes, only the changed property in the struct will be sent
So you filter what's being sent and do stuff accordingly
You will have an OnRep so it fires on clients
well, okay it gets a bit tricky
there's a 'manager' (subsystem with a replicated actor) that's holding an array of structs.
the structs have the values I'd like to change, as well as a list of affected actors
And inside that OnRep you bind to a delegate so the other class does what needs to be done
when one of the values changes, I'm trying to loop through affected actors in the manager, and send a notification to them
basically, the affected actors don't hold the actual replicated struct
so i guess the bottom line is
how can I get Actor A to tell Actor B to fire an event that replicates on both server and client, and is implementable via BP
Even if the actors ain't got the replicated struct they still have some property that needs to be set depending on that struct value that got sent. So instead set those properties on the target actors directly on server and have them replicate
That's the definition of multicast
But by the sounds of it, you don't seem like you want to multicast
Multicast isn't stateful
yeah, unfortunately multicast won't work.
Okay, it's not a huge deal to add the extra properties on the actor since it'll only ever be 3 extra properties. unfortunate that I need to mud up the class a bit, but π€·ββοΈ beggers can't be choosers
Thank you @fathom aspen
try components
Yes you're right.
I'm doing this on a component to not mudd up any specific actor class
should have stated that more clearly.
Hey, is there any reason to think world partition will update to work on listen servers without requiring the server to load the entire map at once?
i dont think listen server is the correct way to go for open world maps
Whys that?
The idea isn't to have many people on it. 2-4 players at once
Well 1-4, but when multiplayer, 2-4
how is a client supposed to handle all the server AND client stuff for a huge map without using some nasa computer?
with world partition, I wouldn't imagine it being too computationally intensive
it depends on ur game i guess, but something like ark survival etc obviously cant use listen servers
Maybe you can correct me on this, but a dedicated server solution would require me paying for the servers correct? Which would be quite expensive, and extra risk I wouldn't feel comfortable with.
tbh i dont see the point in making listen server except in some very niche situations
dedicated server will always perform better
you can host a dedicated server on your own machine too
and it even allows u to assign ur cpu cores manually to ur server / client whatever u prefer
I understand you can, but that adds complexity to the user to setup the server doesn't it. Port forwarding etc.
which is something that has a negative impact on user experience
and bad multiplayer performance will not?
personally i would just go for better performance instead of catering to people who dont know how to set up a server etc
i mean u can always put a guide out
Yeah, but adding difficulty to users is a key way to reduce sales
a guide makes it easier, but not easy
and in most cases its desirable to have a dedicated server instead of having to rely on some other persons online times
In this case it's a coop game. Hence the 2-4 players
you can also just run the dedicated server without the player even noticing i guess
if you use steam subsystem or something
i think u dont even have to portforward
the whole point is to have a separate process for the server
So I will admit to not having too much experience in multiplayer programming for unreal, so can you explain the issue with the listen server solution (other than the fact that world partition doesn't work with it yet)
like i said it depends on the scale of ur game, but in general you dont want a listen server because the host will run server and client shit in the same process with no control over it
so basically if the host client lags, the server WILL lag with no exception
as opposed to being able to better manage your resources if you have a separate server and client process
you could give the server process a higher priority
and reduce lag for others when your client lags
listen server surely has it perks but it will always perform worse than a dedicated server
Just double checking, when you say: when the client lags the server will lag too, in that context when you say client you mean the listen server local user and not external clients right?
Because an external user lagging shouldn't matter right?
exactly
wouldn't a dedicated server be more computationally expensive overall? As both the server and client have to manage the map data at the same time, rather than the listen server where they are only handled once??
nope because of net culling
net culling?
so if you have adequate hardware it should be no issue
basically u can set it up to only load actors and stuff that are in a certain range of a player
yeah, but there would still be a server and client copy wouldn't there?
because they are separate instances
thats true but the server and client process stuff in different ways
it wont have much of an impact
are dedicated servers that light weight?
in general yes
they can usually handle like 50-100 players with just standard hardware
But with a large map, they still require to load in the entire map at once right?
net culling
So there would be a decent memory footprint
yeah I know net culling is a thing, but it still requires the full mesh to be loaded due to systems like world partition and world composition not working on servers
so the actors won't have loaded in, but the map would have to
yeah obviously the map data needs to be loaded
Yeah, but if the partitioning systems worked on servers that requirement could be reduced to just the map chunks
reducing memory usagge
doesnt it work on dedicated servers?
not yet apparently
also memory shouldnt be an issue these days
i have 32 gb in my pc and 32 gb extra lying around because i dont need that much fkin ram lol
not even when developing in unreal engine i dont need that much ram
and ram is way cheaper than other components
Ideally you'd want to limit ram requirements to 8gb on the lower end though
idk i would just go with the flow of time and dont spend too much time with supporting outdated minimalist systems π€·ββοΈ
at least when it comes to ram
How different is developing a dedicated server solution vs a listen server solution. Overall they wouldn't be that different to program to my understanding but I could be wrong
well
think of multicast
if you want a sound to play on all clients in a listen server u would just multicast
but on a dedicated server u dont want the multicast to run on server
so you'd just call not authority multicast?
yes
so slightly different but not strictly harder?
yeah its almost the same
World partition might work in listen servers in a use case where you only keep relevant cells loaded... those with streaming sources and cull fx from those cells not relevant for the local player hosting
cell streaming and whatnot
just double checking, If I wanted a single player mode that didn't require the server how would I program that as well?
also running a dc server on the host computer is also taxing and icurs its own issues ideally you'd want it in another machine
multiplayer code works singleplayer
I know it does in listen servers, but if I called something to run non-authorative, would that also just work fine or just never be called?
just double checking so I don't run into this problem later
i.e. multicast rpc with a if(!authority) in it
would that if statement ever be called in single player?
if the multicast is run on server then yes
i mean it gets sent to the clients
but its not run on server
yeah but I meant if I didn't want to have to use a server in single player mode
just to remove that extra computational cost if I didn't need it
thats a good question actually
but i think it should be run
its shroedingers authority lol
the solution around this is I could just check if it is a single player game and run it locally in that case but no other
you dont use a server in your singleplayer game
if it wouldn't allow it
he is asking about the authority shit
if you run it in standalone with HasAuthority
i.e. multicast rpc with a if(!authority) in it
so if he runs this it will not run in standalone?
it would make sense in standalone to just ignore authority
multicasts also get called on the owning client so multicasts will be run although they'll run only in the standalone instance
without a need of a server
yeah I understand it'd run on the local system, but the local system would have authority, so saying "don't run if you have authority" could cause an issue
but might also just be ignored
i bet it runs authority and no authority the same in standalone
but i guess u can easiely test that
if it doesn't, I can add a if(!authority || NM_Standalone) and solve the problem
did u test it?
sorry i went playing padel
yeah test it and you'll see what im speaking about
sorry I haven't had time to test it today but I will soon
Does any 1 know if its possible to use 2 net drivers, or switch them when needed? for example if i want to use steam sessions for player hosted games with steamnetdriver, but then switch for the regular ipnetdriver when i wanna run my own server on my own machine?
theres this variable "bUseSteamNetworking" can i set it to false as a start argument?
What does strip animation data do on dedicated server ?
Is it means animations will not play on dedicated server ?
I font think animation data is passed at all
Animations replicante through the ANIM BP state or u gotta call a multicast to play montages
Does that affect on anim instance tick ? is it disabled on dedicated server ?
Hello guys, my character is jittering at high speeds, this clip is from flying movement mode. Also it jitters when falling after certain time.
First I thought that this multiplayer related issue but it is even happening on listen server and standalone too.
Can anyone help with what might be causing this issue? I am literally stuck.
looks like floating point precision errors
ure just too far away from center of map
I think your blend poses are bugging
Does that happens?
Distance effects?
Check the situation when you blend on another pose in your anim instance
does it work when you are closer to the ground?
Yes checking. Just a sec
Actually it doesn't jitters this much, maybe I was recording thats why it did so much. But yes it jitters closer to ground also
how close?
But it seems like the character is being set back like some position correction
Possition correction happens when you play as client . you said you have this issue even on standalone
When I just fall normally, it jitters then also and just before reaching ground also it jitters.
Yes thats what I am not getting.
what if you play that animation lets say just few meters above ground?
But When I am falling, it is just one single pose and no transition, so I don'
I don't think it could be blend issue either.
No,
Then doesn't
I think its related to speed
ok then its fpp issue
How much velocity do you have ? is that in the bounds of max velocity of ue?
Yes I have fpp arms
around 5k cm/s
fpp = floating point precision
Lmao my bad
basically ur distance is bigger than a float allows
what are fpp arms?
and this causes all sorts of weird positioning glitches
I am just jumping from 250 meters above origin.
I don't think that should be issue
doesnt look like it in ur video though
First person arms. For fpp games there are just arms and not the whole body
That is not the jumping, that is skydiving. I am telling from other tests I just did
wouldn't that just be fp not fpp
first person perspective it is
You can call anyway
any idea?
Maybe issue with character movement component?
it shouldnt
maybe some stuff is conflicting
wait
in ur video i see that ur character is trying to rotate
and go into like a dive down position
but it looks like he rather wants to stay in that gliding position
Wait I will check without giving input
it looks like the 2 animations are fighting eachother or something
and it cant decide which one to pick
best to ask in #animation i guess
No actually at that time I pressed the forward input thats why
Maybe its the camera that shaking?
Let me confirm that
do you have this issue in standalone too or just multiplayer?
both
That's why I am a bit sure it is camera issue
i dont think its camera issue
hmm
I dont think so ....
right
I was thinking of learning this flying off and land of the filed like this based on cod type of games. May I know if you could share resources to me to so I can practice these to learn:) any course or else also fine if you like to suggest to get some experience with such thing:)
Finally!!!! It was the camera issuee!!
I had some complex logic in the player camera manager and that was causing the issue. Fixed a little and now it works so smooth in networked also!!! Thanks a lot π
bruh
you are barking up the wrong tree
ask Danii instead
Does anyone know a good alternative function to BeginPlay for setting up the HUD? The issue I'm having, is that the listen server host doesn't think it is locally controlling its character in BeginPlay after a respawn, I guess there are a couple of game ticks where it doesn't for whatever reason. There's the OnPossessed override but that is only called on the server, and I need it on the client.
I feel like i'm gonna have to use an event outside of the pawn, maybe in gamemode. But I wanted to check if there was a better solution.
There should be some clientside event for when the pawn is possessed, right?
why not just replicate it to clients?
I mean I could call an RPC from the OnPossessed event, but that's kinda eh. In principal HUD should be all clientside
You are adding ui on begin play of pawn? It should be on controller.
^
Okay I'll do that, I just needed different HUDs for different things, so I have been adding it on BeginPlay and removing it on EndPlay
I'm sure there's a way to do that from the playercontroller too
or just remove old hud on begin play and then make new one?
Well yeah that's what i've been doing
Like I said it doesn't work for the listen server host after a respawn
What I'm looking for is a pawn class specific way of adding a hud when it is possessed, and removed when it is destroyed
There must be some other function too but for now you can do that OnRep_Owner in pawn
That wouldn't trigger for the listen server host though right?
why would u even need it when ure basically sending it from the listen server?
you already know its replicating
so u dont need OnRep
Yeah but then where would I call the hud creation for the listen server
after u do the rep or something
Yes I think I remember it was called PawnClientRestart. You restart a pawn and locally it calls pawnClientRestart. You can check that.
Ah I think that's what I was looking for
I'll give it a try, thanks
Lol
I noticed when I fell off my map for a while it would start to jitter, I think it's to do with float precision when the value get's too large? Not sure though
yes
In my case it was camera issue
Ah okay
Was jittering close to ground too
it was my first thought too lol
in source 2 fpp hits really hard
im glad i got away from that shitty engine
Yeah it's a shame source 2 didn't progress much from the first engine
I was excited for it a while ago
i had dev access to s&box but got banned for pointing out some gamebreaking issues lol
its not worth, unreal 5 is way better
and they probably revoked ur access already
the mapping tools in s&box are really nice but the tiny map size limit basically kills it all
valve confining devs to 800 mΒ² maps in 2022 xD
Sad part is it don't bring much for mobiles
Ofc coz I am working on a mobile game
well whole point of mobile dev is to scam kids for money so i kinda can relate xD
Lol
like honestly show me 1 mobile game with actual gameplay value
I wished that it brings something out of the box and we have to least worry about android performance
phone just cant compete with other gaming platforms, and other platforms cant compete with pc
Battle royale games? gameplay matters tho
people going crazy with 10 fingers xD
the only mobile games that i actually had fun with were EVE until they made it paid, and pocket mortys lol
other games just provide minimal gaming experience and are basically designed just to get u to pay for every shit u want to do
like bruh...
at least provide some fun mechanics if you want my money
noob question:
when i play with 2 players with listen Server. the event begin play on the client playercontroller also runs on the server. So if i want to setup UI widgets and bindings etc. i have to create an event and set it to "only execute on owning client"? right?
that reminds me, taptap was also a really cool mobile game
My favorite one is mobile legends
sadly it didnt let u add ur own songs, and only had very few and mostly very shitty songsd
and obviously u had to pay for every new song u wanted xD
Every client has its instance running on the server also. If you want something to just run locally then you can check IsLocallyControlled()
The issue was the lag speed and when the lag exceeds the camera instantly shifts to the target without smooth lerping. So at high speed lag was getting accumulated which was causing this issue.
ahh right. yeah i tought it was weird to set the event to replicated with "only execute on owning client"
Thanks
If i create a custom event in the gamestate and mark it as execute on server. And then call it from the client. nothing happens. but if i call it from the server it gets called. seams like the client should be able to call the event on the server? what am i missing?
i guess it has something to do with the gamestate not beeing "owned" by the client
i might be wrong but it might be cause the client needs to own the object which it calls the function from
try calling it through the player controller
like this?
If i run this trough the client PC. will it use the client PlayerID or the Server PlayerID?
It worked. thanks. but i still think its a bit weird π
it is a bit weird indeed
thats just how ue works
yeah. just need to wrap my mind around it.
If this is being run on the player controller, the thing to keep in mind is that the instance of the player controller exists on both the client and the server. If this is a listen server, then the server has it's own player controller as well, so there would be 3 player controllers that exist, two on the server, and one on the client, but the one on the client is replicated from the server, so really, there are only 2 "real" player controllers, your client is just using a replicated copy from the server.
When you call a "Run On Server" event, what you're attempting to do is tell the server to execute something on the instance of the object that the "Run On Server" event exists on. So if your client is calling this event on a player controller object, then it's in regards to that client's player controller.
Eg:
Lets say both you and I join a game where there is another person hosting the game, so it's a listen server. There would be 3 player controllers in existence on the server, one for me, one for you, and one for the server. My player controller and your player controller are both replicated from the server, so they are copies.
When I press something in my UI (something that only exists on the copy of the game that is running, ie. the server or other players don't know about my UI) that executes the "SetPlayerReady" event, it would be getting called on my player controller on my client. So then when the server receives the command, it knows it's my player controller, and it reads my value for the PlayerID.
When you press something in your UI that executes the "SetPlayerReady" event, it would be getting called on your player controller on your client. Again, when the server receives the command, it knows it's your player controller and will read the value of your PlayerID when passing it on to the game state.
When the server presses that something in the UI, the same thing would happen, but in regards to their player controller.
The gist is, you have multiple copies of a single object type doing things. If it's a replicated object, the server knows which instance of the object is doing the RPC, so when it's asked to execute something, it'll be using the instance of the object that requested the call in the first place.
ahh right okay. thanks for the explanation. So the client PC (player controller) calls the SetPlayerReady. and since it is marked as "run on server" the server will then do the actual call on the Server instance of (my) player controller
Correct π
But then shouldnt a replicated client have a gamestate on the server. just as it has a playercontroller on the server?
so when i create an event on the GameState and mark it as run on server, it should run that on the server instance of my gameState?
You can only run a server rpc from something you own. For the player controller, you own it & you have authority over it so you are able to call server rpcs. You don't have authority over game state, it is owned by server and is just replicated to you so that the game score and other stuff could be replicated to you in a centralized way.
aha! that makes sens. so i should also start to think about the owner of instantiated actors if they need to do any RPC calls
Or hmm.. how do i make the client own something? is it owned by default if it is created by the client?
lets say i spawn an actor
When you're spawning the actor you have the option of setting the owner on the spawn node. Later on, you can also change the owner of an actor by using the "Set Owner" node, but this also needs to be done while running on the server.
GameState is a replicated actor, but only one instance ever exists between the server and all clients, so the server has to be the owner.
Playerstates are player owned actors that everyone knows about, but only the owner can call RPCs on.
Same with any of the player's controlled pawns - they are normally owned by the player who is possessing them.
Generally speaking, you really should only set the owner of an actor to a player if that player is going to be in control of that actor and while the player is in control of that actor they may need to make some RPCs. You shouldn't need to, and sort of doesn't make sense to, constantly swap around ownership just to make it easier to RPC to a specific class - you can always just RPC through the player controller and then when running on the server go to the appropriate actor to perform whatever functions may be necessary. (Eg. "Run On Server" RPC on PlayerController > Get Game State > Run Required Gamestate Function)
Okay yeah, it all starts to make sens now. Thanks everyone for explaining
In short. when do you use RepNotfies for varibles?
Whenever I can
That is, whenever I can solve the problem by using RepNotify, I do.
okay so its more optimised then replicated? i should probably read up a bit on repNofies before i ask so i have more context π
It's not a question of optimization
Repnotify means you get a function that runs every time it's updated.
That's useful. Very useful
okay. so i can do additional logic when something gets updated?
like a health varible. i could make a call to update the UI aswell. that kind of things?
Opening a door can just be the server setting a bool. Then in the onrep you actually move the door.
alright cool. thanks
SessionSettings.bAllowJoinInProgress = false
What determines whether the game is in progress?
GameMode/GameState
I think the base versions don't have that. That's a part of the whole match based system.
What would I set in the gamemode? Or would I just set the sessionsettings to bAllowJoinInProgress=false once the game starts?
Idk anything about it, I don't use the match state stuff. Are you trying to disallow connections when the game is started?
Yes
Start the match I'd assume. You using GameMode or GameModeBase?
GameMode
So afaik StartMatch() only changes the game state enum, no actual logic is done?
Let me double check
My understanding is that the stuff that comes with GameMode is just there as a placeholder. So in other words its up to you if you choose to make use of functions like Start or End match.
Thanks for the response, not so familiar yet but will try. If you can share some resources that would be also great to look into as well.
RestartGame() does actually restart the gamemode though, so not just for your own logic.
could someone explain to me why i cant run authority only functions from the gamemode with a proper reference in the player controller with a run on server event? what alternatives should i use
GameMode only exists on the server
Multicast, etc will not work
Any other object would work
Depending on your use case, PlayerController, GameState, Character, etc
You can't call server RPCs in GameState
maybe gamestate right? im making an admin panel but players get culled out so i cant reference them at a certain distance
Where is your RPC defined?
Cause this can be read two ways
i go from widget -> playercontroller (owning client) -> playercontroller (run on server) -> gamemode (run on server)
Okay this would work. You just don't need that Server RPC at the end in GameMode
As it's not replicated
i see
one problem is that this does work except for the fact that authority only functions dont run for whatever reason in the gamemode
this is a screenshot from the gamemode, for whatever reason "kick player" doesnt work but teleport does
could it be that playerstate cant be referenced through all of these?
It should be working fine. Breakpoint it and see what happens
It can be. It would be a server side reference
But I'm not sure how you are saving that reference, but that doesn't matter
Breakpoint, debug, etc..
appreciate it
I have an On_Rep variable and it's triggering the OnRep Function on the server
only on the server
I switch the variable on the server, but the OnRep function is being triggered on the server, I didn't do anything special
Did you read what I wrote?
They won't. It's just how they work
You have to do it manually
OnRep_MyProperty();```
So it looks like this
Maybe I didn't explain properly my issue, I don't need anything to happen on the server, I'm just saying that when I change the variable on the server, the OnRep function doesn't trigger on clients, printing logs says that the OnRep function logic is happening on the server, and I need it on the clients, and I was wondering if I did something wrong
This sounds like the impossible has become possible
Provide me with context
It doesn't seem like it should be this way
this is how I change the variable on the server
maybe because the actor is not replicated?
I forgot to make the actor replicated, but I don't know if that could cause the issue, I'll test
ah, yeah that did it π€¦
my bad, thanks
@fathom aspen ive tried debugging and haven't got much info other than the "kick player" node not working and the player state reference not being the issue. i create the widget on remote in the player controller, could this be part of the issue?
Not working doesn't tell me much
Does that mean it's not getting executed?
So the breakpoint isn't getting hit
i have to test in game as this is a modkit unfortunately
i dont believe i can use breakpoints
what i do know is that every part of code works until the "kick player" part which is an authority only function
that should not be an issue though as im running this in the gamemode
You can: https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/Blueprints/UserGuide/Debugging/
You just didn't know it
If it's a cpp function then add the breakpoint to that function and attach a debugger and use DebugGame Editor
would this work within a modkit where the player controller and game mode are both proxies though? sorry iβm away from my pc
This is not the issue believe it or not. Saying something "doesn't work" doesn't help the one helping you fixing your issue.
I'm not sure what's that, but shouldn't be any different
Without debugging I would have quit programming since I started it
Are there any plugins that can fetch Steam Avatars that aren't direct friends with the Player? I'm guessing I should just do an HTTP GET to the Steam API and pull it for each player.
Advanced Sessions as far as I'm aware and tested only fetches a direct friend's Avatar.
What's the workflow for sending an actor ref from client to server? I need the server to "do something" to an actor when the client clicks on it (RPC right), but since the actors are technically different versions I'm not sure how to tell the server which object to "do something to".
ServerRPC(AActor* ActorRef)
For blueprint just add an input parameter of Actor object reference in the rpc event
Hm I swear I tried that before and I got a null error but it works like a charm now. Ty so much!
I believe that the GetFriendAvatar() method works for any SteamID
At least thatβs how Iβm using it and it seems to be working so far
it could have been non-replicated or spawned by the client
the actor was def spawn by the server but i think your right. not sure what i changed when I was testing things but now its replicated and your totally right, its working now.
I have a replicated array on an actor in the world. When the server adds items to the array, the clients see it. But when a client adds items, only they can see it.
client needs to rpc the server if you aren't already doing htat
networking workflows are though to wrap my mind around. its getting there but phew its rough lol!!!
client can't replicate to others and will be overwwritten
it was super weird for me but then it just started making sense
Do th RPCs need to be in the actor BP or can they be in the character BP?
anything owned by the player controller
hope to get there soon! π
It's in my Character BP. The actor is replicated. Clients see when the server updates the array. Clients cannot update the array.
so the first thing I notice is that you're multicasting after rpc'ing the server. You can set that value directly at that point
in fact, you might find that to be the issue after testing
multicasts are used for things that can't be replicated, like playing sound, spawning particles, while replicable data can just be run from the server, like spawn/destroy actors and setting replicated values
multicasts are primarily for cosmetic stuff like UI and sound, in my experience
So turn off replication on the multicast function?
remove it entirely
just call the server's event and set the variable
Like this?
a replicated variable sort of multicasts it already
yep
I believe that would work if you test it
unfortunately not π¦
you can put a breakpoint on the Append node and try to see what the values are at that moment to get a clue as to what's not being sent over
another thing would be to look for other times you're using that array, because you might be trying to set the value from the client or something
the reason that the server has to be rpc'ed to replicated values is that it's authoritative, and a consequence of that is any changes the clients make for themselves will be ignored/overwritten
This is the only time i'm trying to set that actor's array. The server is saying that the Hit Result Grid variable is not valid
when i try to update it from the client
is that a replicated actor?
I'm going to assume no, so you could either replicate the actor or get the information before calling the rpc and pass it in through the event
yes
correct
loaded from level implies its net addressable
not that it is replicated
there is a difference
It's late. a fresh set of eyes tomorrow will probably help. Thanks!
Hey, if I have a finite grid represented by an array and I want make sure that the values in the array are consistent between server and client, what is the best way do this?
The array is an array of actor pointers representing what is in that grid
it will likely be atleast 10k long
Many entries, look into FastArray replication.
The ptrs are then resolved the the replication, if the actors are replicated, but that will be very very very costly with 10k so I'd rather go with determinism
If you have that many actors, you have to replicate the seed / save data used to generate that and have the actors be local only
It's not that many actors, just that many pointers
it's so you know what actor is in what grid point
Then have each actor replicate its coordinates instead
yeah better add a GridPosition component, that updates it's entry in your grid
I was considering that option, my only concern is that if you're not in a relevant range then they wouldn't spawn until you got within range. And then once they spawn they would have to call a function to find out what grid points the object occupies. This would likely cause a lag spike.
yeah I already have one, just considering the pros and cons, and thus I thought I'd ask here
That's completely controllable
which thing is controllable specifically?
Relevancy
you thinking make it always relevant?
Dunno, depends what you want?
I mean, you can also impl it like this: ON connection you send a List of all filled entries with the actor ID (as it might not be spawned) And then you just replicate it with RPCs, or you write some custom replication / use the fast array serializer
If you're concerned that an actor spawning would have to find its position - if you replicate the coordinates on the actor like I suggested I'm not sure there's an issue here
Finding the grid location from coordinates should be extremely cheap
yeah it is pretty cheap, though I do call a scan line to find the ground level and also make sure the area below it is the correct type
but yeah I imagine unless I am doing this with literally thousands of items it shouldn't impact it too much for too long
but at the same time, if the objects are spawned I don't need to do the scan line as I can just assume they are in the right spot
sorry, took my brain a minute to catch up
Hi everyone
Unreal Engine has a feature called "Pixel Streaming"
it's a roughly-speaking gameplay stream, you can connect to it from multiple devices via browser (<video /> tag)
And transfer by webRTC - events from the keyboard-mouse, and it turns out even to play on the running instances of the stream.
A working example - MetaHuman software, you generate a model of the character in the browser, without downloading UE5 on your computer and without deploying its instance, the application instances for you to deploy to the cloud on a car with a graphics card, and stream it to your browser
Key question:
Does it make sense to deploy a single instance of UE in the cloud, in which a large scene is loaded (photogrammetry model of 80gb, but with asynchronous tiling), and for each user/player - spawn a camera on the scene, give it under his control, and render on this instance, what sees each such camera - and then streaming to the user/player what he sees his camera?
Or is it a dead-born idea?
will it consume a lot of resources to give each user a camera, and a separate rendering of this camera?
and will it save a lot of graphics card resources if several users are viewing the same scene from different cameras
Quick question: if a PlayerState has a ServerRPC that is part of a function called by all clients locally, will it only succeed when called on the client that owns the player state?
Or if I want it to only succeed for that player, should I add a local player check before calling the RPC?
You can only call server rpcs on player states that you own as the client, so, yes, it will only call for 1 client
However if you're using a listen server, it will call for every client
So, you should check for a locally controlled client.
Ok thanks will do!
Just out of curiosity, how come it calls for every client on a listen server?
Surely only the listen server itself and the client that owns it will succeed in calling it?
Because if you call a Server RPC on the server it will execute like a local function
So a listen server can call any rpc.
Right but it wouldn't call for every client, just server + owning client?
Ah I guess you mean on the server for every client
So it effectively is on every client being called twice
If you do something like foreach (PlayerState in PlayerArray) PlayerState->CallServerRPC() it will call it for all of them if done on the server or listen server
But only 1 if don't from a client
Ok perfect so I'll do something like
if (ACharacter* OwnedC = Cast<ACharacter>(PlayerState->Pawn))
{
if (OwnedC->IsLocallyControlled)
{
ServerRPC();
}
}
And that should mean that even on a listen server, only the local client will ever call the RPC
Ya
Great thanks for the help
Continuing with teams from yesterday I have this struct for a team (used as a variable in my GameState):
USTRUCT(BlueprintType)
struct FSSPTeam
{
GENERATED_BODY()
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "SSP|Teams")
FText Name;
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "SSP|Teams")
FColor Color;
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "SSP|Teams")
FGenericTeamId TeamID;
};
- Should I keep an array of players inside the same struct or in another type in GameState? (TArray, Struct, Class, UObject?)
- When referring to players in the GameState, should I use Controllers, PlayerState or something else?
TArray<APlayerState>
Or TSet<APlayerState> might be more appropriate depending on your usage.
Oh yeah the controllers don't exist on the other clients
depending on size array search is still faster than TSet (smth like 12 entries? I've seen smth like this mentioned in the code base)
Ah there is already a TArray<TObjectPtr<APlayerState>> PlayerArray; in the base class, nvm π
But you can add an arra yof players to each team too
Should I use the FSSPTeam struct or a separate type? And is a struct good when adding and removing from the array inside it?
I think I remember something about changing struct instance variables bringing problems, but I suppose I can just assign a new one when the array inside changes?
I might be mis-interpreting something though
Can anyone tell me why im keep getting this (pic 1),
I have a camera with player controller, and have pawn with ai controller
when i click on pawn, im invoking RPC to server to set the owner of that pawn to player controller (pic 2)
Update owner function invokes inside pawn(that is ACharacter class) (pic 3)
After that im trying to invoke server RPC inside pawn but getting this warnings, also i checked that on client and server owner of that pawn is set to my controller (pic 4)
Hi, have a replicated ship which is a pawn and keeps moving at a constant rate. The movement is a bit jittery on client, any one knows why this happens? Is this the limitation of the pawn class?
You need interpolation, since replication will never happen as fast as the framerate.
Honestly, I though structs did per-property replication, but I've heard differences of opinion on this.
UStructs ARE NOT considered for replication.
UProperty variables ARE considered for replication.
Not entirely sure how to read this.
Even if I add movement input on both client and server, technically the replicated position should be same and there shouldn't be jitters. But I see same results, doesn't matter if I call it on only server or both.
But adding movement input on both should technically fix it right? But it don't.
You can have either purely client-side movement, or you can have server-driven movement with interpolation
Replication will happen twice per frame, or once every second
It's unpredictable, fundamentally
Just a fact of life in multiplayer
If it's client-driven, server-auth movement then you need interpolation + rollback/replay
Which is a lot harder
But again, fact of life
https://youtu.be/oO3lc2UyJgk hey guys im having an issue where unpossessing a pawn causes game breaking lag back and fourth, jittering, breaking animations, and some other problems as you can see in the video, its worse when you unpossess while moving because the player actor simultaneously follows the formerly possessed actor, despite it not having a controller which should make it stationary, and sits where it originally dismounted
Ok assuming server replicated movement. How can I get replicated position info so I can smoothly interpolate?
im sure i just make basic mistake but idk what to do about it
Does it ever make sense to set a replicated property on the client locally just until the server updates it with the same value for everyone?
As in to only allow the client to do something once (like set a clientside ability on cooldown), but still update the value for everyone else. I guess a simpler form of the question is: if a client changes a replicated array of structs locally, will the replicated version from the server simply overwrite it and make sure it matches what is on the server?
Measure the average replication rate using repevent and a moving average, and every time it replicates something you start interpolating over the estimated rep time
An even simpler way to phrase my question: is it fine to change replicated properties temporarily on the client to represent locally updated state that will match what the server will replicate down to all in the future? As in
// Some clientside ability activation where Array is replicated
if (Client->Array.Contains(Value) == false)
{
// Update the array for all
Client->ServerAddToArray(Value);
// Update it right now locally to prevent the client calling another ServerRPC before Array replicates down
Client->Array.Add(Value);
}
Fixed it without interping
I'm not sure about a replicated array, but certainly it works as you'd expect for simple properties. Often used for things like shooting reducing ammo count locally so it updates immediately, and then at some point the server will send the correct value.
Yeah! Perfect, thanks. Good to know it makes sense for stuff like this
And that it's fine to set replicated properties on client knowing that the server will refresh with the same thing later or an updated value
yeah the only thing to be aware of is that if the client changes it but the server doesn't, then they will remain out of sync
Just to let you know changing replicated properties on client is a bad practice and you should totally avoid it unless your code will break without that.
why would everyone else have information on how much cooldown you have left?
why in first example i get
Client1: PlayerController_C0
but on second i get
server: PlayerController_C0
client1: (empty)?
Its a player state BP
no PlayerController thats not your own on clients
you do get a bunch of accessed none in the message log instead
It's complicated but basically everyone simulates their own projectiles locally and cooldowns can affect how a projectile behaves. Not good practice but it's a PVE game where cheating doesn't matter
My main question is that if you have a replicated array and you add an element on the client, will the server nicely overwrite the array when it replicates?
It seems to do that based on my log tests
if everyone simulates their stuff locally, simulated proxies should run their own cooldowns
and not require replicated data
Yeah ideally but there's some stuff that is triggered serverside (like spawning replicated actors when a cooldown expires) and some that is clientside (like local projectile logic) so rather than calling loads of server RPCs from the clients I just have it replicated for now
and also, use a fastarray, much easier to control
But just to satisfy my curiosity could you answer this?
im not entirely sure what happens
fastarray breaks
tarray, don't know
it is exceptionally bad practice
so i never tried
Ok thanks, it APPEARS to work similarly to if you set a single replicated property on a client
I'll see if I can rework this system to be better π
I guess it may be preferable to have the cooldowns simulated locally with a server RPC firing whenever the cooldowns expire
So on every local machine it's correct but it's also updated on the server to allow for the server spawning stuff
Yeah true in the heat of battle players are simply not going to notice it being a bit off
so having cooldowns updated on them is just a waste of resources
Well not entirely in this case as it can drastically change how bullets look and behave in this case without having all clients sending big RPCs to all other clients telling them what the bullet they just fired looks like (a lot of stuff is determined by current cooldowns)
they can just do best guess
Sorry yeah misread, I think you mean to just update cooldowns on all machines locally, don't care about replicating and it'll all line up close enough to what each local player is seeing
Off by whatever latency but completely acceptable and won't change the result of the simulation drastically
They can be updated on both client and server without replicating to allow for the serverside spawn logic where needed so it all works out!
One idea if the ship doesnt have a lot of complex actions and movements could be to only replicate a location from the server where the ship should be (according to the server). the client moves the ship actor independently and and interpolate its position (over time) if the location from the server is different from the client location.
Will this node return the locally controlled PC if its run on the server? i mean. since the Server has all player controllers?
i mean, it will return the 0th (first) player controller on the server
im assuming you are trying to use this in an event or function. your best bet is to pass the PC to the event/function you are trying to use it in. then you dont have to make such guesses
alright okay. so i need to think about how to handle this.
I Have an actor that is AI controlled. But i want this actor to have a reference to a playerController becous it need to query some values from the PC from time to time. The Actor is spawned on the server. So i guess if i pass a reference of the playerController at the time of spawning. it will be the Server instance of the PC that gets passed. So basically null when a client is using that reference?
Do i set the PlayerController reference on the actor as replicated? or Should i try to avoid having the PlayerController referenced at all on the actor. maybe its bad practies?
@shell forum Where are you calling the Avatar fetch from?
You can definitely replicate it if you want it to be accessible on client. Though having references all over the place isn't something you want to be doing all time, as they are all loaded when the class that references them is loaded
It means that UStruct properties are not considered for replication unless you specify them with a UPROPERTY
Correct they do
Yeah i might rework it later. But it seamed to work atleast
another question. Do abilities with GAS need to be executed on the server??
looks like it is not the case in the Lyra project since they are checking "is locally controlled"
Yes
You also have the option to SkipOwner
Thanks! In this case I still want the owner to get updated cooldowns from the server but just set the variable locally to prevent the client triggering the ability multiple times before they get the "is cooling down" info from the server
But will likely just simulate it locally everywhere to prevent any edge cases where it may not work as anticipated
I don't believe you can
I mean there is FGameplayEffectContext and its Handle
GAS massively replicates shared ptrs but IIRC they have a custom serializer everytime
Look at that
Right
I just need a bit more advanced state machine than enums
But not as complex as object driven
sigh
I found the issue but not the solution. The client cannot update a variable on an actor unless that client owns the actor. But the client doesnβt own any actor in the world and I donβt know how to have them ask the server to set them as the owner.
The client owns the Player controller and their own Pawn, you can add RPCs on those to talk from client to the server.
Yeah I canβt figure out how to RPC the server to assign me (the client) as the owner of an actor so I can update a value on it
Iβve tried creating a run on server event
But the server says that the actor reference is invalid
So when the client passes the actor they want to be the owner of, the server canβt see it. Even though itβs replicated.
Er well that should work assuming the actor is replicated, but it's not advisable to pass a reference like that in an rpc as it's a security risk.
So how do I use the RPC to tell it which actor I want to be the owner of then?
If Iβm not passing that actor
The usual approach is that player walks up to something, presses Interact, and the server checks what is in front of the player is and does it that way. Can also pass the actor ref too as long as the server validates that it's possible to interact with that actor (line of sight / range /etc)
But what you have described should work
Unless the actor you're passing a ref too is not replicated
I had to step away but Iβll show you the simple version in a bit. If the code is right then itβs a replication setting somewhere
and your Server RPC to take ownership is on the player controller or pawn?
Pawn
It starts in the level
ok it's set to Replicate?
Yes
This is the code in the character blueprint.
This is the code in the actor i want to be owner of
what error are you seeing?
No error, the client thinks they are the owner no matter who else is
in that log, the server set itself as the owner. when the client did GetOwner, it got itself. But if the client tries to set itself as the owner, it doesn't work.
@shell forum Nvm I figured it out. It was just a race condition with the async load.
For anyone dealing with Steam Avatar loading issues, you'll likely need to do a 'Request Steam Friend Info' and put a check against the data fetch before the Get Steam Friend Avatar. I guess you could also properly Async or delay the Get Avatar, but it always returned 'Success' even when it was still loading.
Does anyone have a website or a video explaining where each of these components:
- Game Timer
- Game Manager (changing the rounds between lobby, game start, round, round end)
- Leaderboard
- Achievements
- Roles assignement (killer vs innocent, tank / dps / heal in moba,)
- Team Assignement
- Quests
- Win / Loose Condition
- ...etc
need to be in what class between : - Game Mode,
- Player Controller
- Player State
- Game State
- Client (Widget BP)
If there's no resource showing where each of these common stuff in games need to be, how do you decide where each of these need to be please ? π
Please ping me if any answer π
If I have some replicated property A in my actor, and another property B, completely separate of A, and they both change at the same time, I forget - how certain can I be that the client will see the change in both properties in the same frame/update cycle?
My question is about where's the doc for that.
π§π»βπSupport us on our π²Patreon for awesome benefits: https://www.patreon.com/kekdot
In this video we talk about the Unreal Engine Multiplayer Framework. We discuss the most relevant multiplayer classes such as the GameMode, GameState, PlayerState, PlayerController, Pawn class (Character), and the relationship between the PlayerController and Wi...
EspaΓ±ol?
No, i mean you. "Laura" is latin name. So hard to see spanish speakers here jaja
For instance he puts the variable "Username" in the player Controller, why not just create a variable in the Character_BP ? What's the difference between a variable created in your Character_BP and a variable in the PlayerController ?
why ? I need to understand how you decided that instead of the Character_BP and the Player_Controller to understand the logic I need to have when I'm deciding where to put stuff in the future
argh π¦
and ?
A non-replicated Username variable, I hope!
What if you want like in Among Us to have a role where you can kill someone and take his appearance and his username tho ? π€
That would be his player name, then, not a "username."
When I see username, I read login credentails.
Character is dead. How you're going to access the name in scoreboard for example?
PlayerState is where you save stuff that should persist a pawn death
Anything character/pawn related goes to Character
Anything else PlayerController
When the character dies, doesn't unreal just despawn the player model and disable the player input ? So if it does that then I don't see why it would clear the reference to the player itself π€
How do you know what goes to what is you go to the source code and see what stuff exist in each class
That's how you get what are they used for
The character is destroyed. You have no more access to its properties. What its name? Idk...
PlayerState is still there though
Interesting, thank you for the explaination
tho, then why not putting everything in the player state ? π€
Because that's a bad architecture. First thing first, that will bloat your PlayerState. Also why would the pawn health stay in memory if it's not needed after the player's death
So too much stuff in memory or probably even repliacting at all times
And that's bad... like really bad
fak
Guys is there a way to set owner no see for a point light? Maybe a trick with a RPC
Is the point light actor replicated?
If it is, just set the owner on the server. If it's not replicated just disable the entire point light client side whenever you want.
it's a point light inside a replicated actor
so I can't set owner of a point light component
Obviously the owner of the component is the actor
So its actual player owner will be the actor's
yea ok
Hey I have a problem
Although I use "Destroy Actor" when the bullet actor is hit, It still remain like afterglow
It's only happened in client side, not in server side
I checked "Replicates" and "Replicated Movement" and "Component Replicates", but it doesn't work
how to fix it?
Also, I replicated hit event, but it doesn't work
Does ForceNetUpdate() work on replicated variable marked COND_InitialOnly?
Probably not
First of all, is this bullet spawned on server or client?
and is the hit on server or client?
The last three lines don't work (that's why they are commented out). But probably I'm doing it the wrong way.
Does someone know what I need to do to get this working?
Ok
Hello, i have a problem with replication. Is there a way to call "run on server" event from client? When i set this event (pic.1) Server can open the door and it is replicated to both server and client but client can't open it. When i set this event to not replicated both can open it but it opens only on 1 game client. Static mesh is replicated, blueprint is also replicated. Client player BP is child of Server player BP.
Only from the OWNING client
you don't want your player to own the door
they DO own their pawn
do the run on server in the PAWN
The client tells the serverside pawn to tell the door to open.
do the RPC inside the pawn
inside the door blueprint?
sorry i dont understand exatcly what u mean
Do you know what a Pawn is?
i do
ok, so you need to do the RPC inside the pawn or playercontroller (probably pawn in this case)
Make all the players be doors. Problem solved 
It'd go something like this in your pawn.
Clientside
Input -> Run on server event
Serverside
Run on server event -> do thing (tell door to open)
Is this general interaction or just some specific door thing?
general
ok so it'd go like
Clientside
Input -> Choose what to interact with -> Run On Server Event (passing over the actor to interact with)
Serverside
Run on server event -> Call Interact (Interface call probably) on ThingToInteractWith
Or you could just do
Clientside
Input -> Run On Server Event
Serverside
Run On Server Event -> Choose what to interact with -> Call Interact on it
This is all inside your pawn. The door needs no RPCs at all.
okay ill try to do it
It works now, thank you! I had to rebuild key check system but it works
hello, need your knowledge. How you could handle a melee system in multiplayer, when there is a latency between server and client?
There's a lot more than one way, depends how competitive you want the game and how quick the feedback
generally, my big problem is, if someone is doing melee, ok the calculations are on server side, and after that it tells the player, you hitted that, take that info back. If now there is a latency, and the player spamming the melee, the server could lag at this point and become unresponsible
one way is , when melee, he can be able to melee again, if he got the information back from server
i dont know, i need your knowledge
You probably want to put this on paper, define your max latency, think about how much you want the server to control this, and decide based on this. Do a graph with the RPCs and replicated packets, with the client on one side and the server on the other
As a default you'd probably want to have a MeleePlayer() event taking a target Character as parameter, have the server run basic checks (is the distance between both reasonable?) and then replicate the modified health, send a multicast with the damage info so that you can play a sound on the victim's client, etc
The time between two melee hits should be checked both on client and server
Just to make it more clear:
I want to create new custom movement types, which need to be replicated. Two of my compressed flags are used to send the custom movement flags and the current movement mode.
When using any of the custom movements I have the issue that the player will wall run, when sprinting just after walljumping.
Another issue I have is that my climbing movement mode doesn't work. The only thing that happens is the server correction.
If someone knows how to handle replication with more than 4 movement types and how to update the compressed flags... Well I'd be happy. I'm stuck for 3 months now on this issue.
@bitter oriole is there any way to add fake latency for testing?
In one of the ini files
If you were to disable them all except for one at a time what happens? Lets say you start with just sprinting, do you have it fully working 100% of the time even with lag? IE: bRequestMaxWalkSpeedChange = true, then somewhere else in your code you're checking for that bool to be true which then calls an RPC.
found it ty
DefaultEngine.ini
[PacketSimulationSettings]
PktLag=0 (ms)
PktLagVariance=0
PktLoss=0
PktOrder=0
PktDup=0
yep found it tyyyyy
That was my approach. My code was too messy for me to properly understand and debug so I ended up disabling all of the custom flags except for one and just tried to get that one fully working. Then I had a path forward for how to make the other ones work.
Click 3 vertical dots near play button, go to Advanced Settings at the bottom then search "net" then look under the Multiplayer Options for "Enable Network Emulation". I have mine set at Server Only with 75min 150max and 3 packet loss percentage.
But feel free to try the Average and Bad profiles too.
Sprinting works.
Dodging works as well.
Technically wall running worked when using one of the default custom flags. So did wall jumping, but as I wanted to have climbing implemented as well (I also need sliding and swinging at some point, but for now I need to have the others work) I needed a custom movement type enum to expand it.
Hey, I have a camera prop to which IΒ΄ve attached a Scene Capture Component. Than I attached the whole camera BP to the character as child actor component. Everything works fine in standalone but in multiplayer the scene captures what the other player sees and I canΒ΄t seem to figure out why
Can someone help?
Ik there must be some clash because of all the clients knowing about each others scene component but idk how to solve it
Perhaps you need to know which client you're dealing with then use a Run On Owning Client custom event.
Nice! Idk why I did not find that out myself. IΒ΄ve set the scene component hidden by default. Than checked whether the pawn is locally controlled and then ran the event on owning client to unhide it. Worked nicely, thanks
it's multicast spawn
so it is hit on both server and client
if it's a replicated actor you shouldn't multicast iirc. And if it's not replicated, you need to multicast again to remove it
Oh, I get correct result when I only spawn bullet in server!
I thought that I have to spawn in multicast because sometime bullet wouldn't return hit, but I get hit result after I replicate hit result!
Thank you!
Hi, I am working on a project. its a local multiplayer game. but my 2nd player controls are not working. can anyone please help me out ?
anyone know how to do a multiplayer compatible knockback effect? like a destiny boss stomp or a lucio boop
Lucio boop could be a simple Impulse on the CharacterMovementComponent
are event dispatchers replicated in multiplayer?
well I thought that wasnt going to be that simple
but it seems to be working pretty good
thanks man
does this mean i shouldn't use event dispatch to try and replicate something, i have On Use Item to fire my gun and i've been having issues with my weapon, could that be it
Replicate an event means: call it from client, and execute it on server, OR, call it from server, and execute it on client.
Can an event dispatcher do that? No
Can an RPC do that? Yes
What other than RPCs can do it? None
Replicating properties is another story...
gotcha
It is working well on normal pings
As a local player you might still notice a hickup on 50ms+, not sure.
After all, the AI is a Server Character, so the impulse isn't predicted
alright, ill keep that in mind.
Hi everybody - I am having some trouble with setting up and connecting to my dedicated server through remote desktop, and I would really appreciate any assistance.
We are making a simple multiplayer mobile game in UE5. I followed the official docs regarding setting up a dedicated server. I have built the engine from source, created Server.Target.cs, built and packaged it. I did not make a separate client target but rather just packaged the default build target (as per the docs).
Everything works fine locally when I run the game and server exe's separately. But when I copy the packaged server files over to the remote desktop (where the actual server is running), run it and try connecting to it as a client I get this error:
"FailureType = OutdatedClient, ErrorString = The match you are trying to join is running an incompatible version of the game. Please try upgrading your game version., Driver = PendingNetDriver IpNetDriver_21******"
I tried googling this and had no luck. The builds/packages are identical with what I have locally and what I copy to the server desktop. I tried packaging Shipping versions, rebuilt the engine from source and retraced all the steps - all with no avail.
An associate with a lot more experience recommended us to change to UE4, which would be less than preferable to say the least.
Any help would be much appreciated!
Did your stuff work on ue4?
You might also have more luck posting in #packaging than here
Thanks, I will post there as well. By revert to UE4, I mean change to it - we were always using UE5 for this project.
If i'm calling ForceNetUpdate before Destroy on an actor, does it guarantee me that every properties will be replicated (and so execute all OnRep_ needed) before the server destroy the actor ?
you do need to find the functions that calcuiate a version
and override them to return the same value for both builds
I got a Component (Replicated) and a Struct Variable (Replicated).
The Struct Variable has a Boolean and an AActor Pointer, both marked with UPROPERTY()
The Server sets the Boolean and the Actor Pointer and calls OnRep.
The Actor the Pointer points to is Replicated and exists long before the Struct Variable is modified (on Server and Client).
Problem: The Client calls OnRep with the correct Boolean, but the Pointer is null.
Did I miss a step? I have a similar setup in an Actor (basically the Actor that the Pointer is pointing to), just with a different Pointer and that works fine.
The Component sits on the Character.
The only things I could imagine are:
- The Actor isn't marked as replicated. (It is)
- The Actor doesn't exist yet. (It does, and if it would get valid later it should call the OnRep with a valid Pointer iirc)
- Magic
Ah, it was Magic (: A restart fixed it for now. Lovely.
I have been trying to trace this bug for the last 2 hours and still I have no clue... Any ideas why it stationary actors don't immediately replicate movement when their velocity changes?
https://youtu.be/PM0sHN_HM_o
If they're stationary they can't move?
Should get a bunch of warning spam if you try to move a stationary component
My apologies, by stationary I mean they can move, have physics but have not moved in couple of frames.
Those two ball actors are the same, but the one that was not placed on the ramp (and has no movement after falling down on the floor) takes much longer to rep movement and then teleports
What are their network update frequencies?
Both Min and Max?
You can see it trying to move though
Almost certainly looks like client and server are fighting
Yes
It is trying to move, true. It jitters when it should be moving
So it's getting some data from the server
Could also be the smoothed physics replication causing it
You can try fiddling with 'PhysicsErrorCorrection" in project settings, or with the console vars
There are both time and distance tolerances before it snaps to the Servers' physics IIRC
And since you're only applying the impulse on the Server, the client will be relying on a snap to get back in sync
Thanks I will give it a go
Where possible you should simulate all physics on all connections
Give those tuning parameters a good look too
the default parameters are very strict IMO
But if the clients move something and the server doesn't, it's permanently out of sync too
Tl;DR Physics networking sucks
I've actually found it to not be too bad if you DON'T need prediction
Yeah, the overall case is a bit more complex, this is just boiled down to the core problem.
I'm working on multiplayer player-built vehicles lol. It's rough.
Thanks for the suggestion about PhisicErrorCorrection, I have set the Error Accumulation seconds to 0 and it works properly. I understand that setting it to 0 is not a solution but at least I know where to dig in the source code.
if you read the comments in the source they explain all the parameters. Basically it gently nudges the local object towards the server's state, and hard snaps if it accumulates too much error.
I also can see the correct movement if I do Net.RepMovement.DrawDebug 1, so the only question is, why is the actor with a tiny bit of momentum replicating right away and the one without movement gets held back by the error correction..
Looking into AActor::SyncReplicatedPhysicsSimulation() atm
I know sleeping is screwed up in UE5 rn
Interesting, I will try it in ue4 just out of curiosity
Might be worth going back to UE4 just for the stability sake
or just disable sleep to rule it out
Stupid question, but how?
It didn't change anything, so either it's not the sleep in UE5 or I disabled it incorrectly
Just fyi, I have tested the same setup in 4.27 and it works as intended.
Chaos vs PhysicX?
Chaos
all the transitional plugins are of very unstable quality
the ones that are supposed to start working on 5.1, none of them work now
not fully
Any idea when 5.1 is coming?
there is very little guarantee those systems will behave flawlessly with 5.1
and no
we had to implement multiple fixes to common UI
because its just broken
and Chaos has even more troubling history as it was supposed to be ready from 4.22 or 4.23
No one ever knows when a specific version is coming until it's released
but 5.1 means that Epic is semi-comfortable calling UE5 production ready
57 pages of open issues on issues.com atm that are assigned to 5.1, so not for a while methinks
that pushes it even more into the unknown
Wait for 5.3 at minimum at least.
Or don't. Plenty of stuff works fine already
5.64 will still have bugs
5.0 already has working things
We're in full prod on 5.0, it's pointless to wait if you're not launching for a while
its fine as long as you can fix engine bugs yourself
I mean 4.27 seems very stable. Without 5.0 features. So like 5.3 could be lesser bugs for whatever existed so long
when you really need to
The issue is the 5.0 pipeline is pretty different to UE4 if you want to take advantage of the newer features
Or 5.3 could be the one that introduces Nanite on skeletals and break everything
Yeah
Definitely some stuff that needs improving though, as always
as the engine will also get upgrades during our development
We don't even know what's gonna be in 5.1, speculating on what could be in 5.3 a full year from now is just.... weird?
Can keep an eye on UE5_main to see what epic's focuses are
I understand your point. But i don't mean anything much newer than current features.
this damned project (took too long and it bores me now) started on 4.7, released on 4.27
Lol I feel that
5.1 is already rebooting Nanite from the ground up
Woah. Luckily i don't use that yet.
So saying wait for 5.3 (again, next year stuff) makes no sense, nobody knows what will be in that
Maybe it's gonna drop DX11 support
I can agree
if you're about to release, upgrading to 5.xx would be suicidal
if you're starting a project, 5.xx is fine
I would say 5.0 is way too unstable for release. Pretty sure at least 5% of my demo's downloads ended in GPU crash
Hoping that 5.1 improves on that
What if you've been working on the same project since 4.1 but it's still a programmer art prototype lol.
Is the game instance valid on a dedicated server?
Hi! does anyone know why "simple move to location" may not be working on client but yes on server?
Client has no NavMesh maybe?
is it necessay if i'm doing the request on server?
I might be wrong, but isn't it because client does not have the access to the controller that should be doing the moving? For example AI Behaviour trees run only on server too and the movement result gets replicated to clients
i just checked and navmesh seems to be okey on client
also the client is constantly floating, i can't figurate out what is wrong with the replication here.
Floor is being added to the client OnRep, everything seems to be set to replicate on the pawn and the floor.
If i move with "Add movement input" it works okey on both server and client π§
Does any 1 know if its possible to connect to "IP" servers using steam net driver?
or has any one changed the engine in a way that allows it?
no
so how does a game like pubg handle ranked games?
Not by exposing IP addresses to clients so that they can DDOS the others
thats not what i asked...
ok so how would u go about creating dynamically spawned ranked sessions?
Dedi creates session, players join session
Then you might not want to use Steam matchmaking in the first place
Sure there are many ways, like not using the Steam online subsystem, or by letting your servers use it
I expect PUBG has their own service and only uses Steam for identification
Personally for a competitive indie game I would certainly want to use Steam sockets & matchmaking
DDOS resistance free of charge is kind of a no brainer
bu then i cant do ranked game modes
Why not?
well from my understanding i cant use just regular ip server with steam
and thats what i gathered from what u said aswell
so how am i gonna spawn or even host ranked servers somewhere, i would have to write a custom backend matchmaker
Normally you would simply have your hosted ranked servers start a Steam session and have players join it
No idea what the issue is here
its not that simple is it? take League of legends for example, people join a queue and the matchmaker apoints them a server
thats what u need to have a ranked experience
so ur gonna need a matchmaker regardless if u write it or if u have it on the baas
ive never wrote one so i would rather not
i wouldnt even know where to start tbh
So if you've already understood that you need your own matchmaking, what does Steam has to do with anything here?
well i wanted to use playfabs matchmaker for ranked, and steam for just regular "player creates sessions to play with friend"
thats why i asked if those 2 could play nice with each other
You don't want to maintain two parallel matchmaking systems, it would be a huge waste of time
Once you've got a competitive ranked matchmaking system up and running, playing with friends is an easy-mode cherry on top
well ive got the competitive stuff going with playfab
but playfab doesnt have a master server kind of thing as far as i know
You're looking at anti-cheat, server hosting, DDOS mitigation, player reports, and of course the advertising budget for a competitive game; you're looking at custom matchmaking - I promise you playing with friends will be a nice afternoon's worth of work after that
i know that i need all of that, its just that i wanna try doing like a proper game u know for the challenge of it
then if it works it works
if it doesnt it doesnt
im doing this alone and looking for easy solutions to see if it can be done
My personal advice would be to start with a purely Steam-matchmaking-based system without ranking and stuff, and then see if you have enough players that ranking is possible
Because when your game has 3 online players you can't exactly do ranked matches
ive tought about that but i feel like ranked is very important, not only for the players but because i want to try doing it and seeing how that environment works and the balance and community and all that jazz
thats why i actualy started with playfab ranked first
and got it going
but now , like u said, i feel its probably better to have that simpler stuff with friends
but i wanted to keep the ranked aspect
so i am a bit stuck
I'm just saying your ranked competitive game is only possible with very successful games
So maybe think a bit about that
i understand
im probably gonna have to redo some things then
i have playfab fully integrated and stuff
its just kinda hard to throw that work away
You don't have to throw it away, you can simply pause it, keep it on a branch in source control, and spend the rest of today implementing Steam sessions with friends. When your game has 10 players online all day long, which is a massive success as far as i'm concerned, you can look at how a ranked game could work. That would be my personal advice to ensure you don't spend time developing unused features.
well tbh i only need to redo the UI and leave the playfab stuff hanging
if im going the steam sessions route im probably gonna need to do some coop mode aswell
π
Any suggestions on how to mitigate client corrections?
When I play a listen server with my friend over the network, if they collide with me or any other server authoritive moving object they get corrected quite a lot.
How best to mitigate this? I'm expecting corrections to happen but not at 50ms with standard gameplay collision
by the way @bitter oriole do u have experience with multiplayer games, in like very big games, or a failed attempt at launching a ranked multiplayer game
is security important?
if its not
try this
GetCharacterMovement()->bIgnoreClientMovementErrorChecksAndCorrection = true;
GetCharacterMovement()->bServerAcceptClientAuthoritativePosition = true;
I tried replicating this on the "TopDownTemplate" and it doesn't work neither.
AI controller for a player character doesn't seem the best option. Does anyone know of a way to do this?
I'm seeing suggestions online about creating a proxy that only acts as the mesh holder and move that around while the player moves with AI, but it's insane.
what persists when you server travel to a new level?
good question probably only the data of the gameinstance
well u probably need a new player controller
what exactly is not moving properly?