Jump to content
  • Advertisement
Sign in to follow this  
xee

2D game, pursuit code Q's

This topic is 2279 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'm currently working on a rogueish/nethack text game, I'm somewhat stuck on how to implement the pursuit code (how a monster chases down your character). I somewhat took a stab at it and currently have the monster take your X,Y, and by using a series of subtractions/additions relative to it's own position, did manage to have it head towards your general direction quite consistently. But say it runs into a wall that's in it's way, should I code it somehow so that it knows it's looking at a wall and have it try to figure out how to walk around the wall to get to you? Or should I just make it cheat a little, and just record your keystrokes from the moment you start fleeing and just have the monster follow your footsteps exactly smile.png ? Thanks for any info!

Share this post


Link to post
Share on other sites
Advertisement

I'm currently working on a rogueish/nethack text game, I'm somewhat stuck on how to implement the pursuit code (how a monster chases down your character). I somewhat took a stab at it and currently have the monster take your X,Y, and by using a series of subtractions/additions relative to it's own position, did manage to have it head towards your general direction quite consistently. But say it runs into a wall that's in it's way, should I code it somehow so that it knows it's looking at a wall and have it try to figure out how to walk around the wall to get to you? Or should I just make it cheat a little, and just record your keystrokes from the moment you start fleeing and just have the monster follow your footsteps exactly smile.png ? Thanks for any info!


There are a couple ways this can be handled, depends on how you want to model your AI. If you want "perfect" AI, then you can use pathfinding (with A* or A-star being the common one).

If you want imperfect AI (or more realistic), you can try simulating tracking by scent and/or sound. There is an article here about this: http://roguebasin.roguelikedevelopment.org/index.php/Tracking_by_Scent_and_Sound

While I'm link roguebasin, here is another that might be relavent: http://roguebasin.roguelikedevelopment.org/index.php/The_Incredible_Power_of_Dijkstra_Maps

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!