Hi jumpman,
thank you for your kind words!
How did you code the units? Each unit has their own while loop?
It is a three layered system, like in a lot of similar games.
At the lowest layer, the action which is executed by the unit, mostly animations and physics are handled. This layer is executed in each frame.
At the middle layer (the most important one), which is executed by every group (4 - 12 individual units), the AI functions are performed, like attacking enemy groups in range. This layer is only executed in every fourth frame.
At the highest layer, which is only executed by computer controlled factions, strategies are executed, like having groups as a reserve to react on the players action.
I am using while loops. I don't know if it is slower as other possibilities like discussed in
here and unfortunately I am too late in development to revamp the whole code.
How did you program the pathfinding?
I am using the
Dijkstra algorithm, which is only executed once per "move to"-order. On rare occasions you notice a short lag when a lot of units are moved a long distance, but usually its very fast.