randomly generated reasonable world

Get help using Construct 2

Post » Tue Jul 02, 2013 4:26 pm

Hello,

I know there are several tries on this topic, but all of these are only usable for some kind of endless runner game, at least I think so.

I need a modified version and I do not know how to accomplish it.

I want a nicely reasonable generated surface terrain combined with detached reasonable caves in the underground to generate a nice adventure world.

A major problem maybe is that I want it to be generated only at the first start of the game. The randomly generated world should be saved and loaded, when you restart the game.

I thought about this whole thing and came up with an idea, but I am not sure if it is doable because it could cause some kind of lag:

Could you actually make the world to be 1 array? Let's say the world is 1 big grid. The height is 15 squares of this grid and the width is 20.000.

Now on every square of this grid, which is actually filled with a block of the terrain, the value is 1. When there is no block on the square, the value is 0.

So you could save and load this array to keep the randomly generated world. When the players destroy or creates a new block on the grid, the array is changed and saved when the game is closing.

Then you could have a second array, which is holding the different materials like earth, stone etc.
Let's say 0 for earth, 1 for stone etc.

Is this doable or do you know a better way of achieving it?

I would really appreciate your help, whether it is in form of a tip, idea or even a example capx.

Best Regards,
Astrosus.
B
8
S
2
Posts: 110
Reputation: 1,463

Post » Wed Jul 03, 2013 12:20 am

3.000.000 elements to cycle thru every time you loop thru the Array ,
With that , I can say all what your array will do is crash the game

Also . Procedural's hard , to get to a pretty good generation , you'll need a modified version of perlin noise, and coding that bad boy isn't easy AT all , while you could use easier algorithms like diamond-square or midpoint displacement ( There's an example running around but I'll let you do the search ) but it's not your level AT ALL.

A lot of people went for gold and falled short , I'm telling you , try something at your level , and when you'll understand C2 better , tackle those subjects .

Cheers !

Edit:

My blow-hard answer ;

Generate a 1D curve using midpoint displacement and fill all the bottom with minerals and such

and then , for cave generation ...
"Mine" the generated terrain using this techniqueWhiteclaws2013-07-03 00:33:01
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461


Return to How do I....?

Who is online

Users browsing this forum: David181, evillair and 57 guests