A Reddit user kaw_kaw_kaw_kaw shared a WIP of thier game.
As the developer explained, to make the game deterministic, any math that impacts the game state, meaning anything beyond purely visual elements, is handled by a fixed-point custom math library. For example, they created their own system for spatial queries using an R-tree, which is used for tasks like checking if a unit has a vision of an enemy or selecting a target. The same fixed-point math library is employed for pathfinding as well.
In addition, the prototype features a fixed-time 32 FPS game loop. Whenever a player performs an action that affects the game state, their input is scheduled into a specific tick in the loop to ensure that all players' game states are updated identically.
"A lot of the things that need to happen in a given game tick need to be deterministic but don't actually change the game state directly. Think of things like finding paths or performing queries for nearby units. I run all of those asynchronously using the job system at the start of each game tick, and then I use a single thread to synchronously run all of the updates that actually change the game state in a deterministic order, things like units taking damage", commented kaw_kaw_kaw_kaw.
Apparently, everything in the game so far effectively operates independently of the Unity engine, except for using the jobs system. You could think of it as a separate, purely logical game engine.
For those interested in developing similar projects, the developer shared some insights into their pathfinding approach, inspired by this GDC talk on StarCraft II's system. First, they generated a Delaunay NavMesh the way described in the video, and for pathfinding itself, instead of A*, they used an algorithm called Polyanya that is similar but basically considers a whole interval of points in one step instead of considering one point at a time. One of the key advantages of this method is that it allows you to bypass the funnel algorithm entirely. Right now, every unit in a formation generates its own path, and all of this runs on the Jobs system with Burst.
Learn more in the original post Reddit post here and join our 80 Level Talent platform and our new Discord server, follow us on Instagram, Twitter, LinkedIn, Telegram, TikTok, and Threads, where we share breakdowns, the latest news, awesome artworks, and more.