Book Image

Going the Distance with Babylon.js

By : Josh Elster
Book Image

Going the Distance with Babylon.js

By: Josh Elster

Overview of this book

Babylon.js allows anyone to effortlessly create and render 3D content in a web browser using the power of WebGL and JavaScript. 3D games and apps accessible via the web open numerous opportunities for both entertainment and profit. Developers working with Babylon.js will be able to put their knowledge to work with this guide to building a fully featured 3D game. The book provides a hands-on approach to implementation and associated methodologies that will have you up and running, and productive in no time. Complete with step-by-step explanations of essential concepts, practical examples, and links to fully working self-contained code snippets, you’ll start by learning about Babylon.js and the finished Space-Truckers game. You’ll also explore the development workflows involved in making the game. Focusing on a wide range of features in Babylon.js, you’ll iteratively add pieces of functionality and assets to the application being built. Once you’ve built out the basic game mechanics, you’ll learn how to bring the Space-Truckers environment to life with cut scenes, particle systems, animations, shadows, PBR materials, and more. By the end of this book, you’ll have learned how to structure your code, organize your workflow processes, and continuously deploy to a static website/PWA a game limited only by bandwidth and your imagination.
Table of Contents (20 chapters)
1
Part 1: Building the Application
7
Part 2: Constructing the Game
13
Part 3: Going the Distance

Improving Runtime Performance with the Scene Optimizer

Developing games for a given platform comes with its own set of unique challenges and benefits. Console games have the benefit of having standard hardware specifications and drivers to target, but at the expense of those same hardware specifications creating severe limitations in other areas, such as RAM or video RAM (vRAM). Browser-based games have their own bag of double-edged swords too – the ubiquitous nature of JavaScript and the web brings similar problems to console developers with restricted hardware specs, and some of the same problems that PC developers must face with a wide variety of hardware combinations.

Using the tools and lessons from this chapter and the preceding chapters of this book, it’s easy to imagine writing some code – a coroutine perhaps – that monitors the real-time performance of the application and makes tweaks to various settings in response to bring frame rates up to...