Hello everyone,
I am currently programming a multiplayer RTS with lockstep. So far everything works fine, but now I am up to pathfinding.
Right now my units don’t have collisions, so they can run through each other and stay on the same spot. I used “SimplePath” and the “A* Pathfinding Project (Free)” for the basic grid-based pathfinding which works very well.
Now I am not sure how to implement collisions in a way, that they are handled on every client the same (deterministic). I don’t trust the physic-collision to get to the same results on every client. Furthermore I want some “advanced” stuff like using a flow-field grid for example. I am well aware of the fact, that I probably have to write my own code for that, but since its a hobby and I want to learn stuff, I am happy to do so.
But now to the main question: What is the basic concept of pathfinding in lockstep-based-games? Does every unit get some squares on the grid and just calculates its way through or do they really “bump” into each other? I mean, on a tile-based game its sort of obvious, but in games like C&C, Age of Empires 2 or Supreme Commander (yay, flow fields!), what “defines” the space a unit needs?
I thought giving each unit a empty entity where it stands on the map, but grid based, so it “jumps” from 1 field to another. this entity gets a unit. which is its representation and “follows” the object, so there are no “jumps” on the screen. This way i can determine where a unit is on every client the same (based on lockstep turns, their duration and its speed). Without collision they never get stuck, and the AI maneuvers the backend-entity so collisions don’t happen, but by code and “thinking ahead”, not just running into eachother.
Or am I just missing something fundamental basic here?
(I hope this is the right subforum here)