Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!




Drawing things the "new way"



Copyright

CAVEMAN (C) 2000-2013 Rockland Software Productions

Drawing things the "new way"

Drawing things the "new way"

No LOD yet, drawing out to 1000 feet. about 10,000 batches. fixed function, no shaders yet. drawtime for this frame was 33 ms.

Chunk based terrain. Originally the game filled he render queue directly from the world map data, checking for things like "is there water in the way of this plant?", "is there a temporary shelter in the way of this tree?", etc. this took a long time. world map data was laid out in a form that was efficient for storage and use, but not efficient for drawing.

This required a major re-thinking of how things were done. Since this was about drawing graphics faster, i applied the best design methodology available in such cases: "hardware driven design".

Hardware driven design means starting at the lowest level (the hardware or the lowest level API you call against), and saying, "ok, what does this thing want? and what format does it want it in? and what is it good at doing really fast? and what is it slow at?". its a bottom up approach where the needs of a lower level component/API dictate the design of the higher level components/API's above it.

using this approach led to the following changes:

1. creation of a data structure that holds terrain drawing information in a format optimized for fast digestion by directx.

2. instead of drawing the ground as individual dynamic quads with unique textures, all quads with the same texture are placed in a single static mesh, resulting in 4 interleaved meshes making up the ground mesh (most terrain types currently use a 4 tile texture set).

3. instead of processing the world map data to fill the render queue each frame, the world was divided into chunks. chunks are generated on the fly and contain the contents of the render queue for a 300x300 area of the world (before frustum culling), including ground mesh, rocks, plants, trees, bushes, water, etc. drawing a chunk consists of simply frustum culling and drawing each mesh in the chunk.

the data structure designed for the chunk system worked so well that the render queue in the Z3D game library used by Caveman (and all my other games) was redesigned to use it.




    PARTNERS