TNT Basic Forums > Programming Q&A
Pathfinding and enemy AI
< Last Thread     Next Thread >
Thread        Post A Reply

03-11-2002 20:05

Posted by:

Find more posts by MiniMe

I'm making a topview game and I've just started to program the enemy AI and I'm wondering how I shall do? Right now it just goes towards the player and when it collides with the player it explodes and kills the player, but I want it to go around obstacles and such. How shall I do that so it doesn't get stuck and still doesn't slow down as hell?

03-11-2002 22:06

Posted by:
Mark Tully

Find more posts by Mark Tully


Well pathfinding isn't always an easy problem to solve, there's various well established algorithms to find paths, I believe A* is particularly good (search the net).

One approach could could take if your obstacles are fixed, would be to divide your map into open spaces using map polygons. Objects can move freely inside the same polygon without fear of collision. When they want to move between polygons you could invoke path finding code to see how to get into the next polygon without hitting anything.

Any ideas that reduce the amount of path finding that needs to be done will help speed things up.

Anyway, search the net, you should find loads :)

Good luck,


03-12-2002 16:50

Posted by:

Find more posts by Chris

Try this...

This is on a Director programming site, so the specific alterations to the algorithm will be inappropriate for TNT Basic. However, there's an excellent section with A* algo broken down into psuedocode. Have at it...

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.