🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Reccomendation of basic AI

Started by
2 comments, last by DVazanias 21 years, 10 months ago
I am making a game that requires basic AI to control the ai character. All the AI character needs to do is follow the human player. But obviously i dont want the AI one to hunt them down like a missle, they need to hunt them when they are in their line of sight....and when out of their line of sight they stop and resume what they were doing before. I was going to use the A* algorithm for the path finding with the goal being the human player. Is there any simpler methods for such basic ai requirements?
Advertisement
Well I think that a nice pathfinding algo with an FSM (Finite State Machine) attached would do the trick; do some research on FSMs. They are quite simple and fun.

So if i do this:

Set up states like thisa for example:

enum STATE{
HUNTING; //when my ai char is looking for player
RUNNING; //when running
SLEEPING; //when sleeping
PATROLLING; //when on patrol
};

then i could do a switch statement on the states and do an appropriate movement on each...for example on the HUNTING state run through a path finding algo like A* and get my ai char to start hunting my human player, and if the human player goes out of the line of sight set the state back to sleeping or patrolling

is that all there is to implementing a FSM? And how easy is the A* algo to implement?
once you''ve learned how A* works it gets quite quick to implement. I would suggest that you implement a test map and then move on to begin reading A* tutorials right away, testing your findings along the way.

An excellent starting point is Amit Patel''s page:
Link

This topic is closed to new replies.

Advertisement