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

A* - Keeping track of nodes

11 posts in this topic

Working on my A* implementation - Mostly working fine, but I'm having difficulties in updating the g values of nodes.

When I look at the neighbours of a given node - in order to check whether or not the g value is an improvement on the current node's g value, I have to search both lists, comparing the x/y coordinates of the current node, with each node in the lists. This seems over complicated. What is a good way of keeping track of the neighbours of a given node?
0

Share this post


Link to post
Share on other sites
What data structures are you using for your implementation? Ideally you want to use set structures for things like the closed set so you don't have to do things like compare against every node in the sets.
0

Share this post


Link to post
Share on other sites
My code is pretty dirty at the moment - unsorted lists for open/closed, and a 2d array for the map. The path is just a singly linked list of nodes.
0

Share this post


Link to post
Share on other sites
Using ordinary lists would be suboptimal. Take a look at the algorithm and look at what operations are done on each of the collections. Ex: for the closed set all you ever do is add elements and check if elements are part of the the closed set, so something like a binary search tree or a hash table would work well, and most languages have those kinds of structures as part of their standard library.
1

Share this post


Link to post
Share on other sites
Hello
For the open list, a binary min-heap is a good structure to store nodes. After an "insert" / "remove top" operation, he top item will always be the node with the least F score.

For your closed list, you don't actually need a real list to store nodes, if you'll never take things out from the closed list. So instead of adding a node to the closed list, you can just use a flag to indicate whether the node is in closed list, open list, or neither.

These are just what I've found to be useful from my own recent (also first time) implementation.
1

Share this post


Link to post
Share on other sites
I've finished implementing what I believe to be an A* algorithm in some rather heinous code. I hope to try out binary heaps when I revisit this.

These are some images showing it in action. Blue representes an obstacle tile, orange a closed list square (explored) and the white line is the final path. Does this look correct? It moves towards the obstacle, then fills in back toward the starting point, until it can get around the obstacle, then resumes.

[img]http://i.imgur.com/UvDhv.jpg[/img] Edited by Silgen
0

Share this post


Link to post
Share on other sites
The first image doesn't look quite right. The final path seems suboptimal; it can save a step by moving diagonally where it moved horizontally right past the obstacle.
0

Share this post


Link to post
Share on other sites
Surely it would have had to make the diagonal movement just before reaching the point though?
0

Share this post


Link to post
Share on other sites
[quote name='Silgen' timestamp='1354409019' post='5006146']
I've finished implementing what I believe to be an A* algorithm in some rather heinous code. I hope to try out binary heaps when I revisit this.

These are some images showing it in action. Blue representes an obstacle tile, orange a closed list square (explored) and the white line is the final path. Does this look correct? It moves towards the obstacle, then fills in back toward the starting point, until it can get around the obstacle, then resumes.
[/quote]

The pathes seem good, but aren't the pathes supposed to be completely inside the oranged area? Since you can only know a path if it is explored. Can you try producing these pictures with the open nodes also coloured?
0

Share this post


Link to post
Share on other sites
[quote name='Silgen' timestamp='1354409904' post='5006155']
Surely it would have had to make the diagonal movement just before reaching the point though?
[/quote]
I'm not sure I follow what you're saying. From the point just above the obstacle, it should make a diagonal step to the lower left. By making a horizontal step left it needs to take an extra vertical step down later. Edited by SiCrane
1

Share this post


Link to post
Share on other sites
Ah I understand what you are saying - my mistake. I disabled that type of movement to prevent it going through walls that are only one block thick - guess I'll need to revise that then.
0

Share this post


Link to post
Share on other sites
Ultramailman - the white path overwrites the orange path, and the open list just outlines the orange block.
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