Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 1 more developer from Canada and 12 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!

Desert sands


CAVEMAN (C) 2000-2013 Rockland Software Productions

Desert sands

Sand terrain. 4 tiled seamless texture maps, and practically no moirre' patterns!

distance scale in the game is 1 foot = 1 d3d unit.

terrain is drawn in 300x300 chunks. a chunk is a list of all the terrain textures in a 300x300 area, and for each texture, a list of all the meshes that use it. all textures are 256x256, and a matra of one texture per mesh is used. chunks are genrated on the fly as needed. 10-20 (can't recall offhand) chunks are cached in memory with LRU replacement.

the ground mesh is actually 4 meshes, one for each ground texture tile. a world map determines the heighmap function and texture set used. a "pattern map" determines the texture ID of a given quad. a 10x10 ground quad is heightmapped, moved to its location in the chunk, and added to the static VB and static IB for that ground texture's mesh. once all 4 meshes are generated, their textues and meshes are added to the chunk.

when a chunk is drawn, the game simply cycles through the list of textures, setting each one, then drawing all its meshes, then moving on to the next texture. each mesh get a frustum cull, then gets sent off to directx for drawing. at this time, no sorting on mesh ID or nearest to farthest is done.

this method is required to allow a large (2500x2500) mile seamless world that can change at any time by random events in the simulation or by player actions.

this is all done with just textures and one light in fixed function. no shaders, no multi-texturing, no tex blending, nothing fancy (yet! <g>).