GG Pathfinding – Path Occupancy Bitmask

64 bits to flag node occupancy:

I experimented with adding a ulong to each node to assist with pathfinding.  With each bit representing a slice of time.  By flagging these bits based off unit movement speed, I could leave a ‘note’ of when a unit would occupy a node. This seemed to help movement with a few entities:


The first unit to move receives priority. For each path calculation, the unit requesting a path shifts the node’s bits based on the time it was set to the current time and checks if it’s occupied when it will arrive.  If it is, it adds the cost of moving diagonally to its total cost.  This worked as a good indication if the unit should go slower, avoid a nod or if it is cheaper to wait. With several units, many started calculating inefficient paths around when it might look nicer for them to wait.