Lod34 / Scoundrels-Kingdom

"Scoundrels Kingdom" is an adventure RPG set in a fantasy kingdom full of magic, intrigue and dark secrets. Players explore a vast open world, navigate complex political power games, and face tactical challenges against mystical creatures and cunning enemies.
Other
0 stars 0 forks source link

Procedural generation map #1

Closed Lod34 closed 1 week ago

Lod34 commented 3 months ago

I'm having trouble creating the game map. Initially, the issue was understanding which terrain set should go first. Based on the texture of the land and water, the water terrain set would be the last one (3). So, if it says "cliff," it actually means the water level. Therefore, if water was the last level, the first one should be the cliff level. But bitmasking for the latter isn't working, probably because I haven't inserted an atlas for the cliff level that has all 9 cells filled. In any case, I've tried to solve it in multiple ways, but I can't.

here's the code: Scripts/proc_gen_world.gd

immagine_2024-06-11_130154715

immagine_2024-06-11_130128429

immagine_2024-06-11_125412743

immagine_2024-06-11_125441112

immagine_2024-06-11_125501739

Lod34 commented 1 month ago

I had a great idea. to solve the bug in my opinion you could create "masks" for the terrain. Let me explain better:

let's say the order of the terrains layers is cliff, grass, water

Ok, so let's set the various tiles... and the famous bug remains to be solved. Initially I would have filled the entire level 0 with water, but we can create cases, for example:

if above this block there is a grass tile --> then fill level 0 with grass

if there is a water tile above this block --> then fill level 0 with water

and so for the other cases.

While if you want to add the "scorched earth" effect with the dirt, just create a new tile map above the main one, but it must be created with another type of noise, so as not to be the same. And always using the if system:

if this block is a grass tile --> replace the grass tile with a dirt tile following the pattern of the noise just created

This system has only one problem: if the dirt is close to a level boundary, it will appear broken. It can be solved by setting a padding, but I don't know how to do it.