Jump to content

  • Log In with Google      Sign In   
  • Create Account

Pathfinding Preprocessing


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 AltarofScience   Members   -  Reputation: 934

Like
0Likes
Like

Posted 29 April 2013 - 11:43 PM

I really want to get to work on improving the AI, and the pathfinding/performance of the AI. One thing I was wondering was about pre-processing various aspect of the map.

 

One thing I was really wondering about was whether I should mark the openings of convex map features as closed. Say I have a large area that only opens on one side. When moving from squares on the open side to places on the other sides it would save a lot of work to not have to search that area. I think. I don't really know because its not my area of expertise.

 

Do these sorts of things ever help? Is there some pitfall I'm missing? Maybe it would take too long to load the map if you had to check all these things?

 

If these things do help, are there any I haven't thought of that would be good?

 

Alternatively could I populate a of blocked squares list for each map and then just load that? I.e. I add blocked square list to the map class and then the map save populates it before saving so I can just reload it every time instead of having to process the map during the actual game.


Edited by AltarofScience, 29 April 2013 - 11:47 PM.


Sponsor:

#2 ApochPiQ   Moderators   -  Reputation: 15765

Like
0Likes
Like

Posted 30 April 2013 - 11:38 AM

Have you profiled your existing code to determine what is actually slow?

#3 VladR   Members   -  Reputation: 722

Like
0Likes
Like

Posted 02 May 2013 - 01:22 PM

I am doing a pathfinding preprocessing upon loading a level. It is not strictly speaking A* (although I do have an implementation of A* too, for testing purposes), but I managed to reduce the complexity to 5-10 conditions, which is plenty fast even on a cell phone, let alone PC/XBOX.

 

So, figure out exactly which part is slowest, and how much memory will it cost you.

 

I can say, for my part, that preprocessing as much info as possible on walkable / connectable areas of the level has helped tremendously and now I don't have to be afraid even if 20 enemies decide at one frame to start the pathfinding...

 

I haven't exactly profiled that particular aspect, but the new optimized pathfinding is not recursive at all, just linear (with few early-out conditions) impact of which on the level design is manageable (not ideal, but a reasonable compromise).


VladR    My 3rd person action RPG on GreenLight:    http://steamcommunity.com/sharedfiles/filedetails/?id=92951596

 





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS