Game Development Reference
In-Depth Information
With all of this in place you should now be able to move the player ship around. Of
course you can't see it yet because we need to write in a way to render the system,
using a renderer to manage everything.
Renderer
The renderer is just an encapsulation of the texture loading and drawing code we
have created so far. We will use the renderer to keep track of a scene, which refers
to all of the visual objects in the game world, and draw everything in the scene. At
the same time the renderer can provide a number of other features that can be use-
ful to complex games.
Resource management
Content gets re-used in games quite a bit, and if you had to load each texture and
piece of data for every instance you would waste a lot of memory. To get around this
we need some form of resource management. As usual for games there are many
ways to go about implementing this, from a really simple cache to a complex memory
and resource manager that sits separate to all other sub-systems in the game. For
our sample we'll add a really simple resource manager to the renderer to cache the
textures as they are loaded, but for a larger game this is insufficient, so let's take a
look at what usually goes into the design of a resource manager.
To get started, we need to have a way to work with the filesystem. Some games
store resources as individual files on the disk; however, this creates a lot of overhead
seeking between the different files. To get around this many games implement a
packaging system that combines the files together to allow for faster loads by read-
ing from a block of disk space rather than random files. This has the benefit in some
situations of allowing the package to be loaded into memory as a block of data and
then the resources are extracted from there. Other benefits include allowing the de-
veloper to arrange the resources on disk based on their usage. For example, all of
the textures used in a level could sit in a single package, allowing for easy installation
of new levels with all of the dependencies included. Console games with disc-based
access need to consider the layout of the files on the physical disc, and often optim-
ize for the reading patterns of a DVD or Blu-Ray drive.
Once you have a way to access the file from disk (either through an access layer
or direct) you need to look at ways of loading and parsing the data. One common
Search WWH ::




Custom Search