Game Development Reference
In-Depth Information
total, only six triangles are updated—every frame for each wall—and processing time is kept to a
minimum.
Geometric processing
Downloading a complete model from the server can become an issue if the model is considerably large
and download speed is slow. Common solutions to this problem, such using gzip compression in the http
level or using a binary data format instead of textual JSON, don't address the underlying fact that a model
may inherently contain a lot of information.
Figure 8-6. (a) The simple quad mesh the grid is based on. (b) The desired grid effect.
Often in algorithms design, a significant performance gain is achieved by changing the actual algorithm
rather than by making tweaks and micro-optimizations in the code level. In the context of 3D models, this
is analogous to using a different, simpler model instead of optimizing the details of format and transport
efficiency. In CycleBlob, the world grid is based on a quad mesh, which is essentially a simple structure.
However, for display, I wanted the grid to have holes through which the rest of the world can be visible.
This effect can generally be created through various means, which I've considered when writing the game.
Rendering the grid using thick line primitives. In addition to polygons, the graphics hardware is
also able to draw lines from vertex to vertex. To draw the grid, thick lines are stretched between
two neighboring vertices (see Figure 8-7). This option requires the model data to specify line
segments, rather than triangles or rectangles, so some data conversion needs to take place. The
main drawback of this method is that thick lines don't appear as realistic as polygons when it
comes to creating the illusion of a surface. Line primitives are drawn as thick, 2D strips, so under
close examination they appear to add a certain, unaesthetic thickness to the surface. Moreover,
with thicker lines, small gaps between segments become visible.
 
Search WWH ::




Custom Search