Code Spelunking - particlequest/ParticleQuest GitHub Wiki

In this page we'll be posting the investigations we are performing over the least obvious BrowserQuest pieces of code. Feel free to add a section if you had a hard time figuring out anything, you will probably help someone in the future. ;)

Diagrams of class hierarchies

Work in progress.

External libraries

Module loader

In order to encourage a modular code, this project uses RequireJS.

Code explanation

Game main initialization (Work in progress)

  1. index.html triggers via require-jquery initApp() in main.js.
  2. home.js
  3. initApp(): I think this calls init() of most of the main game classes referenced below.
  4. The page/game waits till a new player is created or joins.

When a character is created (Work in progress)

  1. client/js/main.js: app.tryStartingGame()
  2. client/js/app.js: tryStartingGame() > startGame() > start()
  3. start() sets game.username > this.game.run().
  4. client/js/game.js: run()
  5. run() > initPlayer()
  6. initPlayer sets the sprite according to this.player.getSpriteName(); the sprite is actually hard coded into the Player class as clotharmor.