Temple of The Roguelike Forums

Developers => Design => Topic started by: Gornova on November 17, 2016, 02:41:17 PM

Title: Random ship-dungeon
Post by: Gornova on November 17, 2016, 02:41:17 PM
I'm in the middle of revising/expanding my roguelike CryptoRL2 (more info here (http://randomtower.blogspot.it/2016/04/cryptorl-version-10-is-out.html) and here (http://forums.roguetemple.com/index.php?topic=4788.msg47155)).

My next roguelike setting will be on board of spaceships and I'd like to hear some ideas how build random dungeons around this concept: ship-dungeons!

My "pillars" on this roguelike will be:

1) exploration: explore to find better weapons, find "exit" and collect stuff. No levels, only equipment to be stronger and survive
2) meta gaming: more you play, more you know about setting, dangers and so on and you can build tactics
3) permadeath: I'd like to use this concept creating a seed for dungeon creation, so it's possible for player to try different levels

In my mind I've found some methods for ship-dungeon generation:

1) random walk (http://www.roguebasin.com/index.php?title=Random_Walk_Cave_Generation): works fine for cave-based dungeons (I've used this for CryptoRL2), but not so cool for ships, because is too unpredictable and can create small corridors with awkward turns. I think is fine for cave dungeons, but need more work on it. Pure cellular automata feel, at least for me, like I'm missing something, some "crucial points"

2) grid (http://www.roguebasin.com/index.php?title=Grid_Based_Dungeon_Generator) based dungeon: like in spelunky a dungeon is just a space divided using a grid (see here (http://tinysubversions.com/spelunkyGen/) and here (http://tinysubversions.com/spelunkyGen2/) for an introduction). On random generation, there is a random walk between "start cell" (decided from one side of the grid) and "end cell" (decided from opposite side of the grid). After that "rooms" will be placed on each cell of the grid, taken randomly from a "pool" of templates (based on a theme).
Results here is good and can be realized easily with an high degree of randomness. I think this method is more suited for a random ship-dungeon, because you can create rooms for basic system (engine, dormitory, engineering bay, escape pods, etc..) mixed with "special rooms" (captain room, stargate room, alien nest and so on) on a grid with a specific shape (square, rectangle, ellipse, with wings, battlestar galactica and so on) and iterate on it

3) classic room/corridor (http://www.roguebasin.com/index.php?title=Dungeon-Building_Algorithm): place rooms randomly and connect them using corridors. I don't really like this way for my theme, what do you think about it?

4) bsp (http://www.roguebasin.com/index.php?title=Basic_BSP_Dungeon_generation): I think with my theme is fine, but I need to use "square splitting" strategy and will be become like grid based dungeon, more or less

Thanks for your time and thoughts!
Title: Re: Random ship-dungeon
Post by: Tzan on November 18, 2016, 04:27:01 PM
I was reading thru a random gen post, somewhere, it had a good idea for spaceships.
Make a random set of rooms, then mirror copy them, so you end up with a symmetrical design, which some spaceships have.
Title: Re: Random ship-dungeon
Post by: Gornova on November 21, 2016, 08:17:34 AM
thanks for your suggestion!
Title: Re: Random ship-dungeon
Post by: javelinrl on November 29, 2016, 04:11:24 PM
Unlike most dungeons, where we can get away with just building corridors and rooms at random and just having them be "natural formations" or "old abandoned ruins" without actual architectural considerations, I believe that you should center your generation around the actual rooms of a ship. Spaceships, even in the craziest fictional universes are always sort of cramped, utilitarian, spartan vessels - sure you see now and again those huge, luxurious ships but even then they always serve a purpose and are somewhat rare in the universe. Maybe they have big open spaces with vegetation because it is a homeship and people need to feel comfortable there; or it is a military flagship that needs as much firepower as be a symbol of power, for when acting on diplomatic missions and such. My point being, you really can't pull off any old map generation method and expect to create believable spaceships that feel like space ships.

What I would do is start by generating a random list of the areas in the ship. Some of them are obligatory and every ship should have at least one: living quarters, bridge, storage, dining, propulsion, fuel/food storage... Then you can add extra rooms based on the type of vessel (military, scientific, trader, scout...) - things like gyms, laboratories, fire control, turrets/weapons, sensors, etc. Each room of course could be different sizes and have specific characteristics.

I would try to come up with a system that minimizes corridors and maximizes the symmetry of the ship (if you cut it in 2 sides they will both look the same but mirrored). This shouldn't be too difficult to do if you add a a few central rooms and keep adding similar rooms to either side at each step. I would also minimize corridors - it is mostly wasted space on an utilitarian vehicle. Make them be just small spaces to access other rooms, only a few squares big on each side. Rooms should lead to each other directly whenever possible. The laboratory leads directly to the dining hall? No problem - if you take a look at ships like the Millenium Falcon or the Serenity they really are bare-bone, just the necessary size to do its job and move around. A lot of compromises are mad to achieve it.

Finally, I'd think of slightly different generation methods based on ship size (small, medium, large, colossal...). Large ships need several quarters and storage. Several dining halls (or a very big one). They also have more space to waste so they can have more corridors and even have bigger sizes for normal rooms in order to improve the quality of life. On the other hand, small ships should be very tight, making the player feel claustrophobic - ships are always an expensive asset so making one as small as possible to keep the purchasing price down is something anyone making ships should consider, especially "entry tier" ones.

Having said all that, I don't think you'll ever find a ready-to-use algorithm that is going to do all of this easily for you. You might get lucky and find a space-opera open-source game with something like that already done as a means of inspiration and study. If you just go ahead and use any old algorithm to generate your ships there's a very high chance that they will feel like "dungeons in space" and not like believable spaceships - especially for die-hard roguelike fans who have seen these algorithms being used in other, more traditional games before.
Title: Re: Random ship-dungeon
Post by: Gornova on November 30, 2016, 07:32:16 AM
thanks javelinrl for great feedback, I really appreciate!

In the end I'm following path you proposed, you can see more on my blog: http://randomtower.blogspot.it/2016/11/spaceship-random-generation.html

TLTR: works fine with a set of rooms, a template for ship "shape" and mirroring and without corridors (so far)
Title: Re: Random ship-dungeon
Post by: javelinrl on December 01, 2016, 12:15:49 AM
Nice article but I don't like the way you're doing mirroring. As I've said in my last post, ships are all about putting maximum utility in the minimum possible space. That way you don't need the same rooms left as you have right. For example why would you need twice the storage, and why isn't all storage together to make everything more accessible? Or the same with a possible laboratory room: why would one lab be on one side of the ship and the other one far away on the other side? Small transport ships only need one storage for example, but your system makes sure that there will be at least 2, one on each side.

Did I understand everything correctly? I suggest that you skip the mirror part and instead just fill all rooms both sides in the third step. I agree that symmetry is essential, but not room symmetry, only shape symmetry (the shape of the ship).

Here is a real ship layout (http://thorfinn.net/wp-content/uploads/2010/12/Layout2.jpg). You can see that the ship itself is symmetrical but not the internal layout. If you just skip the symmetry step and "join" rooms of the same type that are close to each other you can easily get the same effect without changing your procedural generation very much!
Title: Re: Random ship-dungeon
Post by: Gornova on December 01, 2016, 07:31:09 AM
very nice suggestion and nice schematics ! Really appreciated!

I agree with you, some random generations could be awkward, I will merge adjacent rooms together.

I plan also, using a "random walk" from top of the ship to the bottom, build the "player route", then place doors, have bonus rooms and so on, so from player perspective, it's event not possible to see duplicated rooms.

I like also the idea to have variations among rooms, for example one lab is "biology lab" another one is "destroyed lab" and so on! I will work more on that and I will share results here, hope you will find it interesting !

p.s: I think that with a little bit of pixel art could be a really nice roguelike btw !
Title: Re: Random ship-dungeon
Post by: javelinrl on December 02, 2016, 05:52:13 PM
Yes, please post your progress, this is very interesting for building any sort of "realistic" structure like castles and houses! Maybe you should write an article on RogueBasin after you've made more progress?

One of the things I'm most interested about is how ship corridors would figure in the generation. I don't know how to get these results but the Normandy from Mass Effect has been coming to mind when I try to think about "realistic" ships with utilitarian corridors:


What do you think about the symmetry problem I mentioned above? You don't seem to acknowledge it in your reply.
Title: Re: Random ship-dungeon
Post by: Gornova on December 05, 2016, 07:58:50 AM
note: I'm working on getting more and more ships design, like Enterprises, Battlestar Galactica and of course Normandy :P

I have no progress for now, just trying to solve some minor coding issue and post another results. For sure I will share my thoughts when I will be ready!

For the "symmetry problem" I'm not sure if just merging two adjacents rooms will results in better room placements.

I've found nice resources here:

- thief like roguelike (http://playtechs.blogspot.it/search/label/2016-7drl): nice example how to use room placement to create "stealth game based maps"
- random ship generator (http://playtechs.blogspot.it/2011/08/symmetric-starship-doors.html): an overview on creating ships layouts
Title: Re: Random ship-dungeon
Post by: javelinrl on December 05, 2016, 07:03:56 PM
I love the ThiefRL maps, even if they are all rectangular "on the outside"... Also seems pretty easy to just transform some of those "rooms" into corridors (just narrow walkways between the room doors).

I don't like the SpaceRL maps though because they are too symmetrical. That is great on the outside but on the inside as we've seen from real-world ships, that's not really how it should be.

Great links anyway!
Title: Re: Random ship-dungeon
Post by: Gornova on December 07, 2016, 10:04:25 AM
You are welcome javelinrl  !

do you have other links on the subject ? or ideas ? or home-made-demos ?
Title: Re: Random ship-dungeon
Post by: javelinrl on December 07, 2016, 01:45:42 PM
Sorry, not on the subject, no... I'm afraid you've reached my depth on this - but I'll sure be watching this thread to see if any other cool ideas come up since it is a pretty interesting design challenge overall. I'll be happy to give feedback on your progress if you post it here too!