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

Room Based Euclidean Map

4 posts in this topic

Hello all,

 

I have been stuck on this problem for about 2 weeks, and I think I have hit every brick wall possible, so alas  find myself here. I am currently creating a 2D rogue-like game (c++) with map elements not to dis-similar to the game Rogue Legacy. The level map is comprised of different rooms of different sizes that have entrances/exits to rooms that are adjacent. It's a little hard to explain, but hopefully this picture of Rogue Legacy which shows the game map will help.

roguelegacy-2013-06-28-01-28-15-84.png

And here is a crude paint drawing (where green arrows are entrance/exits)

UUyGzDw.png

 

 

Currently I am generating a map using a modified pathfinding algorithm which gives me my desired layout of rooms. 

 

DzDwsbu.png

 

I currently run the map generation store the rooms in a 2D array. Once all of the rooms have been generated, I then run through the array and place portals (entrance/exits) in the relevant rooms and set their destination room.

 

This works perfectly at the moment, where all the rooms are the same size. However adding larger rooms that can have more than the standard 4 portals (Left,Right,Up and down) is turning out to be a little tricky, as I am having trouble calculating the destination room and/or the position in that room.

 

 

Any help would be greatly appreciated, if you need anymore information just let me know :).

Edited by dsm1891
0

Share this post


Link to post
Share on other sites
You could make your room "portals" as vectors:

vector <int> portal[4];

where the [4] is the 4 cardinal directions. The vector would hold all the "room numbers" associated with that direction.
For example:

room (0,1) has 0 portals N, 1 portal S (room (2,2)), 2 portals E (room (0,2)), and 2 portals W (room (0,0) and room (1,0))


I don't really know how you are accounting for your rooms, but this should give you something to think about.
0

Share this post


Link to post
Share on other sites
When considering Rogue Legacy, there are a few things to consider first (the following is based on observation, not being involved in the game). The individual rooms are not randomly generated. There is a (large) set of handmade rooms available. These rooms have several exit locations. These exit locations can be 'open' or 'closed'. Exits in 'closed' state seal off an (again handmade) area of the room with blocking tiles.
Each room has an integer size in map-tiles (I believe from 1x1 to 3x3, although I haven't played the game for a while). One map-tile is always NxM room-tiles big (the actual number does not matter, the point is you can easily fit rooms together in a map like that and exits are always in the center of a map-tile edge).

These design decisions make a Rogue Legacy-like map generation actually a lot easier. In pseudo code:
Place the starting room.
While the map is not big enough:
   Pick a random 'closed' exit E in any room already placed
   Pick a random room R from the library of possible rooms (all exits of this new room are 'closed')
   Pick a random exit E' (opposite direction of E) of R and try to place it in the map so that E and E' connect
   If that is possible without overlapping with existing rooms in the map: (*)
      Place R in the map
      Iterate over all other 'closed' exits of R
         If there is a corresponding 'closed' exit in the room in that direction, set both to 'open'
The check at (*) is actually extremely simple. Since everything is neatly on map-tiles, there is exactly one way how you could place the room in the map and the check could be as simple as a bitmap with one bit for each map-tile. Edited by BitMaster
1

Share this post


Link to post
Share on other sites

I really like the technique described above, and I've seen several other techniques described in various articles scattered across the web, but if you want to experiment I have an idea that should work.

 

First add all the rooms to the map, use a force based system to give some separation between the rooms.

 

Then walk the map vertically and horizontally shooting rays from each room, record the first room the ray intersects.

 

At the end of this, for each room you will have a list of rooms that it could link to below and to the right, and a count of how many possible links exist.

 

If this count is greater than a pre-set value, randomly pick one of the rays and add doors at both ends.

 

At the end check all the rooms to make sure they have at least one door. If not pick a ray at random and add doors. If no rays exist, remove the room.

 

By using a ray based system, rooms can be any shape you like. As long as you can find a ray - shape intersection test, it will work.

 

I also have some ideas for corridors, but that's for another post.

0

Share this post


Link to post
Share on other sites

Hi,

Sorry for the late reply I kinda forgot about this thread.

 

The problem with the suggested methods above is that I first create a paths, then traverse the nodes (A.K.A the matrix along the path) populating each position with a random room.

 

You can read about my map generation algorithm (RBES) here: http://www.davidmarshall.info/rbes.html

 

but the TL;DR version is:

populate the map assuming all rooms are the smallest size

once the population of the map has finished, check and deal with overlapping. Then check the size of the rooms and link to adjacent rooms/subrooms for how ever many subrooms are on the parameter.

(a subroom being the space a minimum room could fit into)

 

Sorry for late reply, but I hope this will help somebody in the future :)

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