I've already gained some speed improvements from how I'm handling dynamic blocking objects, but I wanted to revisit some of my older code and see if I could clean it up a bit.
One of the things I was doing before to make faster calculations was to strip the A star graph down to a bounding box around the start and end + a small border. Actually this turned out to be slowing the code down once I reorganized things. The only time this would speed things up is if the map were really huge, the start and end locations were really far apart and every room on the map was open... So this got dropped for now.
I was doing some esoteric things with getting the nearest node in the graph for a start and end point, which was almost taking longer than the A star search (on short routes)! So that got cleaned up. The route smoothing pass cleans that up anyway.
Here's the end results for comparison:
Almost a 50% reduction in some cases. It may not seem important but once there are multiple units in game starting to pathfind around the map, a 50% reduction in time taken to calculate paths is going to be quite a big deal.
It now looks like the code is ready to move forward again.
One of the things I was doing before to make faster calculations was to strip the A star graph down to a bounding box around the start and end + a small border. Actually this turned out to be slowing the code down once I reorganized things. The only time this would speed things up is if the map were really huge, the start and end locations were really far apart and every room on the map was open... So this got dropped for now.
I was doing some esoteric things with getting the nearest node in the graph for a start and end point, which was almost taking longer than the A star search (on short routes)! So that got cleaned up. The route smoothing pass cleans that up anyway.
Here's the end results for comparison:
Almost a 50% reduction in some cases. It may not seem important but once there are multiple units in game starting to pathfind around the map, a 50% reduction in time taken to calculate paths is going to be quite a big deal.
It now looks like the code is ready to move forward again.
Comments
Post a Comment