how to have the built in player array in the game state be set to renotify? Or if not then any way to turn off the player array replication in the game state? As I want to make my own player array system but with a repnotify.
best way to initially send local player data like user name to the host? Like I tried multiple method like to use server’s game mode postlogin event to request the owning client to send, and another method where player start begin play to load save file then auto send to host to replicate to all? But want to see other peoples methods
I want update into send all in time with no race conditions like when clients are sending 2 variable values that must be in order where 1 variable must come first before the other. Is my worries of a race condition a valid concern like is it ok to have both variables set as replicated or should I make a run on server and multicast event that pass these variable values and still have the variables as normal?
GS Player Array already works similar to a rep_notify outside of the onRepFunction. As changes are made to the array, they are replicated to you via GS. More so the GS is updated. If you have a casted GS reference those updates will be present.
How/When to send client “account” data is pretty dependent on the scope of your project. For example if you have a multiplayer game on Steam/EoS you’d want a backend server. Use the clients data from Steam/EoS to look them up on the backend when the connect to the server. So, On connect get credentials → backend API request. API sends a response with the requested data.
More simplistic is to “trust” the client. Not good in any case, but it does simplify the process.
In the controller class (client-side) get the data in a struct. Pass that struct to the Server controller. Srv Controller executes a Game mode/state event using the data.
Race conditions… Pack the 2 variable value into a single. e.g. Struct, appended string etc.
When going about the struct, do so at the same time. as in the same flow logic.
thanks for the idea of using a struct to replicate it to prevent race conditions, but what about what about the idea of passing 2 variables into a multicast event, will that have the same effect or is there some problem I am not seeing?
All values sent in a multicast stay with the event. They are a part of it. Thus they are bundled in the same packet.
Key with the struct is when you set the member values of the struct.
First replication of the struct is the entire structs structure and set member values. Next replication of it could be just one member if that’s all that has changed. So it matters When you set them.
If I set a member then wait a few ticks/frames and set a different member those changes could be replicated separately. All in one frame/tick matters if you are worried about race conditions.