#multiplayer
1 messages Β· Page 51 of 1
I have an actor that is spawned by the gamestate, it stores other data about the common classes and has a HISM component that my multitude of actors needs to get their meshes spawned
And you spawn that on BeginPlay of your GameState, limited to server and replicated?
my level is not placed by hand, it is generated, so I have a handful of "master" actors that hold all necessary information about the types of actors that can be spawned
yes
Do you know what a Delegate or Event Dispatcher is?
yes
Okay
Make an OnRep variable for your Manager Actor in the GameState
Make an Event Dispatcher called "OnManagerReady" or whatever fits better
I store them in an array currently since i have multiple, will that work?
I don't really know honestly
Well okay, I will just explain it with one for now
So you have the OnRep/RepNotify variable, and the EventDispatcher
You call the Dispatcher when the OnRep calls with a valid pointer
Your other actors have now 2 options
On BeginPlay, they get the GameState (that should always be valid on BeginPlay)
They can now check if the RepNotify variable is valid
If it is, great
hello guys what's the discussion about
If not, they bind to the Event Dispatcher
That way they get notified when the manager replicated
That can also be setup for an array variable
But you need some condition for when to call the Dispatcher
One could be that you know upfront how many managers the client should expect
If you have x valid entries in the array, then everything replicated and you can call the Dispatcher
this is probably not the case due to UGC
Idk how you use those managers
But all it takes is to notify the waiting actors with the Dispatcher
That's basically the easiest setup
thats a super smart setup
I'm sure you can figure out how to set this up with your array. I will head to bed now π΄
Would it work if my actor can check if the expected manager exists yet in the array?
yes everything has an id that matches the master
Guys how I can solve when I have non smooth movement but lagy in my game? also usage of my cpu and GPU is like 80% even my game is empty map with me and my friends playing it.
Then you could always call the Dispatcher and the binding actor can check if their info/manager is now valid
Are you using characters by now?
Or still pawns?
still pawns but I used flying movement and it's suddenly replicate my movement to the forward "flying" every other movement like roll pitch yaw of plane is using RPC to replicate
I won't go with characters with planes heh
I noticed unreal likes to pin the GPU even in empty levels. Still not sure what causes it honestly.
it's packaged game so I am testing it on .exe so I don't understand it
sometimes it peak at 99% usage which is insane
Witcher 3 uses less
same for me, packaged game isnt exactly slow but it tries to cook my gpu. In editor its normal though
right now I just cap framerate which helps but is a bad solution
Are you doing the movement client authoritive? Which of the players are lagging?
but isn't packaged game like real game which u are going to ship? how to make real testing .exe then
If you don't use the character and the CMC you have to code this yourself
i can't answer this because I don't understand oh how u mean it
well my shits heh
you are looking for prediction I think?
i know CMC is top for replicating but doing plane with character is curse
are your clients movements kinda choppy?
idk firstly I need smooth flying but I have laggy movement af
i Can make video Tommorow now i am going to sleep hah
theres some creative methods in this chat I've seen people do
but this might be a way https://www.unrealengine.com/marketplace/en-US/product/smooth-sync
The truth is that network movement is really involved.
And the pawn has no proper setup
This is nothing you just wing with a few BP nodes
smooth sync is my best friend
If you ditch the CMC you need to code this yourself
The other alternative is the new movement component but that's too pricey for them
I would be interested in a link so I can add it to my wishlist
idk I think players are replicated fine but problem is in movement at my side I mean in my window it's laggy when I run editor it's fine smooth when I play standalone or client or exe it's laggy and really not nice
I can't find that via phone
if it feels like big ping its probably just not having prediction implemented
It's a 300 or so euro plugin
wowie
u already sent me it's not fitting for my purposes

Yeah I'm talking to sumrex
ah sorry
i checked it I think it's not usable for me because I joined DC and they have not finished replication for flying pawns etc
so no it's not good for me
they are planing to finish it
i red their dc
Right

smooth sync is just a component you put on an actor
its really basic prediction (if you can even call it that) but its good for simple stuff
Yeah but keep in mind that smooth sync isn't doing any prediction or?
Only extra and interpolation
yeah thats the word
i think u should see a video what I mean what is my game doing I smell here a lack of communication from my side heh
So if you don't do client auth movement then this won't fully solve it
smooth sync has a checkbox for client auth
dunno if it works bc I havent tried it lol
Well I'm using this engine for 7 or so years now. I've shipped multiplayer titles. If you tell me the movement is laggy with ping and that you use a pawn with RPCs then that's usually meaning that your setup is lacking all the stuff the cmc implements.
Prediction
Reconciliation
Interpolation
Extrapolation
Corrections
Etc.
And I can't give you a magic answer to your problem
sorry master
cmc is char movement component right
Yop
or have i misinterpreted the whole thing lol
i know but maybe I thought it can be problem in CPU when I have 99% usage it can lag no?
Sure then hunt your CPU problem first
yea that's the problem no idea how to solve it I am not using any materials anything empty map with gray colours
and 2 players
weird
anyways it's late I am tired good night guys thank u for answers and forgive me my words if it touched u
i am sorry
profile
You should try to profile your game to see what is causing the high cpu is what Max means. #profiling (:
Hello, anyone here know about networking and custom movement modes? I'm trying to find someone to help me with those.
yeah thanks for explaining it properly β€οΈ
Right, sorry this is my first time asking for help like this. I'm still fairly new to unreal and I tried to figure it out from an online tutorial on networked movement modes. It works on the server but the client keeps rubberbanding and I cant figure out why.
Dumb question, I found a variable FVector2D SpatialBias; in Replication Graph (GridSpatialization2D). By looking at the code, I think it's the offset from center, but I am not 100% sure. Can anyone please confirm?
Does anyone know if GetCachedUniqueNetId() is only set if you're using the OnlineSubSystem or can this be used for a custom dedicated server without sessions too? Trying to get a unique player id per player that joins but not currently using the online sub system
if you're using a real OnlineSubSystem
FTFY. The default Null OSS is fake/limited
What does that mean sorry? When I print the GetCachedUniqueNetId() is it blank, are you saying it's not actually null?
It's not set, or it's not unique, meaning that it is meaningless in a Null OSS
You need to be using a real OSS like Steam/EOS
Null OSS is just for LAN sessions and works based on local IP addresses basically
Ahhhh okay thank you, makes sense, didn't realize it was called NULL OSS like that
Yeah its name is weird too, but it's worth its name
Does it have any use? Or what do people use it for?
Well you don't really care about your OSS at a very early stage of your game, as all your concern is to basically make sure your multiplayer features work. And iirc there must be an OSS by default for the engine to function, so it's a placeholder before it's anything else
Also it's there for the simple use cases and the ease of setup (well it's already setup for you)
But I don't imagine games being published with it really
Ahh I understand okay. And I'm setting up proximity voice chat with Vivox and needed a unique player id to send to vivox servers so was trying to use the CachedID for a test, but perhaps I should setup EOS OSS for accounts now to get a unique ID
Yeah. Or you could roll your own method of assigning UniqueIds to connections (basically extend the Null OSS), but that sounds to me quite an overkill when it's already implemented in other OSSes
Right yeah, right now I've just been randomly generating a number, but wanted to make something better now, so probably time for EOS now. Thanks for your insight, appreciate it π
Does anyone know what format of the URL ServerTravel expect me to send for "Game" option? It should be an game mode blueprint/class. Just name or full path?
It should be the an alias name of the GameMode you want to load
Look into Project Settings at GameModeClassAliases and you'll understand
how do I check if two actors have the same owner in multiplayer?
Actor1 > GetOwner() == Actor2 > GetOwner()
thx, is it possible in BP?
Yes
like if I have nested ownership, will it still work? ie, if actor1's owner is A, and actor2's owner is B, but B is also owned by A
if I use getowner(), i will get A and B, but they are not ==
I'm supposing
Run the game, type stat Game into console, show us the screenshot
Probably easier to make a recursive function that travels up the ownership chain of an actor until it's null or a player controller and then return that. You can then == that. Generally most everything network owned is eventually owned by a player controller.
I forget, replicated struct, does the entire struct get replicated or just the value that changes?
Only value that changed
It exists: GetNetConnection π
game instance exists on the server right?
On every instance of the game, so yes
Fair. Hadn't thought of using the NetConnection, but it's as good of a test in the end.
Yeah, it is basically the function the engine uses to check if an actor is capable of firing server/client RPCs. Also confirms your test a while back to when it is safe to do so (OnRep_Owner that was)
So is there a way to know (from a client's perspective), when an actor successfully gets replicated?
Is it just "OnRep"?
Usually when its BeginPlay triggers
+- the condition of the Game actually having started of course
So BeginPlay and then like "get the local controller and do something"?
Depends on what you are up to here
Players that spawn in the match for the first time need to be viewing a camera on a replicated actor
For the Host the actor is there when BeginPlay starts on the controller
For the Client, the actor does not exist yet
PostNetInit()
On the actor?
Well that'll be called the first time that actor is "initialized" from network
If you want some other object to listen out for it, you'll need a global delegate you can subscribe to or something
It is since it's a new actor (so long as it's spawned at runtime, not placed in world)
I'd just use PostInitComps tbh
and broadcast the event
Listeners can decide whether they care or not
COND_InitialOnly will send the initial value even if it is set later in gameplay yes? As long as it is the first time it is set?
no, only ever once
Or at least, only when the channel is opened first time
And so long as it's different from the serialized value
So if it starts out as null and gets set later, then COND_InitialOnly won't actually send it?
correct
Hi everyone, I'm having a hard time to use the Teleport function with a replicated pawn. Sometimes the teleport don't work and the pawn just stay at his place. Check the picture to know how I teleport in BP. I'm posting in multiplayer because I'm not sure if it's related but since the pawn is teleported client side and the client send the location to the server maybe it interfere somehow ?
guys what can cause this? I was trying my game now and I was shooting this plane on the right in circle life was replicating exactly like on left window everything was fine but suddenly I saw on the right that my plane in square on the left has different direction even I was still hitting him and then few second later my plane on the right dissapeared from map of the plane on the left like he got disconnected and both were on the map alone
little bit weirdo
π
I don't think we can know what's really happening, it's too broad of a description and we don't know how any of this works at all. Have you tried to debug the related logic?
I am trying find in logs anything if he is kicked or what but i Dont see anything weird there
I mean to debug with breakpoints etc. Logs are probably not enough to determine what's happening
They would show if the Player disconnected quite clearly though
can I send here youtube video where I can upload behaviour of it?
or i can upload right from the chat?
but this time I am running it via standalone and I dont have big cpu usage
This is how it looks, movement is laggy as I said yesterday and I have feeling that replication is not exact + then that plane just dissapear which is weirdo i will try debug it somehow
oh video is big I try to convert it
Idk about the freezing while playing
But the other window is simply reducing frames cause it's in the background
The actual lagging you get is something you'll need to #profiling
https://www.youtube.com/watch?v=N00wgNXXU-s&feature=youtu.be - youtube link i will delete video because its not good to download anything from discord, my bad
yes will check
at 1:28 +- one of the plane dissapear
anyone ?
if you are calling that client side it wont work - you need the server to move the client. So get the client to ask the server to move it
ok, I didn't want to go that route but will try that π
thats literally how multiplayer works though - the server has to do the actions on various actors so that it replicates. Read the guide pinned to this channel if you need to know more
yes I understand that but here since the client sends its location to the server, the client sends its new location to the server. Here the server never says which location the client should be. The teleport currently works something like 80% of the time. But yeah... Will do :p
thanks
Hello, I have been fumbling with an idea to get an ability to stay active while the owner hold down a button. Basically a held ability.
However, the spawned class needs to get info from the owner that the button is still being held.
My first thought is to have a function on the server that asks the client if the button is held and returns true or false but this sounds like a lot of back and fourth.
I'm reaching out here to see if i'm on the right track or if there is a better option. I appreciate any help π
#gameplay-ability-system simply keeps track of the Button being pressed or not
It's a boolean on the AbilitySpec that says InputPressed
Together with 2 RPC Events for Pressed/Released
It has to be said though that Epic had to add a security measurement to allow the Server to kill off the Ability if the Client ended it, because otherwise it could get stuck, waiting on Input forever
I made my spell system before looking at the UE ability system.
Maybe this is the final push to move over to that.
Is the 5.1 version needed or is 5.0 okay for the ability system?
I have an asset im using that has an issue in 5.1
We shipped games with 4.25 with GAS :P don't worry
Woot, Thank you π
so I have a projectile that can add a radial impulse to my vehicles that are fully client simulated and I'm unsure how I should go about adding the impulse
void ARacingTankProjectile::OnHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp,
FVector NormalImpulse, const FHitResult& Hit)
{
if (HitComponent && HitComponent->IsSimulatingPhysics())
{
HitComponent->AddRadialImpulse(GetActorLocation(), ImpulseRadius, RadialImpulseStrength, RadialImpulseFalloff, bImpulsionIgnoresMass);
SetLifeSpan(0.1f);
}
}```
for now I added this to the projectil's OnHit but I'm not even sure it's called in the client
Hit will be called on everyone that has the projectile and the vehicle
And has the same sort of setup and actually causes a hit fwiw
The more I narrow down this root motion bug in 5.1, the scariest is becoming...
Reported this bug about a month ago, it is a new behaviour in 5.1. Iβve been able to reproduce it in a blank scene. Steps to reproduce: -Make a character with an AI controller and focus the AI on a moving player. Make sure that you let the character rotate towards the desired rotation in the character BP. -Add some logic in the character AI t...
I've got a doubt about how to go in the networking of GAS abilities in our game. Since it's an RTS, we use manager actors to replicate data (having one channel per unit is not feasible). We're using GAS to do everything related to combat, melee attacks, ranged attacks, special abilities, etc. I think GAS components replicate through the actor (in this case, each unit) but we're trying not to do that - is there any way to have the ability system components on each unit, but replicate through a manager?
A workaround I can think of is to not replicated the GAS at all and let it run independently on client/server, but only generate the effects on the server and replicate the results (for example, if one unit gets damaged, the damage calculations happens only server-side and the new health gets sent to the clients as a server update). Client-side, only the aesthetic effects would be played (animations, fx, etc)
So - I want my characters to move slower when strafing left/right and walkin' backwards. Is there a smarter way than to just update the MaxWalkSpeed of the CMC when those inputs are given?
change the input value to 0.5, 0.7 etc rather than 1
in settings
guys how do i implement multiplayer in ue5 can somebody please dm me a video or something to explain
Way too broad a question. Check the pinned posts.
https://vorixo.github.io/devtricks/network-managers/ Maybe adapt this to your scenario?
Not sure how well it would work under a GAS scenario though
thank you so I guess if a client perceives a hit from the projectile it should run that? would you recommend rather letting the client decide if it got hit or should I let the server decide?
and if the server decides how can I replicate the effect of a radial impulsion on a client's vehicle when it's potentially not at the spot where it got hit in the server
Thank you for your help. I moved the multicasting into the character parent cpp class instead of the movement component, and now everything seems to be working.
You pushed me in the right direction. Thank you, it's greatly appreciated. Have a great day βΊοΈ
Yeah, something like this - thanks for the link π
But dunno how does it go with GAS
Hey all new to unreal. Does it make sense to use a replication graph or override AActor::IsNetRelevantFor for things like pawns hiding behind walls or something along the lines of a smoke screen to prevent something like wall hacks? Seems like it would be computationally expensive to add stuff like collision detection, and there might be problems with like people coming around walls or out of smoke becoming replicated network relevant out of nowhere on the client that might feel jittery. Is this a path worth going down? Just trying to get a sense on networking in unreal.
I mean regardless of Unreal, there will always be latency in place when you go around a wall. I believe the creators of Valorant do it but with some adjustments to the technique (and also done in Unreal) π
They have an article about it somewhere on the internet. So βtechnicallyβ sure you can do it.
Guys, one question, to replicate the information of my stat of my character, that is, my chosen character, my nick and my statistics, to the rest of the players when I start a game, we must do it in the player stats or is it correct to do it in the player controller and then do the replication in multicast
I currently collect the values ββin my playe controller and then from there I call a replication function that I have in my pawn controller so that it is displayed to all players but I don't know if it is correct
I was watching the valorant video on how they rewind for actors only within a sphere collision that extends throughout the map, but I just found this: https://technology.riotgames.com/news/demolishing-wallhacks-valorants-fog-war which seems to answer my question! Looks like they went down the Ray tracing / collision issue and said it was too expensive and decided to make grids
Player controllers only exist on the owning client and the server. I would personally use PlayerState or indeed the Pawn/Character π
guys is there in game mode any function for override which can end match? Or restart map? or anything like this I mean when one team will lose it will tell You won or you lose and then it will kick them out and restart current match
If you do not have seamless travel enabled just open a (different) level and it will kick all players.
I believe there's a state somewhere in GameMode or GameModeBase for ending a match, starting it etc. but it doesn't really do much on its own, might as well make your own enum or name for the current state or similar π
i found this so i thought if for game over
but I am joined on session
Sessions have nothing to do with kicking players or not. Sessions are a way to find others and give some info. You can still kick players just fine by opening a level π
is there way how I can get player variables (his team, name) in game mode?
I cant get any of these info
it is stored in his game instance
That should be in the PlayerState
Game Instance is only ever accessible on the local instance of the game. You can have the client send an RPC to the server (on their playerstate or player controller) with the data and then the server can store it wherever it wants.
Can someone tell me how i can show and update my teams hud like this image. Or at least point me in the right direction. Like add the team widgets to as a child and update each teams widget at least the health portion like in the image. So far im getting the info from the teams player state but its not reflecting at all.
Any help would be greatly appreciated
Kind of complicated to explain that through text. First you need to make the playerinformation UI (name, health, mana, etc)
Then you need to make a panel UI which serves the purpose of managing these playerinformations UI's.
The panel UI should have a vertical box or whatever you want to use as alignment, and then it creates a playerinformation UI for every teammate you have, assigns the player ID of that teammate, and then finally, you add that UI to the panels vertical box
Does that make sense?
If not then I don't mind showing you after I whip up some coffee
Well i i got the add team hud frame to ui as a child to a Vertical box, but now i cant seem to update the info like if a team members health has updated it should reflect on his Team Frame widget, instead it updates everyones widget on the team, ive tried thru event dispatcher as well and same results
Don't need any of that. You can do that if you want but a simple timer by function or timer by event is just fine In this
I usually do every 0.3 seconds
Update all the relevant information by getting it and then setting it
If you wanna be giga Chad max performance than you can deal with event dispatchers but I dont think it's necessary for small UI stuff like this
How can I start multiple singleplayer clients to check host/connect buttons?
PIE with multiple windows without auto join, or just launch the uproject file multiple times.
Thanks
@fathom aspen Has GMC received your seal of approval yet?
I'm having a weird issue that happens when I launch standalone instances of my game from in editor. My game runs with with a server and clients. I have a bunch of replicated actors that fail to spawn on clients. The left window is a client and the right window is a server. All the white squares, the timer in the center and the green divider flames seem to be failing. The kicker is that everything works perfectly when I do a packaged build, but that's too slow to iterate on so I'd prefer to do my work launching from in editor. I also get this crazy log output. The top is the server and the bottom is the client. Does anyone have any idea why this is failing?
can someone dm me or tell me how to make a simple multiplayer so i can play with my friends
Well if you can kindly show me i would highly appreciate it, and Thank You
Hello, guys 
I have strange problem after updating to unreal engine 5 from 4. It seems that dedicated server works after building, but not the listen server
but how do i make it
slots in the server browser are shown incorrectly, cant join, servertravel doesnt work, like it launches on the non existing server or idk. But if i check that event on server only then it still launches in client atleast as far what i see in console
You watched that already?
yeah it didnt show me how to do it in blueprint
Have you made a game before?
yes
Sure it does, it teaches you multiplayer concepts which apply for both BP and c++
its just that im not the best at ue so i need help with doing it in blueprint
Well feel free to ask questions, try to be as specific as possible when describing the problem you're facing. But if you want a private tutor or something like that maybe you could look into hiring one of the many suitable candidates over at #hire-a-freelancer ?
ok
@near basin Also you may want to read through the pinned messages on this channel. There's tons of good free resources to help you make a multiplayer game.
when using 2 different mesh for fps multiplayer game, one mesh is for hand and other for full body , is it better to use 2 weapon meshes ? or only use one mesh and make different attach socket for them?
I'd just parent it to a different socket, depending on which view I'm in. That'd be my first approach.
so how can I make it ? because a view is for player itself , a view is for other players , I used IsLocallyControlled() , but it does not work good for switching weapons
In your attachment logic just attach it to MyMesh which would be different for first person and 3rd person
name the sockets the same and it'll all Just Workβ’οΈ
Just change what MyMesh points to depending on local or not
Gun attaches to MyMesh.GunSocket
for other players , they must see the weapon attached to full body hand mesh , but for player itself , it must attach to arm hand mesh in first person view , How to distinguish between player's view and other players' view?
When you go to set MeshIShouldAttachThingsTo, check if you're locally controlled or not
do mentioned this ? IsLocallyControlled()
because for switching weapon not work
I used that
why not
Hey everyone, I'm still stuck at my old issue,
I used onswap controller and got a reference to all the player controllers. I also spawned characters on the level.
When I try to let the client possess a character, it does not work.
If the very same code has a delay node, it works and the client possesses the character. Does anyone know why that is please.
Feel free to mute cringe voice, I tried to do some quick explaining but yeah. Keep in mind this is like super basic way of doing it just to get your foot through the door
it's all commented if you need to pause
look at it
btw - you should check your discord message you got π€£
Thank you so much ill give it a try once i get home. Again Thank you so much, ill let you know how it goes once i get home ang try it ok thanks
np, just ping me if you have any questions
will do Thank you
Well yeah that's on the server
Don't have the server say which mesh it's attached to. Have the server say which socket or just the fact that it's attached.
let each machine decide whether to attach to 1st or 3rd person mesh
Smart people:
I can't figure out why this won't work:
https://blueprintue.com/blueprint/aswe1zw-/
I originally had the class to spawn set to generic class reference of an actor class and it worked fine. But when I try to spawn specific classes so that I can feed in variables that are used in the construction script, it doesn't work on clients, only server.
Why are you multicasting to destroy the weapon
why not just spawn/destroy on server only
I don't remember why I did that. It wasn't getting rid of the previously spawned weapon before spawning another.
Assuming your weapon actor is replicated, just spawn it and destroy it on server
Until you really know your way around networking, assume a multicast is a mistake.
It's replicated. I'll try that again but it wasn't working.
Ignore equipping and attaching for now, just spawn and despawn the weapon and make sure that works
Equipping/attaching is done with a rep notify.
so CurrentlyHeldObject is replicated and has a repnotify?
Correct
And it works as long as I'm feeding the server rpc a generic actor class reference variable, which doesn't work for me, because then the spawn actor node has no context for the exposed variables I need to feed it
Oh shoot. Wait.
Standby
Yeah I thought maybe it was because I needed to also feed the "Current Melee Weapon Info" variable through the server RPC instead of having it inside but it didn't work
Hmmm. This is strange
GMC v2 will, it will be released in a couple of months (hopefullyβ’οΈ) 
By the way the author is planning on integrating predicted physics replication (they got ideas from NPP ^^)
hello guys, how are you? I have this error when compiling, does anyone know what it could be?
Yeah it's not replicating correctly for some reason. Works fine on the server but not on clients of course.
NPP?
Can I not call a server RPC from a client on a listen server model?
Ok. That's what I thought. And I'm calling it from the PlayerCharacter so the client definitely owns it.
Do I need to spawn the actor and then set its variants during a rep notify? I thought I could just set things up in it's construction script using one exposed variable
Network Prediction Plugin
I don't get it man. This really makes no sense. It works just fine on a different server RPC that is almost identical to this one.
Btw what's GMC v2?
General Movement Component version 2
Basically it's more of a revamp and improvement to the GMC
Can a multicast RPC arrive before an actor has begun play on a client similar to how an OnRep function can be called before being play is called on a client? Or is it guaranteed to call after?
I mean if the actor hasn't replicated yet then the multicast won't be called on client
Yes it can be received before the actor has begun play(which means the RPC might not actually run) and onrep is supposed to run before begin play but I've run into issues where that is not the case but it's not intentional...
At least that was what I had last time I tested it (but I need to investigate it again)
So even if it's reliable it won't even be called on the client when the actor does replicate?
Yeah it seems OnRep stuff happens AFTER begin play on server and BEFORE it on client
Which is annoying, guess I just need 2 checks in code
Correct, won't be called even in that case
Order of function call matters with actor spawning and RPC's
However, I noticed that there is a setting/cvar that you can play with so they are queued
Or I'm prolly hallucinating
It's really something I'm investigating as I write my next article
@fathom aspen if you find it, please let me know because I'm gonna try it out
So if you were tasked with spawning a replicated actor and on the same frame as the spawn, setting a rep notify struct on it, how would you handle it to ensure the client calls their OnRep function with valid info? Just two checks, one in the OnRep func to check if already begun play and another in begin play to check if the struct is valid (and if not call the OnRep func)?
Booting source now, wanna try and find it hehe
I'm actually trying to do something similar with no success. I can use a server RPC to pass a generic actor class reference and then call spawn actor from that. But when I try to pass a specific class so that the node has context and can receive an exposed variable, it does nothing.
Yes to the general idea regarding on rep. When spawning actors I try to feed in as much replicated variables as I can so it starts off right and then in the actor encapsulate the handling in there...
Ok so the hacky dual checks are needed in that case, seems to be a common thing unfortunately
If you don't do the two checks clients will often call their OnRep too early and the func won't call correctly as the actor hasn't begun play yet
Yeah because OnRep is On Replicate, which we only replicate values to remote clients. While the server already has the source of truth for everything
I mean once in a while we have a similar question that is tied to replication order guarantees which are really scarce in UE. Generally you want to have a TryInit() function that runs in a bunch of different places (sounding similar to what you did)
One thing I've done is basically pool a bunch of the actor ahead of time and then your only having to deal with replicating the correct data and then you call that TryInit function(or whatever you want to call it)
But that's actor pooling and it's a whole other can of worms
Even if you had to pack those properties in a struct, they won't really be valid at the same time if they were unmapped properties (those that are assigned NetGUIDs)
It looks like this snippet from Exi is the common way to do it, was curious if Multicast RPCs could get around it but sounds like they don't
Yup, networked multiplayer is "FUN"
Ofc they won't. Not that they sound fun for such a stateful replication
I mean in my case it's a once off init so OnRep is probably the worse option
However seems like in Iris if you fire an RPC (prolly a client one) on BeginPlay you force the actor to replicate
Didn't 100% validate if it's true but I don't know if I like it (if that was true)
I don't even know what Iris is trying to solve at this point, I've heard 20 different explanations of what it does from Epic's own employees. I wouldn't even bring it up honestly until they finally do a live stream on it or something
Their new online multiplayer networking stack
It's SUPER WIP, with 1 document on UND that talks about how to turn it on... And that's it, no explanation of what it does, what it's for, and what it solves, etc. Just that it exists, it's new, here's how you turn it on but that may change!
Basically don't touch it till they tell us what its for
Hahha definitely won't be touching for a while in that case
I mean I'm still on UE4 so can't if I wanted to
Ah yeah... UE5 exclusive
Awwh, I was hoping to bother wizard cell with all my inevitable questions on it asap
I mean... You can... I don't speak for Wizard... But that was my recommendation when it comes to asking about Iris atm
https://blueprintue.com/blueprint/wm2-e7r8/
Alright so this is what is confusing. The top one works but the bottom doesn't. In the top, it just spawns whatever actor I pass.
In the bottom, it needs a specific actor so I can expose a variable and pass it. This variable has all the info for the weapon such as the meshes (going to be used for weapon customization if/when I can get this to work) and it sets the meshes in it's construction scrip. The Currently Held Object variable is replicated with an rep notify. In the rep notify it attaches the spawned item to the first or third person meshes depending on if it's remote or local.
Any ideas why the bottom one isn't working?
I agree with Yaw. It's really a hassle that it's not documented. I managed to "understand" a very few things with my past experience of the old replication system, but that is still nothing.
I'm still determined to give a try in a few weeks (after I knew how to make it work in binary versions π )
Is the bottom one run on a simulated proxy or autonomous proxy?
I have a suspicion that it's running on the wrong machine(simulated proxy) so it literally cannot make server RPC's
It should be autonomous proxy, it being the Character BP
But then why would the top one work at all?
Yeah, simulated means there's no controller for this pawn on this machine, so it can't run RPC's without a controller
Ah... hmmm should I be calling this kind of stuff from the player controller then rather than the player character?
Might be your running the top one on the autonomous proxy so it's working fine, you can run a "Is locally controlled" check or get the actor's local role
Hmmm.. I guess I'm not understanding. It's a possessed player pawn so shouldn't it have a controller?
I didn't look into the code, sorry, but also doesn't have to be from the PC
Exactly this ^
IsLocallyControlled is a really handy method that ends up being an oversight for most peeps
Possessing a pawn means they have a valid controller on the server and the specific player's machine. But on other player's machines that pawn is simulating possession
Even on your own machine you are a proxy for what the server has but you are autonomous because your a human on the computer, so your player on your friend's machine is simulating your proxy
Language is fun
Ok. I'm not second-guessing you. Tone doesn't come through via text so the following question is just for my own understanding, to avoid this kind of thing:
If these two events exist in the same graph on the same pawn, why would one be running autonomously while the other is running simulated?
Totally fine, I like explaining this stuff because it's a concept that tends to have to have lots of questions to fully "get" it.
Yes they can exist on the same graph, it all depends on where it's being called from, so if your running an OnRep, which can run on both simulated and autonomous proxies then it only one running instance would actually be able to run an RPC successfully
So it may be the thing where equipping an weapon is getting called on the wrong machine
So you can print out the local role of the actor(which is how you know if it's simulated/autonomous/authority) to debug it
Also as a heads up owning client is autonomous proxy
ok. Very interesting. I'm gonna try to absorb this little master class you've just given. π Much appreciated! So no by running IsLocallyControlled and pulling from the true branch, it's working fine.
Is Iris even getting commits?
All I know about Iris is what Epic claims - a new networking thing that is supposed to improve how many actors we can replicate
Considering @pallid mesa isn't talking about it here, seems like the answer is no
But world partition is still a roll of the π². So we'll see how it turns out in 2028.
And WP was supposed to be a big feature for UE5
I'm in the camp where UE5 needed more time in the oven...
Eh - it's been largely fine for me honestly. I mostly don't use the new stuff though π
Right now, the biggest benefit to using UE5 is using UE5Coro π
I feel like I wanted to master UE4 more before I'm overwhelmed with these new features xD
@whole grove you got a fan
Live in the fast line like me π
I'm just sittin' here at the thought that the best thing about UE5 is being able to use a third-party plugin π€£
I see too many πΆ
You are destroying it, then trying to get its class
It doesn't exist any more
so it doesn't have a class to get
Break your function up, it's not obvious that spawning an item should destroy the item you currently hold
It's working now with with an IsLocallyControlled check.
That's still gross. Destroy the weapon on the server, not just on the client
Wait. I'm already calling the destroy actor function from the server RPC. How is that not destroying it on the server?
Show your code from input to the end of that entire function chain
To start with, don't tell the server your currently held object. Server should tell clients their currently held object
This is how this part should be
So... don't pass that into the server RPC? Just attach the variable directly in the server rpc
The server should be the one setting that property anyway, it should be a replicated property
The only thing that passing it from client does for you is to allow one client to tell the server to destroy literally any actor in the game
ah. Hmmm. So since the Currently Held Object is set in the server rpc after it spawns, destroying it on the server will be fine. Got it. I'll try it out when I get home.
Basically the crux of the matter is, the SERVER should be the one saying what object you're holding
Gotcha. Thanks. Much appreciated. I'm still trying to get used to replication. It's so much different than vanilla coding
Basically completely ignore the fact that Multicast is a thing for now. Make stuff work with RunOnServer, replicated variables, and onreps
That'll get you most of the way there
Ok. And that includes playing anim montages? I looked at a few tutorials about replicating animation and they all used multicast rpc's
Transient stuff like animation is where you start thinking about multicasting
You'd multicast an animation
you would NOT multicast picking something up
because after a little while, it doesn't matter if the animation played or not, but it DOES matter that the thing you picked up is still picked up
transient vs stateful
That totally makes sense.
Should I be checking and adjusting things like health and ammo count on the server as well or just client side?
Server for sure but that gets into prediction if you don't want lag
that's when it really gets hard
So something as fundamental to an online shooter as firing and reloading aren't straight forward? π lol
they are not
making a tight shooter with prediction is not trivial
Oh I don't expect it to be. I'm just surprised that there isn't more straight-forward documentation or tutorials for Epic's best practices for accomplishing things like this.
There's something I don't understand with dedicated servers, if I have an open world with ~70 players + AIs, the server has to compute all their Physics/SkeletalMesh/Movements in the same thread (game thread) at 60+ times/second?
Yes/No. It depends on your technical requirements. You can make a game where the client simulates a lot of stuff in between while the server is only ticking at 10-20 fps. A lot of the heavier stuff is not used on Dedicated. Animations are off by default, they don't run a render thread so no materials and such. The server only needs a general approximation. A lot of tiny details really aren't important to gameplay code as much as they are to make a player 'feel' like the world is more alive. You don't need to have AI running that aren't near a player, etc.
I see. Thank you for the detailed answer.
I did some tests with human AI characters and my main issue is the movement component. If I need to handle hundreds of AI characters do I have to implement my own movement solution? How would it be faster than UE movement component?
If you have to ask, it probably wouldn't be faster.
I mean it could be
but in general, tons of players is HARD
For local multiplayer, how would I go about detecting the amount of connected gamepads to spawn the right amount of PlayerControllers?
Hello, the variables are not replicated to new joined players? by session subsystem?
Which variables?
why does the client have authority when I test in editor?
I swear it should be remote
Many reasons
Play as Standalone, Play as ListenServer, Actor is spawned from the client
are you sure? firstly, that node isnt hooked up in your screenshot. but even if it "really" is - try doing "run under one process -> false", and see if that helps.
I unhooked it cuz it was authority
so it was messing with me, as I was using the remote pin
and it didn't work
debugging
okay
So
This is why it's always important to provide context
Most likely the actor is not actually owned by the player
Which is why the code is actually executing on the server, which has authority
A print string would've revealed that
π
Since presumably you're doing custom stuff, spawning an actor and manually possessing it
you also need to set the owner and you'll be golden
always debug first using print strings, or logging from C++
Hm, not sure tbh. What we did before was spawning the maximum amount either way
In the MainMenu at least
And then have players press a button to "join" the game
A Gamepad can be connected, yet the players might not want to use it
I do, the issue was elsewhere, but your answer directed me in the right direction
has anyone implemented saving system for streaming levels?
i have a situation where i save an actor location on the server when the streaming level unload and the location is loaded back in when the level is loaded
everything works fine on the server but the location is not updated on the client
That's what did for now... Spawning 4 player controllers at all time.
Yeah and that's theoretically fine
It's been a long while since I worked on a local coop game
But back then I didn't know how else to solve it
Specifically since I wanted input from the Gamepads
So I needed the PCs to exist
Later on I marked them as "This PC actually is actively being played." with some boolean.
And then did further stuff with that
I think I destroyed the ones that weren't marked as active before traveling to the actual gameplay
Just so the automatic Pawn spawning of the GameMode didn't bite me
But it's been surely 3+ years. So I can only vaguely give you an idea of what you could try
Agreed, there is likely something a little more streamlined, but for now your approach will do for me.
Maybe yeah :< but not a lot of peeps do local coop sadly
At least not this specific setup
Or at least no one freaking talks about it
@thin stratus this seems like an option.
https://forums.unrealengine.com/t/is-there-a-way-to-detect-a-gamepad/300603/4
Yeah, I guess local coop is not the most common out there. Nintendo does a lot, but obviously it's not UE.
Partially true. I remember them searching for UE devs
Not sure if Mario and Rabbits was UE or something like that
Although that might have been snowdrop
Hey folks. So if I wanted an actor that just exists in the map to be able to call a a server RPC, to spawn things for instance (let's think mob spawner in a multiplayer game), how can I do that? I'm still learning but server RPC's can only be called by the owning client right?
If it's a mob spawner then you shouldn't really need a Server RPC at all. The clients wouldn't be requesting anything, the spawner logic would just run server-side anyway
You use RPC's when a client wants to ask the server to do something, or vice-versa
Ok so by default, the actor that is part of a level, any functions/events on that actor will be running on the server?
If the actor is part of a level, the functions will run on all instances.
If the actor is replicated, then you can use the HasAuthority() check to guard against clients doing things
If it's NOT replicated, you could/would guard using IsNetMode(NM_Client)
latter is probably better in both cases IMO
Hmmm.. Ok. Thank you for answering. I need to do more research
Essentially what I'm saying is there's no inherent mechanism to stop code running in any network domain
so i dont understand whats going on, i have to try ask again.. im setting an actor transform on the server from a save that is stored on the server. why on the client the actor location is not replicated? if i use a literal transform it works fine
A client could call the body of a Server RPC if it really wanted to
Does the actor replicate movement?
yeah it is a character
Who owns the character? A player?
server
And are you also sure that the client isn't also loading + applying that transform?
If so, they may override whatever the server is setting locally
ok. I guess I just need to figure out how to get an actor that exists in the map and isn't owned by any players (except I guess the server player because this is listen-server model) to spawn actors that all players can see
The actor would just spawn some replicated actors, that's all
You just need to decide when and where to call that code
if i just replace the transform from the save with a literal one it works fine so i dont think anything is overriding it
Ok makes sense.
yeah it doesnt mean 100% that is not being overrided but yeah. all of this is running on the server..ill check once again tho
Where was the issue?
race condition
Classic
There's an easy way to handle those with subsystems, because you can very explicitly state the dependences and avoid race conditions, for game initialization
Ofc there's a gazillion other ways, happy that you found and fixed it
it is something that has to do with the ragdolling of the character.. i dont know why i didnt check before (a full day now on the issue) ty
ffs π
I've been trying to find your "use of templates" graph meme/pic for a while
Now realising I could have just MSpainted it
So based on what you told me, I am now successfully spawning on the server, but there are variables that I need to pass to the spawned items which aren't showing up on clients, only the server player.
Specifically in this case, I'm spawning keyfobs that each have their own unique password. The password displays on a widget component on the fob. This works fine for the server player but not for any of the clients as stated before. I'm not sure how to ensure that these passwords are passed to the spawned items. The variable being passed is replicated.
And I have tried OnRepNotify to manually set the fob's password value when I generate the random number and set it as the replicated password variable.
Nevermind. Solved it. The variable on the fob that stores the password was not replicated and now it is and is working.
pawn's location and movements also can be automatically replicated like character if replicate options is checked?
Hey everyone, I'm still stuck at my old issue,
I used onswap controller and got a reference to all the player controllers. I also spawned characters on the level.
When I try to let the client possess a character, it does not work.
If the very same code has a delay node, it works and the client possesses the character. Does anyone know why that is please.
whats not working exactly?
Hi, im having an issue with sessions.. from what i can tell if you have a session created you cant then find sessions as it'll just fail, but im using advanced sessions so if i have a session created and then use the find advanced sessions node the On Success pin gets fired but it wont actually find any results, so can you not find sessions at all while currently hosting one?
the reason i ask is because im trying to make a party system, most games have it so on the main menu you can invite friends then you can find a game / host a private session, but to have a party you would need to create a session to invite friends in, but then im unable to find sessions to join a game? i can host a private one by using the UpdateSession node and moving all players to the pre lobby level but if i wanted to invite friends while im on the main menu and then find us a game that im not the host of, im unable to find sessions whilst hosting a session lol so how am i supposed to be able to find games with a party of friends?
how to get the other computer's pawn location to my pawn when using same pawn class in all clients?
However you want. Explain in plain English exactly which location your pawn should be getting. Is it "get the location of the only other pawn in the game"?
@lament garnet the client's possession of a character
Sorry for being late. Had to leave the house
you are calling possess on the server right?
yh
i can show you what i did
i think it would be better to stream it tbh. Because i changed the original code, checking , if it solved the issue
but results stayed the same
sorry whats the issue again?
im trying to possess character pawns. it always works with the host, but it only works with the client, if i use a delay node at the beginning of the event. otherwise the client wont possess it
inside the game mode
Show your code
im grabing the player controller variable i got from the onswapcontroller and using the possess node to possess the pawn
that pc ready stuff is there, because the delay made me think, that something wasnt ready yet. and i tried to make sure that everything was ready
hello i have a dedicated server running on Linux and when i connect to it with a client through the editor on Windows with the same codebase i get:
LogNet: Error: Server is incompatible with the local version of the game: RemoteNetworkVersion=2689847860, RemoteNetworkFeatures=LegacyReplication vs LocalNetworkVersion=3278373821, LocalNetworkFeatures=LegacyReplication
LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = OutdatedClient, ErrorString = The match you are trying to join is running an incompatible version of the game. Please try upgrading your game version., Driver = PendingNetDriver IpNetDriver_2
am i missing anything, or its giving different network version because the client and server are running on different platforms?
the last one doesn't make much sense, because that would be too troublesome
You can simply have it ignore the different version via config
@verbal tendon i assume with the net.IgnoreNetworkChecksumMismatch=1
Yes
Different platforms give different checksums. Implement your own version checking. Tie it in with CI/CD version history, debug symbol files, yadidadida
I have a bit of an odd issue and don't know where to look. I am setting a charge value for an AnimBP to use. I tried setting it on client, on server, didn't matter. The value gets set, but my AnimBP doesn't work on server. On the Client it works no issue. On the Server it doesn't update at all, even though the value is set in the AnimBP. Play in Editor as Listen Server. The Player (host) does not see the animation update. No other clients.
Show how you're setting that variable.
Does it matter tho when the variable is set and shown in a print? It is set on the Actor currently, using a get anim instance and cast. Tried running that code on client and on server. The variable is set.
Do it the other way around
Have anim instance fetch it
Tried that too
and tried setting the variable it's fetching
as replicated
as datura suggested
have anim instance print it in the logic graph, does it print correctly?
Show the whole chain of logic from where you initially set it to the anim instance
If I can get it fixed, absolutely worth getting less sleep haha
aite
Gets called in a gameplay ability
Runs this event with no replication set, just default custom even and does this. (Tried running it on client and server as well before)
and also tried this approach with removing the set from here ^
and moving it here
that's all of it
This is the first mention you've made of using a gameplay ability for this. Gameplay abilities change things up quite a bit.
Print that booll. Is it synced?
I don't know a ton about gas but I'm fairly certain you shouldn't be calling run on server events inside of abilities. That's the whole point of abilities is that they kind of self-manage and predict
If you are using gas I would think the charge should be a attribute, especially if lots of things can charge up
it's just a visual representation and it's a bow charging
So if you print that float on update animation, is it synced up? You going to find out if the problem lies in the float on the actor not being synced, the float not being received by the anim instance, or the float not being applied in the animation graph. Just start printing it
well for now it's really late and I'm going to sleep, thank you for your help, I'll check everything tomorrow
Guys. Quick question: For accurate testing of a listen server model, I have my net mode set to Play As Listen Server but I get different results/issues when running in Standalone vs New Editor Window (PIE). Which one should I be testing in for accurate results?
Standalone, because PIE is just basically same process by default
Though I'm not saying just go standalone-only. I still adore PIE and use it when I can
Ok. Because I'm getting weird results out of the PIE that I'm not seeing in standalone. It would be nice to have the SERVER/CLIENT preface on debug strings in standalone but alas.
Yeah, but well you have -log windows
And you could also come up with your own solution to that, but never that I cared
I know how to make a batch file to run a build of the game standalone with a log window but I don't see a setting in the editor to open log windows for my standalone windows
There could probably be a setting in editor to make that appear, but I usually do it from commandlet
roger. Thanks.
I did, it's the float not being applied in the animgraph
Hi, is it possible to create a session/lobby without changing a map? π€
Greetings i hope you are all well. am on lecture 21 "call backs to our subsystem functions"
void UMenu::OnCreateSession ( bool bWasSuccessful )
{
if ( bWasSuccessful )
{
GEngine -> AddOnScreenDebugMessage
(
-1,
15.f,
FColor:: Red,
FString ( TEXT ( "Session created Successfully" ) ) // this is successful
);
UWorld * World = GetWorld();
if ( World )
{
World -> ServerTravel ( "Game/ThirdPerson/Maps/Lobby?listen"); // !!!! but this doesnt happen.
}
}
else
{
if ( GEngine )
{
GEngine -> AddOnScreenDebugMessage
(
-1,15.f, FColor::Red ,
FString ( TEXT ( " Failed to create session"))
);
}
}
}
i can successfully create the session after clicking host.
problem.
the problem is the game doesn't seem to be teleporting me to the lobby after i click the "HOST" button.
Strongly advise against hardcoding the path of the map in C++
Expose the level as a DeveloperSetting that you can read from in C++
I would also recommend using UE_LOG rather than screen messages, that way you look for your own and other errors in the log rather than looking on the screen
am following and udemy coarse . i apreciate your input either way . very much . i hope you have a good day . i have moved the server travel to when i click a button on the ui . that seems to work . no issure or crahes
Hello! I am trying to create a local multiplayer game but having some problems with player interaction, for some reason, the enable and disable input wont work, which causes my interact input to not read, was wondering if anyone would know what I'm doing wrong? Thanks :D
Im essentially trying to enable the input of a interact actor blueprint so that I can use my interact action input, I've tested the BP and it definitely reads the entire line for both begin and end overlap, but when I press E, the interact node isn't registered (just some more details just incase :D)
Just architecture and replication question :
If i got a struct with inside 2 FText, and One Bool (UPROPERTY)
This struct is stored into a TArray<MyStruct> replicated.
What happen when i change a bool ? Replication work correctly ? is it the whole struct who is send, or only the bool ? is it better to have two TArray, one for the two text wrapped into a struct, and one for the bool and replicate only the bool as only the bool is interessing for replication, with the same index ?
Only the bool is sent/replicated
The latter question is design-specific
If they relate to one another, then yes it's a good practice
If you want them to replicate together then look into atomic replication (pinned messages)
Hello, I have a problem with widget in multiplayer, I have custom variable energy and for debugging when I press M it subtracts energy by 5 points, but I can't get widget working, when I debug it with print string it showing correctly, but the widget doesn't change the value, can anybody help? I'm don't know what am I doing wrong.
My guess would be that it only updates on the server and not the actual client. Your "Energy" variable is not a replicated property and "updateEnergy" only executes on the server. But I might be wrong.
I changed it and now when client press M it's subtracting correctly for client but also for server but just in widget, but when server press M the widget doesn't do anything
Where do you call "GetEnergyText"?
Can you make sure that the Energy variable doesn't have some weird condition for replicating?
Thanks, just a question, if i replicate a struct, we agree that i should not mark struct member as replicated in the struct declaration ?
You can't mark a struct as "replicated" inside the constructor, only actors have that ability (and components? Don't remember exactly how components work lol).
You simply mark a certain variable that holds your struct as replicated with a uproperty but in the end it's the actor that is networked and passes on that struct π
just to be absolute sure : no UPROPERTY(Replicated) for a struct property, right ?
(i mean, i don't think we can't call them in get replicated override so...)
If you don't have a custom net serializer you need to mark inside your struct all variables with a UPROPERTY() but not replicated. But in the actor you would however do that.
UPROPERTY(Replicated)
FMyStruct ReplicatedVariable;
Yup, thanks !
is there a way to get the playerstate from UPlayer?
UPlayer has a PlayerController property and a GetPlayerController function. From PlayerController you can get PlayerState.
ty
hello is there a way for a client to access the options from the game mode? Since the game mode is not replicated to clients i'm thinking like game state, or something like that
gamestate is probably ur best option
as far as i know u need to do it urself
unless those options are static
which i assume is not what u want
what do you mean?
well if those options dont change u can just put them on the gameinstance and you can have a copy both in the server and in the clients
altough with no comunication
but those options are only stored in the game mode when you call the map when creating the server
so there would need to have some communication between server and client
Hey,
I have a issue where I have a component with a replicated array of vectors that doesn't get replicated to the new client, until I add a entry to the array on the server.
Any clues?
Either store the options as replicated variables on the game state or you'll need to do a Client > Server RPC on something like the player controller, which then can read the game mode, and then you pass the values back through a Server > Client RPC.
@sinful tree i'm doing variable replication right now, just wandering if that information was automatically replicated
thanks for the help π
Hello everyone, I'm still sitting on the possession problem.
The first image will be the code and result with delay.
The second will be without delay.
Does anyone know what could be causing that problem?
I don't believe that putting a delay there is a proper solution.
you need to do a bit of digging yourself
you spawn characters in advance?
characters are spawned on begin play
all characters were found when doing the print as shown in the image
what about the player controllers?
also found as shown on the image
if this is the game mode you are only display what the server see
maybe at that point the client does not have yet the characters spawned on the server
of course delay is not the proper way to go, if thats the issue you have to find the correct event to use
Hi, is it possible to find sessions whilst having a session already created?
yes
are you sure? ive got it so that it creates a session as soon as the main menu is loaded, then if i try to find sessions the find sessions node will fire the on failure pin every time
but if i dont have a session created, it'll find them just fine
any 1 has any idea why this line "AProjectArenaPlayerState* myPlayerState = Cast<AProjectArenaPlayerState>(NewPlayer->PlayerController->PlayerState);" would crash in the login function of the gamemode?
im not an expert but in my project every player has a session and can find other sessions at any time without issues
Are you using the normal session stuff, advanced sessions or something else?
it works with the normal sessions too
nothing special, just destroy the session before joining
but find works fine
So im trying to make a party system, main menu loads, creates session, then you can invite friends
if i destroy session before finding sessions, wont it kick all friends?
PlayerState or Player Controller may not be valid at the time that its being called?
ye thats what i figured
i just wanted to be sure
should i be parsing options in the login or postlogin? login has an option argument but the game mode has a "optionString" variable, so i am quite confused on wheres the best palace
is the options argumente in "login" even the same as "optionsString"?
i mean destroy the session before joining the other one. i dont know how to help with your case sorry. ive got mine working by trial and error
No worries, the problem is that im not trying to invite friends in to an actual game, im trying to invite them in to a party whilst on the main menu, then the host of the party can find a game (that they're not the host of) and join it with all party members, exactly the same way most games do it
so far im not having much luck tho π
does the gamemode wait for postlogin to resolve before accepting a new connection or are Login and PostLogin async?
does ue4 accept player connections async at all?
The packets are handled async, the logic is handled sync but that should be so fast that you'll probably never notice. Imagine if Fortnite had to wait on every player joining their game haha. Be prepared to spend hours waiting on a match to start if that was the case :D
so i can count on my variables not changing between login and postlogin then??
If you have one single variable for a specific player, then absolutely not. There's time in between it.
i have a steamID
ok so, whats the best way to handle this
should i do the optionstring processing in the postlogin?
it seems a bit odd since they give you that as an argument in the login function
What do you want to do?
i want to get the players steam ID
which i pass as an argument
and then i use that ID to make some calls like inventory
and seting up teams
and im not exactly sure if login is the best place to get it, even tho it seems like it
why would "login" even have options as an argument if things werent ment to be parsed there?
the thing is, PostLogin doesnt have the player options
so i am a bit confused as how to pass that information from Login to PostLogin
Hmm.. It kind of depends I guess. And I'm not entirely sure, the docs seem to say you shouldn't use any game logic in "Login" because not everything is initialized yet, but I don't actually know if that means whether or not you should use it to initialize your own stuff yet (has the client passed all necessary login processes for example yet?) but I feel like it makes no sense to not keep those options around longer than just the very login process. Looking at if I can find anything.
my issue is passing the information, since u told me that things can change in between those calls
With knowing now that you meant the actual player given values then no. I thought you meant keep track of your own global variable and hope no two players join at the same time.
It would be very odd if a value has been set like the player ID or whatever and it suddenly changes out of no where π
Assuming it does exist at that point though.
well its not out of nowhere, my concern if for example, player 1 and 2 connect at the same time or try to connect, function login is called for player 1 and sets the variable then player 2 connects and overwrites that variable, by the time player 1 is getting to postLogin the variable has the value of player 2
is this not an issue?
Not sure. The docs say "shortly afterward" is when PostLogin gets called.. But that could be seconds or directly afterwards :/
The player controller is not fully initialized within this function as far as networking is concerned. Save "game logic" for PostLogin which is called shortly afterward.
Welcome to the wonderful world of the lack of Unreal documentation π
Are you using C++?
ye
Ok then you can retrieve the URL parameters from the player controller I think.
APlayerController has the method UNetConnection* GetNetConnection() and UNetConnection has a public variable FURL URL which seems like it has the parameters.
Yoo @fathom aspen you should add this to your persistent data compendium. Makes absolutely no sense why this isn't written down any where xD (As in "persisting data" between client -> server travel and retrieving it).
it might be "RequestURL" instead of URL no?
public:
struct FURL URL; // URL of the other side.
```pretty sure no.
Is it okay to continue to working in editor during packaging the project server or editor?
url of the other side is a bit vague lol
I would not do that honestly. Sounds like a great way to get weird results. But I did not actually try.
I am trying to do line traces for a melee attack on the server in multiplayer, the players sword is set to replicates, replicate movement, and it replicates when i run around with it (can see the debug traces moving) but it doesn't move on the server when i swing it via an animation, only the client side traces work then, how do i make the server consider the movement of the swing animation for line traces, the sword itself visually swings for all players so players can see each other swing, but when the server does a line trace it does it as though the sword was just being held stationary. I am using sockets on the weapon to get the position for line traces
I mean.. That's comments once again in a nutshell. Just try it and see if it actually gives the results you want. It doesn't sound wrong to me though.
You mean the travel URL?
The URL that the client sends to the server yeah.
Yeah but that is already a thing: https://wizardcell.com/unreal/persistent-data/#7-game-options-string
π
As in the UNetConnection.URL it's not, but the idea is there ^^
Yes but no.
Your version is client side, that's exactly why I couldn't find it.
In this case we want to know on the server where to find the already send URL from a client in PostLogin π
picture of what i mean with the server side traces, if i do traces client side it does just what i expect. you can see debug trade on right where the sword was prior to swinging, but they don't move with the swing
The server isn't playing animations. That's a setting
ah, where? nm i'm sure i can google that, thank you
Ah fair enough, the one you have on the server is the server's one. Yeah would be cool to talk about it a little in the URL section there
Thanks for the insights/suggestion!
No problem π
lol, i can't find it, do you know where to set that?
@twilit radish im not getting the full thing for some reason
76561198006820266/Game/FirstPerson/Maps/Play/harbor/AR-Harbor
thats what i get from
NewPlayer->GetNetConnection()->URL.ToString()
its missing my options unfortunately
URL has a options field so it might be there
Those first numbers are a Steam ID.
ye but they are from the server
i tested with the one you said that wasnt
NewPlayer->GetNetConnection()->RequestURL;
this one actualy works
has the full request
Weird comment next to "URL" then lol. But good to know that's the one.
"format"?
i didnt test it properly
im gonna do 1 test and if this works i will post a code snipet
of how to get the thing
ye now i just need to figure out the best way to get that ID out of there
im trying to do "if (UGameplayStatics::HasOption(NewPlayer->GetNetConnection()->RequestURL, FString("SteamID")))"
thats why i was talking about the formating, the options must be formated differently thats why u can get them using that function
What is the best way for me to get the info of what gamemode is active on the client? Got a few different gamemodes, and want to be able to toggle UI element visibility based on which one is being used.
Alright now I'm confused xD
Are you asking whether the server wants to know what gamemode is active on the client? If so not. The gamemode only exists on the server. If you're asking for the server to let the client know then I would just have a replicated property set to "initial only" in the game state which you can then use an on rep for to see when it arrives.
does APawn::OnRep_PlayerStates doesnt executes on server?
OnReps typically don't in C++
you can get the map name and do a switch since game modes are "applied" on maps
is there a console command or hotkey to add another player to a listen server in PIE? basically to test out a player joining the game but not instantly
u are right, should i override the setplayerstatate to call it manually?
You can π
Turn off auto join and join from the other client
Where is auto join?
It used to have an Auto Connect to Server checkbox but it's gone now? Anyway you can just disconnect the client from console then rejoin
So I actually found a much better option. Turns out the GameStateBase replicates the class of the gamemode. So it's as easy as grabbing that on the client and then casting it to check with gamemode is active π
do remember at all if its a project level setting or something on the character, or the character mesh or the weapon actor or the actor mesh, I still can't find it
ah thanks ill try that
parameter in Mesh component named βVisibility based anim tick optionβ under optimization
try that
within PIE i would assume i could do /join 192.168.0.1 within the client window, but that doesn't seem to connect
PIE is weird land, try launching
also look at single process etc
will do, thanks !
yes!!! that did it
thank you, I had it on always tick pose
A new button will appear to add clients right next to the play button after you start a listen or dedicated server PIE session
Also @dark edge in case you didn't know, it's pretty handful
extra question, are you sword attacks montages?
not at the moment, was going to switch them all to be montages, but they are just animation sequences right now except for one attack that is a montage, however the issue was the same for the sequences and the montage
Montages got a specific optimization setting that allows only to tick bones when a montage is playing
rather than all the time @rose pollen
ticking bones is quite expensive
that makes sense and is very helpful, is that something I have to enable somewhere, or will just switching the attacks all to montages take care of it on its own?
you have to tweak again the variable you changed in the mesh component
can you not use montages from the state machine in the animation blueprint? my animations are driven via GAS and the players attribute set component that have variables that the state machines in the animation graph use
you have anim montage tasks in GAS that you can use to play animations predictively @rose pollen
for more details I recommend you asking in #gameplay-ability-system
I've got a game where players have the ability to pick up an object in the world and carry it around. What's the best way to have a server resolve the situation where two players try to pick up the same object at the same time?
It's mathematically improbable that it would ever be the exact same time. The way to resolve is only allow the first one to register on the server that they picked it up to pick it up, and that should happen naturally if the reference to the object has already changed (ie. if it's destroyed, or if it is being held by someone else already)
I say transport them to a colosseum and let them fight to the death.
even if its simultaneous, events happen sequentially in the server so there'll be always a loser
Hrm. Right, so the player requests a pickup and it runs on the server, and that way the server controls the order in which everything occurs and can mark a particular object as unpickupable which prevents any subsequent requests
Pretty much yeah - it's incredibly common in games and gamers understand at this point.
cool, thanks!
You're basically getting into prediction there.
I would never try to predict picking something up, that's a slow enough action that letting the server confirm it is probably the best course of action
Hey guys, trying to make my players respawn if they die. What should I input into RestartPlayer's "NewPlayer"?
Edit: If I call the OnPostLogin event in GameMode, I set the NewPlayer variable and I reference that in the controller as the NewPlayer variable, the clients restart fine, but not the host.
thanks so much, this is so handy for testing/debugging!
Instead of using Get Player Controller (0) directly on your character BP, use your Thirdperson_Player_Controller class to spawn and possess the new character using a reliable run on server custom event.
You can dispatch an event from the character and bind to it on the player controller, or just reference the player controller and call the server event directly from your character, either or works as long as you're spawning and possessing characters on the server.
server knows if a player died, there is no need to send any RPCs in order to respawn them, unless you're waiting for PlayerInput to trigger it
also, PostLogin is a terrible hook to trigger respawns, what you want is RestartPlayer
Hmm thanks guys @graceful flame and @winged badger - I ended up doing a Restart Game instead, but I rather want the ability to make it so it only restarts or quits the game if all players in the session has died. What would be the best way to achieve such a functionality?
Oh yeah, I was just using PostLogin to get the variable for the player. I'm doing all of this in a custom event
OMG of course that makes way more sense LOL. I made the BP I was referring to in my reply to @dusky yoke a while back and made a bunch of unnecessary RPCs such as that one. lmao now I have to refactor them all away.
AnyDamage is replicated aswell right? In my usecase Im calling an event when the health is 0 π€
No. You apply damage on the server, which then executes any damage on the server, which you then set a health variable which should be marked as replicated.
And if apply damage value is set as 0, it doesn't execute at all.
Ahhh, gotcha! Well in my case the variable was replicated, so I guess thats why it was working π
Can someone help me set up a launch character? it currently isnt working on clientside
Try call it clientside and see what happens
Hey there guys, quick question. Do I need to use Advanced Sessions plugin in order to be able to send invite codes for friends to join an open session? (Open because itβs a team deathmatch and may require more people to fill teams)
Hi! has anyone published a game on epic store while using match marking from advanced session of steam?
Has anyone tried epic networking solution for matchmarking?
Advanced Sessions main thing is just exposing more of the online subsystem stuff to BP. You don't really need it per se.
idk how to really ask this, but im trying to update the other player that gets hit by a projectile. What weird is i followed the tutorial and the UI 1. isnt consistently updating(only updating at 0hp) and 2. its updating its owner, not the other actor which i have recasted to. I dont understand what im doing wrong
Show how your UI is updating
Does UE know to ignore my calls to spawn sound/particle when in dedicated server or should I do it myself?
Hi everyone, I would like to add a minimap in our multiplayer game where net cull is enabled. I was thinking about the architecture of it and only saw a possibility to use either game mode or game state to get all players location (server side) and send that data to each client. Would it be the the right way to get everybody's location ?
Morning yall. Im purdy new to the UE scene so do forgive me if my question seems dumb. Im currently working on a mobile game that will take the numerical values that the player has in its attributes and applies it in an automatic fighting scenario against another players character. The outcome of the fight is weighed on 6 different stats that will take in account of how well a character will fight. Is there any current plug in or blueprints that would help with this task? If it makes it easier the game is designed in a 2.5D setting.
If you use the normal statics for those things, they will not run on a DedicatedServer.
And if you really want them to not be processed you can use the switch has authority (in bp)
Probably better to just make the call. Adding extra netcode checks in your BP code will just start making things messy.
And Authority is not the same as a dedicated server check. If you release a game that can run both locally as a ListenServer, but also run on a Dedicated server, you'll end up with issues where the Listenserver won't play particles or have sounds.
Would also actually break any singleplayer code as well.
Why this code doesn't print "Hello" ?
Also hello everyone I curious if anyone had any insight/proper vidoes on steam networking for unreal? or an equivalent for unreal. I used steam over on Unity because it was "free" but im not sure if unreal engine has a "free" server of some kind to work with
Anyone ?
Unreal has a system implemented for Steam networking yeah. Although in the scenario of one of the clients being the host (listen server). Steam wonβt host dedicated servers for free π
I should have talked about that a client RPC is not dropped but instead runs on the server, thanks me!
Are we talking all actors or only players?
Also I donβt see why the gamestate or similar should send that data. If you have a player running around in your game for example that should already exist on the client π
ah i see thx,whats the ratio? is it fully blueprinted ? or is it mostly C++?
only players
the other players are culled by network
I donβt think you can directly with BP interact with most of it. I think thereβs a plugin for it called βadvanced sessionsβ or something similar though.
so one player doesn't have all players location
So you want all players to show up on the minimap while not being at all times visible on the client?
yes
ah nice , yea i just stumbled on to the advanced session plug, thx
currently the net cull works well
Then I would just use the game state yeah. Set for example a timer in there that every so often loops through all players and updates their location and any other information needed in a replicated variable π
yep ok π, that's what I thought
thanks !
could you send the link to that readme pls?
It's still a very WIP, so I don't want to mislead at this point.
I thought it was Vori's post at first, but nope xD
I will make an announcement on
when it gets published
@pallid mesa See what your articles have brought us π
lmao
That should tell you how monolithic cool MP is
Multiplayer is cool. But hear me out. It takes way too much time lol.
@twilit radish yesterday i actualy ended up getting the options like this
FString left, right;
rawOptions.Split(TEXT("?"), &left, &right);
FString options = FString("?");
options.Append(right);```
@fathom aspen had interest in this too i belive?
I still can't imagine there not being some kind of URL parser within Unreal though.
i feel like there should be a better way to do it
but as long as it works right...
Okay I'm convinced. Just make it an addon for π΅
Ever worked with Instanced Static Meshes? π
i never did quite understand if variables can change betwen login and postlogin tho, does any 1 know? like if 2 players connect at the same time?
Im reading some info about the extent of steams servers with UE and they say you cant connect players between regions? in the case of the US is it East, central and west? in Unity you could connect to anyone in the US but i never tested with anyone beyond that , just making sure its not different for Unreal games for whatever reason,
That gets the URL of the client on server?
the first line get the whole connection string
i think yes, thats the URL
They URL options should not change at that point any more, but I don't know either if there's an actual delay in between the two.
something like "1.1.1.1/mapname?option=2000
And it's done on server I assume?
its on the game mode
Yeah cool. I wanted to look my way through that a while ago, but probably just forgot to do it
But Wizard, can we talk about it being a stupid FString though xD
ye the url doesnt change that i know, but i still wanted to know why the login has an options field and the postlogin doesnt
it leads me to belive u should get options in the login
I'm down as long as @whole grove is down
Ah you're talking about the FString itself
I thought the Split thingy
@twilit radish Why is it stupid?
Why is it not a FURL?
It's literally a FURL as a FString, why not just parse it to FURL and make everyone's life a million times easier xD
I literally just noticed that it's an FString and not an FURL
Although I do suspect one of the FURL constructors can be used to parse it, but I was too lazy to look further at it lol.
the URL var only gives the connection string without the options, it does have an options array tho
What's the deal with TUniquePtr? Seen that a couple of times.
Good to hear that it was fixed at least
Other things were not
I'm trying to set up the CMC to allow Characters to be moved "Inside of each other" but not automatically get "Pushed away from each other".
But if they walk outside of each other's collision I still want to to block if they try to move towards each other again.
Wondering if anyone has done that for their Game before, cause I doubt I will find someone outside #multiplayer to have touched the CMC
So you want to teleport them inside each other or something and then when they move away not be able to go inside each other again?
Yeah
Like, imagine you have a stationary enemy and a player who dashes towards them.
The endlocation of the dash is exactly where the enemy is.
Default behavior is that the engine will resolve the collision or "Penetration" and push the two characters away from each other
I want them to be marked as "They can be inside of each other, but only until they moved away from each other, then it should go back to blocking"
First idea was to keep a list of Actors in the CMC or Character
And to skip ResolvePenetration if the Hit Actor is part of the Array
And then hoping that Overlap End Events still trigger
To remove the Actors from each others lists
Sort of like IgnoreWhileMoving works
But I fear that IgnoreWhileMoving, being called on a PrimitiveComponent, also stops any form of Overlap event, so I can't undo anymore on EndOverlap
Maybe a stupid question, but if it's a stationary enemy why can't the player stop in front of it instead of colliding with it / going inside of the collision?
I kind of assume that functionality already has to exist right? What would otherwise prevent you from going through a wall for example.
how to check if you are the host in a listen server?
In C++ with the net mode. With BP.. Uhh.. Not sure.
ie, I want a widget that shows you are the host
@thin stratus cant u turn collision on and off, apply a force until they arent colliding and then turn it back on?
i mean, its probably not the most elegant way to do it but im sure it can be done
if ignorewhilemoving can be triggered on hit, u could also do it on hit, store the actor u hit and then do a proximity check instead of using the event
Well check IsServer if you're in a widget
if the physics dont get triggered on hit aswell
@twilit radish @limber gyro I'm probably bad at explaining this. The Stationary Enemy was an example.
The whole thing is mainly about any form of ability that can cause Player Characters to be inside of each other (which is wanted).
Maybe some attack that pushes all Players in range to the same location
I want them to be inside of each other
And I want them, if they don't move away by hand, to stay inside of each other
Default behavior by UE is to force them away from each other
Then I'm not sure, sorry π¦
That definitely goes beyond me for now.
thats such a weird concept lol, i dont know man, i was just throwing out ideas, first i would mess around with collisions to see if i get good results, CMC seems kinda overkill and is a bit scary
Yeah I will try the ResolvePenetration functio nand override that
CMC is the one that resolves the collision
You can make 2 actors that have a blocking root component
They will be able to be inside of each other just fine
That's why the CMC is the logical thing to look at
And it's multiplayer, so movement and CMC is probably also the best matchup here
The concept might be weird, but I'm not the one designing this
I just have to implement it
CMC is way above my head
only messed with it a bit and it didnt go so well haha, the resources out there for CMC are really lacking
well u should check if the overlap events trigger first with "ignoreWhileMoving" before digging into the hard stuff
who knows u might be lucky and they might trigger
Ah the CMC isn't too difficult for me
I've been dealing with that thing for a few years already
Mainly thought someone might have done that already (the collision shit)
you should do some tuts about the CMC if you have time, would really help the community, ur stuff is always very helpfull
also thanks for the stuff you put out, helped me a lot
Some peeps here, including me, were thinking about that already
Just have too many other things to do atm
There is some stuff in the works for extending it. LIke adding a sprint properly
Not by me though
By Epic?
Haha
Imagine revamping the entire network system but yet not making it easy to do one of the most crucial things in the existence of games π¦
Yop, they basically handle it as a "If you need it, you need to be good enough to figure it out yourself."
Real Life Skillcheck lol
Which is not the case for 99% of people lol.