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)
- index.html triggers via require-jquery initApp() in main.js.
- home.js
- initApp(): I think this calls init() of most of the main game classes referenced below.
- The page/game waits till a new player is created or joins.
When a character is created (Work in progress)
- client/js/main.js: app.tryStartingGame()
- client/js/app.js: tryStartingGame() > startGame() > start()
- start() sets game.username > this.game.run().
- client/js/game.js: run()
- run() > initPlayer()
- initPlayer sets the sprite according to this.player.getSpriteName(); the sprite is actually hard coded into the Player class as clotharmor.