Game Development Reference
In-Depth Information
Best practices
Now that you're ready to take the theory just discussed, where the rubber meets the
road, let's discuss a few best practices on how to do just that. While a complete topic
could be dedicated to this topic, the following selection covers what I believe to be
the top five most important best practices for mobile web development. Again, these
concepts apply to generic web applications as well as games.
Degrade gracefully and enhance progressively
Up to a couple of years ago, any discussion about adding new and cutting edge
functionality to a web application was built around the topic of graceful degradation.
More recently, that ideology has shifted more towards the other end of the spectrum,
where the suggested way of building multiplatform and multidevice applications is
with progressive enhancement.
In this context, graceful degradation refers to building the full-blown application first
(the latest and greatest desktop browser), then scaling it down so that it works on a
less capable browser as well as on mobile devices. Similarly, progressive enhance-
ment refers to building the mobile version of the application first, then making it
work on the desktop browser. Whichever approach is taken, the end result is the
sameā€”one application that functions equally well on both platforms.
While much can be said about both of these approaches, in practice none is partic-
ularly better than the other. The only difference is simply where you start. Hopefully,
the application is well planned for, so that each version is already envisioned before
construction begins, so that starting at either end will take the application to the same
place. Normally, however, the ideal approach to take depends largely on the type of
project in question.
In the case of most games, as was indeed the case with the 2D space shooter game
built for this chapter, it is much easier to develop the desktop version first then re-
move whatever functionality is not supported by, or appropriate for, mobile devices.
For example, the main rendering loop of our game is based on the new requestAn-
imationFrame function. Now, not all browsers expose this function yet, while oth-
ers expose it through a different interface. Gracefully degrading this functionality
Search WWH ::




Custom Search