Spawning sets of rooms!

For questions about using Classic.

Post » Wed Dec 16, 2009 12:35 pm

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! :wink:

**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... :D :D :D

Is there a way for me to write a TXT file then have it loaded into the Array with the "Load from file" command?
B
107
S
40
G
10
Posts: 456
Reputation: 13,202

Post » Wed Dec 16, 2009 4:08 pm

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:
[code:11qivovx]
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. :| Sorry if my post is unreadable :D
I want to help you, so you can ask something :)

[size=85:11qivovx]|||..edit1..|||[/size:11qivovx]
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).
B
3
G
3
Posts: 29
Reputation: 933

Post » Wed Dec 16, 2009 4:15 pm

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!
B
107
S
40
G
10
Posts: 456
Reputation: 13,202

Post » Wed Dec 16, 2009 4:25 pm

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-[u:3e6amt0t]generator [/u:3e6amt0t]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-[u:3e6amt0t]editor[/u:3e6amt0t] :) but not right now)

So, it's good for both of us to communicate.
B
3
G
3
Posts: 29
Reputation: 933

Post » Thu Dec 17, 2009 12:34 pm

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.
B
107
S
40
G
10
Posts: 456
Reputation: 13,202

Post » Tue Dec 22, 2009 3:44 pm

Ok, I'm writing here.

Finally I got it :) Pretty 'clear' interface :D It takes some time to understand :)
But it works well!

Anyway it is something different than I've thought. But nevermind :) Good luck, gammabeam! Nice start for the great game :)
B
3
G
3
Posts: 29
Reputation: 933


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 10 guests