Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

DVazanias

Reccomendation of basic AI

This topic is 5800 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!