Experience with determinism + floating points + multiplayer


I’ve a question if there is anybody who uses MonoGame and has implemented a deterministic float point (fixed point)?

For your background: Right now I’m working on a RTS prototype which uses server/client model where the server is authoritative. This works fine but is not often used in RTS because of network issues.

So either I live with it and you can’t build hundreds of units (The Tech of Planetary Annihilation: ChronoCam - ForrestTheWoods), or I need to change it to a lockstep model where only user-inputs are transfered to each player. This comes with the downside that everything must be deterministic. I wonder if anybody has implemented something like that in MonoGame/C# and can share the experience.

Thank you very much and have a nice day!

In an online game everything has to be deterministic anyway, as everything you see is basically some ms in the past and has to be extrapolated on screen - and as long as every client runs the same code it normally is.

So you either make an input delay to make sure every client will get commands for a near future timespot to be executed at the same time (that’s when older RTS do play some “yes sir” before the unit acutally moves)

Or you inter/extrapolate all movements based on command which was given in the past.

if at any point your game state is not the servers game state … or you surpass the predefined “command delay”, that’s when you normally get “syncronisation error” and get kicked of the session.

So yea, RTS require different netcode than a FPS. There was once a nice website which had indepth low-level information on how to do online RTS and how it’s done for older games. But that’s been some while since I read that …

Thank you for your response.

Probably you mean this post from Age Of Empires: 1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond

Well it has to be deterministic, but it’s very different if you use server/client approach or all clients run the exact same simulation. With server/client (where server is authoritative and client is “dumb”), floating points are no issue. In a simultaneous simulation approach (no authoritative server, clients run exact same simulation, often based on locksteps for RTS games), everything has to be 100% deterministic, so also floating points.
For example: We calculate some position for an unit. With a server/client approach, it doesn’t matter if one client uses 12.999999 or 13.000001. In a simultaneous simulation approach, this could lead to an out-of-sync. My question is if somebody has solved this in MonoGame/C# (with fixed points)?

I’ve found those topics but still I’m not sure about fixed points: