#multiplayer
1 messages Β· Page 69 of 1
- attack is performed on client, target was at life 100 and is now at 90.
- attack is performed on server, target was at life 100 and is now at 90.
- server sends the updated 90 value to the client. The client already had 90 so apparently nothing extra happens. The client prediction was succesful.
But also can happen:
- attack is performed on client, target was at life 100 and is now at 90.
- attack is performed on server, but target was out of range so health is never subtracted (remains at 100).
- server sends the updated 100 value to the client. The client had 90 so health spikes back to 100. Client prediction was not successful.
Take note that this is a very simple example, and I wouldn't actually implement damage/health prediction in most cases
Usually modern FPS games implement more complex systems that reduce prediction errors
Does somebody know why the actor is visible on server side but invisible on client ? The actor has child actors which are set to replicate and always relevant
Each component also has replication value so check the mesh: Component replicates
for seamless travel, will the begin play be called for player controllers when they enter the final destination map? ie, since the controllers persist, will they call begin play again?
Alright I will keep this in mind thanks
unfortunately this did not work. But when i removed the replicate setting on the child Actor everything is visible :D
Hey again, simple question, is it possible to set the name of a server? For example if a player hosts a room as the server and client, how can they set the name or key of the server that anyone wanting to join has to type out
If you extend ganemodebase, yes.
If you extend gamemode not sure π€
Ganemodebase migrates data from the controllers creating new ones, gamemode (assuming you have the same player controller class) somehow keeps the exact same object alive
Hi Do you have experience with unreal engine Steamcore multiplayer setup which is non region locked?
Can I se who will do this please
what this mean?
its an HP Variable, and it is Replicated
What is the correct approach for syncing character capsule to (approximately) match mesh (e.g. during jump) that has the capsule synced in multiplayer?
This is what I've tried so far (and where I hit a wall)
If you are doing online multiplayer, a replicated variable is a variable that when modified from the server, the change will replicate to all clients.
Consider reading the network bible if you need more info https://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf
at which page i can find an answer?
Check the index for "replicated properties"?
not now, not before, as i read it, i dont find anything about how a Character variable can be same time a Map, and how this variable can be Replicated and not-replicated at the same time
Health points in your example there is a float... Not a map nor an set
obviously!
Single green pin is float
You can't replicate map nor sets because they don't have a serializer, most likely
And it might only be a limitation for bp
but Health points in my example there is a float... Not a map nor an set
and same time its not
I am not sure you have the panel on the right variable or If your BP was compilled
π
u can trust me
i try to fix this bug about 3 days, i try dozens of methods and compile it hundred of times
Delete the variable and make it again? π€·ββοΈπ€
no, also C++. Replicating a map doesn't make a lot of sense due to their internal implementation
Is there a way I can ensure that the order of replicated array stays the same across the server and all connected clients without sending the array through RPC?
Hey can someone explain to me like Iβm 5, how I would get the packaged UE5 server onto, say, digital ocean and figure out the IP so I can tilda/connect IP address for playing around?
Because the clienside overlap triggers the run on server event which presumably increments Coins, and also the serverside overlap triggers the run on server event which presumably increments Coins
Just do it serverside only
no run on server event
just
Overlap -> Has Authority? -> Yes -> do the coin thing
You don't know your digitalocean server's IP?
You'll need to cross compile for Linux if you haven't already
A headless deployment on a cloud server isn't really ELI5 territory
The order of an array should be the same on both ends. Is it not?
As far as I'm told, it's never guaranteed
Order of the array should stay the same
Thanks for the helpful tips. Can you explain a bit more simply even lol. I've never gotten further than running gameserver.exe -log on my own box and connecting with clients ~open local etc. I see I need to add linux support to source.. That will be more homework / figuring out over the coming days, but in the meantime. I get it's not ELI5 territory.. Would love any solutions you can offer though - the simplest and I'll go research based on your words. Any windows cloud solution? I also see EOS and all these plugins for Amazon and everything.. so confusing. I'm just looking for the simplest solution to get playing around - not having a serious game deployment.
Simplest solution to get playing around would be to just slap Ubunto on an old janky laptop and use that for a bit
But the general case is to cross-compile to build the linux dedicated server then just run it on your remote box
You're mentioning Ubuntu.. Can you elaborate on the Linux / Windows thing? I'm assuming that's just for performance?
most game servers are linux
You can just test on Windows if you want
Laptop + engine + a launch script and you're good to go, no need to build from source or anything
Yeah my challenge is I'm guess cross compiling for linux (downloading / attaching to engine etc) is going to take a while
Just stick to Windows for now. here's what a simple launch script can look like
tada, windows headless game server
no need to build or anything
just put that on another machine and fire it up whenever you want to test outside of PIE
I have 3 files like that
for fast testing without cooking/building
Wow. thank you for that advice. And that would be on my own laptop? I'm confused though.. I'm looking to test just the exported (build game server). Do I need the engine for that? Each time I was planning on copying over the build
With this you can close, pull latest from source control (you're using source control, right?), restart in like 30 seconds
No worries about long cook/build process! I don't mind that. I'm simply looking for how to get the build server running remotely. (ideally on a paid server)
I get the sense your experience allows you to do things the 'right way' ie. flexible etc. For me now as I learn, I'm looking to just do things the simple way π
So grateful for your tips. Lots for me to research now
so I can jump inside and still get moved like if I never left the floor
Would you happen to mind sharing your solution to this? I've been having exactly the same issue for months regarding my physics based "air ships", when players jump and/or fall within their ships, their movement is corrected when they land.
I also ran into your other issue where players can "push" their ships around when making contact with walls, etc, I have been using the same solution @dark edge suggested and just have a secondary mesh that's hidden for player to ship collisions, the main mesh/collision is used for accurate ship to world collisions π
when i seek a nearest enemy unit, i get closest to position of the 1st client for every clients
how to set, which client is seeking?
mixing physics and character movement component is a recipe for disaster
GetPlayerPawn with a 0 index always refers to the first player pawn, you need to find a way to get the pawn local to where the code is executing.
I'm well aware of that, I've been messing with this game for 4 years now π sadly I was not able to get a realistic looking simulated (fake) physics result where collisions were concerned so switched to real physics, but I had the same "movement corrections" issue with my simulated (fake) physics
if i find closest target before, and then calls an RPC to do damage, Replication is not working
only if i do this at same RPC
so i cant do it locally
Where is the RPC executing? On the server?
I assume so, since GetPlayerPawn 0 on client I believe returns local pawn, whereas on server, it returns the pawn for the first connected player (so it'd always be that same player on the server)
player controller to server
Okay, is that being ran from the controller for the player who needs to find the target? If SeekNearestFoe is within that same controller, just use GetPawn/GetControlledPawn (that doesn't have an index parameter)
This node refers to the pawn which is currently being controlled by the controller you are executing it within
@frail barn
thank you, i'll try this now
thank you again
i relocate function from the function library to controller, to get correct "self" and replace "get player pawn" with "get controlled pawn" and all is working correctly
i think i can use same logic in a new function for an AI-controlled units, after placing it to AI-Controller, am i right?
Glad that fixed it and that should work too π
Hi, sorry if this is a really beginner question, but I'm kinda new in networking.
So I have actors that can have large amount of data (max 5000 bytes). And the more the player plays the game the more of this actor will exist.
I'm testing with an upper limit I want to achieve, which is 20000*5000 bytes. So I have 20k actor with around 5000 bytes of data(200 vector, 200 rotator and 200 uint8).
So I want to send all this to the client on loading screen. I only have to send this data once. So the client can work with it.
I was trying to use RPCs first like sending 5000 bytes per frame, but it took a lot of time and it also made the client lose connection with the server.
This will happen on a listen server.
So does anyone have any idea what would be a good way sending this data to the joining client?
What are you trying to achieve?
Well, I have actors that uses procedural meshes. So I store the data(hit loc, rot, etc.) to recreate the procedural mesh. And I want to send this "ChangeHistory" to the joining client, so he can rebuild the proc mesh locally with this data.
And one actor will have 200 vector, 200 rot and 200 uint8 at max as "ChangeHistory".
Have you checked that it isnt cheaper to just compress and send the "as-is" procmesh data itself?
I tried working with compression, but I couldn't really make it work or figure it out.
Could you recommend me some compression method for this?
by procmesh data, do you mean the ChangeHistory I'm talking about or the procmesh's verts, tris, normals, etc.
If the mesh is simple enough, your change history may be larger than it, if you arent taking into account overlapping changes for example.
What you may want to look into is sending this data over a http stream or something instead.
The Host can start a HTTP Server and the Client can connect to it when they join their session.
Then you are basically free to send whatever you like.
Having large amounts of replicated data on actors is not ideal.
I haven't thought about that, alright I will look into that.
Running into some replication problems,
I have a Game mode that creates team_manager actor components, and adds them to the game_mode as child actor.
It also saves an array of these actors in the game_state, which is set to replicated, the team_managers on my clients are not seeing the same data as the server.
Should I add the team_manager as a child to the game_state instead?
actor components, and adds them to the game_mode as child actor
This doesnt make sense
ActorComponents are not Actors, so therefore cannot be added as Child Actors.
sorry my terminology is probably off here, the Team_Manager inherits from the 'Actor Component' class, and is added as a component to the game_mode
Just create the Teams as regular Actors.
Dont add them as Children.
Ensure they are set to Replicate.
as in regular objects in the game?
Appreciate it, trying that approach now
Make sure they are set to Replicate
If they arent, they wont exist anywhere else but the Server.
I basically modified the movement base code in the charmovecomp to always have a movement base set (dont clear it when jumping, falling, etc) but instead set it from game code when you "enter the ship" and use that for all calculations. Still have some problems though
@willow cargo When the Team Actor calls BeginPlay you can have it register itself with the GameState.
So that Clients can find them.
Ye that somewhat makes sense Spawning actual objects feels a tad wrong, but if it works it works π
Stop calling them Objects, they are Actors, its important to be specific.
Why is it wrong?
PlayerStates are Actors.
PlayerControllers are Actors
The GameState is an Actor
They are all spawned and replicated.
Actor has an physical object 'ring' to it, ( again this is rather new to me )
But I understand what you're saying
Fair enough
If you are using C++ there is a class called AInfo which is generally meant for Actors that dont have a physical representation.
Like PlayerState and GameState.
Though at this point its basically legacy as its not really doing much at all on its own.
And just like in player controllers etc I can force certain functions like 'add yourself to the game_state' to run on the server only correct?
There are mechanisms for you to control which code is executed in what network context, yes.
HasAuthority
Is one.
Checking GetLocalRole is another
Thank you for clarifying
Its worth it to go and read through the pinned comments in this Channel.
will do!
Hey guys, is there a particular stage at which RPCs get executed or do they just get fired off as soon as they get to the target machine?
An RPC will only be received by an Actor if it exists.
So if the Actor that is having an RPC called on it is not available on the other end, it wont receive the RPC (obviously, how could it if it doesnt exist?)
Oh, that's clear to me
I was more asking at which stage in the tick they get called
Something I have yet to investigate is if the Actor needs to be replicating for the RPC to execute or it can be simply referenced over the network
They are async calls, so obviously they won't get executed right away
Also some of them might get queued
It must be set to replicate yes.
Yeah I guess for an ActorChannel that handles the RPCs to get created
Well yeah, but is there a set point at which the function referenced in the call gets executed? I assumed that the call would be received by the machine, and then wait for a specific stage to execute everything.
Thats what I'm asking about, like what the choreography behind it is once the call is received
What "Stage" are you expecting it to be called?
As soon as it exists, it can have RPCs called on it.
Is that not a decent enough explanation?
Well there are tick groups, and everything in Unreal from what I see gets synced to the specific group, in "stages" - pre-physics-, post-physics, etc etc.
Clearly there's a point at which they get executed so that they don't break game logic. My question was what that point is
Replication data is handled immediately. RPCs are "do this thing now" not tied to tick.
When it comes in, it fires.
Sweet, thats good to know. Explains what I'm dealing with right now. I appreciate the help
Also if you're interested in understanding the flow an RPC takes to execute, then here's a fun read: https://forums.unrealengine.com/docs?topic=264973
I had assumed that RPCs get queued up and then executed at a particular point in the tick. Knowing that they fire off as soon as they get to the machine explains things
That's awesome, thank you for the link!
Still you can't really decide which is going to be faster: a replicated property vs an unreliable RPC... (from that article)
And you shouldn't count on which to use based on this factor
The use cases are really far from being who's faster, or which is more performant
Are you confusing me with someone?
I think he is just explaining something in relation to the article he posted
Am I?
Makes sense. I was just a little confused
Ok here's something I'm trying to understand. If I have a Character moving really fast (linear velocity, no damping, etc, just constant velocity), and I use VisualizeMovement cvar, I can see the AutonomousProxy to match the visual mesh rendered on screen, that is, the transform of the actor is always in the center of my character.
This is running as a client from the editor, with a server spawned in the background. No simulated lag.
Now I created a custom pawn, just empty for now, but I implemented a similar VisualizeMovement cvar, draws some text at the actor's location. In the case of the custom Pawn, the AutonomousProxy location always lags behind the actual mesh I'm seeing rendered.
Both methods use GetActorLocation() as the position where to drag the debug text/lines/etc. So I'm not sure what makes the difference in apparent location between the Character and the custom Pawn.
(Note im not talking about the Authority's position, just the AutonomousProxy on the client's machine)
The character moves via the CMC, and the custom Pawn moves via?
the custom pawn just has a linear velocity applied to it, constant value
the bigger the velocity, the bigger the difference between the position used to render the mesh vs the position reported by GetActorLocation
Well yeah then there are no forms of prediction whatsoever
Hence why you are getting corrections
I understand that part, but why isn't the mesh rendered behind as well?
So you are basically asking: Why do my custom MC has corrections but the CMC doesn't
the AutonomousProxy is the actor on the client's machine, and the client's machine is the one rendering the mesh, so how is the position of the mesh correct
if it thinks the actor is behind?
I understand there would be a difference between the server's location and the client's location
(lack of prediction, lag, whatever)
but the mesh is rendered ahead of the client's location ?! how?
So you mean visually you don't notice any corrections?
nope
let me see if I can screenshot what I mean
that's the position of both the ship's location and the player's location, just for reference
this is the player moving with a big velocity, but as you can see I added the "autonomousproxy" text in there for the gizmo, and the mesh matches with the GetActorLocation()
now that's what happens when controlling the "ship". the GetActorLocation() for the AutonomousProxy is down in the bottom, almost cut out of the screenshot, sorry, but it clearly is not where the center of the ship (the mesh) is.
I would have expected that if the client has a different position (either because of replication or whatever) the mesh would still match the client's "view" of where the actor is
afaik it is reasonable to assume that a non-reliable RPC is faster on average, since replication happens "eventually" depending on other factors, right? I know that CMC uses RPCs to send the time-critical updates for example
The reason the CMC uses RPCs is for a few reasons, 1 of those being the immediateness of RPCs, another being that they can optimize the heck out of it.
RPCs can go both ways, Replicated Variables cant.
yeah makes sense, it is basically the same reason I use RPCs for my unit's RTS movement updates
actually I just tested as standalone/listen server, where i don't even have an AutonomousProxy, just the Authority object, and the GetActorLocation() lags behind the mesh the faster I go
no speed / some speed
@mortal mica Are you talking about the Text being lagged?
well the text is drawn at the actors location (reported by GetACtorLocation()) so not so much the text being lagged, but the position being lagged
How are you determining the position is lagging?
Because from what I remember, all the draw debug stuff is a frame late.
is it?
I vaguely remember something saying that was the case.
well, that's very unconvienient XD
well actually it still wouldn't explain why it works fine for the Character (CMC)
character must have an extra trick under it's sleeve that im not seeing
Verify they are ticking at the same rate/time/group?
Hey folks, Iβm about to lose it over a simple variable assignment. I have 3 machines on LAN. I have a 3 item Boolean array in the game state. Each player has an ID.
I need a ready button widget to set the game state array equal to true for the index of the player ID. I need each player to know when this array is updated because when all players say ready, it should start the game.
However, I have tried seemingly everything and canβt get the all the computers to know when they others are ready. How would you address this?
Move the Ready variable for each Player onto their PlayerState instead of the GameState, this state is specific to each Player and not the Game so shouldnt be managed by the GameState.
oh I think I get why, im doing my debug drawing in my Tick function, so it will only display the updated values if I run that tick on Post Physics I guess
Get each Player to send an RPC to the Server saying they are ready, this would then let the Server set the Ready variable to true for that Player, which would replicate down to Clients.
You can set it to be a RepNotify, that way your Clients can know when it was changed for each Player.
Awesome, Iβll try this out. Thanks!
I partly figured it out, but I need some help.
So I try to start an http server like this:
FHttpServerModule& httpServerModule = FHttpServerModule::Get(); TSharedPtr<IHttpRouter> httpRouter = httpServerModule.GetHttpRouter(ServerPort); httpServerModule.StartAllListeners();
But then if I get the content I get this: {"errorCode": "errors.com.epicgames.httpserver.route_handler_not_found", "errorMessage": ""}
Is this normal or am I missing something? As ServerPort I use 8080.
Is this the correct way of starting a http server?
What do you think about using TCP for this purpose? I'm gonna probably test both, but I'd like to hear your opinion. For this I kinda need a reliable data transfer, so everything arrives as it should so the client can rebuild the proc meshes correctly. I'm just not sure how reliable these in actual practice.
I believe you need to bind a handler to the router first before starting any listeners.
I havent played with the HTTP module in a while so I cant remember exactly.
Best thing to do is look at the existing source code where they use the HTTP Module.
Yeah I agree to an extent, I still refer to them for the "faster execution" sometimes XD
@crude marlin You will want TCP.
oh really? Is it because of the reliability or something else?
Well yeah, you dont want a packet to be dropped and then your data be unusable.
oh I see, alright awesome. I feel like that'll be easier to figure out. hopefully.. π
ok so following with my physics investigation, I am now facing some other odd behaviour. My fast moving actor has a box collision in it. My character is on top of the fast moving object, and I managed to get both moving in sync. But the bounds of the box collision seem to not be in sync. Basically It's offset by whatever the velocity is (maybe a frame off?) and the end overlap triggers way before reaching the actual outside of it
(im now testing as standalone, so I just have the authority actor to worry about)
does each component has it's own location? or if a simulate physics component updates the position of the actor, then all components will use that updated transform ?
ok got a new working theory of what's the problem here, and it seems to be all over the place. The CharMoveComp divides movement in two parts, the "Based Movement" (ie if you are standing on something that is a moving platform) happens on a separate tick, After Physics. The rest of the movement happens in Pre Physics with the rest. The CharMoveComp tests overlaps in it's regular Tick, which in the case of a moving platform, it would be the position of the collision in the previous frame, not the current one, since Physics haven't been updated yet, and the actual position of the character hasn't been computed, since the position of the base is, as I said, updated in the Post Physics tick.
I guess the current state of the implementation of the based movement is "Good enough" that it worked for a simple elevator in an fps game, but it's not really properly implemented
(although as I said, it's just a working theory, I could be totally wrong π )
How can I call a FAutoConsoleCommand directly?
Is that a thing?
Found it! Nevermind.
Hello! Very quick question, when using the open <up address> command to connect to a host, is there any simple way to pass in information from your client to the server? Like a name, or little customisation options, for example. Thank you!
yeah just pass it in as options
open someAddress?myCustomName=hey?anotherOption=hello
Always use ? as the separator. & will be parsed as part of the key or value.
?key1=value1?key2=value2?key3=value3β¦ etc etc
Oh thank you! Is there anywhere I can find documentation on those options I can pass in and how to receive them properly on the other end? I'm not sure what keywords I'm looking for here so google failed me 
@hushed heart These βoptionsβ get passed into the Login function on the GameMode for that connecting Player
Aha! Great that helps a lot, thanks!
Hey lads, since I can't find where to set net.AllowPIESeamlessTravel=1 i'm testing in standalone game. But the session creation does not even work. I'm using the advanced session plugin, it works fine in PIE but not in standalone, is there anything you have to do in standalone for multiplayer? (using NULL subsystem, ue 5.1)
Check the Log. It might help explain why your sessions arent being made.
Yes all instances log except shipping builds
Standalone logs appear in the Saved/Logs folder as they are just an editor instance
Ah yeah, not in the editor, makes sense, can you still reach breakpoints in standalone games?
You can attach a VS debugger and breakpoint that way. But blueprints wont AFAIK.
Not sure how they could to be honest
I was talking about C++ breakpoint, so you need to attach manually, makes sense
Yep
well it was unrelated, for some reason, it still used some old code I had unplugged, just removing the cpp file solved it, not sure how that happened but
It seems like the PlayerState isn't directly available when a client joined the server, at least if i'm not wrong.
If i'm not, at which point would it be available ?
I believe the game state is responsible for creating player states. I'm not sure if this is best practise, but dependent on project I would have a set of "player state ready"/"game state ready"/"pawn ready" delegates I could subscribe to, so I knew for sure when I was initialising everything at the right time
I wouldn't have a problem with using delagates for this, but is there already one for the PlayerState ?
I don't really know how to set something like this up for myself
to solve that I send a RPC from the player state of the client when he's ready, then you can retrieve the infos from that RPC
but there's probably a built way to do it
Actually, there's AController::OnRep_PlayerState, maybe that works ?
Would try it
This should help a bit: https://wizardcell.com/unreal/persistent-data/#7-game-options-string
That's super useful, exactly the sort of thing I was looking for, much appreciated!
what the hell is happening here? I am converting the default UE5 FPS template into a multiplayer template and when I tried changing the projectile spawn to work as an RPC :
when I pick up the weapon from the ground and shoot, the game restarts without the client??
urgh
Logs will tell you
i think they changed the fps template for ue 5 and its so frustrating
every tutorial looks different than my template
you were right
but i have no idea what these mean
Hey guys! I wanted to ask about the dangers of using reliable RPC and specifically how I can tell whether or not I can get away with its usage.
I have a fairly vital chunk of data that I need to get to the clients regularly, at around 48 times per second. Seeing how its a frequent update, I was going to go with a unreliable call, but the framerate of the received data drops to maybe 24 frames, which becomes very noticeable. I do interpolate, but my data changes fairly unpredictably at times.
I don't really use regular Reliable calls anywhere else, so I was wondering if I could get away with the sin of making this one single update RPC reliable after all
What are the rules of thumb on that?
anyone know what these errors mean?
im having a hard time finding info online
If you scroll up a bit, it says something about being unsupported. It looks like the client is trying to create a replicated component and failing
If you're already dropping unreliables, there's a good chance you'll just overflow the reliable buffer
If you overflow, you get insta-kicked
Thank you, that's good to know!
The likelihood of that data stream remaining that consistent in the real world however is miniscule, it just won't happen - so probably best to work around that somehow
Hard to know without context but the solution would probably be to try and make them more deterministic
If you can drive randomness from a seed, that makes it easier
Super tough to do, seems impossible to avoid. They're just incredibly context-dependent with their behavior
So I'm gonna end up replicating an insane amount of environmental context
I was hoping to avoid all that specifically to keep bandwidth low
the best you can do is to buffer updates and interpolate
sending such a big amount of data 48 times per second seems a stretch
Just don't replicate redundant info. If a client can already figure something out for themselves, that's the best way to save cost
Anything that is reliant on a steady data stream will break, ultimately
reliables won't fix that, they'll just make the breakage more obvious
their system is hugely random at all times, we already advised to make it more deterministic but it seems not possible for them
why could that be
Weapon Component is the problem
i just added a custom event in the BP there
this ss right here
Yeah, its rough. I'm exploring ways to fix that but ig we'll see. I have an idea of maybe clustering projectiles before sending them out. Someone suggested trying this - grabbing one reference projectile and using it as an anchor to get away with 8bit precision on locations of the projectiles immediately around it.
The issue is the Blueprint is trying to add a "Weapon Component" to the character
And I can't really tell anymore than that. Perhaps both Server + Client are creating the component? IDK
But if they are, and it's replicated, that's at least one problem
Adding replicated components at runtime should only be done by the Server for instance.
it could be
the weapon is in the air and needs to be picked up
it then somehow adds the component to the player
and deletes itself
weird that i only get the error once i try to shoot, the weapon gets equipped just fine
yeah, or just update less per second too. I bet nobody can see the difference between 24 and 48 if interpolated correctly
ideally some of your projectiles can be aesthetic only and don't need such frequent updates
or some that are slower
Whatever this is, I already hate it
Presumably said tutorial is not multiplayer ready?
Yeah. Maaan networking is hell and I hate physics π
Ah right, yeah so that's at least part of the issue.
Both will be adding that component independently. The FPS template was never meant for Multiplayer
ah yea i see
So assume nothing will work in MP
do i need to just set it as server only somehow?
Would it make sense to store things like player names within the GameInstance ?
I know it should be rather stored in the PlayerState, but so far it seems like i can't really store it only there as i'm not able to use seamless travel 24/7.
With that i mean i'm taking the user name before joining the server, but when i join the server for the first time the prev PlayerState will be gone as it wasn't a seamless travel
next time design your system around multiplayer friendliness
so ideally you can achieve similar effects without so much trouble
I am my own worst enemy because I get cool game ideas and then decide that coolness is worth the future suffering
The game's entire concept on its own spells hell for multiplayer

@chrome bay i managed to make it so it doesnt crash and the component only gets added on the server; problem is, it only gets added on the server, it doesnt replicate
i just added an RPC in between the callback and the cast
Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_Rifle_C_1. Function RPC Add Component will not be processed.
now i think i need to set the owner, but idk how
how do reliable RPC's work internally? I thought reliable RPC used the TCP protocol but I'm now noticing when I start the server it only opens the UDP port
I think it is UDP with a custom aknowledgment protocol (more efficient for games than TCP)
ohhh I guess that explains why I dont see any TCP ports being opened then
everywhere I read online it says:
Reliable RPC = TCP
Unreliable RPC = UDP
maybe it used to work like that in previous UE versions, because I see this repeated alot
I see
Adding a component VIA RPC is quite strange anyway
Classically In MP, a weapon would usually be implemented as it's own actor
oo
i see
urgh i thought the transition from unity to unreal would be smoother
ill probably ditch the template then and make it from scratch
Yeah - the template does it as a component and if I recall, so does Lyra.
how annoying
Hey, by default Online Subsystem is not exposed in Blueprint, right?
do you guys have any good multiplayer tutorials ?
There are no good tutorials, just figure it out.
yea diving in randomly into a huge program sounds efficient
Then don't dive in randomly. Figure out what you want to try to do, then try to do it. If you get stuck, look up the specifics. Also read the compendium
oo thank you!
noice
if my function is in a function library, how i can get Controller here?
Get WHICH controller?
controller, which controls a pawn, obviously
A few I like are from Kekdot and Betide Studios. Might depend on which Online Subsystem you're aiming for. Druid Mechanics has a helpful one for incorporating EOS but ends up telling you almost everything. The code is virtually the same no matter which Subsystem you're using. Mainly brush up on replication, I guess. Lot's of folks handle the lobby functions inside widgets, so UI and widgets is handy. Buy a Patreon and work from project files? That's fairly efficient.
You need to either pass the controller or pawn in as a function parameter
whats an online subsystem?
im really new to unreal, ive only been using unity for years
Steam, EOS, stuff like that
the thing that handles sessions and connections and stuff like that
The subsystem is that back-end for common multiplayer functions. This way the code doesn't need to change wether you're using EOS or Steam. You will see references to the "built in" online subsystem.... but you need to remember that it only works on a local LAN. For anything the really talks over the internet you need a more robust subsystem like EOS, Steam, Xbox, PSN .. ect. Good luck!
ohhhhhh
like literally steam and epic
i see
damn yea thanks guys
i really like unreal so far cause the game framework is eons ahead of unity
there s so much stuff out of the box
stuff i didnt even know i wanted lolol
It's pretty sweet. The only change I would want is that it had a little bit less opinion on the actual structure of your game. Unity is a little bit more of a blank slate in that regard. But it's still perfectly serviceable for pretty much anything you would want to do.
yea i was actually worried about that
like its so much stuff that i was worrying it might actually be restrictive
but i think id still prefer havin it the unreal way
ig its different needs
Hello! I'm using Game Features in my project, some of which are activated when the game room starts. A problem is that when the game is played online the feature fails to load.
I'm trying to reproduce the issue, but when I play with myself locally it does not reproduce (maybe this is because of some race condition that happens due to ping and load delay online).
Since I found it during testing with friends, it doesn't make sense to try to fix it in real-time and send a build each time for testing, I'm looking for a better way to reproduce it locally.
How would you advise testing and fixing it without involving more people? This is quite an important thing in general, isn't it? π¦
(Also important note that I don't have easy access to additional laptop to test from 2 machines myself)
are you at least simulating network conditions?
Hey guys! Any clue how I can increase my network bandwidth limit?
I've tried adding the following lines to my Config, but it doesn't seem to have an effect. My RPC and replication are still being throttled, hard.
DefaultEngine.ini
[/Script/Engine.Player]
ConfiguredInternetSpeed=4194304
ConfiguredLanSpeed=4194304
[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=524288
MaxInternetClientRate=524288
DefaultGame.ini
[/Script/Engine.GameNetworkManager]
TotalNetBandwidth = 4194304
MaxDynamicBandwidth = 1048576
MinDynamicBandwidth= 524288
[/Script/Engine.Player]
ConfiguredInternetSpeed=4194304
ConfiguredLanSpeed=4194304
(these values are just extreme values I set in order to see what the effect might be, so that I see the difference)
Anyone know if Lyra can support 100 concurrent players out of the box? Assuming you have a powerful server and don't add a bunch of laggy code. IIRC Shooter Game was supposed to handle that many
My initial guess would be no, but Iβm not certain and havenβt tested
Or wait do you mean is it setup to have 100 players or handle 100 players well?
Because it should be structured to support 100 players, but I donβt know how optimized it is for it
Itβs probably more configured to run it better than a normal project though
Test it and find out? I doubt anyone has done that to be able to tell you.
Yeah I was thinking since it is an inhouse/showcase Unreal project, the devs know their stuff and might have been able to give an estimate on the upper limit or even stress tested it internally. I seem to recall shooter game was said to handle 100 ccu
I mean acceptably with performance comparable to say Fortnite with the same player count. Of course it's still gonna be rough I'm sure haha π
Like in Squad or something when you get to 100 there are jitters and stutters but usually it remains stable, no major freezing or warping or crashing
assuming the server is strong and pings are low etc
My guess is no, Fortnite is ahead of 5.1 with engine performance improvements, and in general probably more optimized systems than Lyra
But like DevilsD said, best way is to find out
Yeah that's gonna take a while hehe. There must be some kind of estimate or insight somewhere, I'll keep looking. Thanks :)
is it possible to switch online subsystems at runtime?
I wouldnt use Squad as a benchmark, its badly optimized in pretty much every consideration.
Its also pretty old
will AI controllers get travelled and loaded on seamless travel?
when my client travels to a match hosted by another client, should I specify the host's current map in APlayerController::ClientTravel URL? or should only the address be specified in the URL? π€
@civic seal Note that the engine doesn't do any true bandwidth control. It just considers the connection "saturated" at those values and won't attempt to send anymore. It's a soft cap at best really. There are separate CVars for RPC limits, limits on tarrays etc. There are still some hard caps you can't exceed.
ShooterGame needed major optimisations to support 100 players well
are there any docs or way to look at the defaults? Didn't run into issues but it would be interesting to know
all I know is that some default limits were increased from UE4 to UE5
UNetDriver / IPNetDriver has most of the settings IIRC
oki thank you π
Oh and DataChannel limits the max bunch size
π
I guess the best would be to not have to modify those and comply with the limits
dunno how common is to change them
We never had to. HLL was shipped with defaults.
Just a shit tonne of optimisation work
UE 4.26 or 4.27 increased the base limits by a factor of 10 too
ahh so it was maybe in later UE4 and not UE5 asI thought
btw is there any stats/logs or debug information when the limits are reached? I didn't find any trouble when testing but maybe it is silently failing
since my game networking is not in a stage where dropped updates would break anything in a very evident way
I don't think it;s easy to get too but you can get the saturation and inging/outgoing bytes from the net connection/net driver
Otherwise it's just about profiling
Hi guys, I have a question about multiplayer character, when I store my character's data in the server, it shows nothing but a headless figure and not my character progression, any suggestion on how to solve this issue?
oki, thank you π
@prisma snow You are more likely to be CPU performance bound than bandwidth restricted.
probably - but I'm working on an RTS and some worse-case scenarios could be relatively intensive in terms of bandwidth. Or not. It is hard to say bcs on the one hand, everybody says how crazy RTS are, on the other, from our current tests and calculations modern internet connections can handle our systems fine
Internet speeds these days are extremely capable from a throughput perspective. Its more about how quickly the data is crunched on either end that will cause issues.
Limiting bandwidth obviously does help. But if you are half sensible with data optimization that wont end up causing you the biggest problem
I see, thanks for the input. I am always worried about potential issues, although I suspect that the problem will be related to timing and network jitter more than bandwidth limits. About CPU, everything seems under control for now, the game thread does some basic compression (related to game logic to a certain extent, very simple for now) and that's all
The CPU cost for serialization happens on the game thread or network thread? Bcs I have not profiled the latter tbh, probably I should
Remember that the rest of your game systems will cost you as well. The more time the CPU is doing something, the less time it has to complete other stuff like dealing with network traffic.
That's not a problem, we optimized CPU a lot and the main bottleneck is GPU for most cases
I'll keep an eye on network serialization cost though
Cool. Just keep profiling. Profile everything. It all adds up
yeah
I bet I can see the network thread on Insights
just never bothered recording it
the problem as always in multiplayer is profiling in real conditions
not sure if profiling a multiplayer editor session is going to provide semi-accurate results
Profiling can be enabled for packaged dev builds
Commandline and console commands
Do some research into that. They are useful for getting more appropriate data.
Ohh, I know the commands, it's just less convenient to test multiplayer since both processes will eat the resources from the same computer, and I don't have two computers to test on easily
Sounds like a local animation is played, with an RPC to the server to try consuming the item. server starts a timer, and consumes the item if not cancelled by another rpc from the client ?
Server sets players new health when item is actually consumed, so that would be handled by the OnRep_Health I'd guess
i'd still do a timer on the server, to avoid missing out on a heal due to local lag or fps issues
then server char is healed at the correct time regardless of what happens at the client, unless a cancel_consume rpc is sent
What do you wanna onrep?
i'd think that'd be an unreliable multicast
as it's not important core functionality
Def
it wouldn't even work as an onrep, players who come into relenvcy would see someone doing the animation who finished it long time ago if you didn't clear it
yep i will be clearing it out once the server reload has ended
any network event that is one and done should be reliable
the enemies would react to the reliable server event starting to heal
the only time you need to make an event unreliable is if you plan to send the even multiple times, and one or two failing won't matter
i'd say that an animation for other players are not super important, and if it misses out, that's no big deal imo
why does he want it to be unreliable?
Sure its part of the immersion and all that
I just suggested it as unreliable π
and i guess thats what they had in mind already
yes i get it. but what about in games br shooting games where it actually matters?
how does it really matter?
the only thing that would happen when it fails
would be that the player just stands still
If someone is healing near me, i would like to go and attack him since i know he is low hp
that's why for more competitveness
there will be healing sound played as well
so br games also ignore such things?
I'd still call that less important than the core element, but oh well
I got no clue what BR games do
Every event should be reliable unless it's being consistently fired. I think you guys might be over optimizing if that's the reason you want it unreliable
The significance of the event should also be considered
if you're sending location updates on tick, that probably needs to be reliable anyways (if you've got a good reason to do this)
Hopefully that's the only reason someone would have a reliable event on tick π
even the CMC does not send reliable RPCs on tick iirc
You should NEVER use Reliable on Tick
Especially not for Movement stuff
This sends ~60 times per second. Who the f cares if a package drops
The Reliable Buffer will fill up way too fast if you do that and you'll start to see a lot of packages being dropped in favor of the RPCs
Up to the point where Clients won't even see replicated actors spawning in
Had that couple of years ago on a client's project
i want to make a replicated pawn movements(like tps project movements) how can i do it?
If your Pawns are humanoid you should fall back to Characters and just use the CharacterMovementComponent
Replicated Movement requires lots of C++ to work correctly
was ment as an edge case example (apparently not a good one) for why context of the replication should be considered for wether it should be reliable or not π
Hey, do subobjects of an actor component replicate at the same time as the component? As of 5.1 at least.
Morning, I have a working replicated shooting system in C++, everything works except first person animations in the clients and spawning sounds (I know I need to multicast the third person animations, I'll do that after). So, any ideas why the animations only work in the server?
logging GetAnimInstance()->GetCurrentActiveMontage() shows that the animation is being played in the clients but it just doesn't
whats the best method for a GameMode on the server to communicate with a game instance on the client?
and also to replicate it to all clients
GameMode cannot, GameState can
yea I am currently letting the game mode call a function in the GameState that have a Have authority switch, that in turn calls the relivant player controller who then calls the Game Instance,
the resault then goes back to gamestate and gets replicated to other players
its part of rank/score management so needs to be updated when GameMode ends,
but it seems like there should be a simpler way
Have GM bind to an event in the GS stating that the score was reached. Then just do the tracking in the GS.
The GS is for the GM to communicate to clients really. These two classes are tied together.
who have authority over the character movement?
sounds like local and server is fighting each other
yea for normal movement that would work, but the moving platform is most likely out of sync.
do the platform just move the character as "impart movement" or does it actually follow the "I want to move" logic
I would add a collision box on top of platform to get overlapping character
then add offset to the character the same amount as the platforms movement, feed this into the replication pipeline you have
Is something like this possible:
Server/Client player controller changes something in the game instance -> client player controller should get event that this happend.
My main issue is that the client has no access to the game instance and can therefore not subscribe to any events.
client has its own game instance
if you want to replicate events, GI is not the place to put them
but how can i share events/variables between both players over multiple levels :/
add an Actor to do it, put it in GetSeamlessTravelActorList on all GameModes and use SeamlessTravel
Actor will get dragged along and persist
suggest spawning it from GameMode and keeping a replicated pointer in GameState to it
bumpity
Movements are Humanoid but collisions are the mesh and mesh is cubic
Hi Peeps,
Question on CPP networking.
I have a variable its set to replicate
But I'm noticing when I change the value in a function that is multicasted and only changing the var if we have authority.
In the function I do see the variable change but its after leaving the function.
After that function processes the variable changes back. Its just a bool from false to true. But sets back to false?
Nothing else in my code is touching that bool. I was thinking the set from networking is maybe just not staying for some reason.
I built this whole thing in blueprint originally and it worked just fine.
It seems its some cpp specific step or something that needs to be done differently.
I also made sure to have the function GetLifetimeReplicatedProps overridden and variables replicate set up in that func,
As well as making sure the variable change is done on the server, and making sure they the bool is replicate set on the UPROPERTY
Also I'm testing all this just on the regular solo stand alone play not even network PIE. I'm really lost on why the variable would reset.
is it best practice to do all calculations server side? or can you do some things client side as well, apart from just handling the keypresses
Greetings, I'm having difficulty organizing my Multiplayer gameplay code. Should I separate the cosmetic stuff and the game logic stuff and call it in different methods? For example, my character can cast spell. How should the client call the method I created to do this? The first thing that comes to mind is the client invokes the method of doing the magic with a server RPC call. But then how will the act of doing this spell be distributed to other clients?
The other obvious question that stuck with me is when I make a server RPC, does this RPC call run on the server version of the actor that the call is made from?
Hi everyone, rather than respawning a character after rag doll Iβm trying to teleport it instead. I have it working on server end I set the location, collision etc. I see the client capsule and mesh teleport in the server view, but on the client only the capsule teleports. The mesh stays rag dolled. I can control the capsule at this point. What could possibly the issue?
What do you mean by that?
When we tested the game we used Radmin VPN for connection. One player hosts game through menu, other player joins
Hi, if i use IsLocallyControlled and its true, then try to cast to the game mode, should that work or not?
Depends on whether the local player is the server
Game mode only exists for the server
Ok sweet! I was getting a game mode cast failing but thats why, cheers!
I would assume ragdoll detached the skeletsl mesh
Any body knows why my ATeamGameMode::PostLogin(APlayerController* NewPlayer) is not being called on a packaged build.
work perfectly fine in editor
it should be called automatically when a client joins right.
I Tried on screen debugging but this doesnt seems to get triggered.
Is this first login into server or seamless travel?
Yup which I reattach, the server sees it and I can control it from client. But the client only sees the capsule
Seamless travel from lobby to Teams GameMode
Seamless doesnt call login
I am looking for someone to help me with my multiplayer game, does anyone know where I can inquire for engineering help?
Only first connection does
π₯
Seamless calls HandleSeamlessTravelPlayer
Does a servertravel call login?
Then they meet up at HandleStartingNewPlayer
finally someone with answers damn i was stuck here for the whole day
Cool thanks
π€ - you haven't asked a question in here for like 2 1/2 weeks, lol.
You can ask here to try and get help to solve it yourself or use #instructions
should i override this function or there is another way i could make the function inside PostLogin work
This being common path for both login and seamless, default implementation spawns the pawn
To do what?
Yes i did asked another question last time here got no answer
Thank you π
Id go for HandleSeamlessTravelPlayer then
Well your comment was stated as if no one answers anything.
void ATeamGameMode::PostLogin(APlayerController* NewPlayer)
{
Super::PostLogin(NewPlayer);
int32 NumberOfPlayer = GetNumPlayers();
if (GEngine)GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Green, FString::Printf(TEXT("Number of players?: %d"), NumberOfPlayer));
AMPGameState* MPGameState = Cast<AMPGameState>(UGameplayStatics::GetGameState(this));
if (MPGameState)
{
/*int32 NumberOfPlayer = GetNumPlayers();*/
if (GEngine)GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Green, FString::Printf(TEXT("Number of players: %d"), NumberOfPlayer));
AMPPlayerState* MPPlayerState = NewPlayer->GetPlayerState<AMPPlayerState>();// Get the pointer we use get
if (MPPlayerState && MPPlayerState->GetTeam() == ETeam::ET_NoTeam)
{
if (MPGameState->BlueTeam.Num() >= MPGameState->RedTeam.Num())
{
MPGameState->RedTeam.AddUnique(MPPlayerState);
MPPlayerState->SetTeam(ETeam::ET_RedTeam);
if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 10.0, FColor::Green, FString::Printf(TEXT("RedTeamPostlogin")));
}
else
{
MPGameState->BlueTeam.AddUnique(MPPlayerState);
MPPlayerState->SetTeam(ETeam::ET_BlueTeam);
if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.0, FColor::Green, FString::Printf(TEXT("BlueTeamPostlogin")));
}
}
}
}
Its where controller ans PS are reinstantiated with new class
no brother i was searching else where and got no answer thats what i mean
Someone not on mobile, please provide a code formatting lesson π
Surround your code in three backticks it is the ` key. On a QWERTY keyboard, the key next to the 1.
Sorry Fixed
That's not fixed, lol
3, not 2
Forgot for a moment how to do that
This is how
After the first three backticks, you can put in "cpp" to give syntax highlighting too.
Ok will try this method
does the gamestate replicate by default?
That looks like it belongs in AMPGameState::AssignTeamFor(APlayerState* NewPlayer);
Not in GameMode
I don't believe so? Easy to check. Just go to your gamestate and check if it is replicating. It's just like any ol' actor.
Then you can just call the GS function instead of duping code
oh gotcha thanks
Its replicating, and it has to replicate
One of the few guarantees you get with Unreal replication - GameState will replicate before any Actor on Client calls BeginPlay
Thanks my men You are a savior will give it a try
oh that's great info to have
This is because GS is what tells the worldsettings to kick of the begin play stuff
If you're curious about the process, I outlined it here: #cpp message
Hey man can you Show me how to format with a snippet iam failing to format my code
3 `s before and after code block
Good stuff
It is just how I said. Surround your code with three `. Then, if you want to add syntax highlighting, add in a language after the first three backticks. Most often in UE's case, it'd be cpp.
understood Brother
Done Is it formatted
Another point: why on screen messages when you have a debugger?
I'm trying to get the gist of replication, but don't understand why when pressing 1 on the server, the print only happens on the server, and when I press 1 on the client, the print happens on both the client and the server
Sorry for this but iam fairly new to Multiplayer
You cook content for windows, you set your target to DebugGame in IDE and press F5
Then you just put breakpoints in code with F9 and see whats going on
Step by step
You mean to say i can use debbugger in a packed built as well π€―
Yes
Iam So noob
Not sure if any game would end up getting finished without that
What do you mean when you say this line
like what is cook content
You need target thats not Editor
You can package the game fully or just cook content, doesnt really matter
Options are right next to each other
Yes i remember now
Ill give it a try men you have opened my eyes brother
i love how in game dev every day i learn something newβ₯οΈ
That isnt going to change with time either
you can simulate lag and packet loss and jitter in the engine
Thanks, that is helpful to know
Didn't know that, this can be the solution π
You are my saviour
Hey, where would be the best place to store a reference to a players character pawn so that it can be repossessed later?
in the playercontroller probably would be my guess
that or playerstate
This is being run on the client and the server but giving slightly different locations. Any idea why that might be?
cheers π those were my two options, thanks for your help
Because the locations are different. time lag etc.
Hi, I'm having difficulty organizing my Multiplayer gameplay code. Should I separate the cosmetic stuff and the game logic stuff and call it in different methods? For example, my character can cast spell. How should the client call the method I created to do this? The first thing that comes to mind is the client invokes the method of doing the magic with a server RPC call. But then how will the act of doing this spell be distributed to other clients?
The other obvious question that stuck with me is when I make a server RPC, does this RPC call run on the server version of the actor that the call is made from?
going back to Cedric's NetworkCompendium and hte years that I had invested into multiplayer frameworks... there are a few ground rules to go on.... but it also depends on the server type - as ListenServer is worlds different from DedicatedServer. In my own experience i had more luck and easier times with DedicatedServer than Listen - because it takes the player out of the loop... Listen server adds in more checks & balances throughout your code to ensure you are server (or not) and what to do in that case.
DedicatedServer:
Anything that is visual effects doesnt belong on the server - its overhead that doesnt need to be done - as there is never a player that plays as its entity. If you need others to see the VFX you intend to spawn (fireball, waterbolt, etc...) then you need to spawn them with a NetMulticast RPC.
Anything that is a game altering event - do damage, affect stats, manipulate movement component, needs to be done on the server,. The puck doesnt stop there - and you'll have to playtest 2 players minimum to see that each player sees the other's code changes if it needs to be replicated out to the other players attached. Soemtimes I found that you still have to do a NetMulticast RPC to make changes take effect on remote clients. I found this portion to be most non-consistent.
Anything that is done locally (but needs authority) still needs to be handled through an RPC with netmode set to OwningClient.
My highest suggestion is to debug thoroughly using print strings & ensure the thing syou NEED to replicate are indeed pulled off to each remote client, and that'll be the best way to learn replication. Have this at your browser always - its a great resource & good read to understand the core classes & lifecycles in effect: https://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf
I want one of the players to act as a server in my game, but at the same time, I want to treat every player as a client. Is there a way to this?
It is easier for me to develop in this way, I think what I want is for the player, who is the server, to start a dedicated server in the background and connect to it like a client.
so it seems sets and maps can't be replicated, what is the standard way to replicate some like a map if that is what you need, do I basically need to make my own class that replicates a keys array and a values array?
This is called ListenServer... the harder of the 2 types to code against. Its because one player has full authority - and that needs to be handled with the utmost care obviously.
This is also a design question - "do I care about the fact that someone could go out of their way to design cheats for this game?" If your answer is yes - then you are welcomed to some gruelsome code practices that make you a stronger/better network architect in Unreal.
This is NOT ListenServer - a player whom hosts a DedicatedServer is simply doing just that - hosting a map for others to connect to. That person would be required to both launch the DedicatedServer (either on their own PC or a second PC) and also launch the game to connect to this DedicatedServer that is running already.
Seems like there is no way to do both at the same time
The fact that one of the players has some privileges makes it difficult to think
you need to analyze your infrastructure - and decide the type of servertype:
Are people going to host the SERVER from a cloud based server, or a server machine in their home? ~ DedicatedServer
Otherwise ListenServer
My game is fully coop
and story based, so dedicated server way cost a lot
and there is no point to maintain that much server
then do it the zero cost way and design your game for ListenServer connectivity
this fits most console style gaming - where one client HOSTS the game, and others connect to it (typically via some Friends/Online subsystem)
This is exactly what I wanted, but while writing single player game logic was not difficult, everything became too complicated in mp
When a character performs a behavior, my first reflex is to calculate it on the server and then distribute it with multicast.
when using seamless travel, how do I completely reset the Game Mode, player controllers, game state etc, I don't want anything to persist and I want them to be reinitialised
so begin play, contructor function will be called again etc
GameMode and GameState won't persist to destination level by default but to transition level, so they shouldn't be an issue. You're here because PlayerControllers are persisting. For ez mode make sure that PlayerController class is different on the destination and source levels. It's even a good practice anyways...
For the mark the pins has a persistent data compendium
Wow, TIL:
- Subobjects (including ActorComponents ofc) don't need to be replicated for them to fire RPCs. Their owner/outer actor should be though.
- Subobject that isn't replicated, neither stably named, will be replicated (in the sense of created from replication not that it bReplicates) to client if you fire a reliable client/multicast RPC on server. Looking at the code, a server RPC shouldn't do a similar effect on server.
Up
when I store my character's data in the server
You'd need to be a bit more descriptive here
Hmm I tried using the open level option but I need to know how to Override the Name=Desktop to Name=(Data value)
I wonder it might work
Still not sure what your actual problem is
First you say you store stuff on the server and now we are talking about traveling :D
Can you please explain the full setup and what you are trying to do
Otherwise no one will really be able to help
Wait so the open level is not the solution on loading the character?
OpenLevel opens a new level
Not sure what that would have to do with Characters
It would cause you to travel to the new map, which is most likely a hard travel, so all Actors will be destroyed and the match cycle will cause a new GameMode and all its relevant classes to be spawned, including, if you use the DefaultPawnClass, a new Character
I see, but in your case how did you load your character?
What do you mean with load
Again, you have to be more specific
?Name= question you had is a C++ thing
If you can use C++, then you can alter that stuff
ULocalPlayer* LocalPlayer = GEngine->GetFirstGamePlayer(this);
if (LocalPlayer)
{
// Send the player nickname if available
FString OverrideName = LocalPlayer->GetNickname();
if (OverrideName.Len() > 0)
{
PartialURL.AddOption(*FString::Printf(TEXT("Name=%s"), *OverrideName));
}
// Send any game-specific url options for this player
FString GameUrlOptions = LocalPlayer->GetGameLoginOptions();
if (GameUrlOptions.Len() > 0)
{
PartialURL.AddOption(*FString::Printf(TEXT("%s"), *GameUrlOptions));
}
// Send the player unique Id at login
Connection->PlayerId = LocalPlayer->GetPreferredUniqueNetId();
}
That happens in UPendingNetGame::NotifyControlMessage when the Client sends the Login message after being challenged.
Means, if you add your own ULocalPlayer class, you can override GetGameLoginOptions and pass over more data in the same format. I wouldn't change the ?Name= part.
You can only pass strings though, so not actual objects.
@fathom aspen I think you should add this to your Compendium page
I only used that in the past to pass over UniqueIDs that the Client had in a more complex Server/Client model
But it allows passing over some data on connection from client to server
Which is available in PreLogin and Login in the GameMode
Hmmm I think tried that before but it loads a headless character but weird part is that when I login again it loads the character perfectly
So first time a user logs in the game it loads a headless, but the second time when a user logs in it loads the character correctly
That's probably your code. I still don't know what you mean with load
If you join a Server and you properly connect etc., you will get a PlayerController, and if you have a DefaultPawnClass in the GameMode (or similar setup), you'll get a Character spawned for you.
Anything beyond that you'd need to tell us what you are doing
Cause just from this, there is no reason for a Character to be headless or not
What would be the best way to do enemy name plates that scale for each player based on distance in multiplayer?
Oh yeah I mean spawn sorry I got used character load hehehe again very sorry
So yeah my main problem in my game is that when a player joins a server and properly connected the character itself just spawns this headless model as a first time login or should I say as a new user, but the second time the user logs in its not the headless anymore but a perfect pawn itself
Yeah I think that bReplicatesByDefault thing on actor components just to register them when constructed, what matters is ReplicateSubobjects function on owning actor
i want to rotate something but only for the local client, how can i do this? im trying to rotate my world space health bars above enemies, but if more than 1 player is close, it will fight between the 2 rotations. can i make it so only the local client sees the rotation so it wont fight between them all?
Hey i have read docs about GM and GS and stil didn't get what is the difference between them . They are both pretty similar why to not handle eveything in GS ?
Difference is that GS replicates and is available to clients. GM is not
When i hit a tree thats placed with the foliage tool, i want to remove it and place an actor there (so i can damage it) but for some reason it only works for the host and not the client. am i doing this wrong?
it still spawns it as the client, but doesnt remove the instance of the tree
Hey Guys, why won't my friend find my sessions? I already forwarded all the ports needed, I am using Steam Online Subsystem. Please any help or insight would be immensely useful
I'm Having an issue with getting the tick even to work with get actor location.
I have this code running on the tick event.
its connected to this here
But what its logs is confusing
Even without moving, it gives me very different values
I know there might be better ways of doing this, but I want to know why this happens
Why is that a Client function hidden behind an authority switch..? Bit wierd
Also the only logical explanation is that is is moving
Sorry that was some left over item from when I was testing.
When I move the only item that changes is the top most value the 3 values below that wont change at all. The next value is the same as the top value and it continues.
I thought it was something to do with the actor so I created a new actor and got the same result.
I'm sometimes getting corrections with a quick dash CMC movement ability. The corrections don't happen when move combining is completely disabled. What does that normally mean is wrong? The only thing I currently see wrong is that I'm relying on GetWorld()->GetTimeSeconds() within CalcVelocity
Would make sense, the Server will simulate the "combined" move in a single frame - so any reliance on timestamps may break
Okay I figured it out, it was so stupid >.> I had duplication of the character in other locations.
Even new characters had the same controller which uses the tick so it caused the different values.
I'm kicking my self rn
Right that makes sense, I feel like something else is setup wrong but I should fix this first. I'm trying to change the player's speed based on a curve, which takes a timestamp. Not sure the correct way to do that from within CalcVelocity
Hard for me to say, but you'd probably have to store the timestamp outside of the movement update loop, then increment it by the internal movement simulation delta time during the move
So you would need to start the dash, store the timestamp, then increment that timestamp with DeltaTime to get the lookup time into the curve
You probably would still get occasional corrections though I'd imagine unless the simulation timestep was locked
That makes sense, that's what I was thinking too. Where should I increment it? PerformMovement?
Yeah possibly, or maybe even with that calc function
So instead of storing the start time, store the "time through dash" and increment each time it's called
That might be more accurate
It would at least work with the server simulating big chunks of moves at once
But if Server + client are simulating with different timesteps I still think you'd probably get corrections now and again
But not sure.. it might be ok
Is there a way to make it work with different timesteps?
on which instances does the hud class exist?
Might be possible since the character sim is supposedly deterministic but I'm not sure, usually with any physics sim different timesteps mean different results
But.. CMC is substepped IIRC so the effects might be subtle at best
local clients only
Thanks π
I think UT had a dash, might be worth checking their source code out @jolly siren
ah okay I'll crack that open
Not sure that it's time/cuvse based though
Hello! Stupid simple question that is stumping me a little, partially why I much prefer working with dedicated servers, but alas I must use a listen-server for this project.
How can I quickly and efficiently tell if the pawn I'm working with is on its owning client and not the server, unless this is indeed the listen-server's own pawn? The issue being I believe all the remote pawns on the server are considered autonomous proxies and have authority, so I'm struggling to be able to distinguish them. I just want to be able to tell if we're on the pawn's own client, so I can apply, for example, some force feedback stuff to their controller. If anyone can point me in the right direction, I'd be super appreciative, thank you!
A mixture of IsLocallyControlled() and IsNetMode(NM_Client) should do it
Authority is which machine started the spawn process pretty much. So remote pawns do not have authority.
Remote pawns on the listen-server would have authority though, is that not correct? If the server is responsible for spawning and replicating them?
yep
Just note that Authority != Server
Which is why you often need to use the more specialised tests depending on the context
Listen server is the server, so it would make sense that the pawn has authority. Because that is the instance that started the spawn process.
Thanks Jambax, but mm. In that case, IsLocallyControlled and IsNetMode(NM_Client) sounds like it makes sense, though does a Listen-Server also consider itself a client in that regard? Just trying to make sure I can check if the pawn happens to be the listen-server's own pawn.
Listen Server would not be a client
The local users' pawn on the listen server would have authority, would be NM_ListenServer and would be locally controlled
NetMode is the local net mode of the game instance
So that's really the only definitive "am I a server" or "am I a client" test
Okay so, "Is Locally Controlled AND (am a client OR (am a listen server AND have authority)) should give me true only if the pawn is the owning client's, or is the owning listen-server's own pawn, does that make sense? 
yeah I would think so
I just noticed some of my enemy's sort of desync a bit sometimes. Is that normal in the PIE?
They'll teleport 5m away from me but still be attacking
Ah! I think I just realised the true source of my confusion. Right okay, thank you both!
Or is it something I've done π
sounds like a you thing
never had that
I'm not sure how to disable controls for both the server and the client, right now it's only disabling the controls for the client. This is in a playercontroller class
what is the correct way to get FUniqueNetIdPtr from PlayerState on both clients and host/server?
You just need to do it on the client.
yeah I've just found it and testing. thx
even without the macro and the exact setup you have
Make sure Force is not enabled
Try this
Hmm doesn't work either
but I think it might be because of the fact that the character sometimes get spawned before the playercontroller gets instantiated
because some of my spawning logic also gets messed up from time to time
nope didn't work either haha
So weird that it does work on the server
Is the return value of the Is Move Input Ignore node always false?
I forgot we are in the #multiplayer. do not use the Get Player Controller node
I tried doing it with a self reference but that gives the same result
or is there a different node?
Most of the time controller is still invalid at Begin Play, Try this (in the character class)
Everything is working, you just call the function in the wrong place
This does work indeed. Problem is that I have a controller for the lobby level and the gameplay level, and just one character used in both levels
That code is in the character class, so it doesn't matter what controller you are using, or you can write the code in the player controller class
If I write the code in the controller class I run into the problem of the controller not being initialized at beginplay
this doesn't seem to work either, even though it's pretty dirty
did you try this? #multiplayer message
This is the first time I'm seeing the Self reference is invalid at Begin Play
Yeah I'm not sure what's happening either
So you fixed it finally?
No that was to show that the client also runs through the logic with the print string
but it doesn't set the ignore move input to true
Did doing it like this fixed the problem?
No
If you're running as a listen server, then you would have two player controllers. One would return local for the server, and the other would return local on the client.
I am running as a listen server
But that would still mean that the input should get ignored
all the other functions work perfectly fine, even the ones with references to self
Using this node does work for some reason, starting to think it's a bug or something
Before ignoring the inputs, set the input mode to the game only
Doesn't work either
I guess I'll just go with the ui only input mode as that seems to work fine, and players will have to interact with the ui anyway in the lobby
thanks for the help anyway :)
Hey is there any one that have experience with unreal engine Steamcore multiplayer setup which is non region locked?
controller makes an rpc to seek target and do damage, then calls a custom event in fighting unit parent class
widget element is updated, if i use every tick, but not updated, when i call a custom event to update
what is wrong?
Use the built in apply damage and any damage events
Then on the any damage event you setup functions to subtract health or add negative damage for healing.
why are you casting here
why not just save your widget as your HP BAR Heroes type and save yourself the hassle
i'm casting, because i use a parent widget as an overhead widget component of a character
i dont understand what u mean "why not just save your widget as your HP BAR Heroes type"
widget is saved as a parent user widget class, is it bad?
i use my own damage, it suits my goals
AGrippableActorBase* TryCast = Cast<AGrippableActorBase>(OutOverlap[0]);
if (TryCast)
{
ActorInRight = TryCast;
ActorInRight->GrippableMesh->SetSimulatePhysics(false);
FName AttachSocket = ActorInRight->RightSocketToAttach;
ActorInRight->AttachToComponent(GetMesh(), FAttachmentTransformRules::SnapToTargetNotIncludingScale, AttachSocket);```
```cpp
ActorInRight->DetachFromActor(FDetachmentTransformRules::KeepWorldTransform);
ActorInRight->GrippableMesh->SetSimulatePhysics(true);```
When attaching to the socket "AttachSocket" in the AttachToComponent it attaches it fine and all but when I use the DetachFromActor after that, ON THE CLIENT it always sends the actor about 50 meters to my right. When playing on the server it works and if I remove the AttachSocket from the AttachToComponent and just attach it to my mesh it works on the client too when using the DetachFromActor
How tf can that be possible
The collision settings are all good
All of that is run on the server
Hey everyone, im trying to get a problem solved with instanced foliage and don't have luck so far, can anyone confirm that removing a single instance works both on the client and server in ue 5.1 (blueprint)?
Calling this from a multicast only removes the server instance, the client stays no matter what i try π€·ββοΈ
So there is Online::GetSessionInterface(UWorld) from OnlineSubsystemUtils.h and Online::GetSessionInterface(FName) from Online.h and they return different objects? π€
Ok the problem appears to be that the Socket location somehow is not the same on the client and the server because I tried destroying the Actor and spawning a new one on the socket location
But the solution is still unclear
hello everyone, what would this close reason indicate caused the connection close?
LogNet: UChannel::ReceivedSequencedBunch: Bunch.bClose == true. ChIndex == 0. Calling ConditionalCleanUp.
[2023.03.15-18.22.54:700][788]LogNet: UChannel::CleanUp: ChIndex == 0. Closing connection. [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: , Name: IpConnection_2147482468, Driver: GameNetDriver IpNetDriver_2147482504, IsServer: YES, PC: BP_RTSPlayerController_C_2147482328, Owner: BP_RTSPlayerController_C_2147482328, UniqueId: NULL:DESKTOP-25EVTNG-
[2023.03.15-18.22.54:700][788]LogNet: UNetConnection::Close: [UNetConnection] RemoteAddr: , Name: IpConnection_2147482468, Driver: GameNetDriver IpNetDriver_2147482504, IsServer: YES, PC: BP_RTSPlayerController_C_2147482328, Owner: BP_RTSPlayerController_C_2147482328, UniqueId: NULL:DESKTOP-25EVTNG-, Channels: 403, Time: 2023.03.15-18.22.54
[2023.03.15-18.22.54:700][788]LogNet: UNetConnection::Close: CloseReason:
[2023.03.15-18.22.54:700][788]LogNet: - Result=ControlChannelClose, ErrorContext="ControlChannelClose"
[2023.03.15-18.22.54:700][788]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] Remot
Wow, this is amazing, thanks for tagging me! I talk about the Options string, but I never knew this function existed. I will make sure to add it, thanks!
Neither the latter is important for them to be able to fire RPCs though. They could be net addressable for example on a replicated actor and that's sufficient ^^
proposal to pin
I was however amazed by #2, as someone could abuse it to account for deterministically spawning stably named ActorComponents just by firing RPCs π @peak sentinel
Nah, it will be in the compendium which is already pinned π

x2
Here ^ @peak sentinel
Fire a reliable client RPC on an server-only spawned ActorComponent and you have a linked ActorComponent both on server and client (linked in the meaning that it's identified by NetGUID)
Is it possible to wrap a map inside of a struct to be able to replicate that map?
Well thats gonna be a tough one for me then π₯²
Thanks @tender jay
I mean I replicated a TMap recently but I was kinda forced to do that
Can you share how you did it?
Custom net serialization, but it only works becasuse the Objects on the TMap were archetypes
If they aren't then you're out of luck
Well I might already have an idea on how to work around that
So I guess I'll just not bother with that π
Literally just serialize the Object that has the TMap into a byte array and replicate that and deserialize that on client
I can live with that π
I needed to do it that way because the Object that had the TMap had tons of other stuff that all needed to ready at the same time on client for an atomic operation
Yeah just go with a struct inside an array/fast array
Which function? The NotifyControlMessage one?
Nah, ULocalPlayer::GetGameLoginOptions
It's really flexible in the sense that you can have a centralized function that takes care of the options for you ^^
So you don't have to do it manually each time you do a travel
I always wondered where the Name option came from but I didn't dig deep enough to find that. But now we know at least XD
I will have to double check that the options string is cached here for clients, so I indeed say that it's cached for clients π
Pretty sure it gets set somewhere during the connection process. Don't see why they would change it afterwards. But definitely can't hurt to check, it's been a bit since I looked at it π
I create an actor with NewObject and then spawn with FinishSpawning(), but I can't see the spawned actor on my clients even though the replication flag and net load on client are open. When I spawn the same actor directly with GetWorld->SpawnActor it works fine. What am I doing wrong with FinishSpawning?
you cannot create actors with NewObject
UWorld::SpawnActor or UWorld::SpawnActorDeferred are the only ways you should be spawning actors.
SpawnActorDeferred works, thanks a lot
why cant tmaps be replicated?
because epic never implemented it
Anyone know if there're any (very very rough) estimates for when Iris Replication will become a production-ready feature?
Or rather, since it's officially marked as "experimental", does this mean it hasn't even been confirmed if the Epic team have committed to developing this feature through to completion?
It can really range, and itβs not a guarantee either
For example State Tree and Smart Objects were released as experimental in 5.0, and then made production ready in 5.1
But CommonUI released as experimental in 4.26 and is still experimental
Experimental can range from "we might drop this feature without notice" to "we are nearing completion and to expect API changes but it could be ready soon".
Iris will likely be in experimental for a few more versions, its quite a decent underlying change and will need to be battle tested thoroughly.
This is how I set lean boolean variables
This is c++ interface to get those variables
This is in c++ animinstance to set those replicated variables to animBP
then I use those to rotate spine in anim graph
Problem is when one client lean then all players lean
(First image just demostration. In game Leaning happens with keys Q and E etc.)
This is from interface.h
Are replicated moving platforms possible in blueprint alone, or do I have to edit the CMC in C++ in order to make clients not "jitter" while standing on them?
I havent found a clear way of achieving it anywhere online.
guys, bReplicates = true; is causing my weapon to spawn twice for each client, but without it animations won't play for them, thoughts?
One spawn is from the server and one spawn is from the client.
So long as they are set to be character movement bases and are stably named or resolvable over network, it should work fine
When CMC is standing on something, it's movement becomes "relative" to that base. That only works if the base itself is network addressable
You have spawn code happening on your client. Lock it behind a HasAuthority() check.
Thanks, just found this answer in an old forum π
I have a TArray object that I marked as Replicated. I fill this object with a server RPC in my actor component. Afterwards, when I make a Multicast RPC call using the data in this TArray, I see that the Array values are null . What could be the reason for this?
Why is it marked as replicated and multicast?
Drop the multicast.
If the tarray has values, but they're all null, it's for 1 of 2 reasons: 1) The array hasn't finished replicating (only its structure has) or 2) The elements in the array aren't replicated. I assume they are uobjects/components/actors.
Just adding an object to a replicated array does not mean that that object itself is a candidate for replication.
Just that the reference to it in the array will be replicated.
I am using multicast for cosmetic things like run anim montage
Maybe I misinterpreted. You're not multicasting the array itself as a parameter?
{
if(SpellSlots.IsValidIndex(Slot))
{
ASpell* spell = SpellSlots[Slot];
if (spell)
{
spell->OnSpellCosmetic();
}else
{
LOG_ERROR(TEXT("Cosmetic Failed"));
}
}
}
And the spells themselves are set to replicate?
they are AActors
{
SetReplicates(true);
}
Alrighty.
Do they exist on the client?
Have you tried doing a debug check like for (ASpell* Spell : TActorRange<ASpell>(GetWorld())) { log(I'm alive!); }
You may want to set bAlwaysRelevant to true.
I didnt understand this
When I cast a spell actor is visible on both client and server
So you're 100% sure the actor is on the client and it's been replicated from the server and not spawned locally?
when I cast a spell, its visible both on server and client
net load on client is checked
so I think when I spawn object on server its getting spawned on client to
How are you spawning them?
why wont my array populate?
void UInsertCardListView::StartCreatingCardList(UInventoryUI* Parent, UInsertCardDisplayUI* CardDisplayParent, int32 Index, FInventorySlot InventorySlot)
{
ParentUI = Parent;
CurrentIndex = Index;
ParentCardDisplayUI = CardDisplayParent;
Server_AddWidgetToArray(Index, InventorySlot);
RefreshCardListSlot(InventorySlot);
}
void UInsertCardListView::Server_AddWidgetToArray_Implementation(int32 Index, FInventorySlot InventorySlot)
{
FIndexToInventorySlot IndexToSlot;
IndexToSlot.Index = Index;
IndexToSlot.InventorySlot = InventorySlot;
ItemIndexToSlotArray.Add(IndexToSlot);
}
.h:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated)
TArray<FIndexToInventorySlot> ItemIndexToSlotArray;
Are you expecting the server call to finish and replicate the result before the refresh call?
i just need it to add to the array
it only adds one instance, i have this class being called twice because there are 2 widgets being made, but it only populates 1 time
Yeah thats the problem.
Just ignore the question then!
Idk what refresh even does. I'm asking if you're replying on the replication happening before refresh does what it's meant to do...
If the answer is no or it's not relevant to your problem, just say so.
you need to know when the replicated array is received from the server to be able to refresh the list with new data
onrep is probably better to call RefreshCardListSlot
It depends if he's asking why it won't populate on the server or on the client, though.
So, what Im doing is populating a scrollbox with widgets, and Im adding the widget to an array so I can make some logic to where I can only select one widget at a time
I get the information of all the widgets currently in the scrollbox from the array(that is the idea)
void UInsertCardListView::RefreshCardListSlot(FInventorySlot InventorySlot)
{
//Propagate widget into card list
FInventoryItem OutInventoryItem;
ParentUI->PlayerInventoryComponent->GetItemDataFromSlot(InventorySlot, OutInventoryItem);
NameLabel->SetText(FText::FromName(OutInventoryItem.ItemName));
IconImage->SetBrushFromTexture(OutInventoryItem.ItemIcon);
}
You're completely ignoring the things you're being told/asked
RefreshCardListSlot has nothing to do with what im trying to accomplish
So, what Im doing is populating a scrollbox with widgets, and Im adding the widget to an array so I can make some logic to where I can only select one widget at a time I get the information of all the widgets currently in the scrollbox from the array(that is the idea)
So we're getting somewhere.
Are you expecting the server call to finish and replicate the result before the refresh call? you refresh your ui? Do you wait? Have an OnRep?
but you said it adds one instance, I don't see a loop anywhere to add more than 1 instance
it gets called twice
because there are 2 widgets being populated
so, the array should populate 2 values
it only ever adds one
where is it being called twice? this is what i see
StartCreatingCardList() function calls Server_AddWidgetToArray(Index, InventorySlot) one time only
where is the code that creates entries for the list view?
When I save player actors to a replicated array on the server, will clients be able to reference the actor correctly from their version of the array? Or do server and client references differ for spawned actors?
for (const auto& InvenItem : InventorySlot)
{
FInventoryItem OutItem;
if (!PlayerInventoryComponent->GetItemDataFromSlot(InvenItem, OutItem))
{
continue;
}
const FGameplayTag FirstTag = OutItem.ItemDescriptionTagContainer.First();
if (CardIdTag.MatchesTagExact(FGameplayTag::RequestGameplayTag("Equipment.Type.Card.Weapon")))
{
if (FirstTag.MatchesTag(WeaponTag))
{
TArray<UWidget*> InventorySlots = SB_Cards->GetAllChildren();
int32 CurrentIndex = InventorySlots.Num();
UInsertCardListView* CardSlotDisplay = CreateWidget<UInsertCardListView>(this, W_CardListView);
CardSlotDisplay->StartCreatingCardList(Parent, this, CurrentIndex, InvenItem);
SB_Cards->AddChild(CardSlotDisplay);
}
}
else if (CardIdTag.MatchesTagExact(FGameplayTag::RequestGameplayTag("Equipment.Type.Card.Armor")))
{
if (FirstTag.MatchesTag(ArmorTag))
{
return;
}
}
}
CardSlotDisplay->StartCreatingCardList(Parent, this, CurrentIndex, InvenItem);
there are 2 slots currently, so it gets called twice
i think a listview takes only an object payload for each entry and it handles creating widgets when you call additem
is it because im adding to an array of an instance of a class?
its an old name, we were using listview but decided on adding children to a scrollbox
you expect it to be called 1 time only?
nope, i expect the array to populate 2 items
oh
int32 CurrentIndex;
if (InventorySlots.IsEmpty())
{ CurrentIndex = 0; }
else { CurrentIndex = InventorySlots.Num() - 1; }
i was right in my assumption
i cant add to an array from an instance of a class to another
i put the array in my component and it fixed the issue
Does DOREPLIFETIME handle repnotifiable properties or should I use DOREPLIFETIME_CONDITION_NOTIFY?
It handles it
DOREPLIFETIME_CONDITION_NOTIFY is for when you want to change the notify method
π
does anybody here know how does unreal behave with an array of objects being replicated? On the client side, the size of the array seems to be fine, but the items in an array are all unknown
all the references are there on the server side
Means the objects themselves aren't replicated
An array of objects is just an array of references to them, the objects htemselves also need tobe resolvable
does anyone have some good documentation and best practices for destroying sessions for the steam online subsystem? I'm not seeing a lot of info in the official documentation
I've got there an connection timeout problem where i'm not quite sure how to fix it.
I'm able to join a session created on a different PC. This join leads into loading the "Lobby" level, works just fine.
But when i want to do an server travel to an actual map which isn't empty only the listen server will properly join it.
The client which should also join sees something of the map, but in a frozen like view. After some time the client gets the time out visible through the logs
Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionTimeout, ErrorString = UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 60.02, Real: 60.01, Good: 60.01, DriverTime: 65.99, Threshold: 60.00
...
Any idea besides just increasing the allowed time and praying it fixes it ?
@vague fractal is this using an online subsystem?
The steam one, yeah
Are you seamless traveling?
From lobby to next map?
Cause steam doesn't like the hard travels
I'm doing an hard travel as i can't use a seamless level on levels which weren't loaded before afaik
My information comes from here π
https://docs.unrealengine.com/5.1/en-US/travelling-in-multiplayer-in-unreal-engine/
There are three ways in which a non-seamless travel must occur:
When loading a map for the first time
When connecting to a server for the first time as a client
When you want to end a multiplayer game, and start a new one
Specifically the first case
Seamless just means that the clients don't disconnect but get parked on a transition map
Pretty sure the first way they list is Singleplayer
Is it normal that I get a crash from calling GetWorld() and GetGameInstance() functions (trying to get the controller to travel to the session host) on the result callback delegate for IOnlineSessionPtr::JoinSession function? Only happening in packaged (development) game, no issues for the editor
But this whole site is tilted as Travelling in Multiplayer π
:x
Just try it
You won't get rid of the disconnects without it
I coded enough multiplayer games, including for steam, that you can trust the fact that you will want and for steam need seamless traveling
For server travels that is
Hm don't think it should crash unless you call this where there is no world access
I mean, i'm fine in trusting you as the docs aren't always great, but the docs straight up say a hard travel is needed π
Will try it in either case as i don't have much options here xD
My lobby kit on the marketplace travels from lobby to gameplay seamlessly
Idk what they mean with the first way they list
Just in case tho, since steam seems to be some special case here.
Will the modified code mess up if i'd switch to e.g. the EOS subsystem ?
Haven't used eos. Your game should favor seamless server travels either way
Epic should also say somewhere on that page that you should seamless travel whenever possible
EOS was just an example, any subsystem would be an option here if it helps to answer it ^^
Steam is just not good with the clients reconnecting
Idk how other subsystems react to it
But again, you should not hard travel with server travels anyway
Alright, thanks for all the info.
I'll try to use a seamless travel and see if it fixes it. Update sometime soon β’οΈ
I'm calling it from a GameInstanceSubsystem, which works when creating the session to travel to the gameplay map with the additional ?listen. Actually trying to replicate your CppSessions blog and repo to get help but can't figure out what may be the issue
GameInstance subsystem probably has no valid world
It should use the gameinstance's? Which is updated when you travel. Maybe it's invalid while travelling, though.
Is it travelling when joined to a session?
I'm trying to get world to get the controller to call the travel. So I'm not travelling, manually at least, yet while trying to get the world
Maybe check the source and see what it does!
UGameInstanceSubsystem doesn't override GetWorld()
It has no valid World :D
You can try getting it directly from the GameInstance I guess
GetGameInstance() also crashes though
But this part is working without issues π€
void UNSSessionSubsystem::OnCreateSessionCompleted(FName SessionName, bool Successful)
{
const IOnlineSessionPtr sessionInterface = Online::GetSessionInterface();
if (sessionInterface)
{
sessionInterface->ClearOnCreateSessionCompleteDelegate_Handle(CreateSessionCompleteDelegateHandle);
}
OnCreateSessionCompleteEvent.Broadcast(Successful);
if (Successful)
{
APlayerController* playerController = GetWorld()->GetFirstPlayerController();
playerController->ClientTravel("BattleMap?listen", TRAVEL_Absolute);
}
}
Hm
Maybe it auto gets it from Outer
Ah yeah it does
class UWorld* UObject::GetWorld() const
{
if (UObject* Outer = GetOuter())
{
return Outer->GetWorld();
}
#if DO_CHECK
if (IsInGameThread())
{
bGetWorldOverridden = false;
}
#endif
return nullptr;
}
Can you post the Join Session etc. code please
Well it was like this and crashing at line 75:
https://hastebin.com/share/ipipugupin.rust
Then I changed it a bit to directly try travelling at the session interface's join result callback instead of calling TryTravelToCurrentSession at widget's lambda and now it's working:
https://hastebin.com/share/robimezaje.rust
@thin stratus The seamless travel worked!
The documentations should really be edited when it comes to that :D
Thanks!
How do you detach an actor from the socket so that on the client side it does not offset 50 units to your right. Is it some kind of bug with UE because attaching to a socket works fine but detaching it or getting the socket location to spawn a new item just makes it offset it a lot to the right
All of this called from the server:
AGrippableActorBase* TryCast = Cast<AGrippableActorBase>(OutOverlap[0]);
if (TryCast)
{
ActorInRight = TryCast;
ActorInRight->GrippableMesh->SetSimulatePhysics(false);
FName AttachSocket = ActorInRight->RightSocketToAttach;
ActorInRight->AttachToComponent(GetMesh(), FAttachmentTransformRules::SnapToTargetIncludingScale, AttachSocket);```
```cpp
ActorInRight->DetachFromActor(FDetachmentTransformRules::KeepWorldTransform);
ActorInRight->GrippableMesh->SetSimulatePhysics(true);```
Or do I have to send a client RPC just to send the socket location to the client and then spawn a new item using that
Or why does the socket location not replicate correctly
Spawning a new item with NetMulticast works but ofc this is not a good solution
Damn Unreal engine can sometimes be difficult to operate. Updating all socket and bone locations on the server were set off and once again had to scroll every setting to figure it out
Works now with the DetachFromActor
Hi guys, one question. I made a "coin collection" system in a game project I have in unreal. The problem is that when I start the game as a server with 2 or 3 clients, I "log in" to each client with different accounts and when I collect the "coins" it adds the coins in all the accounts logged in at the moment. The query in the database is well formulated, I don't know what it could be, maybe replication problems? I really appreciate your help, thank you very much.
I think the problem is that the query when the coin is grabbed is generated in all the clients, how can I make it so that the query is generated only in the client that "grabs the coin"?
That is the function that saves the information in the database table, and the function that adds +1 when you hover over the "coin"
