My guess is that you are using A* pathfinding, and if so, here are some optimizations – which you might already know and have evaluated, but I don't know what you know so I'm going to risk making some potentially redundant suggestions:
* Searching from start and destination avoids some unnecessary branching in the path.
* Precache paths up to a certain number of intersections away, either based on a fixed number, or a maximum total RAM used, or both. This allows skipping some pathing calculations.
* Precache paths to the most frequent destinations (special industries, school buildings, perhaps garbage collection? or maintain a dynamic list). This works by flood-filling a map, starting from the destination, and subtracting the road distance between each intersection.
* Merged pathfinding for vehicles with the same routes. If everyone on a bridge is going to end up at the same intersection, they can probably share some of the same calculations. I'm not sure how to do this.
Some of these would require recalculation every time the player changes a road, though.
* Searching from start and destination avoids some unnecessary branching in the path.
* Precache paths up to a certain number of intersections away, either based on a fixed number, or a maximum total RAM used, or both. This allows skipping some pathing calculations.
* Precache paths to the most frequent destinations (special industries, school buildings, perhaps garbage collection? or maintain a dynamic list). This works by flood-filling a map, starting from the destination, and subtracting the road distance between each intersection.
* Merged pathfinding for vehicles with the same routes. If everyone on a bridge is going to end up at the same intersection, they can probably share some of the same calculations. I'm not sure how to do this.
Some of these would require recalculation every time the player changes a road, though.
- 1
Upvote
0