Sunday, February 4, 2024

Weekend Project: Water Zones

I had quite a busy weekend.  First, I  created a rudimentary world map window.  For larger maps, the scroll bars allow scrolling around to see the entire map.  I still have a lot to do to it, but it is a start.

Water Zones.  A YouTube video showing how to do this is now up on my channel, here.

Next, well, I did not expect to tackle this feature so soon.  But inspiration struck and here I am with a first-pass at a water zone system.  The world builder has been updated to separate all water tiles into zones.  A zone is defined as a group of touching water tiles.  Depending upon the total count of the zone, the water tiles range from a natural spring to a river.  The following features are in place:

  • 100% procedurally generated water zones.
  • 7 water zone types, from smallest to largest: well, natural spring, watering hole, pond, lake, creek, river.
  • 5 water depths.
  • Ponds, Lakes, Creeks, and Rivers are randomly named using historical and fictional names.
  • Mousing over a zone will identify it and provide some basic details (see photos).
  • New water tiles (the best ever!) with 8 water styles from calm to raging.
  • Depracated the water shader approach (from my previous post) and decided to create tilemap animated water tiles.  This was my first look at the tilemap animated tiles in Godot 4.  I love it!!!
  • Animations include 21-tile flowing animations from an amazing free resource:
  • JSON definitions for 80 named water zones with many more to come.




The North Platte River!

There were two very challenging parts to this feature.  First, I had to write some translation logic for the Perlin noise water tiles in order to ensure that shoreline tiles were shallow and tiles out in the middle would be deepest.  Next, I had to write the zone detection and selection feature.  After a dozen failed approaches, I finally figured out how to group adjacent tiles into their own zones.  It takes exponentially longer to run the calculations for larger maps, but it is working well.  I will keep on optimizing.  What do you think?

Oh, and I also managed to add a new tree to the game.  Cottonwood, a very common tree in 1820 Wyoming, and even today!  You can see them in the second screenshot above.

Until next time!

I'm Bound2bCoding

No comments:

Post a Comment

Feel free to leave a comment. All comments are moderated.