Four pillars of deterministic game play
This article intended to be a short reference for future me, and others who are interested in deterministic game play. This is why I skip the What and the Why of deterministic behaviour. But if you are interested anyways, watch this talk.
Pseudo-randomness
Most of the games need some random behaviour. The good thing is that it doesn’t have to be really random. It just has to be unpredictable for the player. Deterministic random seed can do the trick.
Order
The order of execution and also the order of data passed to the execution is very important for deterministic behaviour. Therefor think twice when using Hash based data structures like Dictionaries and Sets.
Floating-point numbers
Be careful when using floating point numbers, because they might be represented differently and even lead to different result for the same computation. That sad, I personally never experienced problems with floating-point numbers, maybe because most of the times the result are rounded anyways.
Tick instead of delta time
Delta time is directly coupled to the current performance of players hardware. This is not deterministic per definition. By using ticks instead of delta time we can preserve deterministic behaviour and are able to choose between slowdowns and visual glitches.