• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Mythics

How to pathfind intelligently once target is out of sight

9 posts in this topic

Working on a turn based, 2D tile based game. Going very heavy on tactics/strategy.

I have field of vision working quite well for players and enemies alike, but I'm struggling with how to have enemies chase a player once the player has left the enemy's sight. Tiles are unknown to characters (enemies/players) until they have been seen at least once, and when not in direct view it is unknown what is actually at that tile even if the terrain is remembered.

The game is mostly within a tunnel like cave system, so an enemy chasing a player could encounter things like the path splitting two ways or even encountering dead ends. The field of view is also a 90 degree cone in front of the character and turns are taken using action points, so a single character could take multiple steps per turn (easily leaving another character's current line of sight).

I'm sure there's some form of pathfinding that could use things like last known position, previous movements observed, etc to 'chase' a target, but I haven't had a lot of luck with Mr. Google today in finding anything relevant to my exact kind of situation.

Any help on this would be appreciated.

Thanks,
Mythics

PS: If there's anything else I could add to assist someone in assisting me, please just ask. Ty
0

Share this post


Link to post
Share on other sites
[url="http://games.soe.ucsc.edu/sites/default/files/weber-aiide2011.pdf"]This paper[/url] explains how to use particle filters for this type of problems. It's about the only technique I can think of that would help in the situation you describe.
1

Share this post


Link to post
Share on other sites
Damián Isla has done some great work under the title of "occupancy maps". They are similar to an influence map but the influence radiates from the last-known position into adjacent areas that are unseen. As you move and reveal more areas, the values in those areas are 0'ed out and distributed to the other, unseen, areas. At any point, the bot can work with the assumption that the player is in the area with the highest rating. Obviously, as more things are revealed, that location can change. Also, the map continues to "bleed out" over time (under the assumption of continued movement) so that the highest rating can actually move down corridors and around corners. This makes sense and allows for the bot to "chase" the player through a series of logical twists and turns despite not seeing the player any more. When faced with two directions, the bot will check one and, when determining that it is clear, automatically assume the other one, etc.
2

Share this post


Link to post
Share on other sites
Yes, I should have mentioned occupancy maps too. Particle filters and occupancy maps are basically different representations of posterior probability as you allow for your estimate to move out and as you eliminate possibilities for where the target is. They are both forms of Bayesian reasoning.
1

Share this post


Link to post
Share on other sites
Ditto on the occupancy maps. Unknown terrain does make it harder. If one is chasing someone and comes to an unknown T junction, there are only a few options available, e.g.:

1. Go where you expect the opponent has maximum utility. For example, if your opponent is trying to escape the caves, the path which heads up is more likely.
2. Go where you can see the most. If one tunnel is twisty and the other goes to a big cave, you can rule out a lot of options of where your opponent is by going to the big cave.
3. Go where you can corner your opponent. e.g. if you've mapped most of the area you have an upper limit on how much unknown territory is connected to each branch.
4. Follow past precedent, e.g. the opponent turns left more often.

Also in general when predicting opponent behaviour don't forget the time factor. If your opponent has a tight deadline such as escaping before bombs go off, assume they will take the suicidal shortcut or direct path that may be a dead-end rather than any other option which is tantamount to giving up.

You can also investigate D*, which is often used when discussing a robot pathfinding in unknown terrain (although it doesn't revolve around chasing):
[url="http://en.wikipedia.org/wiki/D*"]http://en.wikipedia.org/wiki/D*[/url]
0

Share this post


Link to post
Share on other sites
I don't think unknown terrain is as much a problem in occupancy maps as you might think. If you don't know what the hall around the corner looks like, you treat is as an open area. As you discover walls, etc., you just remap the probabilities onto the list of "walkable" areas.
1

Share this post


Link to post
Share on other sites
Wow, excellent. Thank you all very much, exactly what I was looking to find. In regards to unknown terrain, that's exactly how I've been handling it IADaveMark, thanks for the reply to jefferytitan so I can feel more confident in that approach.

Occupancy maps sounds like a slightly easier approach, but I'll definitely look into both.

Thanks again.
0

Share this post


Link to post
Share on other sites
Hmm, interesting upshot of that approach is that exploration would be encouraged because unexplored areas would register as low cost. I wonder what metric you'd use for a more balanced approach? Cost for unknown areas = weighted average of surrounding known costs?
0

Share this post


Link to post
Share on other sites
What you have to understand is that this goes beyond 'pathfinding' to higher level behavior control.

You would have a 'last known location' and if you could see sufficient terrain (discovered) a path to get to at least that point.

A higher level behavior of 'discovery' has to be carried out if you want to persue that now unseen target.

You can move towards that 'last known location' but as you move closer and previously hidden terrain may be filled in (or the target even comes back into view) you need to do some checking along the way to react logically (you might even uncover terrain that allows a shorter path to that 'last known location')

So there is more than a little logic/states needed to control this discovery/search process.

Once you get to taht 'last known location' and you STILL cannot see your target then another search process will take over considering where the target went:

You can assume it didnt go back the way you came (you would have detected it, and acted accordingly)
If there is only one way the target could have gone then the decision is simple ( tracing all routes and discarding deadends type processing).
If there are several directions then you have to have some exploration strategies to try to first discover the terrain and then the possible paths of the target (with the possibility of seeing the target again while you do all this)
Do you do some stepped breadth first seach down the available paths or a depth first (that may be taking you further and further away from the correct path)

Depending on the extent of your maps there could be an explosion of potential paths/directions the target went, so
at some point you may want to have the 'behavior' give up and assume the target is lost (have limits for the search strategies)

Remember pathfinding is just a tool and there is always higher level logic that will control how that tool is employed (prefereably efficiently and appropriately) Your game mechanics (like that unvisited/hidden terrain) and map data will likewise effect how the pathfinding is to be employed.
0

Share this post


Link to post
Share on other sites
Agreed about the higher level logic. You don't want your guard AI becoming a solo adventurer in the outside world, all in pursuit of a player which may be long gone.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0