Is there any good resources how to write deterministic algorithms?

Question

Posted Jan 11, 2020, 4:06 AM UTC

13
calciferscastle•

What do you mean exactly?

void AddTwo(int a){ return a+=2; } is 100% deterministic.

Are you speaking of using floating point determinism? Thats is a beast in itself, compilers, cpus, operating systems etc can all cause this to change.

I would start here

https://gafferongames.com/post/floating_point_determinism/

3
LumpySpoonOP•

I'm making an RTS, and looking into ways to synch my units, currently im thinking of making every algorithm to use int instead of float in the backend, like pathfinding, and basic custom physics. Just using float to smooth it out visually. It's kind of hard to explain it. I have a lot of thinking to do. Thanks for the help!

2
calciferscastle•

The int idea is a good path.

https://www.gamasutra.com/view/feature/131503/1500_archers_on_a_288_network_.php

http://richg42.blogspot.com/2018/02/some-lessons-learned-while-developing.html

On a side note i believe unity is working on deterministic floats with ECS/ new networking. Unsure of the current state tho

3