Why using chuncks with infinite world creation (unity C# 2d top down)

1.4k views Asked by At

I'm making a 2D top dowm survival game, I have Perlin-Noise working (I load different sprites based on the Perlin-Noise value) but now I'm at the point to spawn the "floor" inside camera-view and delete "floor" outside the camera-view. When I google or look at YouTube I only see tutorials where they use chunks.

My "floor" is made out of sprites and I use collisions (you can't walk on mountains for example)

Now I wonder if it has benefits to use chunks because in every chunk I have to make the sprites. I mean I have to make/load the sprites either way.

So I could:

1) I make chunks with for example 3x3 sprites and load them

2) I just load needed sprites (you could call it chunks of 1x1)

I can't find any benefit for 1) but all tutorials use chunks. So maybe I'm missing something

thank you for your time :)

1

There are 1 answers

0
Orchaldir On

I use a finite map, but the ideas are similar. I have a map where each cell has a size of 100*100 meters. For each of those cells I store high level stuff like the land form (e.g. hills, high mountains, ocean), biome (desert, snow, forest) & weather.

For each of those cells I can generate a map of many smaller cells using interpolation and extra noises. Those cells contain the information that changes from cell to cell in the same chunk.

Using large chunks can also help with render performance of terrain, because they can all share the same 3d mesh. The height is encoded in a texture and the shader accesses it.