I’m just wondering, is there anything built into UE4 for online playing? Like a standard way to synchronize actors with a server, including some form of lag compensation? It would be great.
If not, does anyone know of either a library doing that, or some resources on how to execute that well in UE4?
Thats a really good question, lets see if Epic replies.
I haven’t come across any lag compensation, but there is plenty of general movement prediction, at least for characters, in the character movement component.
The basic concept for lag compensation is easier enough:
- Keep a record actor positions and rotations that you wish to use as part of the compensation for second or so.
- Perform an action on client, sending the results to server along with timestamp.
- Once server receives action, change position & rotation of relevant actors based on timestamp and check results.
- If results are valid, revert positions & rotations to current time and continue.
- If results are invalid, revert positions & rotations to current time and correct the client.
is working on something that could be used in such a manner:
May be what you’re looking for
I get the impression the trend nowadays for fast ballistic weapons is to actually perform the hit test on the client and send all the information for validation on the server. Rollback collision testing becomes too hairy when you need to take bullet travel time in account.
Instead of recording all the hit box/collision info, record what is needed to recreate the frame of animation at the time of impact.
Wondering if you could use the replay feature for that?