Today I was working on the A* pathfinding script for the player.
I hit upon an idea for speeding up the calculations. I used a simple script I'd earlier written as a rectangle border select for selecting multiple units in another game and used it to draw a rectangle around the player and the target. The graph that's generated for the A* pathfinder is limited to this rectangle (plus a 10 square border, about the size of a single room). This greatly reduces the size of the graph needed for path finding (from 200x200 squares to around 30x30) and reduces the resources needed to calculate the path.
this is good because Blender Game Engine uses Python, and even a well written A* implementation is not that fast in Python.
Still, I'm getting a logic tic rate of between 3-7ms which is very good. I'll have to wait to see how other blender users report their speeds, but so far I'm hopeful about having real time pathfinding displayed for the player during their movement phase.
It took ages to get it to work because of a typo.
I was looking for node.next_to but I'd typed node.nex_to in the graph generator.
Still I tested every other part of the script trying to get it to work. :)
I hit upon an idea for speeding up the calculations. I used a simple script I'd earlier written as a rectangle border select for selecting multiple units in another game and used it to draw a rectangle around the player and the target. The graph that's generated for the A* pathfinder is limited to this rectangle (plus a 10 square border, about the size of a single room). This greatly reduces the size of the graph needed for path finding (from 200x200 squares to around 30x30) and reduces the resources needed to calculate the path.
this is good because Blender Game Engine uses Python, and even a well written A* implementation is not that fast in Python.
Still, I'm getting a logic tic rate of between 3-7ms which is very good. I'll have to wait to see how other blender users report their speeds, but so far I'm hopeful about having real time pathfinding displayed for the player during their movement phase.
It took ages to get it to work because of a typo.
I was looking for node.next_to but I'd typed node.nex_to in the graph generator.
Still I tested every other part of the script trying to get it to work. :)
Comments
Post a Comment