Skip to content

Dependency and library management

Ong Ming Yang edited this page Aug 10, 2014 · 2 revisions

Dependencies and build process

Our codebase depends on three libraries:

  1. Threejs (for all WebGL stuff)
  2. lodash (for performance and utility)
  3. jQuery (for all dom event manipulation)

Of the three libraries, only Threejs is installed locally (for stability) via npm. The other two are included in index.html via a script tag referencing a cdn repository.

Invoking grunt does three things. Firstly, it copies our locally installed libraries into the build folder. Secondly, it compiles all coffeescript files from lib, maps and terrains into corresponding files inside the build folder. Thirdly, it injects references to these files in index.html. This completes the build process.

Library management and invocation

Our core source is stored inside the lib folder. main.coffee is responsible for declaring the init() and render() functions that will be called after all class definitions are loaded.

All maps are stored inside the maps folder. A map is an instantiation of the Map class.

index.js is responsible for invoking init() with a user defined map and terrain, and calling the render() loop.

Foo

Clone this wiki locally