Game Development Reference
In-Depth Information
That said, because the Web is universally available, consider what devices may be
accessing your game and what constraints they may have. Varied screen sizes and
resolutions are nothing new, but touch controls in particular can present challenges
for 3D games. Still, applying traditional web development techniques to games can
yield creative solutions. For instance, taking the approach of graceful degradation
/ progressive enhancement, mobile users could be delivered a spectator view or
some other reduced version of the game. Alternatively, you could provide onscreen
controls when keyboards and mice aren't available, perhaps with the HTML5 Virtual
Game Controller library ( https://github.com/austinhallock/html5-virtual-
game-controller ).
One final point to think about: Three.js-driven games can integrate smoothly with
existing websites. For example, most games need menus, and it's much easier to
create them in HTML than in 3D. Don't feel like your entire application needs to
display exclusively on the canvas. On the other hand, if you want to get creative,
you can actually embed HTML inside your Three.js environment. You can read
more about how to do this at http://learningthreejs.com/blog/2013/04/30/
closing-the-gap-between-html-and-webgl/ and http://jensarps.
de/2013/07/02/html-elements-in-webgl-recursion/ .
Performance
In some ways, performance considerations for 3D games in browsers are pretty
similar to those for consoles and desktop games. The biggest difference is that all
resources must (at least initially) be streamed to the client instead of read from a
disk. For complex 3D games with gigabytes of assets, overcoming this limitation for
low-bandwidth clients can be a serious challenge.
As legendary programmer Donald Knuth wrote:
"Premature optimization is the root of all evil."
This section discusses best practices and suggestions to get great
performance out of your game, but before expending significant
effort, you should measure and test your application to see where the
bottlenecks are and whether the effort is worthwhile.
 
Search WWH ::




Custom Search