How do I create an "infinity" map using tilemap

Get help using Construct 2

Post » Wed Oct 07, 2015 4:15 pm

I have created a basic map generation. Basically this system randomly creates all the terrain, but i dont want a fixed layout where you can reach the start and the end of the map, I want to create something like a sandbox game. In order to do that, instead of my character moving, all the rest of the map needs to move to the appositive direction, so if I jump, the character don't move but the rest on the screen will move down. If I walk to the right, the map will move to the left and so on. The problem is that i don't know how to do that with tilemap because I can't just work with it's width and height like a tiled background would work.

Also, I'm using array to make it possible. I thought about having an extremely big array and start feeding it in the middle of it's width and height and then make this transition about what is shown in the tilemap and what is deleted as it goes away from my view.

Obs: the array should be, in any situation, extremely big in order to feel like a sandbox so the player couldn't reach the start or the end of the map, so it would feel like an infinity map.

To sum up, how do I create an "infinity" map using tilemap and array?


Edit: Which's the limit of width and height of an array? How much megabytes would have my savegame if this array had 100k of width and height filed?
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Wed Oct 07, 2015 5:38 pm

Javascript's numbers are stored in 8 bytes of memory. Assuming your array is filled with 100 000^2 of these numbers, it would consume roughly 80 000 000 000 bytes of memory / disk space. In terms of megabytes that would be 76 294, which is far too much for anything practicable.

For large scale "infinity"-like map, it's much better to work with "procedural generation" and only save alterations to the map (if any).
B
75
S
31
G
27
Posts: 1,015
Reputation: 20,765

Post » Wed Oct 07, 2015 5:52 pm

Magistross wrote:Javascript's numbers are stored in 8 bytes of memory. Assuming your array is filled with 100 000^2 of these numbers, it would consume roughly 80 000 000 000 bytes of memory / disk space. In terms of megabytes that would be 76 294, which is far too much for anything practicable.

For large scale "infinity"-like map, it's much better to work with "procedural generation" and only save alterations to the map (if any).


You mean to don't keep stored what was already created? If so how can I generate what was discovered by the player before?
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Wed Oct 07, 2015 6:53 pm

@Magistross

I was looking at it and I found a method using seeds, where you randomly generates this seeds (a sequence of letters) and then this seed will generate the map. It means that this seed can be saved to generate the same map over and over. It's awesome because u just need to save the "trigger" that created that kind of world and not actually the whole world. But then it starts to be really complicated and I don't see right now how to use this method with arrays and tilemaps in construct 2.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Wed Oct 07, 2015 6:58 pm

It's in fact quite a complicated subject. But you got the basics right, it all boils down to using seeds so you can manipulate the RNG in producing consistent and predictable results.
B
75
S
31
G
27
Posts: 1,015
Reputation: 20,765

Post » Wed Oct 07, 2015 7:14 pm

@Magistross

Well, I'll try translate this method in construct 2. I can see that it will be a really tough task but I'll try.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Wed Oct 07, 2015 8:11 pm

You could also settle for a hybrid method. Procedurally generate chunks of new terrain on demand, and only have the current chunk and its neighbors loaded in memory at a time. This way, generation would only occur once per chunk, and the world would still be consistent and "infinite" without weighting terabytes of data. ;)
B
75
S
31
G
27
Posts: 1,015
Reputation: 20,765

Post » Wed Oct 07, 2015 9:15 pm

@Magistross

Actually I was thinking about something like this.

Each letter would represent a previously created small pattern. But if, in this randomization of seeds, happens to occur two same letters in sequence, it would represent a bigger pattern, like an evolution of the small pattern represented by the letter A.

Would be really painful to create all these patterns before start randomizing anything, but after that the possibilities is huge.

Also I'm only thinking about the simple part of the terrain( the "silhouete" - It's a platform game). I didn't think about other elements on the map yet.

The idea behind of all of this is that I'm trying to create a game where you can go from planet to planet and find different terrains, materials and animals/enemies each time you explore a different planet.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Wed Oct 07, 2015 9:27 pm

I'd recommend using the noise plugin:
viewtopic.php?t=93998&start=0

It lets you use perlin noise which is the basis of Minecraft's terrain generation.
B
94
S
33
G
118
Posts: 5,393
Reputation: 75,847

Post » Thu Oct 08, 2015 1:20 am

R0J0hound wrote:I'd recommend using the noise plugin:
viewtopic.php?t=93998&start=0

It lets you use perlin noise which is the basis of Minecraft's terrain generation.


I did some research about this perlin noise. Could you please sum up the subject for me? All the video tutorials about this method is in english and my spoken/listen english isn't that good to understand such a complicated theme. Also, I'll look at it for sure but this plugin is for it or just can be used for this?

Thanks

Edit: I'm looking at it and I don't see how it could be helpful to create random terrain in a platform game using tilemap/array. I can see that the different shades is used to represent something else, but I'm not getting how to use this plugin and this "clouds" and translate to my tilemap which is dependent on what tile was placed before because they have a sequence (e.g after tile 2 I can place tile 3 on the same Y or 4 with Y-1 regarding to the last tile position)
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Next

Return to How do I....?

Who is online

Users browsing this forum: Magistross and 3 guests