This week I improved on my old pathfinding code. Previously I used a basic A* algorithm to calculate pathing, now it is slightly modified to support units of different size. When a map is first loaded a square-grid which depicts walkable terrain is generated behind the scenes. Red cubes represent unwalkable ground (i.e there’s a wall or obstacle there), yellow cubes represent walkable ground with a clearance value of 1, green cubes have a clearance value of 2, magenta cubes have a clearance value of 3, white cubes 4, black cubes 5, and blue cubes 6+. Clearance value depicts how far away from an obstacle that point on the grid is. This is how we determine if a unit is too big to walk in an area.. if the unit is size 5 and we center the unit on a grid point with a clearance value of 2, the unit’s bounds will extend onto unwalkable area, thus we prohibit the unit from entering any nodes who’s clearance value is smaller than its size. Read more about clearance-based pathfinding here. See a demonstration video here
I also implemented a multi-threaded architecture for game servers. This means that each game hosted on a server gets its own dedicated thread allowing for games to be processed parallel to each other. So if one game hits a frame spike and processes really slow the other games will not be affected since they are executing in parallel and do not have to wait in line.