Check out the latest Staff Blog update that talks about what's changed, what's new, and what's up with these "Pixels".
Making it draw water
making it draw water.
the world map is a 500x500 array of structs, one for each map square.
one of the variables in a wold map struct is watertype:
none, dry creek, creek, stream, river, lake, spring, waterhole, dry waterhole, or swamp.
ocean is considered an elevation type, like flat, hill, mountains, etc.
each map square has its own d3d coordinate system, and is 26400x26400 id3d units in size.
the game has a heightmap function that takes a map square x,z, and d3d x,z, and returns the d3d y value of the ground at that point in the world.
the heightmap function uses the info stored in the world map struct for the map sqaure to select a heightmap formula, and any modifiers. the basic heightmap formulas are ocean, flat, hills, mountains, and impassable mountains. they are of the general form y=A*sin(B*x)+C*cos(D*y), or summations thereof, IE superimposed sine waves. i may switch to perlin, and i may add bitmap based as well. Each map square can have a different heightmap. So they usually don't line up at the borders. heightmap seam fixing code is used to fix this. it works with any type of heightmap. modifiers to the basic heightmap create depressions for water and tarpits, create cliffs, create canyons, and fix the seams at map square edges.
this heightmap info is used to generate a 300x300 chunk of ground mesh on the fly as needed. actually 4 meshes, one for each ground texture tile (except jungle which just has one ground tile texture, and therefore one ground mesh in a chunk) . Then the water quads are drawn.
Note that the water (and most everything else) is just placeholder graphics. right now i only have 2 kinds of trees, 4 kinds of plants, and 4 ground texture tiles in this woods scene, and the plants aren't even drawn at different orientations.
if i had the time, i could get it to the point where you could walk up to a tree and go "that's a birch!" or "that's an oak!" or "that's a maple!". but i'm just an army of one, and this game has evolved into a large scope project.