fewer deserts

This commit is contained in:
Chris Bell 2025-03-01 23:10:22 -06:00
parent 2be653504a
commit cc339b9389
4 changed files with 7 additions and 14 deletions

BIN
game/game

Binary file not shown.

View File

@ -25,7 +25,7 @@ main :: proc() {
rl.SetTargetFPS(60)
player = {
position = {CELL_SIZE * 10, CELL_SIZE * 10},
position = {CELL_SIZE * 10000, CELL_SIZE * 10000},
camera = {
zoom = 4,
target = {player.position.x + (CELL_SIZE / 2), player.position.y + (CELL_SIZE / 2)},
@ -37,7 +37,7 @@ main :: proc() {
load_tilemap()
defer unload_tilemap()
world = create_world("test_world", 23462547245)
world = create_world("test_world", 23456725245)
save_world(&world)
game_loop()
@ -65,7 +65,7 @@ game_loop :: proc() {
player_grid_pos := get_player_grid_position(&player)
player_grid_pos_tile := get_world_tile(&world, vec2_to_vec2i(player_grid_pos))
current_chunk := get_chunk_from_world_pos(&world, player_grid_pos)
status_string := rl.TextFormat("POS: [%i,%i] : %v | Chunk: %v : %v | MODE: %v", int(player_grid_pos.x), int(player_grid_pos.y), player_grid_pos_tile.type, current_chunk.position, get_biome_from_id(current_chunk.biome_id).name, player.mode)
status_string := rl.TextFormat("POS: [%i,%i] : %v | Chunk: [%i,%i] : %v | MODE: %v", int(player_grid_pos.x), int(player_grid_pos.y), player_grid_pos_tile.type, current_chunk.position.x, current_chunk.position.y, get_biome_from_id(current_chunk.biome_id).name, player.mode)
rl.DrawText(status_string, 5, 25, 20, rl.RED)
rl.EndDrawing()

View File

@ -93,7 +93,7 @@ handle_player_input :: proc(p:^Player, w:^World) {
// Movement
target_pos := get_player_grid_position(p)
dt := rl.GetFrameTime()
move_delay : f32 = 0.0
move_delay : f32 = 0.2
if p.move_timer > 0 {
p.move_timer -= dt
}
@ -215,7 +215,7 @@ will_collide :: proc(w:^World, pos:rl.Vector2) -> bool {
#partial switch tile.type {
case .SOLID:
return false
return true
}
return false

View File

@ -149,7 +149,7 @@ get_biome_type :: proc(world_pos: Vec2i, seed: i64) -> Biome {
// Adjust temperature to create larger hot regions
// This skews the distribution to have more areas with higher temperature
temperature = math.pow(temperature * 0.5 + 0.5, 0.8) * 2.0 - 1.0
// temperature = math.pow(temperature * 0.5 + 0.5, 0.8) * 2.0 - 1.0
// Local variations (small details)
local_var := noise.noise_2d(seed, {f64(world_pos.x) * local_scale, f64(world_pos.y) * local_scale}) * 0.1
@ -162,18 +162,11 @@ get_biome_type :: proc(world_pos: Vec2i, seed: i64) -> Biome {
normalized_moisture := moisture * 0.5 + 0.5
normalized_temperature := temperature * 0.5 + 0.5
// DEBUG: Uncomment to log values when testing
// fmt.println("pos:", world_pos, "temp:", normalized_temperature, "moisture:", normalized_moisture)
// Lakes appear in low elevation areas
if normalized_elevation < 0.3 {
return lake_biome
}
// ADJUSTED: More generous desert conditions
// Deserts appear in hot OR dry areas (not requiring both)
// This makes deserts more common and creates larger desert regions
if normalized_temperature > 0.55 && normalized_moisture < 0.4 {
if normalized_temperature > 0.6 && normalized_moisture < 0.3 {
return desert_biome
}