- Check out the git repo somewhere and
cd
into it. npm install
and wait for a whilenpm run dev
will start a webserver on http://localhost:8080
index.js
is the entry point for the script (it gets loaded in at the end of index.html)- ES6 as a language is pretty cool: ES6 Features
- THREE is loaded in from the static/ folder, documentation here: ThreeJS docs
- Globals are defined in
Constants.js
Game
is actually aGameThree
object... will fix that somedayGame.load
creates a bunch of ThreeJS objects that get added toGame.scene
(a THREE.Scene())Game.update
gets called on every animation frame, effectively 60x per second.dt
parameter is number of seconds elapsed since the last animation frame. So moving forwardVector3(0, 0, 1) * dt
effectively says "move forward 1 game unit per second".Game.camera
can move around the same way that any object can, except it also has directionality- I wrote a
Keyboard
handler that I can easily use to track if a key is down or not (has some bugs) - The part that really made me understand this is that everything is just handled 16ms at a time. Basically every 16ms you figure out what needs to change and then change it.