Lockstep Network Model and UE4?

Hi everyone,

I wonder how hard its would be to implement lockstep network model in UE4 without having to break all the network code in the engine. Iockstep still seems to be the way to go when you speak of RTS games and since most engines doesn’t offer good features for that kind of game it’s would be great to see that in UE4.

I must be honest, I’m bad at network programming so that’s why I ask this question first :wink:

Regards

This is a fairly complex topic but I can go over a few options:

  1. Send RPC’s from each client to server as they take turns to feed their input into a simulator that only runs on the server. Then use standard actor replication to each client, so they see what’s happening.

This would give you more room to decide if the simulator needs to be deterministic or not and easier to support late joins.

  1. Send RPC’s to server for each move, then forward these moves back to each client via multicast RPC’s. This would require a completely deterministic simulation running on all machines. It would also be more difficult to support late join. There wouldn’t be any major engine modifications though.

  2. Same as 2 except send RPC’s to all other machines in full mesh/lockstep fashion. This is probably the closest to the original lockstep model seen in doom but also the one that would be the most difficult and least flexible option. You would need to make some modifications to allow full mesh RPC’s for example.

#1 would be my vote as the engine would nicely support this, late joins are possible, and wouldn’t force you to use a deterministic model. You could still lockstep turns if you wanted but you don’t really need to do that either.

Of course this is complicated by details out of the scope of this reply but hopefully it gives a few ideas of where you could start!

Wow this is a really neat solution, thanks for sharing John!

Rama

Thanks for the answer John :slight_smile:

#1 Im not sure about one, at least for a RTS point of view. Having the server to send informations about all units (few hundreds units in late game usually) and the simulation result to every player might be too heavy on network bandwith. I know noone still use 56K modem, at least i hope but you still try to minimize as much as possible traffic data in MultiPlayer game. But like i said im not very good at network programming and you have way more experience than me so this might be a good option :slight_smile:

#2 seems to me the best guess, not having to code a full mesh RPC, server having to only send “Player orders” instead of the whole simulation and having a deterministic simulation even allow to have a game replay feature, which is always great to have in a RTS.

#3 is good too but considering the modifications to do in the engine itself for a full mesh RPC and my knowledge about network programming this might be a too heavy task for me.

I guess its time to dig in the engine code to see how the networks is really working since you guys are still working on documentation on network :slight_smile:

Thanks again for your post John it’s will help to find the best solution :slight_smile:

Regards

#1 You should find a way to compress the information. packing, grabbing only changed values, and so on.

#2 Your suggestion would work on most cases, but it will diverges eventually if two machine uses different floating point h/w(different model CPU) because floating point precision is different by CPU H/W model.
You can use quantized method such as fixed point calculation for your simulation. I believe unreal do some quantization for network replication, but not everything. you should figure out which one it is.

Regards!