How do I make Unity deterministic for a deterministic lockstep architecture (RTS development)

I want to make an RTS in unity. Yes, I know, it’s a big project, but I have a couple of friends who want to do it with me and this is not my first large project.


The multiplayer as far as I am able to gather has to have a deterministic lockstep architecture, where only input from players is relayed to the server. The game runs on the server and is simulated on the computers of the players, where only changes in the state are communicated to the clients, and not complete state of the game.


This would require determinism, that means I cannot use floats for example for location, so I would have to change transforms to work with integers. There would be no random numbers generated on the clients, only on the server which is communicated then to both clients. Physics would only be used for the visuals, no game mechanics. This is easy for an RTS, which generally doesn’t make use of physics in that sense.


What else? Is there a guide to making Unity deterministic, is there something I’m forgetting? Is there something like a plugin that would replace the usual transform component with an integer transform? I know that most devs avoid making an RTS in unity, some who have done it it seems have completely skipped unity for any logic part, used only for visuals, like a layer on top of the real game. I don’t think I have to do this, i think can build this game in unity. Please any input is welcome on this topic.

I don’t see that using floats is an issue for you. So long as you are performing the same operations in the same order you should get the same result, so I don’t see why you can’t use unitys normal transform behaviour.

You can also safely use random numbers deterministically, as you can supply a seed to the rng which you can sync between clients.

The only non deterministic thing I can think of is the physics engine. So long as you are updating everything in a regular way, not scaling movements by frame rate etc, I see no issues using unity as is.