#multiplayer
1 messages Β· Page 31 of 1

but the error is gone! π kill me
Another thing to try, I had issues even with standalone through the editor. Create a .bat file with this code
"<PathToUnrealEngine>\Engine\Binaries\Win64\UnrealEditor.exe" "<PathToProjectFile>\MyProject.uproject" -game -ResX=800 -ResY=800 -log
Run the file twice and you get 2 windows with separate consoles
This is how I always test things
Yeah I'm not sure honestly, like I said try the bat file approach
yeah with the space after then the map path
viewport 0 is still a PIE instance in run on one process false
the bat one is a good one, you can further automatise it it for initial join.
Client: "<PathToUnrealEngine>\Engine\Binaries\Win64\UnrealEditor.exe" "<PathToProjectFile>\MyProject.uproject" 127.0.0.1 -game -ResX=800 -ResY=600 -log -WINDOWED```
π i just wanna change the map please unreal
Command not recognised might be the client attempting to run the command
Did you add your hasauthority check?
Add that in and make a bat file with the code vori posted
yeah
You're in gamestate so it's running on client and server
yes
i do?
Yeah the ServerTravel command must be run on the server
well
i think the cmd now works
its just
the pie thing
maybe i should disable it again?
.bat file π
we can get this to work
Trust me, do the .bat file thing
This is how I test all my multiplayer stuff, I get issues in editor
π¦
ya know what fuck this
You have to go one step further and replicate the object through some actor channel. See this: https://jambax.co.uk/replicating-uobjects/
im going to create a new server for the map and boot the players in the lobby server to the new one
Damn you were so close, you just need to make the .bat file π
nobody can fucking stop me not even the unreal devs π²
I don't know a lot about prediction for multiplayer myself, but it sounds like you're approaching it the correct way and are just seeing a side effect of using client prediction. You may need to use a second replicated variable that you can set client side for their selection and visual display and the server only updates that variable if it absolutely must have the client swap to that other weapon (eg. client misprediction), otherwise the server can replicate your existing "Active Weapon" variable for everyone else to get the visual information.
Because each has its own use case. ForceNetUpdate is called when you want to force an actor to be considered for replication on the next frame. Internally it calls FlushNetDormancy because what if the actor in question is dormant? They do that for you and just flush net dormancy, meaning they wake that actor up for you.
right but it seems like I get the same result calling flushnetdormancy myself
Yeah that's where my mind was going too. Having a ClientActiveWeapon that is only set manually in certain cases, and ActiveWeapon which is replicated to everyone and used for spectators & other players. I'm just concerned there could be some syncing issues for the client weapon.
what if I just dont use seamless travel
Iirc forcenetupdate lasts one second by default
Yes, but it doesn't sound about right to use it for an actor that isn't dormant. (Might have side effects that you are not aware of)
You don't need seamless travel to bring clients with you, servertravel handles that
Seamless is for persisting data of certain actors
I'm telling you the issue is most likely running in editor, make the bat file and your mission will be over
okay so what you're saying is it's worth using force net update because it has additional checks that could be considered? that would make sense
Hah, the warning he was receiving was regarding seamless though XD
but the naming is weird
CAPS
Seamless is very easy to get confused with server travel.
Oh right xD
Still you should do it, having 2 log windows is nice
All I'm saying use the call that fits the occasion. FNU can be used in all, FND exclusively for dormant actors
No, no bats
Amazed to see this channel active like this
oooh, okay.
gotcha
Run under one process check
Seamless travel in the gamemode unchecked
That's for anyone else who's struggling
YO since people are here right now, if any of you are bored I'd love some input on this issue
I won't bring it up again I promise xD
My solution atm is going to have a second ActiveWeapon variable just for the owning client
have you read UT4's method?
that isn't replicated
No I haven't, I'll take a look at that
π it's a good place where to start
If you are referring to NextUpdateTime, then yeah. Actors are checked for replication on a tick basis, but you can act like a big boss and intrude with FNU
If a player crashes during an online multiplayer game, does the Destroy() method get called on the server's version of the player controller?
It should be, yes
Thank you. π
i have now, doesnt seem to be anything of particular interest
But wondering why you're asking for anything newer?
What's so flawed about that system
It was used in Paragon for the record
Also in UT
i mean theyre just kind of ugly really, also UT is really expensive to run since it runs another uworld alongside
So I would bet it was used (being used) in Fortnite
because looking at what's there currently now, its looks like that would work
I haven't got to look at all the hidden gems that ue5 has, but it never hurts to try π (not that I looked much in the replay system tbh)
yeah i'm gonna give it a go i just was curious if anyone in here has already, i'll report back what i find
Amazing, would love to hear what you found!
same here
Hey so I need a system where when the player wins, their level is increased which is kept in their game instance. There are two players in the server
I don't want it to increase all players levels only the winner
The level variable is saved in the gameinstance and is saved
GameInstance isn't replicable so RPCs there are meaningless
Just access the GameInstance locally and save your thing
Yeah but how can i reference the winning player like that
You don't reference anything but the GameInstance. The winning player references it locally
So could i do something like assign host to player 1 variable and assign client to player 2 variable
if player 2 has 3 match wins the game is won for player 2
GameMode announces Player A won -> Client RPC to inform that player they won (through PlayerController for example) -> inside the RPC save their level locally in GameInstance
Ideally the server should keep track of the client level so they don't cheat
You should save stuff locally because that makes sense when you travel to a new server and you want persistence and also because that's natural
Yeah
Ok one more thing aha
I'm updating the play rate of a timeline
Why does it only work on the server and not the client?
The saber is thrown and so the timeline works
Just modifying the speed doesnt for the client
does making an RPC reliable remove any need to worry about packet order? (i.e.: does it execute the RPCs in the order that you sent them)
Yes
But only for that actor channel I believe.
Of course
ok, thanks
noob question... is the following workflow normal for multicast rpc
client calls ServerJump() (server rpc) --> ServerJump() forwards to MulticastJump() (multinet rpc) to run locally and on all clients
(replace jump with any action)
So @fathom aspen I should be making a win event on the player bp which increases level etc
But how should i be keeping the round stats?
Because at some point i need to tell the player it's won from the gamestatebase
That's exactly how you don't want your Jump to look. While that in theory could be working, it's easily breakable and you don't want to perform movement on multicast especially when you want it to be reliable @young spoke
For example CMC replicates movement for simulated proxies and interps location and other stuff on tick
Jump is already implemented for you if you use the CMC
Multicasts are meant more towards playing unreliable events such as all kinds of effects
Scoring of an individual player should be stored on the player state. When you increase the score, you can check if the player has enough score to win, and then signal to the player that they've won.
I have no literal idea what "round stats" are but if they are something that relates to a player then PlayerState, if they relate to the game then GameState.
But how could I reference the player who's won 3 times in the gamestate for example
Round win/loss
Won what 3 times? Is there a level transition between each one of those wins?
Won 3 rounds, there's no level transition only the one into starting the gamemode from the lobby
The level transition is finished
That's per player right? You have no teams right?
If the answer is yes, then put it in PlayerState
Yes
So the same thing then - reset the player's scores at the start of each round, store the rounds won as a separate variable still on the player state. When you're increasing the rounds won, you again check if they've won 3 rounds.
Stupid question but is the player state accessible or is it just the player bp?
Every player controller has a player state instance created for them.
Player state can contain data that can be replicated to all clients and is always relevant, so scores fit really nicely there as you can access them from any clients at any time.
You can access the playerstate of a player by getting player state from controller or from character/pawn.
Also iirc GameState has an array of PlayerStates or smth like that
Could i just make a wins/losses variable in the player bp?
Not the best idea. Characters lose relevancy, and if you have any type of respawning, then those variables won't persist.
Ok got it
If you do it on the controller, then its not accessible to any other clients.
But I could have the wins loses for each player in the gamestate too?
I was right: https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/GameFramework/AGameStateBase/PlayerArray/
Array of all PlayerStates, maintained on both server and clients (PlayerStates are always relevant)
Then check whos player 1 and if they've won
Just store player data in player state
They have been told about it 3 times at least (2 times by me). They have also been pointed to read multiplayer compendium pinned in this channel, but all to no avail.
I see, didn't read the full conversation... definitely not the way to go when dealing with multiplayer π as if it was not difficult enough
Nothing towards you, but I was trying to get their attention that it might be worth it to roll the dice this time
yep, indeed
I will it's just im kinda asking a different question but I can't explain sorry lol
I was using Jump as a placeholder.. could be any kind of custom movement or ability triggered by 1 client that needs to be multicasted across all clients
I should just being doing a tick checking for both the (0) and (1) player's score to see if it's above 3 on the playerstate
My answer would stay the same. As long as you can use the CMC use it, it already has that hard part done for you (look into this channel pins for adding custom movements to the CMC). Even basic AActors has still got their movements replicated, but you would still have to do the interps, reconciliation, prediction yourself. @young spoke
If replicating movement was that easy, then CMC file would have been < 1000 lines of code.
I think you should start now tbh
guess i'll just revisit cmc
while it's not useful to always recreate the wheel, this kind of seems like a vital thing to know how to do
I wish if it was just not to recreate the wheel, but in fact it is how you do things efficiently/correctly. CMC is crazy big, but it's fun to read tbh
are multicasts in bp in the server or client?
it's so heavy though :(
I have a bit of a problem, I have a First person shooter setup, and I have a third person character for the remote views, when the character walks forward and steps it triggers a notify.
It does call print string locally to the remote players, but it doesn't play the sounds
I put a is not locally controlled check to make sure it doesn't trigger on local TP characters and only on Remote players
They are the same in cpp. The question is badly formalized, but they are called server-side and executed on server, and clients the actor is relevant for.
By when I call a multicast event in bp it is in the client?
It looks like itβs being executed on the client
It depends on where you call it. If you call it when running on a client, it'll only execute the event on that client. If you call it while running on the server, then the event would be called on all relevant clients.
so it basically should never be called on the client
so multicasts still play on the relevant client like if it was playing only on the client?
if its a multicast executed from the server
Yes
It is fairly common for Clients receiving a Multicast from the server which they themselves initiated, to ignore it
Because the coder already had the client implement that effect
on the client side
another question while youre here; if i call switch has authority on a server RPC will it ever execute to the client?
what if i want to send information to the client from a server rpc
Generally it's more efficient for your netcode to send messages to clients through replicated variables
though not always
Connected 2 players on the same laptop , the 3rd is the phone , phone is not connecting on my maps. Err itβs not loading the maps. Packaged *
( looking for potential help , trying to connect with mobile to desktop for this )
might be a memory problem
try connecting on a very small map with no assets connected to it
(you probably want a whole new game mode to achieve this minimal memory)
It connected in a lobby with basic assets
But when transitioning it got stuck in loading
Yeah I dunno but it sounds like a memory problem
try loading that level on your phone without being connected?
So the phone can load the level on its own, and the phone can connect to a simple lobby with the other devices, but the phone can't connect and load the level
Anybody know if Unreal's replication system uses an octree for large maps?
An example. I have 1000 gems on the ground over a large area. All set to Replicate. Will the replication assess all 1000 individually, or batch them into groups and assess them that way first to filter out far ones in batches.
By default each one is checked individually, you can use Replication Graph with a spatialized node for more advanced replication.
Ok. I'm a BP Goblin
I was thinking of just making a BP based system
where every actor reports itself (on constructor beginplay) to it's corresponding grid actor, and the grid actors turn replicates off for everyone under their purview if no player is within range
the player count and existing server CPU strain on the game are actually quite small
thanks I found some good vids from that
what do your gems do, just sit there until they are picked up?
they don't need to send any updates after they are spawned?
right
dormancy will cause the actors to just send an initial spawn/update package as they become relevant
and not send any updates afterwards
but the server would still need....
to do checks for all the gems it has spawned, that you're not around for?
the server will not waste time evaluating if those actors should replicate, or bandwidth sending updates
Ok but riddle me this
I am on one side of the map
A gem is spawned dormant on the other side
Doesn't the server still need to run lots of checks until I get close to it?
at this point you don't know that it exists (as client)
The Server mainly runs IsNetRelevantFor on that I guess
So if it's out of range it will just not be relevant
only if you were to walk into the net relevancy range (with default behavior)
Well isn't that what we're concerned about altogether? too many IsNetRelevant checks?
No
would the server send 1 package which would cause you to spawn the gems
That function is tiny. The annoying thing is if the Server compares the whole state of the Actor to check if it should repliate
Which it will not if it's dormant
(spawn from relplication, client side)
just finding the FObjectRelicator for that Actor takes as much time as doing 50 relevancy checks
But if you have a lot of actors that are relevant AND not dormant ,you can still cheat a bit
If you don't need constant updates, you can reduce the priority and update rate
And whenver you set a replicated varaible
You can force push the net update
Yeah I'm good about ForceNetUpdate and low update times
when the gem is picked up, you just FlushNetDormancy for that one gem, causing another update
what I worry about is just the sheer number of IsNetRelevant checks on a larger map
So I'd considered turning whole sections of the map to Replicates - Off
(large map, somewhat small player counts)
Keep in mind, that Multiplayer without C++ will be a minefield anyway
there is a problem with the grid approach
yeah I'm limiting my scope pretty well I think, 2kmx2km only for now
say you are standing on the lower right side of grid area 1,1
and you don't see any close gems from 1,2 2,1 and 2,2
Yeah you have to load up the adjacent 8 grids
even if they are within a few meters
dormancy will do the work for you and it will do it well
So to recap, if the server spawns a Dormant gem far away, it will perform IsNetRelevant updates for that gem, up until I see it, and then it will never run those updates for me again?
Just sitting dormant on my client computer
IsNetRelevant has nothing to do with the dormancy afaik
close, but not exactly
if server spawns a Dorman Actor far away it will not exist on your clients computer
until you come close enough to get that single update
Hey there! Does anybody know what ServiceResponse and ServiceRequest UFUNCTION specifiers mean and how do can you use them?
All in all, you have a limited amount of solutions for a BP only approach to this.
Starting with lower updated rate and prio + utilizing dormancy is probably the best.
If you later down notice that all available BP methods aren't cutting it, you might have found the reason C++ is required for some projects, especially Multiplayer ones
you literally have only 10% of the tools available in BP to optimize your network
Well I'm really just hoping to get 8-10 people in a playtest environment for a few weeks
the final product would be like....20 people on a server, 40 tops
Valheim style, but smaller maps with much less objects
that is a very tall order for BP
i would not be comfortable with more then 8 using just BP tools
k
on the bright side, learning some c++ to use the tools BP can't is not that bad
Yeah I imagine that if the development is going well enough and the playtest can handle a few lads that'll be motivation enough to press deeper
:P we can't stop you from trying I guess
Ok so here's another thing, I tested this big white cone with INITIAL dormancy, and once I get close, it's always relevant at any distance, so now am I correct that now I need to start thinking about draw thread issues for the client?
definitely not
eventually, maybe
but until you have a working prototype
its too early to think optimization
That's also probably not that much of a networking problem
Culling is a thing. LODs are a thing.
What I would be more worried about is having that thing tick for no reason :D
when you have enough experience, you can write reasonably performant code on the first pass
So yes it will be an issue
but before you do, thinking optimization right away clutters your task complexity beyond what you can be reasonable expected to handle
I'm well past the point of "working prototype", I've been doing that for 5 years, had 4 people playing a multi server MMO 3 years ago and have only improved since then, just trying to plan well for this project
but I appreciate the concern, I've seen plenty of folks get lost trying to chase optimization they don't grasp
Well, fwiw, I don't think we ever optimized in that direction on The Ascent
The only thing we massively optimized was Tick and overlapping BeginPlay code
that's interesting, can you elaborate a bit more on what you mean by overlapping beginplay, like staggering out some of that logic so it doesn't all hitch at the beginning?
Yap
And also things like Spawners vs placing the Actor into the scene directly
Spawners are lightweight. Paired with proper SoftObject Refs to DataAssets, the level can become quite small in memory size
And only loads and spawns stuff if needed
There are a bunch of things you can do before you have to think about a cone in the distane that the player isn't looking at 90% of the time, causing it to not be rendered anyway
Something that UE4 isn't utilizing by default (not sure they have a base implementation in C++ somewhere), is what "isNetRelevanceFor" does but for Tick
Which one would call Significance
But you can probably see that in some games already, where the tickrate is reduce when the actor is far away
Or even turned of
But again, less of a Multiplayer problem at that point
well, imagine the player ran by 300 gems while exploring, now just need to be sure it has at least some reduction solution
Yeah, reduce tickrate on far away gems, or turn it off. Use very simple meshes or even turn off rendering for very distant ones
Stuff behind the player isn'trendered anyway, so your worst case is if the player looks at a flat area with tons of them in the distance
well the cull steps can be expensive in their own right
If you want to check what is actually rendered and what not, you can enter the Debug Camera and disable the render update
if the counts get bloated
Then fly around abit
congrats on The Ascent, it looks like a hit
Thanks, my company was contracted for 2 years full-time on it. So can only partially take credit hehe.
It's Neon Giant's game, not ours.
Don't be modest, just say "I made most of it by myself, some other people helped"
Haha, to be fair we did a shit ton on it, that's not wrong
I'm using a blueprint widget to show the PlayerState->PlayerName above of the head of all of the players. If none of the players can see the other players name updated on the blueprint widget. What could be happening?
Thanks.
I'm going to update my question on Unreal's forums and I will share the link with you, because there are a lot of code to show.
Hate to say it, but dormancy is totally bugged in BP @low helm
It's unfortunate, but good to keep that in mind
how
thanks I will test that
You're welcome, hope you fix it
You can find them here: https://forums.unrealengine.com/t/players-dont-see-the-updated-playerstate-playername-of-the-other-players/689398
Hi! Iβve just started to develop my first Multiplayer game. Thereβll be two players with their names above of their heads. Iβm using a Blueprint Widget to show it. When the game begins, the player has to set his/her name. I have a Blueprint widget with an Editable Text. This is how I show this blueprint widget: When the player hits the Ent...
Thanks.
Any one able to tell me why my pawnparameters struct isnt being correctly set within the pawn when it is spawned? this is my code:
the parameter struct is set locally and then passed to the server when the pawn is spawned, but when i check the variables in the pawn once its spawned its just using the default struct values
What actor is this code within?
player controller
What are your struct members types? I only see one float
Ah I totally misunderstood your question. So you are expecting to see the changed values on spawn while in fact you are seeing the default ones
yeah
Reproduced for sanity and I see the changed properties just fine when spawned
Two questions:
- Where is this server RPC called from?
- Where do you examine if the struct members have changed?
on mine, i check the params on the client when calling the event to spawn pawn and they are correct, and then again i check them on the server and they are also correct
but when i check on the pawn and they are incorrect
this all happens on PC
I think I know that already, I meant what native function calls RequestBeginGameplay
And answer question 2
that is also called from PC
im not sure i understand q2
you mean like where do i use the struct values?
You keep restating yourself without giving me any meaningful answers
RequestBeginGameplay is called by a function
Name me that function
i have it set to run on owning client
And where you call that owning on client event
The name of the native function is the thing I'm looking for
But anyways I will suppose that RPC is being called and it's all fine
from the game mode when the player joins the game
Answer question 2
You said inside Pawn
What function inside that Pawn?
BeginPlay?
yeah the struct vars are use inside the pawn
no they are just used for various functions
like jump etc
it will get the jump strength from the struct
like this for example
They should be mutating the CDO values just fine. My only guess is that you are somehow resetting them back to their default values somewhere
hmm. there are no set values in my pawn
it works for the server player
only the clients it doesnt not
Oh then my doubts were true
Back to question 1
You are calling the server RPC too early it seems
Causing it to drop
But that doesn't explain how a pawn is being spawned
it starts here
in the game mode
which eventually calls the begin gameplay
and that leads to the initial image i posted
this
Finally you answered my question. That function is the first safe point in time to fire RPCs on the PlayerController. So that's not the issue it seems
Debug, like I would
Hey I almost figured it out!
I'm using EOS to create sessions and join them.
Everything is perfect on pc.
The only thing left is that Account Portal is launching web browser in pc but not in android and login gets failed in android.
Any solutions to make it work in android as well?
Ohh I'm so close to make it work! Please guide me if you can π
Thanks
The last resort tool to every sane programmer @celest bough
i have no idea how to debug this, i normally just use print string for everything xD for this i can see the server is passing the correct value but then as soon as i print the value from the pawn, its the default value
The grapes is what I was going to add but you are speed π
This should get you running
Say bye bye to print string
ty
Isn't it multiplayer :/?
Its just not launching web browser to login. I know to be more specific it is of #epic-online-services but if you can help, π¦
No it's not. Pretty much like #online-subsystems isn't. That's why they have their own channels
(I would if I knew, happy I could help guiding you to the correct channel)
Ok alright thanks.
Hey, I am very new to multiplayer and I am trying to figure out the RPCs for Objects that exist within my level. Therefor I created a quick TicTacToe setup. Upon a tile getting clicked I want to spawn a decal.
As I read I will have to do this via the GameState or PlayerState, as the object is serverowned. So I set up a cast to the GameState and then did a serverRPC/Multicast there. But if I click the tile on the server the multicast works fine, however clicking the tile clientside does not RPC to the server. Could anyone help out why that is?
Does anyone know of a course or tutorial that explains how to set up a server for multiplayer game production in unreal engine 5, friends, it is very important to me
The object can still replicate, you just can't do a Client -> Server RPC in the object unless you own it. In your case the flow would go like
In PlayerController or Pawn
Input -> RPC to server (I clicked this tile) -> Server side does stuff, spawns actors, sets variable, whatever
The only communication from client to server is "I clicked on this tile" or "I clicked in this location"
?
Check pinned messages, starting with the multiplayer compendium
There are a million. On a scale of 1 to 10, how familiar are you with Unreal Engine already? Could you go and make PacMan without following a tutorial?
That suggestion goes to you too: #multiplayer message
thanks a lot ^^
Reanswered for posterity and visibility
I also recommend keeping this close if you're just starting to learn RPCs. There's two graphs about halfway down that'll tell you what will happen if an RPC is invoked on client or server.
https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/Networking/Actors/RPCs/
Also found in that compendium ^, you will find out that multicasts when called from client will execute like a normal function on client
Also as you go through the pins you will learn to keep away from multicasts for stateful events: https://vorixo.github.io/devtricks/stateful-events-multiplayer/
If I have an actor in the level and want to call RPCs from it without needing to do so through the player controller to solve ownership, is there a best way to do that? Is it reasonable to set the actor's owner to the player 0 player controller on every client so that each client can call RPCs?
(thought I'd sneak that in here while it's relevant π )
Sir i try to learn just create a server firstly there are many tutorials but steam subsystem is problematic in unreal 5
Thans sir
It doesn't have to be PlayerController, but can also be Pawn (in case owned) and PlayerState.
Usually you do that, because why hold too much of hard references to actors, when you can bypass that?
Also you don't use GetPlayerController(0) because that means they are all owned by the first player and that might be unpleasant for your game
GetPlayerXXX(0) nodes are avoided in multiplayer
I remember I had a project that ended up with a playercontroller with dozens of functions that were primarily for calling rpc's on objects.
Maybe there's a nice way to do it by passing a lambda to a single function in the controller instead π€
Live example from that project: You want to open a door on a button click. You should be calling a server RPC that involves that door. Peeps usually think that they have to own that door, but that's wrong
You literally have a generic interact function that examines what object it's interacting with and call that server RPC accordingly
All done on PlayerController for example
Aside from eliminating the need to hold too much of hard refs, you also have a modular code
I'll take a look at that! Which project is it? Discord isn't redirecting me to the right spot for some reason.
It's a metaphor, I was trying to make you remember what that was
I may also be overly used to all the boilerplate from previous industry experience π
If Anyone wondering!
Here is the answer from Epic on same exact question.
Ohh I love Unreal!
https://eoshelp.epicgames.com/s/question/0D54z00007jiRXDCA2/cant-login-with-android?language=en_US
is it possible to make one Client gets connected to 2 server.
What i am trying to do is, trying to Join 2 server using beacons, so one server can interact with another server.
Now once my connection is established, I want to decide for some Pawn that they can be seen in another server too, so I was thing if i can do some manually call from server1 to server2, which can create a client for me on server2 and but it should be control via the client which is sitting on server1.
as far as i understood this, there is NetDriver which has ipConnection, which i think is the representation of a user for a server, and ipConnection can have Actor Channels.
and all of the Client to server connection is done by a class (stateless something) and this class has a call AddNetConnection() , i was thinking if i should make this function call from server1 to server2 sending all the necessary data to create a IPConnection,
After that i probably have to customize the updates to these ipConnection.
anyone have any experience with this ?
other Approach, as i already have connection between servers, I can just create a psuedo Pawn, which will be a replicated Actor, i can spawn that, and make movement replication go through via Beacon, drawback of this approach is, everytime i add some functionality to my main pawn, and i want that to also work between server to server, I will manually have to add this via beacons also.
If it's alright, let me ask a more specific question about working with actors in the level!
I have an actor like this, which is, I think, pretty standard.
class ANetworkedActor : public AActor
{
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing = OnRep_Property)
float Property = 0.f;
UFUNCTION(BlueprintCallable, Server, Reliable)
void ServerUpdateProperty(float InProperty)
{ // impl
Property = InProperty;
OnRep_Property();
}
UFUNCTION()
void OnRep_Property()
{
if (ensureAlways(ActorWidget != nullptr))
{
ActorWidget->UpdatePropertyTextBlock();
}
}
}
Then in the widget I have:
class UActorWidget : public UUserWidget
{
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Widget, meta = (AllowPrivateAccess = "true", BindWidget))
class UButton* IncrementPropertyButton;
UFUNCTION(BlueprintCallable)
void OnIncrementPropertyButtonPressed(float value = 1.f)
{
if (ensureAlways(OwningActor != nullptr)) {
OwningActor->ServerUpdateProperty(OwningActor->Property + value);
}
}
}
From the client, I get No owning connection for actor.
There's no way to use the ServerUpdateProperty from the client directly?
HAve you actually copied+pasted your actual header?
I thought you'd need to use _Implementation methods for those Server methods.
No, I tried to extract the important stuff to reduce the noise π
Yeah, I moved the _Implementation in there with the little // impl comment.
OwningActor has no owning connection
That's just going to cause confusion π
So I know I can do something like this in my player controller:
class AApplicationPlayerController : public APlayerController
{
public:
UFUNCTION(Server, Reliable)
void ServerUpdateActorProperty(class ANetworkedActor* Target, float NewValue);
}
void AApplicationPlayerController::ServerUpdateActorProperty_Implementation(ANetworkedActor* Target, float NewValue)
{
Target->ServerUpdateProperty(NewValue);
}
void UActorWidget::OnButtonPressed()
{
const auto World = GetWorld();
if (ensureAlways(World != nullptr))
{
auto PlayerController = Cast<AApplicationPlayerController>(World->GetFirstPlayerController());
if (ensureAlways(PlayerController != nullptr))
{
PlayerController->ServerUpdateActorProperty(SyringePump, NewValue);
}
}
}
Two questions:
- Is there a cleaner way to do this?
- Is there value in the
UpdatePropertyfunction on the actor being aServer, Reliablefunction if it's going to be called through thePlayerControlleranyway?
- Too generic names to be able to tell what's the end purpose here.
- No. A server RPC will exist on an actor that is capable of running it.
You can't call a server rpc on something not owned by the client.
To be more specific, I have an actor in my level representing a syringe pump in a hospital that has a large UI giving access to some of its internal state. A networked player in virtual reality is adjusting those properties using the UI for it. For the syringe pump, it's not so bad to have a function on the player controller for each of these properties. For some of the other machines in my level, there are going to be dozens of properties, so making a function in the player controller for each would be a bit of a mess.
(player state, controller, pawn)
Having said that, I was fine with the mess. This is how things were done when I worked in AAA way back.
Buuuut if there's a way to not have a specific function in the player controller for each of these updates and to instead have a generic UpdatePropertyXOnActorY function, that'd be pretty sweet. I'd normally do that with a lambda, but that isn't supported with Unreal's networking.
Again, you wouldn't have a function in PlayerController for each object
ServerInteract(GenericObject)
GenericObject will have that function that you hate placing in PlayerController
It's just that the PlayerController is guaranteeing you are on the server by the time that object-related function is called
Literally no boilerplate
So clean
And nothing hard about it
GenericObject for example will have a generic Interact function
I feel like you're telling me something very obvious with the GenericObject and I'm somehow missing it π
Interact for door is not the same for rock
Every object will define how a player interacts with it
That's polymorphism explained in a really peasant way
#online-subsystems might know
Ah, you're saying the cleanest way to do it would be with an interact interface.
Right, an interface.
was trying to multicast on a PlayerController for a couple hrs, RIP
π€£ well at least i have learned... painfully
no one answers
PlayerController exists on server and owning client only. So that's like firing a client RPC instead (ofc with a normal function on server)
Doesn't make it legitimate to ask here though. https://forums.unrealengine.com/ is a thing too
Hello, I have a quick question.
On a programming level, how do we build an Unreal Engine 5 MMO (Metaverse) on a dedicated server?
What would be a suitable place to start?
That is many things, but it is not a quick question π
I hope you get a nice answer, though!
I think it's a super quick question. You start with the game. π
And you have a very good understanding of Unreal's networking, and the tools it has
FWIW UE is not MMO friendly, meaning you will also going to heavily modify the engine
The issue with that question is understanding that you can't have a dedicated server to build until you have a project. If you get that far, then you can worry about a backend that spins up the dedicateds and tears them down, or manages their properties.
Cries in distributed servers
For a proper MMO, you'll also need to handle things like region-based relevancy, resizing regions, server management, etc.
Just buy one of those marketplace plugins. Easy.
Guess it depends on the definition of an MMO. Everyone has their own view. It's not really that easy of a question given how many different variations of MMOs there are. Games like The Cycle or AnarchyOnline for instance just fake it with instanced lobbies where you're rarely connected to more than a dozen people at a time. Can still chat globally but that's about it. Versus something like ARK where there are separate shards, no global chat for everything online. Or something more like WoW where there is very little hard cut instancing outside of specific dungeons.
yeah MMO sounds like a multiplayer+infrastructure nightmare
Okay, would it be best to make the most of the project and then adapt it to multiplayer? or
Work on the back end first, then add the game?
The game is a metaverse/MMO used in schools.
Make the game multiplayer, but don't worry so much about the MMO part at first. You can do 80% of the work before you even build a dedicated server.
I'd never build a multiplayer game as singleplayer first - but you can build multiplayer (if you have enough knowledge) using the editor to test and slowly understanding the easy and difficult parts in your context
Don't ever try to convert a SP game to MP.
If you want to even attempt that, run your SP game from a dedicated server.
First of all thanks to all for the answers, the team are reading all and adding it to our investigation. If any one have other advices they are all welcome, we know this is not an easy task.
Why do we need to have ownership of the object to call an RPC for it if the RPC is run on the server? This seems to necessitate a lot of extra code, and I'm not seeing the benefit of it.
So I can't tell the server that YOU want to shoot your gun.
I can only tell the server about things I own.
Otherwise you'd be doing tons of ownership checks all over the place. Only being able to RPC through objects you own is the best default.
Is there a way to disable that behaviour for some objects? To have an object owned by everyone?
What's the specific use case?
hey guys, is there a way to stress test the mp game ... smth like dedicated server where it does not render the game but acts like a client ?
So what would make that different from a dedicated server?
It's connecting to the server?
You might be able to spin up multiple headless clients in an automated test or osmething.
yeah, is there a way to do it out of the box?
Just fire up a bunch of instances and melt your gpu
and/or cpu
In this case I have an object in the level that has a bunch of properties that I want to be able to update and then call an OnRep. Anybody can walk up to the object and change it through a widget. As I understand it now, I need to have the widget get the world, get the player controller, and call the server RPC on the player controller that passes the pointer to the object I want to change and the new function. I can't have a server RPC on the actor itself because of the ownership rules even though anyone can change the object at any time.
Probably technically possible but I've never heard of it. Would probably be easier to just get like 4 clients on your rig
As Adriel says, right now the only way would be to start multple clients and ahve them all connect.
There is a blatant issue with that. Widgets don't hold state, they just display it. So you didn't convince me.
More specific, how many properties we talking? What's the gameplay here?
The widget doesn't change the state. The widget has a pointer to the actor that owns the state.
Also you are welcome to override UNetDriver::ProcessRemoteFunction and have your rules of when you are able to fire RPCs
I won't be responsible of the chaos that happens tho
What I'm getting at is, can the properties be put into a struct?
Then you could make it a simple passed struct in the update state RPC
Ah fair, throw everything in a struct and a single RPC.
HeyMrServerIWantTheThingToBeLikeThisNow(NewStateStruct)
It'll result in a lot of extra data being passed, but I can leave that as a problem for another day.
It's not being sent on tick so it's like zero data
You could also make it more of a transaction "Change field X to value Y"
Hi. Has anyone done - server trigger local save for each player and server trigger local load for each player (local file/steam cloud file). Something similar like in Terraria or Phasmphobia.
whatever makes it so you don't need a different RPC for every field.
@daring portalJust curious, what's the actual gameplay here?
automation game?
Space Engineers style?
Virtual reality simulation with a controller using a desktop and multiple virtual reality trainees. It's a simulation for training anesthesiology residents. It's mostly working, but I'm reworking the networking to make it more reliable.
For objects like syringe pumps, the anesthesia machine, etc. there is a lot of stuff to control and any of the trainees can approach the device and change it either through physical interaction or through a widget depending on the property. The desktop proctor has its own UI that gives access to all of the properties.
Yeah you'd definetly want a transactional approach. Basically spell out which property, what change you want, and server either does it or doesn't (not allowed)
Now by "a lot of properties" we're talking less than 20 still.
So I think a struct would be fine.
Cool thing is you could record that
and audit it "Hey mr whoever never turned the machine on and now the patient is dead"
or XXX person cranked up the flow rate to X number
you could record all that
hell you could automate a procedure. It'd basically be a flowchart of transactions.
True story! I have a system for recording the events, but baking it into the networkign would be nice.
I also have a system for automating procedures or making a set of procedures as a text file that triggers a list of exec commands on the server. It's ugly as hell. I'm hoping to make it nicer and post it up as a plugin on Github at some point.
And preferably make it work in a safer way than triggering random exec commands, which was sloppy to the extreme π
So based on everything I've learned here, this should be a reasonable approach?
USTRUCT(BlueprintType)
struct FNetworkedActorProperties
{
float X;
}
class ANetworkedActor : public AActor
{
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing = OnRep_Property)
FNetworkedActorProperties Properties;
UFUNCTION(BlueprintCallable)
void UpdateProperties(FNetworkedActorProperties InProperties)
{ // implementation function in cpp
Properties = InProperties;
OnRep_Properties();
}
UFUNCTION()
void OnRep_Properties()
{
if (ensureAlways(ActorWidget != nullptr))
{
ActorWidget->UpdateProperties(Properties);
}
// recording and other nice extra features
}
}
class UActorWidget : public UUserWidget
{
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Widget, meta = (AllowPrivateAccess = "true", BindWidget))
class UButton* IncrementXPropertyButton;
UFUNCTION(BlueprintCallable)
void OnIncrementXPropertyButtonPressed(float value = 1.f)
{
const auto World = GetWorld();
if (ensureAlways(World != nullptr))
{
auto PlayerController = Cast<AApplicationPlayerController>(World->GetFirstPlayerController());
if (ensureAlways(PlayerController != nullptr) && ensureAlways(OwningActor != nullptr))
{
auto NewProperties = OwningActor->Properties;
NewProperties.X += value;
PlayerController->ServerNetworkedUpdateActorProperties(OwningActor, NewProperties);
}
}
}
}
class AApplicationPlayerController : public APlayerController
{
public:
UFUNCTION(Server, Reliable)
void ServerUpdateNetworkedActorProperties(class ANetworkedActor* Target, FNetworkedActorProperties NewProperties)
{ // implementation function in cpp
Target->UpdateProperties(NewProperties);
}
}
Keep in mind when you call that RPC, you're sending the entire struct each time
So depends how big the struct is. FNetworkedActorProperties params should be const-ref also
I guess from here the biggest improvement would be caching the local controller in the widget. That doesn't seem to cause any problems I can think of.
The widget already has access to the local controller.
That'll make a lot of my GetWorld in my codebase disappear!
GetLocalPlayer or something I think.
Basically when a UserWidget is created it can have one of two different outers. World or GameInstance. Regardless of which or how you create it or where from, it will pull the local player from somewhere to populate the widget's local player, which it can use to get the controller for that widget. The only time you need to care about passing it a specific outer is for local coop games where there's more than one local controller.
GetOwningLocalPlayer. Beauty!
are on rep functions called on the server?
Generally speaking BP style OnReps are frowned upon because it's nice to be able to breakpoint specifically an OnRep and know it's on a client.
referring to response above. How do you usually debug client-only behavior or multiplayer in general. Say your game uses steam, do you have to make a shipping build every time and attach a debugger?
Single-player heretic detected 
It doesn't have to be shipping. It can be standalone, and to debug client-only behavior you attach the debugger to the client process
Or if you're deploying to Quest you just cry a lot π
I don't know if that's just me, but I hate VR
I know it doesn't interest anyone, but happy to share with you my feelings
They are Meta now
Obviously the name was the reason to the chaos

I was excited for VR then I started developing for it and now it just represents pain and dead dreams
I'm purple, remember?
I will tell you once you're purple
You're not purple enough to understand now
I could get you one 
I'd be more excited for VR if my left eye's macula wasn't basically broken.
Not rich enough to buy that. I'm Zuck now 
The $3 tier was almost convincing enough. But alas, still not enough features.
I don't care enough about emojis
heyo, I'm trying to just hack together some simple session connectivity stuff for demonstration purposes using Advanced Sessions. I can successfully create an advanced session and join it just fine, and see two pawns appear, one for the host of the session and one for the newly connected player. However, I then want to open a new level. I call Open Level on the host, and simply doing so also opens the level for other connected player - however, it seems like they go to different "instances" of that level, insofar as there is only one pawn in each. How do I call open level from the host, and have this cause the connected player to open the same level as the host (with both pawns present)?
You can't. Reason being OpenLevel is just a wrapper for UEngine::Browse, which due to the docs (https://docs.unrealengine.com/en-US/InteractiveExperiences/Networking/Travelling/#uengine::browse) disconnects clients from server. If you want clients to keep being connected you want to call ExecuteConsoleCommand with servertravel command.
That's some good obscure stuff
More about that jazz can be found here: https://wizardcell.com/unreal/persistent-data/
Very wizardry
if i have a timer delegate to a server RPC do i have to invalidate that timer on the client or server?
worked a treat, cheers @fathom aspen
You invalidate it where it exists (where it's bound)
i dont need to set a timer through the server? can i set a timer via the client and bound it to the server will it tick on the server?
No. Timers are local.
Pretty much like delegates are.
They have no idea networking exists.
would it be stupid then to have a timer that is connected to something like attack speed, to make it execute an attack every x seconds according to attack speed? if timers are local are they not hackable
It's not stupid if it's done on the server.
Anyone know why this isn't replicating to the clients?
This is inside the game state
Presumably too early. Put a 0.5 second delay on it and test again.
That worked! Thanks
Trying to repro (and no matter what I do), I'm getting only the server to execute the multicast!!! What sin did I commit to deserve this dragonHell? 
omg - I forgot about that π
But probably if that multicast was reliable you would get it to execute
(Don't judge me if it doesn't)
I hate them anyways
Hold up.. Negative?
It's a marketing term
that's the whats-so-called input prediction
the machine can predict your input even before you press it π€£
That's obviously being developed by dragonHell
THATS SO COOL
tbh I recommend everyone to give a try on making a game on an old architecture, ie: amstrad
it's much fun (made this: https://www.youtube.com/watch?v=lv0hjZbbIfA)
Speculative execution has gotten crazy, it can tell what you're gonna do before you do it
does that really work?
yes, with a very great accuracy
client prediction in multiplayer context always seemed to me a fancy way to say "simulate no lag"
amazing, but also applied to games? where can I learn more about it?
well this has more to do with hardware design
On the level of predicting a branch in code, it's like 95% hit rate.
ohh yeah, that got crazy good
still dunno how
Any tips on making throwable grenade with client-side prediction? I was thinking spawning a "dummy" client-side nade, which travels 20% slower than proper (replicated) one.
Once the replicated one is spawned on client, set it to be Hidden in game.
Over multiple frames lerp the old dummy one to the replicated location. And destroy the dummy on when in sync.
So it looks like the projectile speeds up after a bit of time.
Don't is my suggestion tbh
The chances that players will actually see it by the time you have animation and everything else are pretty slim
It looks fine with the animation when player is stationary, but you can see the grenade spawned next to you when you are moving from side to side. Not sure how to cover the spawn location with an animation.
Other problem is the grenade you get from the server is going to be behind by a factor of RTT + processing time
if i call does timer exist by handle and the delegate is executed on the server will the check for this call have to be done on the server as well
yes
Timers are local only
zero network functionality
That is why I would slow down the dummy grenade in contrast to the default one. The path for both should be the same if I am not colliding with dynamic objects. And the spawn location is basically 100% the same.
Isn't that going to be wierder though? Seeing a slow grenade suddenly start moving faster? I'd think that'd be more jarring
If the "throw" is initiated by the server, you could get the server to throw it earlier to mask the latency slightly
I think I am being a massive dummy, I think I can just do the "release" on the server which should spawn the nade at the current location.
So the player "holds" the nade for a tiny bit longer
Thanks @chrome bay as always!
prediction just gets messy fast, if you can avoid it I would
Yeah, I am trying to push myself to do the nasty parts so I know and understand why they are so messy. This is also one of the reasons why I am not using GAS atm.
This is how Bungie did it:
Is that from the Halo talk?
Oh yeah, Halo has a presentation on that
Tricky part of releasing early on the server is making sure it still goes the same direction the client wants
if i set a timer handle to be replicated shouldnt it replicate from server to client?
doing this check on the client always returns false
You're replicating the timer handle. Like Jambax said:
Timers are local only
zero network functionality
Your timer doesn't exist on the client because you created it on the server. Replicating the handle doesn't just magically start a timer π
but you have to create a timer on the server, no matter if the delegate is connected to a server
for it to be on the server
Correct.
now that makes sense, lol
A timer that starts on the server exists on the server, one created on a client lives on a client.
someone told me on here that if the timer is created on the client and the delegate points to a server call then the timer exists on the server
dey wrong
No one aside from me spoke to you and neither that I told you that
Waiting for the proof, while I know it doesn't exist
Like we said. If you start a timer on the server, it exists on the server and only the server. Start one on a client and it lives on that specific client. If you want to communicate between client and server something then either use a RPC or the replication system π
Yeah my answer was clearly misleading: #multiplayer message
You're always misleading Wizard π
Sorry for the accusations then. I would be happy if you go back and correct that individual tho.
Back to your space shooter game!
Bold of you to assume I have touched that any time recent π
||How about blog posts then?||
||crying intensifies||
Hello ,how to I get motion warping replicated? I used the "run on server to multicast" way. But client keeps jitters back and forth
I'd be very interested in reading a blog post about server hosting setup using the third person starter project or Lyra. I know there's a very long video series out there by flopperam for UE4 with AWS but I think an article would be better.
Hehe, you're lucky because the next planned blog post (soonβ’οΈ in the making) will somehow touch upon that. Wasn't my idea, props to vori for pushing me towards it π
call it a blog, call it a sample... lol
Call it a...? Nah that word can't be disclosed now xD
What if it ends up not being it... u never know
/s
The grenade still looks so weird when it spawns next to the character. Grrrrr
In a multiplayer game, need a local single player scenario, such as some editor. How to do it.
is it possible to replicate physics object accurately between clients? i wanted to make a grenade but when the client 1 throws it, it falls in a bin for him while for client 2 it completely missed
or should make a custom deterministic physics solution for the grenades?
It is a tricky situation, I am not experienced with this specific scenario. To start with, I'd make sure that the inputs (stuff like the force, direction, origin of the action) are as close as possible, else even a perfectly deterministic solution would differ between clients
Unreal doesn't have a deterministic physics engine, although iirc Chaos is better at it.
Idk how granades are dealt with traditionally - but it seems like a common thing to sync between clients/server, so there must be some good solutions
Another option is to make some kind of server-only simulation that sends updates frequently to interpolate in the clients
Some informative articles about networked physics: https://gafferongames.com/post/introduction_to_networked_physics/
Introduction Hi, Iβm Glenn Fiedler and welcome to the first article in Networked Physics.
In this article series weβre going to network a physics simulation three different ways: deterministic lockstep, snapshot interpolation and state synchronization.
But before we get to this, letβs spend some time exploring the physics simulation weβre going ...
Yes, that's easy. Doing lag compensation / prediction is the hard part.
The built in physics replication is pretty good but it doesn't do anything for you regarding prediction. Perfectly fine for server-auth physics tho
If you're ok with the ping delay between client hitting the button and grenade appearing on their screen, then it'll work out just fine for you.
Unreal has replicated physics?
ya
Ancient
I think it's opt in per body but it replicates all physics. You have some tuning values in the project settings
understood, thank you very much! maybe someday I need it to replicate some catapult projectiles or smth :D
Yeah it's great, you just can't do prediction without a TON of extra work. I use it for my vehicle game just fine but my vehicles are slow and tanklike, not F1 cars.
Just thinking of client-side prediction with complex physics makes my head ache
My game has player-built vehicles so yeah. No thanks lol.
lol
I don't think I'll make a system to robustly predict the motion of XxX_Sephiroth42069_XxX's divide-by-zero-mobile with 12 engines and 34 wheels and guns with propellers on them
I just spam inputs to server and let it do the physics. I only replicate the chassis and turret movements tho. I don't replicate wheels and the like, who cares if they disagree as long as the motion of the actual vehicle is the same.
Hi everyone
lol was just about to ask about vehicles
I see that in UE5 the Chaos vehicles are all driven server side
Is it the same with the Chaos vehicles in UE4?
If not do you think they might update it anytime soon or is that something that I will have to look into myself?
Hi
I want to get prediction for a tank
How did you get it done, also what engine version is it
@chrome bay Just out of curiosity I tried this. When grenade is replicated to owning client, instead of spawning it where it was when player threw, it spawn it where the player is now.
Then it follows the same movement as server, but it lerps toward the server one.
Looks something like this, and it feels much better imo. Not sure if this information is of any use to use, just wanted to share my findings from experimenting.
This image is from character moving left. Red is the "fake" location, and green is the server location.
I know that wrapping sensitive c++ code with #if UE_SERVER /*code here*/ #endif makes it so that code block isn't shipped with the client build but what happens when you do that on a player controller?
Very cool! Would look a little funky but better than the alternatives.
or maybe I'm confusing player controller as being client only like widgets are
What else that can cause a charactermovement replication become client authorized? I was tinkering to reduce the lag and switch/edit so many things I couldn't remember, and now the multiplayer is become client authority, not server's
I've checked "Ignore Client Movement Error and Correction" and "Server Accept Client Authoritative Position" both are turned off
The only thing I havent check is GameNetworkManager, but I cant locate it
Are you using the built in character movement component?
WITH_SERVER_CODE does not ship with client build. With server is for dedicated servers only if I am not mistaken.
Yes, but I did override the calcvelocity function
That's like the main part
your modifications are probably what's causing issues here
What sort of changes did you make to it?
lemme open my vscode first
but iirc, I only change the acceleration part
I just want 'almost' instant velocity change, so I use 10000
if (!bZeroAcceleration)
{
const float NewMaxInputSpeed = IsExceedingMaxSpeed(MaxInputSpeed) ? Velocity.Size() : MaxInputSpeed;
--Velocity += Acceleration * DeltaTime;
++Velocity += Acceleration * 10000;
Velocity = Velocity.GetClampedToMaxSize(NewMaxInputSpeed);
}
I suspect what's happening here is that the GameNetworkManager has some built in speed cheat detection / prevention stuff and whatever changes you made to the calcvelocity function are not compatible with the cheat detection. Is that data being replicated? validated?
I dont think I do any validation
btw, I switched back to builtin charactermovement, and it still client authorized
What do you mean by client authorized? what makes it client authorized? are you getting lag and corrections?
client authorized, like all the movements are simulated in client and replicated to server instead of the client send commands to server, and the server simulate it then replicated to clients
I only noticed it when the animation only works in client. Before, the animation works in both server and client
So on a listen server?
yep, on listen server
ya, no pretty sure movement is still server side even if its listen and not dedicated, otherwise how are the other players going to see each other run around?
I don't do prediction
it's insanely hard
Why would you need to do prediction for a tank anyway
a tank doesn't do anything in 30ms
A human uses their controller to modify their character. The controller sends an RPC to the server so it can make the requested movement change on behalf of the human who pressed the button and then that change is automatically replicated out to all other connected clients via the server in the form of proxy actors.
You should be able to get instant acceleration with the stock CMC just by setting default values
Otherwise you'd have clients ending up with different simulations
which is just desync
I can tell that it's client simulated since the movement is smooth on client but stuttered in server (with simulated lag)
No its client predicted
The character movement component does client side prediction to reduce the feeling of input lag. When you press a button you expect something to happen right away, correct?
I can tell it's client simulated since what the server see is different with the client.
When both start at the same time, in server, player A(server's) is in front of B(client's), but in client, its the other way (It's a racing game, I forgot to mention)
Also, before, in client, there was this bouncing movement (to sync with server I guess) from time to time, but now it somehow magically disappeared.
A car racing game?
not actually car
well any vehicle I suppose probably shouldn't be using the CMC in the first place
There is no difference between client authoritative and client predicted assuming there's no problems
The differences come when the client and server disagree on something
You choose the server's result normally, or the clients result if you're doing client authoritative simulation
it's snowboarding race
Either way the client is in the future relative to the server on their own screen
Yeah a snowboarding/skiing game would be doable with the CMC, you'd have to do some fancy math in the update step tho
boarding is a bit more complicated than walking
if you want momentum and energy conservation etc
that's the problem, in client, client see he/she is the winner, but in server it's him/her
That's the core problem with multiplayer
yea
It's best to use server's authoritative
They'd still see themselves crossing the finish line before the server does
but the problem is, I somehow made the game client authoritative
that's what prediction is, it lets you see stuff in the future
I doubt you did
How do you know it's client authoritative and NOT just predicted?
There might be a setting on the CMC to change that, look around
different result between client and server
because it predicted forward
If true, and server does not detect client position error, server will copy the client movement location/velocity/etc after simulating the move.
And what happens in that case?
there was no correction made and so the winner appeared as the loser
Does server accept client or client accept server?
with prediction you will NOT have everyone agree on the state of the game. That's a fundamental problem
Yep, checked it
You might have broken the correction system somewhere
idk
what does a 3rd observer see?
I suspect its due to some sudden speed change that CMC cheat detection doesn't like because it wasn't done through a RPC
Good idea, I only tested with 2 players so far
What different result are you talking about?
If you're talking about the finish line, that's normal. Assume you have a host and 2 clients and they all are moving exactly the same.
Each client would see themselves IN THE FUTURE and other characters IN THE PAST. Everyone thinks they're winning.
race position, when both players start at the same time, with the same speed, each local players is the winner
In server : server's player is in front of client's player
In client : client's player is in front server's player
That's normal. Every client is in the FUTURE on their own screen, and sees other ppl in the PAST
Core fundamental problem to racing games with prediction.
Surely the answer there is for the client to predict the other clients in the future too?
Snowboarding is smooth and slow enough that you could NOT use prediction or yes, use extrapolation.
You can't extrapolate parkour, but you can sorta extrapolate cars, and can very easily extrapolate airplanes.
Depends on your update frequency, really.
well that and ping
Yeah.
mispredict by 30ms on an airplane, it's not much different
mispredict someone jumping by 30ms, big deal
If I was making a snowboarding game I'd use physics and NOT predict but that's just me
Using server's authoritative should solve it I guess?
You'd still be predicting
And I'm here using extreme case of 300ms ping π
Yeah so everyone sees themselves winning by 300ms or so
That's the fundamental problem
you have 300ms error SOMEWHERE. Either it's lag between input and seeing something happen, or you're predicting
yep, but the prediction is only so the client "doesnt feel" like his/her input doesnt do anything for the next 600ms .
it'd be 300 but yeah
ping is round trip usually
those are your options. I'd choose non-predicted if it was VERY important that everyone aggree on everything. Especially if collisions are common
Ah right, I forgot
Say 2 clients predict and collide. There's 3 ways that collision played out. Which one should be the "truth"?
That's why collisions in PUBG vehicles are so ass
I was using pawn movement as 1st attempt, and ended up handling all the networking manually, although no prediction yet.
Then I switched to CMC so I can let it do all the networking, including the prediction
But then somehow, the prediction is not working and it switched back to client authoritative, which means back to square one π
Is there somewhere I should take a closer look to address this issue?
If I were you I'd make a backup copy of whatever changes were made to CMC then revert it back to default and try doing what Adriel said by changing default values for the same effect.
Acceleration, speed, sprint speed... etc that sort of thing but since you mentioned its a snowboarding game you may also want to try adjusting friction and braking too.
Thanks, I'll try that π π
Hey! guys back once again. I'm just wondering how I might save a variable to a player when transporting between two levels.
|
Lobby(Player selects character) --> Game Starts --> Each person in game has their Character is set to selected character
|
GameInstance of a Save game can do it
You can pass through information from the Player to the Server via the Options field when transitioning into a session via OpenLevel
AGameModeBase::Login gets passed this value in the Options param.
const FString PartyId = UGameplayStatics::ParseOption(Options, TEXT("PartyId"));
UGameplayStatics has some helper function for parse Options
That take the form ?Option1=Value1?Option2=Value2...
Silly Unreal. Didn't use proper URI format!
Oh it is. It was like that in udk lol
Yeah but im talking UE1
The worst part is that world and mesh axes are different. Even in UE5.
π€·
Like a mesh pointing in +y will point in +x in the world or something really stupid.
That's totally the wrong way to go about it.
World and mesh or world and FBX?
I'm not sure in the details. I don't do graphics!
The actual looting should happen on server only.
The thing that totally boggles my mind with FBX -> Unreal is that I have never once found any combination of export or import settings that ends up with a skelmesh facing the right way.
Like it'll face to the right, I'll change the export settings to rotate it 90 degrees, and it'll still face to the right
WTF
What's the best way to network on object that doesn't belong to an actor?
Attach it to an actor anyway?
In my case, I'd like to have a networked UUserEventLog.
Right now the UGameInstance has a copy of the log and it is updated over RPCs by the PlayerControllers, but it would be nice if the UUserEventLog itself was replicated so that all the clients could be more easily in sync with the server.
ALthough, why is it a UObject?
Can't it just be a struct?
Ha just read that article, thought about tagging Jambax π
I could make it a struct. The question of what do I attach it to remains, though.
In that case I'd have it live on GameState probably
Hadn't thought of doing it on the GameState, but it makes sense to me!
How could I do this with multiple players that have multiple different characters selected?
Couldn't you save that data serverside in GameInstance?
Hello ,how to I get motion warping replicated? I used the "run on server to multicast" way. But client keeps jitters back and forth
That's the CMC correcting you, it's probably far more complicated than just multicasting an animation to play
You don't run on server to multicast jumping or walking
Each player sends their own Options, they are all separate.
Hi, I was wondering what is the best way to detect if a player has used their double jump in a networked environment. The ideal behavior would be having players ragdoll with a different jumping force when they use their double jump. My current implementation overrides DoJump from UCharacterMovementComponent. The issue seems to be that my check for double jumping "(CharacterOwner->JumpCurrentCount == CharacterOwner->JumpMaxCount - 1)" returns true for the client but false when the server simulates that client move.
bool URiderMovementComponent::DoJump(bool bReplayingMoves)
{
if (CharacterOwner && CharacterOwner->CanJump())
{
// Check to see if this is a double jump (or last jump or whatever)
// WHEN CLIENT IS DOUBLE JUMPING THIS EVALUATES TO TRUE FOR THE CLIENT
// WHEN CLIENT IS DOUBLE JUMPING THIS EVALUATES TO FALSE FOR THE SERVER
if (CharacterOwner->JumpCurrentCount == CharacterOwner->JumpMaxCount - 1)
{
// Have to ragdoll the character
if(CharacterOwner->IsLocallyControlled())
{
WantsToRagdoll = true;
}
Velocity += CharacterOwner->GetActorUpVector() * DoubleJumpForce;
SetMovementMode(MOVE_Custom, ECustomMovementModes::CMOVE_Ragdoll);
return true;
}
// other basic single jumping implementation here
return true;
}
return false;
}
is this just not the proper way to do something like this?
What is the first function that gets called on a controller after we end travel to dedicated server? Sth like postClientTravel
Hi everyone - I'm trying to connect to a PlayFab (dedicated) server while also using Steam. It does find a match through the matchmaking when 2 players queue, but the players will be thrown back to Main Menu instead of connecting to the server. I think it's working 100% without Steam but for some reason, it will not connect when Steam is enabled. Anyone who can help? Thank you so much. 
https://youtu.be/pRL2NhnJA3E?t=106
I have this issue where I'm using virtual machine and second steam account to test SteamOnlineSubsystem, but only the instance of the game that is run first, shows that the SteamSubssytem is actually being used (other always shows NULL). So e.g. if I run an instance from my virtual machine first, it will have steam, and instance on my actual machine will show null.
It is worth mentioning that both instances of the game show Steam UI properly (after shift-tab I can see friends list and all that jazz). Is this because in the end I'm in the same network in a sense that I'm using a single router?
If that would be the case, then you could never play with more than one person on steam in one house :P
(And that definitely does work)
Right, makes sense now that you put it that way.
That doesn't mean that it will work fine on the same pc inside a virtual machine, though.
Guys I have a problem. I'm playing on a dedicated server that I've created in aws. But at the time of the replications when I generate an object in run on server it does not work and if in multicast I must remove the replications of the objects so that it does not find duplicates?
How many dedicated can handle one vps or vds?
well i just wanna understand order of number, like 5-10-20-50-100. Game mmorpg, not fps shooter. If middle count of players 20 in one server. Vps 8 core 16 Gb ram
It is completely, absolutely impossible to say
Depends entirely on your code, level, assets, desired tick rate, etc
Try 5 different instance types, profile your server
APlayerController::PostSeamlessTravel in case of seamless travel, AGameModeBase::PostLogin in case of hard travel
Check latest message in pins, and you're welcome.
close π
i get a feeling this was client side question
in which case, PostNetInit is first good place to start putting custom client code in after hard travel to server
in case of seamless travel its more complicated, as it will call NotifyWorldLoaded and ServerNotiflyWorldLoaded on departing PC instance, after which its AGameMode::HandleSeamlessTravelPlayer on server, after which new PC replicates which brings us back to PostNetInit
Was going to mention ServerNotifyLoadedWorld but it can't be overridden π
Pretty much why we couldn't fix the seamless travel bug like normal human beings, but they fixed it in 5.1 π
While you mentioned it, me and Authaer had a discussion lately on when it's the safe point to start firing server RPCs on arbitrary actors and he found that it's when OnRep_Owner is called. IIRC you said for PlayerState it's PostNetInit, but I think that could be it because PlayerState's UpdateFrequency is lower than its owner, so by the time PostNetInit is called Owner has already replicated. Might that be it?
I see, but for PlayerController it is higher, no?
PC and Pawns are on default 3 iirc
so PS comes last in initial replication
unless you change priorities
So that would prolly make Owner of PS replicate before PostNetInit gets called for PS
And that would explain why it is safe to start firing server RPCs on PostNetInit in PS
If I set an actor to replicating and disable NetLoadOnClient, but spawn an actor with the same name on server/client, do they link up?
Just curious π
@fathom aspen @chrome bay 5.1 release notes
That's insane. James might want to consider a follow-up writing to his article now π
There are a lot of very nice changes in this release. Touch various parts of the engine.
We 5.1 now?
Yes
I can die waiting for 5.1 to install now while guessing what Iris provides
Still too young for me to mess with Iris, lol
I like how they say these are opt-in features, and that the old systems will continue to work along them for the foreseeable future
Already have projects moved over to 5.1 π
Nasa internet speed detected
Faster. Finnish internet speeds. π
I was going to download the preview yesterday, but I forgot to do it, and I'm still on hotspot π
Fiber internet in 2 weeks ππ»
Brb - immigrating
Does the iris thing explain how to actually use FCharacterNetworkMoveData to extend Saved Move Data?
Because that little footnote in the docs isn't helping.
Been there, done that. Do recommend.
Oh here we go, we are already getting Iris questions. The bar has been raised way too high now
π
I will make sure to answer you when I get enough info about Iris
Well more like if someone skimmed through it, because I'm at the moment not able to.
Thanks. Because I still struggle with getting more than 5 custom movement flags replicated. It's now the 6th month where I'm stuck at.
You technically turn on bUseIris in ProjectSettings. You're welcome, glad I could help
Where's my Iris blog post? @fathom aspen
This is the point where I hide
Unless vori makes it before me, I will be happy to make the comparisons and explanations in one lenghty af compendium blog post
no
He made it before me 
Can we collab?
I am running a RPC (run server) that changes a replicated variable of my character, but that variable does not change in the rest of the clients, why?
Because of few different things
RPC being dropped?
Actor not properly replicated?
I will keep guessing until you post code
oh sorry
Too easy, you don't have any 
You're in #multiplayer land. Found the issue
Have you tried hot reloading?
Maybe you should make sure to live code too. worth to try
My problem is that the other players can see the change, but I can't see the change.
I read that this can be solved with another multicast rpc, but having 2 rpc doesn't seem like the best idea.
OnRep won't be called for the listen server host because nothing is getting replicated since you already have full authority. You need to call the onrep functionality manually in this case.
It does in BP
Onrep always gets called when the variable changes in BP land
Oh really? I just need to stop trying to help people with bp code
You only have to manually call it in C++
You do, I will make sure to upvote proofread
I doubt it's the flip-flop node, but have you considered to debug?
Seems like you didn't, so here's your debugging pack: #multiplayer message
Hi, apart from encryption for requests and sanitizing them what other security related task should be implemented for Multiplayer games on a client server model?
I try debugging by printing the variable on the screen, isn't it the same?
It is absolutely not. That guy I proposed the debugging pack to had a farewell to the print screen function
Hi
I have a "simple" question. Does a dedicated server require an online session? If so how do I implement one?
Thanks
Yeah that seems nice, they just built a list into the base actor class rather than having to make a bespoke actor
Follow-up write to your article when?
fkn Epic making things easier for us
How dare they
Most security things are handled by Unreal it self already to my knowledge, for very good reasons. So just don't do any dumb things honestly and you should be fine, Unreal doesn't seem to give too much opportunity to mess up things in a truly fundamental way. Unless we are talking general cheating, but that's a different story π
Just be sure to like you said your self 'sanitize' / check whatever is needed from RPCs. Having seen stories from Rocket League as an example seemed like most of their security issues came from gameplay logic being exploitable π
Never trust anything you get from a client. Encryption does very little to defeat cheats in practice
@chrome bay your replicated instanced struct pr didnt make it into 5.1 did it?
βΉοΈ
You can still move the plugin into the project and integrate it though if you aren't using source
lol guess I'll delete my website now:
https://docs.unrealengine.com/5.1/en-US/replicated-subobjects-in-unreal-engine/
Didn't want to tell you about it, so you don't lose hope
does this mean we finally can more easily choose what to replicate to specific clients?
ooooh
is Material CHange set up right?
yes
First time Epic makes such a good lengthy net-related doc
They do it on purpose to spite me I'm certain of it
As I said before, other customers can see the change, but I cannot.
does your bool print correctly?
either the bool isn't getting replicated right, or the material isn't set up right
figure out which one
This also explains why they didn't integrate net FInstanedStructs π
Ah if they think this BS is going to replace net instanced struct, no chance
What do Instanced Structs do again?