#multiplayer
1 messages Β· Page 124 of 1
yeah but obviously id want ppl to join at the same time so i have to add somekind of delay as u said
But you need tge widget to update slow enough
Youknow
Add the delay in the client widget
To verify
At the very start
5 sec delay
Plenty of time
At the start of update widget
Retriggerable
Yepp
Well i guess it doesnt need to be retriggerable when GameMode got that checked
But nice, it works
yeh ! super thanks my man
So the repNotify is called before the objects are actually replicated
struggled with this for weeks!:D
will make a big diff for thje project
yeah
Also
unrelated to this
something happend to my widgets each time im opening them i up they get rescaled to 1080x1920 insated of 1920x1080
its super annoying
ive tried googling what the hells going on but with no luck
ty
I will admit I didn't read the whole convo, so I might be missing context, but using delays to solve for replication lag is not a good solution.
If you are able to use C++, the GameMode class has a method "ReadyToStartMatch" that you can override to have full control over when the match starts and what conditions need to be met. For example checking the amount of players that are connected and ready to play.
I agree, even stated it
^
But it verified the problem
Which is a first step π
I also think its not a match but mp were players come and go..
Just a guess from screenshots ofc
Question if you can help:
I currently have my line trace set up as shown below.
It's making my gun fire vfx go in the wrong direction client perspective; however, the damage logic works fine: https://streamable.com/xjafuz
Any tips on fixing the gun firing wrong way from other player's perspective?
use controller rotation instead of the actual camera rotation, since they wont match up on the server
is anyone here still on unreal engine 4.27.2???
what are you using for the internet
to connect multiplayer
Why is the On Rep Opened Roof not executing for the clients?? It's the same setup for On Rep Lights On but that one is working
That's literally so unlogical
Now i put print strings at the start of both and as you can see the client isn't calling the roof one AT ALL
I made an entire new variable now and set it up the same way but that didn't work either. So I guess it's not some bug with this variable
I also tried to execute it with the IA_VehicleLights event but same result. Client doesn't execute it
Also tried it without the roof nodes and just the set material ones. Didn't work either. So it was literally a one to one copy to the lights one but the roof onrep just didn't want to play
I wouldn't say its one to one, the lights input action has a branch and sets the Lights On variable on true or false, but the roof one just sets its with no branch check.. also since you're setting Opened Roof to itself, if that's the only place it ever gets set then its only ever gonna be whatever the default value for Opened Roof is, which I assume is false?
oh my bad, i thought onRep gets called when the variable is set, not only when it's value is changed
that fixed it
thanks though!
this is getting called each time a player joins or leaves. It adds a player arrow for each player. The problem is that is local player controlled kinda only checks if it's you who joined. So when a different person joins for example my minimap gets updated (and adds 2 arrows although it shouldn't add mine) and the one who joined doesn't get arrows added on his minimap at all. Now i am asking here because i think the "Is local player controller" node is wrong
Hey i have a question I have been trying to wrap my head around for afew days now, So i want to have a way to send a request from a server event to a client that will run an event on the client sending its info about itself back to the server. The problem being im using an interface for interactions and i dont want to add every possible variable i might need in the future to this interface as it will get massively cluttered, I have tried adding a player pin and inside the server event getting the variable directly from that pin but it doesn't seem to work
Give an example of something you'd actually want to do with this
if i change some variable in Client Player Controller, not from server, then this variable change on the client only? and if after while i want save this variable on server, then if i get this variable from client it will be Default Value?
the client will simply have its own version and server.. yes?
and is it possible to send a "Map" type variable from the client to the server?
Sounds like a job for a struct, or even an instanced struct πͺ
Okay, so update on this. Gamemode apparently is not available on clients. Right now I am trying it out with the game state where I have made a player state array of all player states in-game.
So the problem now is that the server does see the clients rotation but the client not the one of the server.
Not sure if you're making the Player State array yourself as GameState already has an array called PlayerArray which is automatically managed.
The best way to handle whether a player is joining is to have Begin Play of Player State signal an event dispatcher that is present on the Game State that passes along the PlayerState that started. Your UI can first read the PlayerArray from the gamestate to get all current players, and then bind to the event dispatcher to know when any new players join. Your UI would need to keep track of the association of a playerstate to whatever UI it creates so you know which UI element belongs to which PlayerState.
Same goes for those leaving the game, you'd do a second Event Dispatcher call on the GameState on EndPlay of the PlayerState, then you can look up the associated UI elements that you need to remove based on the PlayerState that is leaving.
it is already working with recognizing players joining and leaving
i think the problem is with getting the rotation of all remote players
for the server it's working but the client can't see the servers rotation so far
Sorry for the bump, but we're still running into this issue after more browsing and stuff
I found out the server command prompt doesn't even say if players join or not, but I can tell they do because we're both in the lobby level - which is only happening via client travel after joinsession was called
anyone? π
i dont think so
i was looking at it before delving into sessions, but i believe it's 4.9
im not sure tho
I don't know if the full functionality is working or not, but I do know that if you add the plugin to your project folder, you can compile your project and that'll make it at least load and do some things with 5.2.
Advanced Sessions is a freely distributed one.
is it?? thought it was paid :/
wow im dumb
Can I do a mixed solution of using that to join sessions and using mine to create them
gotta check that out
cause creating and finding sessions on mine works pretty good
Probably. All this is doing is exposing some nodes to help with creating/joining sessions, it's not really providing much else.
yeah it's like putting a UFunction on these custom methods, then zipping it up or uploading it to a public repo
@gleaming crane there's a 5.3.1 version
https://vreue4.com/advanced-sessions-binaries
There's a 5.2.1 version on that page too π
Ooooo this is perf then! thank you!!
Do you know if I can delete the AdvancedSteamSessions folder if I'm just using EOS?
I would think so, it appears like it is supposed to be a separate plugin.
Can always try and if it breaks, put it back π
Oh I see, yeah I'm currently trying to install AdvancedSessions, ill lyk how that goes
yep looked like the solution built fine when using just the AdvancedSessions
and not steam nor blueprint examples
Hi idk why but my prelogin function is not being called at all but my postlogin function is working just fine
i'm not sure what the issue is
@graceful spoke Did you forget a call to Super::XXX somewhere?
oops i screenshooted hte wrong function
does AdvancedSessions not have a join function?
i called the super::prelogin here
but i don't see my debug message pop up at all
only debug messages for post login and init game
@graceful spoke What if you breakpoint and step through, see where it fails.
i got it working thanks
Hey all what is the correct way to replicate this crouch system?Im running the set capsule half height event on server and it is updated through a time line
Im struggling to get it to replicate any help would be appreciated
The actual equipping of the weapon would likely only happen on server side, so you could spawn the actor weapon on the client and play the montage, but that would be about all you'd want to do, and if the server disagrees, you'd have the client swap back to the previous weapon or handle it however you want.
what do you mean "how"
do you mean in what situations?
do you mean you don't know how you'd tell the client "no you're wrong"?
err, you don't know how to interact with the object then?
interfaces
or just a base class
it has to know something about them
there's some base set of APIs that everything in an inventory can be expected to have
either because they all extend a single base class or because they implement an interface
or multiple interfaces
Here'd be an example of what you could do...
Overlap of weapon on ground > Happens on both client and server, yea?
Overlap > Has Authority (Remote) > Check if inventory can hold the item, if so, spawn the held copy of the weapon > Attach to player's character (Other Actor would have this reference to the player character) > Play equip montage > Keep reference to previously held weapon still.
Overlap > Has Authority (Authority) > Check if Other Actor can actually pick up the object, if so, add it to their inventory, and set it as the item that is being held which then replicates to everyone else. If not, have an RPC on your inventory component like "Reset Weapon" which then switches the weapon back to the original that is still being held according to the server.
Does anyone know how to replicate set capsule half height?
Running it on server doesnt seem to work
Buying something from a shop shouldn't be client predicted nor do I think managing an inventory should be either. There's typically no point to it as only those with higher pings would notice and at those high pings they're not going to care so much that they couldn't buy a weapon faster, nor move things around the inventory snappily, but they expose you to a huge headache of trying to correct problems caused by trying to allow client prediction of these things and could result in confusion from players if it doesn't work perfectly. Like... It would suck to think I moved something in one inventory to another, but then the server disagreed about it but I closed my inventory before it was confirmed and headed out on my adventure and all of sudden got killed, losing an expensive item I didn't intend to even bring with me.
I hadn't read the whole thing and was thinking you were talking about using like a quickbar to swap weapons, but for picking up or buying or managing inventory you absolutely do not need prediction. You should only ever predict things that need it. Anything beyond the minimal required prediction is needlessly complex for no improvement to a game.
Of my Pickup example? Just exclude the client side portion of the overlap and use the OnRep of whatever variables you're changing to trigger the spawn & montage.
For picking up a weapon you just have the client send an RPC that says "I want to pick this thing up" and the server does the rest.
At most maybe you play an animation just to acknowledge that the client pressed a button in the meantime.
if a client spams (through fast auto clicker for example) a server event that has a branch and executes nothing does it really matter?
Yes and no. Yes because they are using up bandwidth / clogging processing time on the server with junk. No because if it's not going to do anything, then it won't do anything. You technically can't entirely prevent someone from hammering a connection like this, but you can detect if someone is doing it and take measures if they do.
Is there no heartbeat by default for the server?
If a client's ping gets too high they get disconnected but as far as I can tell the clients just keep keeping on if the server dies
Clients should disconnect and be sent back to the original level if a server dies.
Anybody got an idea how to freeze an actor in place (stop the animation and movement) without using CustomTimeDilation? It's creating all sort of problems when there is latency
LogNetPartialBunch: Error: Attempted to send bunch exceeding max allowed size. BunchSize=71912, MaximumSize=65536
some tips?
Is storing variables about the number of widgets a player has in PlayerState a good idea? I would like to store data such as: widget number, title, number of widgets, etc
Or using item at index 3, which said potion on client, but said something super rare on the server and you lost your super rare item...
Can someone answer me a question please? Not sure if this should go in C++ or Multiplayer
//Replicate this property using the OnRep_CurrentHealth() function
UPROPERTY(ReplicatedUsing=OnRep_CurrentHealth)
int32 CurrentHealth;
//Declare the function OnRep_CurrentHealth()
UFUNCTION()
void OnRep_CurrentHealth();
---------
.CPP FILE
//Implement the OnRep_CurrentHealth method.
void ADeeabloCharacter::OnRep_CurrentHealth()
{
//OnHealthUpdate just checks and updates the value on the server and if the health is 0 then player is dead.
OnHealthUpdate();
}
//Send the variables needed to be replicated to the replication system
voidADeeabloCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(ADeeabloCharacter, CurrentHealth);
// DOREPLIFETIME(ADeeabloCharacter, MaxHealth);}
}
/*IS THIS ABOVE FUNCTION NEEDED AS THE ONREP_CurrentHealth triggers a replication using Rep-Notify ? and DOREPLIFETIME basically means we always want to keep this property uptodate not just when we "trigger" a rep notify??*/
Am i thinking about this correctly?
someone can help me in #blueprint ?
You need add the property to GetLifetimeReplicatedProps() yes, whether using Replicated or ReplicatedUsing. If that's what you're asking.
Keep in mind OnReps don't fire on the Server. You only need to replicate the value if clients want to know what it is.
The user can create multiple widgets up to 1000, and each widget will have a Title, Description, Photo and ID. I store data about the widget in an array, e.g. I have an array that contains 1000 indexes, each of which has the title, description, photo and ID. Even if the variable is replicated, I will get this error: LogNetPartialBunch: Error: Attempted to send bunch exceeding max allowed size. BunchSize=114862, MaximumSize=65536
LogBlueprintUserMessages: [BP_Organizer_PC] Server: Hello
someone can help?
I am trying to replicate a vehicle enter/exit system. Let's focus on entering as a driver first. The problem right now is that when the client tries to enter a car he doesn't snap to it in the first place and doesn't possess it in the second. That's what the drivers entering process looks like right now in the vehicle BP. When the server enters as a driver it gets recognized correctly and everything goes as wanted
That's the On Rep function here:
I didn't change my character bp code yet and i don't know really if anything here needs to be replicated too and if so, then what and how? I only set the "vehicle" variable to replicated
I think it needs to be divided into parts, this Array, e.g. player get 100 indexes first, then next 100, next, next etc.
someone can help?
Hey all can someone help me out to replicate this crouch system? Im running on server atm and its not updating, i tried multicasting before but it seemed like the wrong way and it was way to laggy in avg network condition simulation. What other way should i try to replicate it?
Im running the timeline custom event on input action crouch key
Why would those 1,000 elements need replicating? What's the use case here?
If this is static data, put it in a data table or convert to data assets, replicate the array of indices into the table, or link them with gameplay tags etc. Lots of ways to do this better but without context it's hard to know.
Crouch is already part of CMC and has client side prediction built in so itβs going to complicate things if you try to modify it using blueprint. Youβre better off using c++ and making your own CMC extension class for your character(s) where you can provide compressed move flags that work with your RPC.
it is dynamic data
user can change title, description, image etc
Okay i dont mind using the built in crouch but its so snappy that when the player crouches the characters camera snaps down. I know there is ways like camera lag but my first person system breaks when using camera lag
I just want a smooth looking crouch and it would be ideal if i could use the prebuilt crouch but just smooth out the camera jitter
Couldnt really find any info on how to smooth it out without camera lag
c++
Article written by Ryan B. On Paragon we initially set up some of our abilities using UAbilityTask_MoveToLocation. It was the very first movement-related ability task, and is the most basic brute-force method of getting something to move. Ability tasks are nice in that you can have a clean βOnStart, OnTick, OnStopβ functionality occurring on Au...
Thanks i just cant use c++ for the project im working on atm
Probably a way to do it with blueprints since its just to smooth out the camera
That pinned forum post details the inner workings of the CMC
I simply want the client to have all 1000 widgets loaded, but it must first get data about these widgets from the server, and since this data with 1000 indexes is large, it is not possible because it exceeds the limit
so when the server enters the car the client says accessed none for the marked player controller but the server still possesses the vehicle. The client on the other hand gives the same error but on the servers side and on top of that the client does not possess the vehicle. Any ideas why?
this in the pawn bp of the vehicle
that's the character bp (the character who enters the car)
Is all of this data generated server side completely randomly?
Why not make it deterministic and just tell the client how many entries there are? Again hard to suggest without much context.
but I have to tell the client what the current title, description, etc. is and the client can edit it at any time
is not randomly
the client created e.g. 100 widgets with a description and title, and the server saved it, when the server restarts I have to load this data to the clients
I just have to load data such as title, description, photo, 2D vector, etc. for each widget, each widget will have different values ββand with 1000 widgets, this data is huge
you're being very generic with your questions what exactly is this data like specifically? When the game starts is the data always the same? What exactly is this array you're replicating? It's hard to help when you're so vague
show some code or screenshots
Ultimately you can't replicate an array of 1,000 elements made up of arbitrary length strings (which are also arrays), refs etc. Need to trim it down somehow.
when the game starts, the data is as it was saved on the server, the data may be different. I can't use DataAssets, DataTable etc. The Array what I replicate is a reflection of the widgets, it just has data about the widgets
ok, before sending it to the client I have to divide it into smaller portions, but I have no idea how to divide the Array into smaller parts.
UE5 doesn't have a system designed for big data?
dynamic big data
is this being done in blueprints or cpp?
blueprints
if you literally just want to subdivide an array then
create a variable for how many elements you want to send
create another variable to keep track of what the last index was sent
create a temporary array that will copy elements from your data array from LastIndex -> LastIndex+BatchSize
update LastIndex += BatchSize and send the temporary array
you'll need to check for index out of bounds
Thank you for the clarification! π
Question, when you Spawn Actor and that actor is a Character that is controlled by AI Controller is it normal for the Owner of that pawn to be the AI Controller even if I defined the Owner on the Spawn Actor?
I would like to run OnPostLogin in GameMode after BeginPlay, I have a problem because Event OnPostLogin is called first instead of BeginPlay
someone can help?
only if Server Controller load first
You could use a bool to check if Begin Play has triggered yet OnPostLogin, and if not, enqueue the joining player in an array.
When your begin play is finished doing what it needs to, set your boolean true and loop through the array of joined players you created and do what needs to happen on OnPostLogin, then clear the array.
but I still need to update the widget, and the server widget is then not available
this makes it difficult, why is it so stupidly done that the server controller when it joins the game is before OnPostLogin, it complicates a lot
how do I update the HUD for the server or clients now
This doesn't make it difficult. Your lack of understanding on the process is what makes things difficult.
Client HUD should update itself, GameMode shouldn't have anything to do with it
It makes complete sense to call OnPostLogin after the login
BeginPlay() is a match-state concept anyway
Not that anyone really uses that legacy match state stuff anymore
So much legacy cruft π
ok, then maybe I'm creating the SaveGameObject in the wrong place and loading it in the wrong place, maybe I should load the game save from a place other than GameMode?
guys is it better to multicast for each player or just run it all on the server
Anyone that can tell me the reason of this when replicating?
Metahuman have no head
Not sure if this is the right place to ask this, but is temporarily spawning invisible actors with multiple capsule/sphere/etc. components considered the proper way to do collision detection for complex area-of-effect traces?
Seems reasonable, if you're going to be doing many of these checks in a frame or over consecutive frames, could help to spawn your collision actor and just enable/disable the collision when you need it
Hey y'all, I'm attempting to launch a dedicated server session via a batch file:
"C:\Program Files\Epic Games\UE_5.2\Engine\Binaries\Win64\UnrealEditor.exe" "C:\Users\\Documents\Unreal Projects\ProtoPlaneFootball\missile-ball\ProtoPlaneFootball.uproject" Lobby -server -log -epicapp="Server" -options pause
For some reason, when I set the gamemode of Lobby to my ServerGameMode (a cpp class of type GameModeBase) it can't login the user. However, if I set it to a regular LobbyGameMode GameModeBase type that's not a cpp class, it registers the player? Zero clue why, im using EOS
Anyone have any resources to smoothing out networked character movement under adverse conditions? I have emulated network conditions set, and notice movement is really choppy, including velocity driven animations playing way slower than they should.
how to store created session name or joined session name?
i am not able to store in player state bcoz after server or client travel, the value is erased
how it is actually done?
i need session name bcoz to register player on postlogin , that is after server or client travel
Hey can someone tell me how to make a multiplayer game using ip address or p2p or something else...
Here's the console command to connect to an ip address
open 192.168.0.1
making a multiplayer game is not something anyone can tell you how to do.
i see people just directly enter session name, but in my game session name is entered using ui
GameInstance?
currently i am storing in game instance
ok so its a proper way to store session name
thanks
I feel like it's something you learn while doing it and researching it
Hey, if i create collisions in runtime for the player and attach them to the mesh for interaction with environment. Should the collisions be added and attached only on server and not replicate them at all. Then when collider hits on another interractable collision, i just sent data with OnRep to client and do the functionality interacting? Is this correct approach as I'm not completely sure how I should handle collisions on multiplayer.
yooooooo its the 1000 widgets guy again!
wassup
this is quite troublesome π
How do you peeps handle any form of moving meshes? I know the CMC has Based Movement, but the base sort of has to be in sync.
However what does in sync mean here, given that the local Client would need to have sort of "Authority" over the position of said platform.
That can include a simple spinning disk on which one can stand, or some sort of constantly up and down going, elevator like platform.
The Platform would need to have the same Transform on the Local Client and Server in Timestamp X.
However that means the Platform is ahead on the local Client, so replicating any form of Transform from Server to Client would be wrong.
In CMC at least once you're stood on a movement base the transform info becomes relative to that base, so aside from a correction when you stand on and jump off the base, all is usually well
There are two issues:
- A rotating Platform (a spinning Disk) could be up to 180Β° offset between Server and Client. If the Client steps on it, it will suddenly appear at the other Rotation, same with when jumping off of it. That's a huge correction and kinda strange to players.
- A moving Platform viewed by multiple players. The Client 1 jumps on it, and wants to predict this properly, it would probably mean that Client 2 sees Client 1 floating and not in sync with the Platform
You are right that "all is usually well", but the correction you mention can be literally teleporting you to the other side of the platform :D
My initial guess is that each individual client would need to forward-predict all bases independently to match the timeframe thier local character is operating on (ahead of server by half ping)
So, would you sync the Platform to a point where, if viewed on two players, at the same time, the Platform is 99% at the same location.
Or would you do the usual normal replication, where both clients see slightly different results based on ping?
Cause the Server will replicate to the Clients with different pings, so they could be offset
Sequencer for example replicates in a way that, if you for example animate a train arriving with it, and you play it replicated on a client with 10ms and one with 200ms, both see it arrive in real life time at the same time.
I'd probably try initially to sync all bases so they are in lockstep with the local CMC, so forward predicted. AFAIK that would at least solve the local player correction when jumping on/off, or make the correction less noticeable
Wierd that I got this far into my career without ever dealing with moving platforms
Dude, same xD
"Hey, we want to add rotating platforms and one of those cats that move their arm up and down and the player can jump on it."
And I'm like... f*ck
Though yeah I do wonder if that makes the issue for third-party clients worse, because your platform is ahead by half ping, their positions are behind by half ping
So big initial correction when they jump on
Unless.. you also forward sim all client π
ooof
fck knows
Yeah with higher ping that means you might see other clients somewhere totally else on the platform or maybe even in the air
cause SimProxies probably don't do any Based Movement
oh arse, right
So the Platform on the Server is ahead and that just replicates the location back
sigh
Hopefully the new CMC solves this lol
5.4 where are you
Does anyone know how to use the Copy Properties function inside the PlayerState class? I am trying to use it to transfer data between two different player states, I hope ive understood its function correctly. I use seamless travel with a transition map and that appears to be working correctly, the Copy Properties function is called after I travel to the new level. When I try to copy the player names collected in one player state and then store them in the other player state, the values are empty, what am I doing wrong?
That should theoretically be all you have to do.
- Requires Seamless ServerTravel (can't be a Hard Travel)
- CopyProperties calls after the Travel on the **Old **PlayerState, passing in the **New **PlayerState
I use this extensively in Lobbies.
Hi Cedric, I have read your compendium, it was very helpful in understanding the structure of the unreal engine. I should add to my question that my PlayerState classes do not match. Unless I have to implement it with one common PlayerState, I created a Parent PlayerState and then assign one child to my Lobby GM and one to my Game GM, is this possible, to use Copy Properties to sync data at the parent level and children inherit it?
Or perhaps this is a stupid approach and I should use one common PlayerState, I anticipate there will be far more variables in my Game PlayerState than my Lobby Playerstate which is why I went with this two playerState approach
Yeah, I also have:
- PlayerState_Base
- PlayerState_Game
- PlayerState_Lobby
- PlayerState_Gameplay
- PlayerState_MainMenu (if needed)
Ok im going to sound dumb, my excuse is im new to all of this. How are you achieving this? Do I call the Copy Properties function and cast to the base parent type and then set the variable for the parent class? (which is the screenshot I posted above), because the copy properties event always returns the old child PlayerState. Do I need to also call the Copy Properties function inside the child and assign data there? Would you be able to provide an example?
Ok im going to sound dumb, my excuse is im new to all of this.
Buddy, this Server exists to help. You aren't sounding dumb. I s*cked at this originally too and I still struggle with it nowadays and will probably forever. This sh*t is difficult.
As long as you properly explain your issues, follow instructions and don't ignore suggestions, you are all good. :P
Thanks π
This is what I do in the Parent
But setup is a bit different though, in terms of names, cause it's a Marketplace Project
I don't have another example
ok, the overridewith is for player disconnects?
Reconnect
gottya
ahhh I dont have the OnSwapPlayerControllers
It's also not needed for PlayerStates
I have that cause I also move data between PlayerControllers
That's data that I need when spawning a pawn
yes if the player is transition to a dungeon for example
im with you
I appreciate your help, I will make some modifications using your examples as reference
Thank you!
I also do that, but I think that can be improved by now
It's cause I use that OnRep to show visuals iirc
But that's all besides the point
The CopyProperties should be enough
For what you are doing
hmm, ill try it now
I assume you are testing this outside the Editor in Standalone?
yep
Turns out standalone was the issue, I had the netmode set to Standalone, the Game Mode was set to New Editor Window. When I changed the Game Mode to Standalone the data copied correctly. Thank you for your help! The example for moving data between PlayerControllers is particularly helpful for the future.
I wonder how HL2 / GarrysMod does it and if it's drastically different then CMC
It's been years since I played but I remember GarrysMod being pretty smooth with crazy movement physics
The main point is that the CMC lives in its own small world
Everything outside of it is lost
If you, from the start, design your engine to have more in mind than just the CMC, then things become easier
Might be worth checking if UT has moving paltforms
But I think they mainly have overlap driven ones and jumppads
Couldnt you sync them once and just run them at fixed speed / intervals on the clients ?
Guess there's desync hsppening over time but in a random mp match based game how mich drift can there possibly be
Over say.. 60 minutes
@hoary spear It's not that easy. Server and Client theoretically need to step on the world/relative location on said mesh in the same timestamp
is there any way to test rejoin behaviour in the editor?
You should be able to leave the game in the Editor
for example, some one gets disconnected and they rejoin
Just not quitting
Press on whatever button in your game that makes you go back to the main menu
one one screen quits
ye
Yeah, so send one back to the main menu
it should work normaly then
im using sessions, does it create a session automaticly?
No
if in doubt with open 127.0.0.1
It's not a session in that regard
You just gotta be careful what kind of session you mean
i have the steam stuff going
An Online Session in PIE is usually not a thing
Well in PIE you def don't have the Steam stuff going
ok
makes sense
so PIE steam gets ignored and it goes back to the basic ipnetdriver thing?
And if you don't start as 3 unconnected players, host and find, and then join sessions (even if SubsystemNULL in PIE) then you don't have any session
Yes
It goes back to the SubsystemNULL
Which uses IPNetDriver,
thanks
Ah right ofcourse, with 400ms you'd be far off on either end
Or any relatively high ping really
Is any one here who have experince to make a mobile multiplayer game
if any any one so pls dm me
i want to know that it work
Just ask your specific mobile multiplayer questions in here. You probably won't find someone willing to do 1:1 DM support.
Unless you pay them
But if you REALLY want to have a private DM with an expirenced mobile multiplayer dev then try looking for one over at --> #hire-a-freelancer or #hire-a-studio
Hey, I am running into a weird issue where it seems as though my BasePlayerState is being initialized after the player controller on the client, but on the server the BasePlayerState gets initialized before the player controller. Is this how it is supposed to work or no?
i am not sure but i belive it is since the player state is replicated from the server and it should take a some MS to update on the client?
dont take my word for it tho
If that is true, then that is very interesting
UE Player State Initiation
Default (GPT-3.5)
User
In unreal engine when does the player state get initialized on the client in comparison to the player controller
ChatGPT
In Unreal Engine, the initialization order of the PlayerController and PlayerState on the client side typically happens in the following sequence:
PlayerController Initialization: When a player joins the game, the PlayerController is created on the client side. This occurs during the player's connection to the game, often in response to a player logging in or connecting to a multiplayer session.
PlayerState Initialization: Once the PlayerController is created, it then replicates relevant information to the PlayerState. This information can include things like the player's name, score, and other player-specific data.
The PlayerController is responsible for managing player input and interactions, while the PlayerState holds information related to the player's identity and game-specific data.
Please note that the exact timing may depend on your specific implementation and network settings, but generally, the PlayerController is created first, and the PlayerState is initialized shortly thereafter. This allows the client to handle player-specific data and interactions in the game.
Response from GPT
so it is by design instead of latency?
But seems like it should be the same for a server as well.
Sounds like it
But I think that gives me a good reason to move my input out of my player controller so that I can assign ability System specific input
isnt the input suposed to be in the character? thats what the templates give u
I think I was running into issues with character specific input or something so I had moved it, but even GPT says the PlayerController is responsible for managing player input, so idk which is the correct answer
@mint stream PlayerState is created by PlayerController. So it comes after. On the server everything may seem like it happens instantly. But on client side you have to wait for these UObjects to replicate.
So on client side you could override the method that PlayerController has "OnRep_PlayerState()" and only try to reach the PlayerState after this one fires.
Also it's worth keeping in mind that by default PlayerState has a much lower net update frequency than say PlayerController. The state will only be considered for replication like once a second. While for PlayerController this could be done 100s of times. Meaning almost every tick depending on the FPS of the game.
That's why you're waiting longer for it on the client side.
Ahhh that makes sense. You're a saint. So would you know the best location to have player input setup? Should I do it in the controller, the character or like a whole new component class that is attached to the character?
Also, your suggestion on the PlayerState worked. I added a BindAdditionalInputs and moved my ASC confirm/cancel input in there and called it in the OnRep_PlayerState !
A client can only RPC to server from an Actor that he owns. Which is the PlayerController by default. However any other Actor that is owned by the PlayerController, like PlayerCharacter, will also be able to RPC. This also includes all components they both have. Basically if the highest level parent of wherever you are trying to RPC from is PlayerController - you are good to go.
So from that perspective it doesn't really matter if you choose to handle your inputs from PlayerController or PlayerCharacter. It's up to you. The only consideration I would make is if you plan to have multiple characters that can be controlled using the same inputs. Then it would make sense to set them up in PlayerController, so that you don't have to duplicate code in multiple characters.
Does "InitNewPlayer" get called when a player rejoins?
Perfect! Yeah, I planned on having a number of players using the same input. Thanks, that was very helpful!
You mean if a player disconnected and then tries to rejoin the game? By default when the player disconnects his stuff will get destroyed. Controller, state, character etc. So when he rejoins he will be treated as a new player, everything will get called from scratch.
i found an article by wizardcell and i think ur wrong
unreal actually copies the player state back
if u reconnect within 300 seconds
But the actors that the client owned will get destroyed. It's just that unreal will keep copies temporarily. You are right tho, that in this case he would not technically be a completely "new player".
Although I wonder then if it uses those copies directly after the player reconnects.
Or creates new ones based on the data in those copies.
Not sure about that one.
from my logs i dont see InitNewPlayer being called thats why i am asking
If it uses those copies directly then maybe it's possible that InitNewPlayer wouldn't happen. Cause it gets called right after creating the player controller. But if it doesn't need to create it, then it wouldn't call it I guess.
Base rep time for state is 100ms isnt it
im gonna test it in a few minutes
I got a question about seamless travel and the physics animation component. I get a crash after the server travel. I was wondering if it's possible to seamless travel with a physics animation component without remaking the component in the new level.
Damn.
You can still change it though. That's just the default.
Yeah was just sure i read 10 per sec
Apparently i was very wrong
Changed mine to 30 per sec
So, multiplayer is turning into more of an issue than I expected.
- Running the game from UE with 2 separate windows, hosting + joining works fine. I can do as intended on the game and it works smoothly (This is Standalone)
Issue :
When I give a copy to my friend to test so we can play against each other, it doesn't work as intended, actors don't spawn, UI doesn't update.
How can I figure this issue out? I can't exactly package after every change, send it to him, he downloads etc.
I love how many issues appear/happen after packaging and moving out of the editor π
the way you phrased that is very generic, ur gonna need to show some code
and pick 1 issue at the time
if ur running steam u can try and upload it there and he can patch thats the easiest to to debug with other people
Currently don't have a steampage setup or anything like that. Is there another way to do it without a page?
not that i am aware of
I know it sounds like such a generic thing, why is it things work smoothly in the editor then when you move away from that, it doesn't work?
ur just gonna neeed to package, zip and send
What we've been doing
no idea and no way to know
could be a few things
pick one issue and show code
So pretty generic, this gets called from the PlayerController once all players have joined the game, the information gets sent over and spawns the actors fine within the Editor, once out of it, it doesn't spawn.
So the order it goes. Players join the game, they get added into an array, once all players join, the server loops through each PC and calls Start Game
Either I've done this all wrong or who knows!?
2 pcs, 2 steam accounts
Yup
Gm as in gamemode?
Gm doesnt replicate
Yea
Ye the top one
Interface into server rpc
The only way the interface event reaches the gm is if its already running on the server
Which makes the rpc bogus
Shouldnt break anything as itll simply run on server , just letting you know
Ok.
Its also confusing with the interfaces
I was about to say, are interfaces "No Replication"?
As its as impossible as ever to know if its a server or client event
They dont replicate but run on the invoking side of it afaik
Correct
If you invoke it on client it runs on client etc
Also. Whats calling the spawn char?
Is thst the playercontroller?
Yea
That no work I guess?
It sends all the information to the server and then spawns the character the PC has selected and possesses it
And youre also passing replicated variables through an rpc...
Wouldnt the server already know what to spawn? Is this a lobby?
has anyone worked with networking and level sequences? we are wondering the best way to synchronize a level sequence
It's the main game, the lobby is where the play selects the class. I feel like I should really use player states too 
Main game as in... not the main menu, but the actual game ?
Yea.
Do you have char selection in the game ?
Yup, in the lobby_gm
Beside the lobby
Nope
Cool
So server should own that info
Either as start match arguments or some persistant data ..
User selects what they need in the lobby and thats it. I think it's because I saved the information to the "game instance" then I get that information and call it back onto the PC once it spawns back in.
sorry for the disturb, I'm using Advanced Session Plugin (Steam), how can I make sessions joinable with a code? I tried that but not seem to be working
Not sure whats common but storing selection in game instance on the server should work
That sort of stuff I believe should be saved on Player State or something like that right?
Cant untill in the actual game
Unless you do... seamless travel
Im not sure what survives then
Lobby > Main Game is seamless travel. I believe it does as this event works and not OnPostLogin
Swapping pc probably means new ps aswell
Hm seems ps can survive
Has anyone else had an issue with 5.3 suddenly causing debugger objects to network differently? I've had this issue where Iris changes isOwnerRelevant on this debugger object.
Disabling Iris compilation has turned out to be very difficult if not running a source version. Anyone else happen to know a simple fix?
What do you mean joinable by code ?
You need a session to find first
I think he means something like Amoung Us?
Yes exactly
I was going to try that at one stage but decided to leave it for another day.
Could you maybe find all sessions, add them to an array then when a player puts in the "code" of that lobby/game it loops through the array and joins it if found - this is probably the brute force/wrong way of doing it
Listing a set of sessions is what I did
every session has a code and inserting that code from join text box you can enter the session with that code
I was trying to use a session property for that
Each session will have a random code "dsa24", A player can input the code to join the session.
and this bp to join a session with session "code"
I can't understand why that's not working...
Have you made sure that the text box isn't returning an incorrect or null input?
let me see... I let u know asap
no
But it would still work if it was on a local machine & stand alone as long as steam is shut, wouldn't it?
shouldn't afaik
Or is this where all my testing is going wrong?
havn't used it in 40 years but atleast back then i wasn't able to
i had to package and use two different pc's with two steam accounts
ok, so I'll try it with two different physical client tomorrow, Idk if it's working on a vm too
vm prob is fine
just afaik you cant run two steam accounts on one pc
and even if you could, you probably couldnt reliably make it select the not currenlty used one
Works for me, 2 stand alone games (Both editor and packaged) with steam shut, I can join/host games
are you using the same plugin?
my ue version is 5.2.1
It then acts as 2 different steam accounts and it game me a way to test it without my friend haha
unreliably
otherwise you'd not be seeing the issues you are seeing π
lol x)
but they're spawning in StandAlone from the Editor
like.. it's probably fine ? but i wont know untill i've tested it packaged
First I was doing it in PIE, then I had errors when I packaged and tried to play it, then I fixed what I had to, to make it work in StandAlone Editor but now it doesn't work in Packaged
I try packaging it, the fact is that if I join a session with a code it joins the same session the first player created but has another code
ill try converting my project to see what happens
came from 4.23 or smth
i had no clue what i was doing back then, so even if anything works.. i'll be surprised
That's how I feel right now, I feel like I don't know how anything works. I think I figure it out but then I'm right back to square one, like now
well it opened up
damn
stuff is still working
gotta try standalone
doesnt work in pie
You know, an issue i've come across with Find Sessions is right after it gets triggered, it will still call the "Success" pin right away. @blazing sinew
yea, even if no session found it goes onSuccess
Normally it takes a few seconds (15 seconds or a little less) to find all the sessions available.
Yea.
Hmm that's odd.
Mine is no better
So that could be one little issue you'll need to solve. As for two people hosting a game but the 2nd one still joining another session, I don't know yet
You can honestly try this way, as I said though, it's probably just a rough work around and not the proper way. It should technically work though.
or I could find all the sessions and then check for each "Results" the code, if the code = to the textbox the player joins that session
on completed if not joined: no sessions found
really?
For my game
For your issue, the only way I can think of it, is the ways we both mentioned. Go through each sessions (once all sessions have been found) and check for code
I think he wants to skip the list
right
yes
In amoung us, the list isn't visible, its more of a "private" or exclusive invite to game
this should just filter on the correct ones tho
can find session find other games sessions?
or is it foolproofed?
Find Sessions finds all game sessions of your game.
yeah but not with the filters.
its gonna apply that before retuning your list
also , this is a thing
Something of an issue i've seen though, is my friend is from the UK and I'm in Turkey, we can't see each others games hosted unless one of us use a VPN. Not sure if it will be a future issue or not.
I've never tried using filters.
@hoary spear My issue is even more confusing now π
So I fixed those few things you've mentioned. It works "fine" with a small map (literally a cube to sit ontop of) for both the CL and SVR but the second I go to the larger map I've made, it works for the SVR but not the CL.
Show the code
Removed the Server Call from here like you said
and just changed the variables from replicated to not replicated.
Not saying they cant be replicated
just saying them being replicated means the server should own them, and clients obide by them π
I swear I know what replicated variables are π
π
So, I'm possibly thinking that this could just be an issue with the loading time of everything? Or not really and I just have crap broken code.
it worked for me... the only problem is that maybe when there will be more sessions it will take more time to elaborate the result
Well, slow loading and bp and no onrep for certain things makes it harder
There we go, that's how I would have done it. Like that. As for taking more time with more sessions, that will be a problem I believe.
The filter should already do this shouldnt it ?
But even a large list here doesnt matter
goes to google and youtube to learn onrep Are you able to give me a quick run down or is there no such thing as a quick run down?
Youtube gives better info
Ok
filters aren't working for me
Idk why...
Maybe filter isnt ment for extra settings..
Otherwise weird there would be an extra node for get extra settings, wouldnt you think?
yea
Well, isn't extra settings a Map(Array) and the filter is a Structure(Array)? Or that wouldn't make a difference?
Wow so I finally figured out why one of my characters was rubber banding so much! It uses the default character movement component and I had RVO enabled. Why? Because it's also used as a base character class which my AI characters are derived from. They are using RVO to avoid running into one another but if you have RVO enabled on a human playable character it causes crazy amount of rubber banding even with low emulated latency. The solution was to just simply only enable RVO for the AI agents.
I feel like I wouldn't need/use RepNotify. I have most things running on the Client side such as the units they own and buildings they own. Only thing the Server really does for me is Spawning Actors and Destroying them required. Unless the video that I watched didn't give me a good enough example.
Yeah im not dure what your game is really about so onrep might not always be the right method
Its usefull for stateful replication
RTS game, spawn units & buildings, attack each other, collect materials.
Door being open as an example
Something like a building state
Would be onrep
If its damaged etc
Clients don't need to know how much another Client or Server has, they just need to know What units are on the field and their location
bp because I'm still in the whole testing/core mechanics phase. If I can't get it feeling nice/good within another week I'm scrapping it.
C++ gives you fine grained replication control
Once I know where the game is going and myself and my friend like it, then I'll transition.
Control you simply wont get in bp
The issue is, I don't know UE Syntax, so the second I get into, I get lost and confused because I don't know any of the functions or calls etc. Like I should know them from using BP for so long now.
Plus in the past i've used C# a lot more for work programming so I get them mixed up sometimes.
Ue syntax comes sooner if you force some c++ on yourself ^^
Well. Atleast that worked for me
After 5 years of bping
Then it starts simple with just uprops and bp exposure
Ahhh ok, I'm in the same boat as you, it's been so long but sometimes I'm like "Coding this would have been faster"
It all makes sense
Im at the peak of mount stupid in c++ yet
I implement almost everything there
Which is a bad tactic
I don't like C++ too because the UE live coding never works for me and I need to always reopen the editor :/ OR IS THAT NORMAL!?
I mean..
I got a new ryzen + rider
Opening editor from ide is fast
Recompiling is fast
Usually a few sec
Live coding usually workd inside cpp files with no new vars decleared (?)
.h always must be recompiled withneditor closed
See, I like to add like 1 new variable and then test it π
That's my issue, 1 line of code, go test it, rinse and repeat
Untill .. you gotta move it for perf :p
Or that fine grained replication control
Its weird tho, replication stuff
Its mot really all that hard
But maaan did i struggle to get it
Before i got it
I know, I swear it can't be this hard but my brain just doesn't want to understand the logic behind it.
Well.. i think I got it ... just like i thought the last time
And the time before that
The project i have with advanced sessions in it
Is my last attempt of mp, untill now
So... 3 years
I haven't tried MP for like 2 years.
I thought I got it then but now I think I didn't haha
Going straight for an rts then is brave π
I told my friend if we can get the core mechanics to feel good within 2 weeks (giving it an extra week now) we can do it, if not we're skipping the MP RTS and going to a SP game
It really isn't too much replication on the game though, a lot of it feels more Client side than Server other than spawning and moving.
Which is literally the most basic replication I can think of.
I haven't come to that stage yet
Is it a better idea to use Capsule Collision components over Static Mesh components when making custom collision shapes for 3d 'hitboxes' in online multiplayer?
Also is adding 3d 'hitboxes' directly to actor/character BPs as components a good practice in the first place?
So replicating what.. 300 to 2000 actors (depending on players * units per player) ,
Right now, I have "Attack Range", "Alert Range" for each unit working on the SVR/CL, the health/damage/speed/ etc.
With their loc, health, bonuses,
Ranges are static known to server and client , unreplicated
Yea
Only the server uses it ofc
But see, a lot of the game itself is Client.
Ish, anyways
Welll... ill respectfully disagree π
I just need this issue sorted and I'm trying to see what is different between my "Test Level" and the "Main Level"
I got a casual city builder thing
Give me 2 weeks and then I'll agree with you π
^ pretty much me right now
I'm at the tip of the iceberg not under the water yet
@hoary spear Thanks for your help with trying to sort stuff out too. I'll get to the bottom of this!
Generally your Player Characters will have a SkeletalMeshAsset which may also include a Physics Asset that is moved as the skeleton's pose changes. This is likely what you want to use for a "hitbox" on many modern multiplay games. If your characters are very square or capsule shaped, then use a simple capsule collision could work, depends on how accurate you want the hit detection to be.
I'm looking to not associate 'attack' collisions with my actor/characters' skeletal meshes but rather their default scene roots, as I want the collisions to be big simple animatable shapes with no physics and overlap-only detections that don't rely on a character's animations
Seems like you have your answer then haha, just use the capsule shape as you mentioned
i have overriden 2 functions in the playerstate class so that i can handle reconection data, the problem is altough it seems that the data is being set properly its not showing in my scoreboard widget, like its not getting updated at all, but all the logic that runs with it seems to work fine
Are you replicating this data? I'm assuming the functions you overrode are happening server side and your scoreboard widget is probably client side, so you need to send those updates somehow
its all being replicated, works great before a reconnect
What functions did you override and what are they doing?
Hello!
I am making a multiplayer shooter and my weapon projectile base class has this functionality in it so that when the projectile spawns coming out of the player character camera, it ignores it.
Works beautifully on the server player but on clients the projectile is still colliding with the player character. I'm not sure why or how but if anyone has any tips or suggestions, anything would be appreciated.
Just to make sure cause I canβt see it in there, are you making the player char ignore the projectile too, and if so, how are you doing it?
My goal is to make only the shooter of the projectile ignored
But normally when you do the ignore collision on a projectile you have to do it both ways
Like try dragging from instigator and set collision response to the projectile channel to ignore, assuming you have the projectile set to a projectile channel
Wouldn't that also prevent other projectiles (i.e. from other players) from colliding?
I guess
overlap would still work?
π€ maybe youβre right, I rmbr I had to do it both ways but I canβt rmbr how I set it exactly
Yeah block and overlap are different
Sry I think I rmbr
For some reason I misread the target as the PMC but itβs just primitive component.
So add another ignore actor while moving but with reversed inputs
So target actor is self and the target is your instigatorβs mesh
Or whatever collision component it has if applicable
@gusty valve
Gotcha I'll try that
Any specific order?
like should I do player first then projectile?
or would they execute on the same frame
Shouldnβt matter itβll happen in one tick, theyβre not latent actions
No luck
tried several combinations
It just feels like my character is getting shoved slightly out of the way when a projectile spawns. Like they're occupying the same space.
Confirmed it's only when it's projectile weapons... Line trace weapons do not move me
Hey Everyone, so I'm getting started with Multiplayer with UE5, does anyone have any good tips, tutorials and resources? I'm planning on working with AWS or PlayFab.
Thatβs not connected right
Try not to connect streams behind nodes it makes things harder to read. But if you rmbr I said your target should be Self on the second one
You plugged in the marine base actor and its mesh instead
And also you have 3 nodes should be only 2 π
Because I was trying to ignore both my first and third person meshes
because I didn't know which one was blocking it
Where is this code what bp?
Ok. And what does get instigator actually return at runtime ?
Is your player character the marine base?
Yeah
Ok, and you have 2 meshes on it that both need to detect collision with incoming projectiles ?
Server message after server shoot (Server is BP_MarineBase1 according to the world outliner)
Thatβs fine
Only the third person mesh is set up with any collission...
good point
first person is only owner see
Ok, so have just 2 nodes then
yeah good point
First one with target being projector mesh and actor being marine base, second one with target being the 3rd person mesh from marine base and the actor being self
Make sure thereβs no other collision on the projectile or the marine base that can cause a block
Yep
Still getting projectile pushback
Sad!
checking projectile mesh collision settings now
You said the other mesh is owner only see, but does that turn off collision for sure ? I havenβt played with that yet
it's owner no see but it also is just set to have no collision
Ok good
Does the projectile have simulate physics on?
No
F
Does the capsule have collision settings I canβt rmbr
Right but does the projectile know to ignore it?
Haha that feels like a philisophical question
Actually the ignore actor should cover that
If the capsule is ignoring the projectile already
That last screenshot never loaded for me so Iβll have to take your word for it π
For shits and gigs I turned off all collission on the projectile and it's still doing it client side
this is beyond strange
Only on client side tho?
Yeah this issue has been 100% client side
Ig weβre back at the multiplayer issue, sounds like a replication problem
should the mesh be replicating as well as the base actor?
You might need to put this code in a separate event that executes on all, but not sure
Youβre in the right channel for it tho π
Sry for taking you on a wild goose chase there, I had a similar issue but only because I hadnβt set collision ignore both ways
No I absolutely appreciate your time on this. This is easily the weirdest issue I've ever encountered with UE....
Feels like it shouldn't be this complicated of a fix...
I very much appreciate it.
It probably is however time to call it a night. Thanks for the help!
Np same here
Hey guys, I am trying to learn about multiplayer in Unreal Engine, Right now i am learning p2p connections through steam but ultimately I would like to know how dedicated server works for UE, For that i wanted to ask is it beneficial to first learn how p2p works and start learning about dedicated servers or I should jump straight into learning about dedicated server?
i think it doesnt matter ryt now
learn unreal engine networking framework first
This compendium is meant to give you a good start into multiplayer programming for Unreal Engine.
Oh I see, For that can you provide me with some resources for where to get started? you already did...Thanks so much!
hey guys, I'm using Session Advanced Steam plugin, how can I get the current session I'm in as result (something like a "Get Current Session" node)? (I would like to make "Get Extra Settings" after and get some settings I need)
in bp
Isnt there a node for that "Current Session" or something like that? You can pull extra settings from that, I can check at the PC. @blazing sinew
Get session settings (I think it might be that)?
This is from the plugin documentation.
thanks, didn't see it
All good, I only knew about it because I've had to use it before haha.
@hoary spear So I've found the "issue" and I just need to research how to fix it now. It seems to be, once out of a certain radius from where the player spawns, the actors are no longer replicated.
Isnt that the relevancy?
Would it be the Cull Distance?
But it shouldnt be from player spawn should it...
Erh this is an area of networking i have not yet come to π
It should be from Viewport but it isn't
tbh, I thought I'd never need to worry about that stuff, I was wrong π
Hopefully someone with knowledge chimes in
Id expect relevancy being centered from the local player tho
In the meantime, I'm just changing stuff and testing, seeing what it changes etc
Not playerstart
It might have to do with the camera being offset from the character.
So if I make the character move instead of the spring arm + camera it may fix that issue
that's what i'd expect ut i dont really know
Man, feels good to wake up and find out the issue π
Ok, so I tested the world offset change, that did not work. Changing individual actors "Net Cull Distance" to max worked.
and you were right! After a video on "relevancy" turns out you were correct.
wild guess xD
Really? haha
I just set it to always relevant, which is right but in the future I will have to change it when I add Fog Of War into the game and need to change when it can and cannot be seen.
I was once told that size required to replicate an array was at least 16 bits + the contents of that array, is that true?
The 16 bits is all that's required to indicate the length?
if the size of the array is limited to 16 bit, then perhaps?
i'd expect 32 but idk π
" Arrays use int32 as the base for its index, so this constraint is the first one and is architectural "
Does anybody know a reason why a client enhanced input component wouldnt fire events?
the setup is as follow:
- using unreal editor built in "Number of player" to setup client and server
- server is also playing
- 1 client 1 server
- they both have a simple pawn that has WASD bound on a move function
- the input component calls moveFunc which does the move locally then send it to the server (which in term send back a position to resync)
- moveFunc is never called on client but works fine on server.
- the line binding the action is called twice when trying to debug, I assume it's bound both on server and client (the second one happens after a while, after the console yields the join success)
- Client is correctly connected (server pawn is moving on client POV)
Check your pawn defaults for replication make sure the actor itself has replication and replicated movement enabled
Server is king.
Anything the server does will be seen and essentially be replicated to clients.
Client actions must be sent through the server to be seen by others
I mean, replication aside, the client does not even go to the function
EngineForce = in.X * EnginePower;
RotationThrottle = in.Y;
DrawDebugString(GetWorld(), FVector(0, 0, 150), TEXT("DING"), this, FColor::Red, 0.5);
Server_MoveFunc(in);
this is bound to WASD, the client never gets the ding (nor breaks on the bp)
actually no binding works on the client, I tried adding a simple space bar func to test and same drill, server can use it but the client can't
The client is spawned as simulated proxy
If you have an empty array of a struct that is inside another replicated struct, is that empty array using up any bandwidth when the owning struct replicates down?
Probably the fact that it's empty?
Best way to know is if u profile
@fathom aspen sorry to tag you but since your here i tought i might, i was reading your article on persistent data on reconnects and i have a few questions
but first let me say thank you for writing it
Woah woah woah - don't ask him about those articles. As him about Lords of the Fallen π
(I jest I jest. Friendly jabs)
the steam game?
Indeed, I'm all lords now βοΈ
anyways i was following the article and from what i gathered u only need to override 2 functions to have persistent data between reconnects done the "engine way"
is this correct?
the functions are "CopyProperties" and "OverrideWith"
Those are the typical ones yes
so after "OverrideWith" is called is the new data suposed to be available in the "PlayerArray"?
cause im not being able to get that in my score screen widget
OverrideWith you don't use it to persist data no
You use it to override data after you reconnected back
It has an unfortunate documentation, but I explain that in the article
You rarely use it sort to speak
from what i understood you use "copyProperties" to store the data
and then when the player reconnects "OverrideWith" is called and u put the data u stored back
No, OverrideWith you use it to override the stored data with new data that you think are relevant now
Say a player disconnects, and then when they are back, the teams switched sides
You have to update the player with this new info rather than count on the stored one
That's what you use OverrideWith for
oh so "CopyProperties" should be enough?
If you look at its default implementation you would see what it overrides the player with
It overrides the name just in case it was changed
And a bunch of other nonsense stuff
Yes
You were probably overriding the player with the wrong/default score
thanks, i will check this out when i get back home
your article was very helpfull, please dont ever stop writing unreal stuff
I'm hoping so, but you know life priorities...
Thanks tho for finding them helpful, makes me extremely happy
I had planned on working through a c++ tutorial on matchmaking to build out my EOS front end by hand. However, it sounds like modelling it after Lyra is a better choice at this point. Am I reading that correctly?
Hi folks, I've got a question in regards to ServerTravel/OpenLevel. I am currently playing around with Creating sessions for multiplayer games and I am facing a problem where the BeginPlay of the gamemode of the level that I am loading in is not being triggered. Any ideas what might be causing it?
I am following a course where the course leader is showing how to load a new level as a listen server, but the issue is that the new level is being stuck at GameInputModeUIOnly and having the mouse cursor on. The solution to the problem according to the course is by modifying the loaded in Level Blueprint's begin play. I am not a fan of this and thought having a custom game mode would be enough to replace whatever is being done in the Level Blueprint but alas I can't get a break point to trigger in the Begin Play of the game mode.
Thanks a lot in advance!
Hey guys HELP ME OUT!! I am using this OSC plugin and it gives me some data at runtime. What happens once I start receiving data everything then happens in server only for example it works in standalone mode, listen server mode but it does not work in client mode. I debugged it then found out like debug msg is coming only from server and not from client how can I replicate that for client also?? for listen server everything is working fine
Gamemode only exist and run on the server.
So a client can't and should definetly not rely on logic in a gm's beginplay
If its not even running on the server, thats ofcourse another braintwister
Is it a safe approach to use the hashed transform and class name as a net addressable path for replicated actors? I know the typical approach is to use some sort of counter on a global manager but im dealing with a scenario where that isnt possible.
How are you planning to go about doing the replication? The built in Unreal net adressability only handles certain cases (unless using NetGuids and spawning the objects on the Server). Using the transform seems problematic if your actors can ever move, if they can't could they not just be part of the level?
its procedurally generated, I would have them replicate based on the bIsNetStartup flag. So really they are treated as level startup actors
they wont move also, so this is fine
So i am running this inside a run on Server event and the default value of both IsCollisionEnabled and IsCollisionEnabledLocal are set to -1. I am trying to call the onRep each time it is set to 0 but it wouldn't call it if it's value wasn't changed. That's why i am setting the variable to -1 first and inside the On Rep i have a branch that checks if it's == -1.
The problem now is that when the server runs this and then a client that it doesn't run the On Rep function for the client and I don't know why?
Sounds like it should probably work then, though I would just generate a name for your objects using whatever key you come up with thats consistent and override the IsNameStableForNetworking also make sure they get the same outer chain on Client/Server
What do you mean by whatever key you come up with?
You need some way to uniquely identify your procedural generated Actors/Objects. It seems that for you that might be your Transform+Class name combo, so when you generate the data then spawn your Actor/Object with a name that includes your Key (Hash of those two inputs as you mentioned). As long as your client and server generate the same exact object name you should be able to use it as a stable name
ah right. When you mentioned key and name being different I thought i was missing some info NetGUIDs, misunderstanding on my part, thanks!
Anyone?
will unreal perform the network id lookup automatically if i try to rpc a TArray<AActor*> ? if not i can just do TArray<FNetworkGUID> yeah?
OnRep won't run if the value is the same, you have to specify in c++ to always run the onrep even if the value doesn't change if you want that behavior
How does it not change, at least one of the two nodes where I set it it has to execute because both have a different value
Replication happens at the end of the frame, the server looks at the values the Client has for a property and compares it to what it has, if those values are the same, it may not send an update in the first place. When the client gets the value, it compares the value it received to the value it has already, if those are the same, it might not call the on rep on the client
If you want some kind of event to ensure the client receives it, use a Reliable RPC instead
But I need on rep for players joining later on to see the state of what happened in this on Rep logic
When players join later, when BeginPlay is called on the actor, they will have whatever the initial state of the values were on the Server, so just check it there
For that the variable needs to be set to replicated, no?
which value, one of your values is replicated (the one with the on rep)
It's also not only about joining. It's about when it gets relevant to a player like they get closer to the scenery
So they would have already executed their begin play long before that
Yea i mean that value which is an on rep. Additionally put the logic inside the on rep function inside a multicast and call the multicast through a run on server. Correct?
Replication (specifically on rep) is not going to handle that case for you, maybe explain what it is you're trying to accomplish at a high level, then I could provide some advice on how to go about doing that
Oh boy I have a whole folder prepared with Screenshots of my code and a vid of what it looks like rn in game
Sent it to some friends
But if you want I can share it with you too, If you would give it a try
It's about the replication of a vehicle entering and exiting system
Okay, what is the problem you're trying to solve specifically with this collision replicated value?
when the player enters their collision should be disabled, they should be attached to a socket of the car mesh and their state should change to a driving state which should trigger a driving or passenger animation in the anim bp.
This here is all my code and a in-game test regarding the replication of a vehicle enter/exit system. I would appreciate any help β€οΈ
take a look
this is the On Rep function in this case. I made a vid of it and not screenshots because it was so large
I have been trying now for days and days
Please i would love any advice if you have an idea
The Scene components should already support replicating their attachments so you just need to attach it on the Server and the client should receive that. I don't recall if the same is true for the collision right now, but in the case you can just use replication to set the collision off when the OnRep happens, or check it on Begin Play and disable it (when Actors become relevant to a client, they get spawned on that client so you can just check in Begin Play in that case and disable the collision)
Make sure your scene Root is replicated then the attachment should replicate
what do you mean by scene root?
Sorry, whatever component you are attaching to the vehicle, make sure that one is replicating it's attachment
look at my code please inside the folder. I am calling an interface function through a run on server event inside the character bp . That interface event is inside the vehicle bp and inside that interface event I am setting that repNotify variable
so it's not directly a run on server event. It's an interface event
the mesh has replicate set to true. I didn't see an additional checkbox for attachment
I tried to structure the code and clean it up kinda so that it's not so overwhelming. I also shared all necessary information inside the provided material
Flying over it should give you a quick understanding on what I tried to achieve with each part. If you have any questions let me know
Okay, I forgot the attachment replication is on the Actor itself, so if your Actor is replicating, calling AttachTo<Component/Actor> will replicate that attachment. Getting in and out of vehicles in a multiplayer game should be a server action, I wouldn't attempt to predict it on the Client until you get it working without prediction at first
It is a server action
The Interface function is called through a run on server event inside the character bp
don't focus on this attachement only
There are some fundamentally wrong approaches that I made I guess, but I am too unexperienced with such complex code to know what the problem is. I have worked on many more simple multiplayer functionalities but at some point you gotta aim higher right xD
If anyone else wants to give it a try. Here it starts
If you are going to make a map vote system, so the players all click buttons of maps and a integer stores the number of votes each map has, where should the integer be stored?
Game instance?
Or the game state
I'd say game state. Especially because game instance isn't replicated.
Makes sense
It doesnt need to be persistant anyway
Ok thanks im going to give it a try
Hey all, i have a widget where if i click a button, it calls a event call vote in my player controller, this then casts to my game state and then increments integer map vote count by 1 run on server reliable. Map vote count 1 is replicated and my game state is also replicated. Any help appreciated thanks
You can't call server RPCs on an actor that isn't owned by the client.
Ohhh thats why it says if owning client lol thanks
Hmm so is the base player controller not the right place to call this?
Your run on server event can't happen on the gamestate.
It can happen on your player controller
Hmm okay
Where is a good place to store votes?
Players should be able to vote and the votes are the same across all of them
Gamestate.
Hmm so if run on server wont work how should i make the vote value the same for everyone
But the RPC to the server has to happen on an actor that is owned by the client
Click Button > Run On Server event on Player Controller > While running on server, get game state, store vote.
Thanks what do you mean store vote though?
Like set it and increment?
Whatever you mean by store vote.
Oh i just meant increment it so that all other players see it incremented
I tried to set it now with map vote count + 1, set that as map vote count 1 but it just ran locally
Thanks its working on beginplay of the controller i think its just because im calling it through a widget
appreciate your help
Ah figured it out
I was using get player controller instead of get owning player
I'm getting the weirdest bug when launching a standalone game, if I set my DefaultOnlineSubsystem to Steam in DefaultEngine.ini, I get the following crash log:
LogWindows: Failed to load 'aqProf.dll' (GetLastError=126)
LogWindows: File 'aqProf.dll' does not exist
LogProfilingDebugging: Loading WinPixEventRuntime.dll for PIX profiling (from ../../../Engine/Binaries/ThirdParty/Windows/WinPixEventRuntime/x64).
LogWindows: Failed to load 'VtuneApi.dll' (GetLastError=126)
LogWindows: File 'VtuneApi.dll' does not exist
LogWindows: Failed to load 'VtuneApi32e.dll' (GetLastError=126)```
ive been having this issue for the last two hours or so :/
in progress lol whenever you sent this message
unfortunately same result
at this point i tried 10 different solutions
tried a few more, no luck
gonna try verifying files
sorry guys, do u know why in the editor when I host a session from a standalone, I can find the session from the other standalone but when I package the project and try it on different computers the find sessions advanced seems not finding any session?
Different steam accounts?
yes
the session actually can be found by the other client when I insert the code, and I can join that, the problem is that is not found by the find session advanced when I search for all the sessions
cause that actually works
but can't do it with the list, by finding all the sessions
It's pretty much the same as my setup, the only difference is you have a bool included. I'm not at the computer right now π
that variable is used by me to disable many buttons
Close steam and run two copies on the same computer. Check if that works (it's the same thing pretty much)
Use the packaged game. If that doesn't work, it could be a similar problem I have but it should work. Is it the same network or different?
same network
Do you need that get owning player for the widget? I had an issue using that or get player controller.
You give it the usual 20/30 seconds to load the sessions?
Also, add a string to the end of "add child" to see if it's finding the sessions. It'll let you know if it's finding it or not.
actually on the same pc with steam closed its working
Should work then with two different computers.
I'll try that again with the other computer
It might just take a while to load the widget, it does for me and my friend.
That's when it goes through steam, through the same PC it still takes a little while (8 or so seconds) but not as long.
on the same pc is working, the problem is that it's not working on different pc
on the same network and with different steam accounts
as I said when I insert the code to join like that, it's working
also, searching and joining the session with the code takes like 3 sec
It should technically work on two PC's. I'm opening my project, give me a moment
What is it connected to? To start the search.
This is mine for reference. The "SearchSession" runs when the widget gets opened from the controller
I solved the problem by setting Min Slots Available = 0
Ahh fair enough, something I wouldn't have figured out
why when I set that to 1 it's not working?
I can't even find that option, is that in a scroll box?
it's last option in Find Advanced Session
Ohhh. It could be because within an Array, int 0 is equal to the first item in an array?
yea cause array index in c++ is 0
It is outputting an array, so if it's 1 it could be trying to read from the 2nd item in the array, could be my guess?
and I think bp and ue5 uses it as c++
maybe yes
Glad you got it working!
I've found even another problem... if max players is 4 and there are already 4 people in the session I can still join that (cause session aren't refreshed in session list and it will count as if in the session there is only the amount of people that were in the session when I refresh the last time)
Yea I know that issue
maybe when I join the session I should check the max and current players in