How to create a map like ‘hypoxia’ in Godot4 by procedural generation?

25 Views Asked by At

I want to make a game such like 'hypoxia', but i wonder like know how to do that? blocks sample

as the pic,

  1. them have difference boder between the difference elements
  2. They also express continuity, even if only exists on the diagonal

I tried drawing different blocks and using tileMap to assemble them, but them was sander block.

Please let me know what i should to do, including the game art.

thanks a lots

extends Node2D

var noise
var map_size = Vector2(100,100)
var dirt = 5
var gold = 3

# Called when the node enters the scene tree for the first time.
func _ready():
    randomize()
    noise = FastNoiseLite.new()
    noise.set_noise_type(FastNoiseLite.NoiseType.TYPE_PERLIN)
    noise.seed = randi()
    make_chuck()

func make_chuck():
    var dirt_cells = []
    var gold_cells = []
    for x in map_size.x:
        for y in map_size.y:
            var block = noise.get_noise_2d(x,y) * 100
            if  gold < block && block < dirt:
                print(block)
                dirt_cells.append(Vector2i(x,y))
            if block < gold:
                print(block)
                gold_cells.append(Vector2i(x,y))
    $cv.set_cells_terrain_connect(0,dirt_cells,0,0) ##dirt
    $cv.set_cells_terrain_connect(0,gold_cells,1,0) ##gold

0

There are 0 best solutions below