How do I do random generation?

Get help using Construct 2

Post » Fri Apr 25, 2014 9:01 pm

I would like to learn how to create rougelike games, but have no idea where to start with the random generation. Can anybody give me some tips, or tutorial for getting to know, and learning to do random dungeon generation? Also on creating an infinite world generation.
B
3
Posts: 5
Reputation: 187

Post » Sat Apr 26, 2014 2:21 am

Im currently working on a dungeon generator, but im far from an expert on the subject.

But I started out trying to make one with path finding.

Demo of the dungeon generator - Alpha: Demo of the dungeon generator - using path finding

1. Path finding
The idea behind it was to add X amount of rooms at random locations with random sizes. Each room then get a minimum of 1 door and as far as I remember the larger the room the more doors. These doors then work as connection points, which are added to a list. When all the doors have been added, it take a random door and path find to another random door on the list. And it just keep doing that until there are no more doors. The path that the path finder find between the doors are then turned into halls, and when its done it create walls around all floor tiles. The problem with this one, was that I found it a bit slow, even though I could have optimized it. But it also was quite complex to make and it does contain some problems where certain rooms might end up not being reachable. So I dropped it due to these things and then because it didn't really fit what I wanted for my game when I thought about it.

2. Node system
So I took a different approach which is a node system, that is easier to make. The idea is that each tile only have so many possibilities when it comes to how you can actually place them.

Image

To start the dungeon I start a random place, and then expand the dungeon from there.
Image

And it will keep expanding that way.
Image

Then I added a functionality that will either force the dungeon to stop expanding or force it to keep growing, which is done so im able to create different sizes.

Then when its done making the whole dungeon, there are actually a lot of tiles that are messed up, because you cant be sure how it expand, so I complete it by running a clean up that correct all tiles. And when this is done its pretty simply to pick random tiles and replace them with room tiles since I only need rooms that are one tile I don't need to worry about where the rooms are connected as they will always be connected correctly, compared to the one with path finding, where im not sure where the doors will actually be placed.

Demo of the dungeon generator version 2.1 - Alpha: Demo of the dungeon generator version 2.1 - node system

But for both types or any time I think, its pretty much about setting up restrictions and rules for how things should work. But a good idea I think, at least it helped me a lot, is to take a piece of paper and then try to draw how you imagine it should work or make the tiles and just add them manual on a tilemap while trying to figure out what rules should apply and how you want it to work. But personally I think its one of the most difficult things to do, because there are so many rules and when bugs happen it can be quite hard to figure out what wrong.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Sat Apr 26, 2014 9:58 am

@nimos100, that's seriously cool. It's times like this that I wish these forums had a +rep/thanks button.

You've already been very informative, but is there any chance you'd be keen on writing a formal tutorial with a capx? Or perhaps two tutorials - one with the pathfinding and another with the node-based technique?
B
57
S
15
G
11
Posts: 912
Reputation: 12,606

Post » Sat Apr 26, 2014 11:26 am

GeometriX wrote:@nimos100, that's seriously cool. It's times like this that I wish these forums had a +rep/thanks button.

You've already been very informative, but is there any chance you'd be keen on writing a formal tutorial with a capx? Or perhaps two tutorials - one with the pathfinding and another with the node-based technique?

I guess I could do it. But don't think ill make one for the first, it was my first attempt to make one and it contain to many bugs, which i see no reason to introduce into a tutorial :D

But the node based technique I guess I could as it works pretty solid from what I can see, even though Im pretty sure its not optimized. But it could serve as a good starting point for someone else that can maybe improve it into something better.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Sat Apr 26, 2014 12:14 pm

Sweet room generation, man. Keep us posted on your progress. Keen to see how you go about populating these meaningfully, procedural level design ftw
B
12
S
5
Posts: 208
Reputation: 1,674

Post » Sat Apr 26, 2014 5:09 pm

facecrime wrote:Sweet room generation, man. Keep us posted on your progress. Keen to see how you go about populating these meaningfully, procedural level design ftw


This is the latest version and the one ill do the tutorial based on, as its more complete and functional, as it uses line of sight and player can move around with WSAD.

Demo of the dungeon generator version 2.2 - Alpha: Demo of the dungeon generator version 2.2

I don't really plan on populating the dungeon in the sense you would see in a normal rogue style game, as the one I need for my game is more a zoomed out map. As combat is not actually taking place on this map, but in a separate one which is a tactical combat. So if the player encounter a group of monster they are taken to another layout to fight, so I don't need to populate it with things. But I don't think its a huge problem to do it, you could just copy/paste how the rooms are generate or how the player is placed and just make it work with monsters and items. Also think it would be fairly easy to expand the design so the room generator makes bigger rooms that are more like a normal rogue style game. But someone else will have to make that part :)
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Sun Apr 27, 2014 4:17 am

GeometriX wrote:@nimos100, that's seriously cool. It's times like this that I wish these forums had a +rep/thanks button.

You've already been very informative, but is there any chance you'd be keen on writing a formal tutorial with a capx? Or perhaps two tutorials - one with the pathfinding and another with the node-based technique?


I have made a tutorial for the node based dungeon generator and it was rough i have to admit, takes a lot longer time than you would think, so pretty sure it will be some time before ill do that again. :lol:

You can find it here:
https://www.scirra.com/tutorials/999/random-dungeon-generator-node-based
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Tue Apr 29, 2014 3:00 am

Thank you so much @nimos100
B
3
Posts: 5
Reputation: 187


Return to How do I....?

Who is online

Users browsing this forum: SputnikCZ and 3 guests