# Spawning sets of rooms!

This forum is currently in read-only mode.
0 Favourites
• 6 posts
• I've been busting my head trying to do something on my own, but I guess I'll have to post it here so you guys can have a look.

I've been trying to make a randomized "dungeon" level, made of tiles. But instead of having each tile randomly (or at least following some laws) on the screen, I must use some predesigned sets of tiles (let's call them "rooms") of 5x5 tiles, for example. Then, at level creation, these rooms will be placed randomly.

What's the best way to do this? I'm thinking about having a TXT file with the information of each room's layout, then choose each of these rooms and create each tile on the screen. But what's the best way to do it?

I'll begin this right away, so I can post some of my efforts here!

**Edit**

I made a TXT with this structure (using a 5x3 tiles room):

1= 3,1,1,2,2,

2,1,3,3,3,

3,2,1,2,3;

2= 1,1,1,1,1,

1,2,2,2,1,

1,1,1,1,1;

But since the Text Manipulator reads the files line by line, I had to go with this:

1= 3,1,1,2,2,2,1,3,3,3,3,2,1,2,3;

2= 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1;

I decided to use one array to store every room in the game: Using X for the room and Y and Z for the tiles position (X and Y).

So now I'm trying to make the Array with the Text Manipulator... Any advices?

**New Edit**

Hmmm... I messed around with the array and now I'm thinking about using the APPs to create a level editor, saving the array positions...

Is there a way for me to write a TXT file then have it loaded into the Array with the "Load from file" command?

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• I did this stuff (auto map-generator)

It is messy, overblown and somewhat undone... don't wanna show it to anyone : )) but it works.

I can tell you - I'm using one big array for the map (2D). For example:

``````0000000000
0001111000
0001111000
0001111000
0000000000[/code:11qivovx]
1- is room-tile (it can be other symbol)
0 - is clear space

Also I've created an algorythm to spawn rooms and corridors ramdomly like.. like chain, you know. One by one (and it's possible to do some ramification).

Like this:
Room - corridor  - Room - corridor.
|
corridor
|
room.

Hope you understand something.

[h2][i]|||..edit1..|||[/i][/h2]
Also it's easy to create map-loader/saver (I've done it) array-txt. It can resolve your problem with text Manipulator (it's unnecessary).``````
• Hi Russ!

Thanks for the reply! I think I get you.

Right now I'm working on a "tileset editor". It lets you intuitively change the tiles then save it on a big array. I'll post it here once it's done!

• Hi!

Are you creating a map-editor, I suppose?

It's interesting. I have an idea HOW TO do it, but have never tried :]

My map-generator is abandoned right now. Funny, it was my first big project on Construct.

Now I'm trying to do another thing.

(and it's neccessary to create map-editor but not right now)

So, it's good for both of us to communicate.

• There it is. Of course I'll have to improve it, and the art and button feedback sucks, but you can have a nice example of how it works:

http://www.gamma-beam.com/construct/tileSetCreator.cap

It's a very simple concept, but it will work fine with what I need!

I'm building 8x10 tile sets, and I'll stick these sets together to form an ever-growing, semi-random dungeon. This will be an exploration "roguelike" maze game.

• Ok, I'm writing here.

Finally I got it

But it works well!

Anyway it is something different than I've thought. But nevermind