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

Chests in Random Dungeons

7 posts in this topic

I've spent the last little while working on a random dungeon generator in python. Right now, it generates random dungeons, and places the "staircases" to go to a higher level in the dungeon (possibly exit the dungeon) or to descend deeper into the dungeon. The next thing I want to add is a way to add "chests" to it. I thought of just picking a random number of chests to add, then to just add them in random spots in the dungeon, but then I get the occasional time when 2 chests are right next to each other, or they are in the same rooms as the stair cases, etc. Just overall bad places for them to be if it where to be used in a game. So I came up with an idea to use path finding (specifically A*) to find the shortest path from the staircase leading up to the staircase leading down, then to place the chests (a random number of them) in the areas furthest away from the path. That way the player has to go more out of his way to find all the goodies. :) Which encourages the player to explore more (kill more demons!) instead of focusing on just going deeper into the dungeon.

I have the path finding working, and the path is generated. But I have no idea how to do the next part. Actually finding the areas furthest away from the path. Any ideas/suggestions are appreciated!
If you want to know more about how my dungeon generator works you can look at the guide I wrote on random map generation [url="http://breinygames.blogspot.com/2011/07/random-map-generation.html"]here[/url], or if you want to see it in action, you can download the Python source code [url="http://code.google.com/p/pygame-dungeon-gen/"]here[/url].
0

Share this post


Link to post
Share on other sites
[quote name='breinygames' timestamp='1314960226' post='4856675']
I have the path finding working, and the path is generated. But I have no idea how to do the next part. Actually finding the areas furthest away from the path. Any ideas/suggestions are appreciated!
[/quote]

My first intuition would tell me to experiment with Dijkstra maps - see [url="http://roguebasin.roguelikedevelopment.org/index.php/The_Incredible_Power_of_Dijkstra_Maps"]here[/url] for a short article. Although this is not something I've experimented with, it seems like it might be suitable.
1

Share this post


Link to post
Share on other sites
From looking over your algorithm, I think it would be useful to convert your list of rooms into a tree. Make the room with one staircase the root of the tree and mark the path from the root to the other staircase. Now you can traverse the tree from the root along any other branch and drop a chest somewhere on that branch. This will ensure that no chests are placed along the path from one staircase to the other. You can adjust things from there to get the kind of results you're after.
1

Share this post


Link to post
Share on other sites
Just want to say that you're my hero for posting this. I've been looking for an example of how to do this for a while in pygame and this is exactly what i need to help me create my own.
1

Share this post


Link to post
Share on other sites
if you implemented A* pathing, you already have a tree correct? can you travel your optimal path and then from each node of the path, branch out perpendicular to your A*s directional heuristic as far as you can or want and place chests in rooms without other chests prior (to avoid your double chest rooms)....You can make the farther pathed out chests have more valuable items to justify the larger detours to get to them.

might not work... who knows.
1

Share this post


Link to post
Share on other sites
I can think of a brute force approach. Something like, go room by room and measure the distance from the room to each stair. Store the location of the room where the sum of these two distances is maximum. That will guarantee that the player has to do the longest detour possible to find the chest.

I suppose if you modify the A* algorithm a bit so it caches instead of making a fresh search from each room it won't be so bad, you'll just need to map the whole level from each stair.
1

Share this post


Link to post
Share on other sites
This doesn't really do anything to help you with your problem, but...

How about having the quality of the items in the chest depend on the distance the chest is away from the shortest path. That way people who want to just rip through a dungeon fast will still have some chance of finding goodies and people who take their time and explore get a better chance.

Just a thought... :)
1

Share this post


Link to post
Share on other sites
[quote]My first intuition would tell me to experiment with Dijkstra maps - see [url="http://roguebasin.roguelikedevelopment.org/index.php/The_Incredible_Power_of_Dijkstra_Maps"]here[/url] for a short article. Although this is not something I've experimented with, it seems like it might be suitable. [/quote]

Thanks for your reply, I actually came up with my own algorithm very similar to 'Dijkstra Maps' described in that article. Turned out great! Thanks to everyone else who suggested a solution.

[quote]
This doesn't really do anything to help you with your problem, but...

How about having the quality of the items in the chest depend on the distance the chest is away from the shortest path. That way people who want to just rip through a dungeon fast will still have some chance of finding goodies and people who take their time and explore get a better chance.

Just a thought... :)
[/quote]

Already done my friend. Thanks! :D
Now there is a small chance that a chest will be placed closer to the path, but most of them are placed far away from the path. And the quality of the items inside is random, but there is an increased chance of the items being of a higher quality the further they are from the path. I'll be uploading this version (1.7) to the google code project page sometime this week! Thanks again for all of you suggestions guys!
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