From 96a6b073c5ef632c156437ed86913d5979e96c08 Mon Sep 17 00:00:00 2001 From: xolatile Date: Sat, 25 May 2024 10:43:47 -0400 Subject: [PATCH] Experimenting with very simple generation... --- source/world.adb | 49 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/source/world.adb b/source/world.adb index abab68f..a48497e 100644 --- a/source/world.adb +++ b/source/world.adb @@ -14,7 +14,7 @@ package body world is view_reach : constant integer := 96; lake_count : constant natural := 3; - lake_reach : constant natural := 3; + lake_reach : constant natural := 12; landmark_limit : constant integer := 90; location_limit : constant integer := 30; @@ -109,30 +109,55 @@ package body world is end loop; end loop; -- - -- WATER TESTING for this in 1 .. lake_count loop declare lake_x : integer := 0; lake_y : integer := 0; + factor : boolean := false; begin lake_x := core.random (2 * lake_reach, map.width - 2 * lake_reach - 1); lake_y := core.random (2 * lake_reach, map.height - 2 * lake_reach - 1); -- for x in -lake_reach .. lake_reach loop for y in -lake_reach .. lake_reach loop - map.tiles (lake_x + x, lake_y + y) := core.random (18, 23); + factor := core.random (0, abs (x * y)) > abs (x * y) / 6; + -- + map.tiles (lake_x + x, lake_y + y) := (if factor then core.random (0, 17) else core.random (18, 23)); + end loop; + end loop; + -- + for x in -lake_reach .. lake_reach loop + for y in -lake_reach .. lake_reach loop + for again in 0 .. 3 loop + if map.tiles (lake_x + x, lake_y + y) < 18 then + if boolean'pos (map.tiles (lake_x + x - 1, lake_y + y - 1) > 17) + + boolean'pos (map.tiles (lake_x + x - 1, lake_y + y ) > 17) + + boolean'pos (map.tiles (lake_x + x - 1, lake_y + y + 1) > 17) + + boolean'pos (map.tiles (lake_x + x, lake_y + y - 1) > 17) + + boolean'pos (map.tiles (lake_x + x, lake_y + y ) > 17) + + boolean'pos (map.tiles (lake_x + x, lake_y + y + 1) > 17) + + boolean'pos (map.tiles (lake_x + x + 1, lake_y + y - 1) > 17) + + boolean'pos (map.tiles (lake_x + x + 1, lake_y + y ) > 17) + + boolean'pos (map.tiles (lake_x + x + 1, lake_y + y + 1) > 17) > 3 then + map.tiles (lake_x + x, lake_y + y) := core.random (18, 23); + end if; + --~else + --~if boolean'pos (map.tiles (lake_x + x - 1, lake_y + y - 1) < 18) + + --~boolean'pos (map.tiles (lake_x + x - 1, lake_y + y ) < 18) + + --~boolean'pos (map.tiles (lake_x + x - 1, lake_y + y + 1) < 18) + + --~boolean'pos (map.tiles (lake_x + x, lake_y + y - 1) < 18) + + --~boolean'pos (map.tiles (lake_x + x, lake_y + y ) < 18) + + --~boolean'pos (map.tiles (lake_x + x, lake_y + y + 1) < 18) + + --~boolean'pos (map.tiles (lake_x + x + 1, lake_y + y - 1) < 18) + + --~boolean'pos (map.tiles (lake_x + x + 1, lake_y + y ) < 18) + + --~boolean'pos (map.tiles (lake_x + x + 1, lake_y + y + 1) < 18) > 3 then + --~map.tiles (lake_x + x, lake_y + y) := core.random (0, 17); + --~end if; + end if; + end loop; end loop; end loop; end; end loop; - map.tiles (10, 10) := 28; - map.tiles (11, 10) := 24; - map.tiles (12, 10) := 29; - map.tiles (10, 11) := 26; - map.tiles (11, 11) := 18; - map.tiles (12, 11) := 27; - map.tiles (10, 12) := 30; - map.tiles (11, 12) := 25; - map.tiles (12, 12) := 31; -- for index in 1 .. landmark_limit loop map.landmarks (index).index := core.random (0, landmark_count - 1);