You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ong Ming Yang edited this page Aug 10, 2014
·
2 revisions
Dependencies and build process
Our codebase depends on three libraries:
Threejs (for all WebGL stuff)
lodash (for performance and utility)
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.