HTML and CSS Reference
In-Depth Information
Servers play an important role in getting content to your players. You don't need to be a large game developer to
experience a runaway success with your game. The last thing you will want is to have hosting and performance issues
impeding the playability of your game. A good hosting strategy will allow another service to do the heavy lifting while
you focus on providing exciting content.
Effective Asset Grouping
Understanding how files are loaded by the browser and how best to process them is important to have a quick loading
game, but reasoning at a higher level about whether to load them is the most effective way of reducing load times. As
the game developer, you know when you need an asset, how frequently it is used, and what its dependencies are. For
example, to render a simple model you will likely require shaders for all the materials used, one or more textures for
the material, and possibly other associated meshes with their own shader and texture requirements. If you are aware
of the dependencies between the assets, you can consider grouping them into a single request instead of making
separate HTTP requests for each asset. This can reduce the total number requests the browser has to handle and
ensures that all asset content is available at the same time. Once again there is a trade-off with the ability to process
assets in parallel, but this section assumes that the cost of retrieving the assets separately is higher.
One option is to group assets by type (e.g. sounds, textures, shaders). The advantage is that if you can identify a
commonality between them, you may be able to group them in a way that reduces redundant data. The most obvious
example is the use of spritesheets to group a number of 2D character animations. In a single texture there would be
no duplication of start frame of the animation, for example. Depending on the compression method, you may also see
improvements in compressing assets together compared to compressing separately. Another advantage is the ability
to easily replace one set of assets with another, for example a texture pack for a model that provides a different skin
for the same mesh without having to replace the mesh. This might be useful if you have customizable characters. One
disadvantage of grouping by type is that you can easily end up waiting for a single asset type to be processed before
the game can progress. Players may end up waiting longer for the game to load before they have a visual/audible
indication that progress is being made.
Another option is to group by dependency (e.g. any assets that need to co-exist to be used). One example is
grouping a model with associated assets specific to that mesh (e.g. shaders, textures, animation data, sounds). The
advantage is that you could be animating the model while loading other models in the background. It is important to
make sure that background loading of assets doesn't have an impact on the performance of rendering the model, but
that topic deserves its own chapter. One disadvantage of this approach is that shared assets may need to be duplicated
or the dependency tree ends up encapsulating the majority of the game assets, losing the granularity of loading in
small chunks. To avoid duplicating shared assets, it might make sense to group common assets together, which can
then be loaded first before any other group.
Another option is to group by association. One example would be grouping by game level. If the game only
requires certain sounds, textures, and other data for a specific level, then it might make sense to only load the data
when the level is being loaded. This is especially true if players have to unlock levels or buy additional content.
Grouping in this way assumes that levels are mainly independent of each other and that the game will have the ability
to access that data at a later point. These high level associations depend massively on the design of the game and how
it is played, but by thinking about grouping at this granularity you can make more impactful decisions on load time.
Figure 2-6 presents a few scenarios in which grouping may occur.
Search WWH ::

Custom Search