Hi! I'm John. Welcome to Domtastic.
I started this project to help me understand chapter 15 of Marijn Haverbeke's Eloquent Javascript by adapting his code to a simple projectile game I've called DOMTASTIC. The goal is to achieve, through customization, an understanding of the underlying techniques used in the chapter, including encapsulation, use of higher-order functions and basic asynchronous programming.
##Playing the Game## Go to dantzlerwolfe.github.io. This game is a browser game and was not designed responsively. Also, please use chrome or firefox. It will not work without javascript. So to get the best (and maybe only) experience, please use a laptop/desktop with a JS enabled browser.
##Unique/Heavily Modified Elements## While I often used Haverbeke's code as a conceptual (and sometimes actual) starting point, you will notice that most of Domtastic's components are completely unique or are heavily customized variants of Haverbeke's sample code. Here is a list of the most unique or heavily customized sections of the program:
- Simple Projectile Motion: I added constant acceleration equations to handle simple motion of objects in freefall (See math/physics section of the main script). This was good enough to handle the limited physics required by the game environment. The
Launcher.prototype.fire()
method uses the globalimpulse()
method to launch projectiles. Those projectiles, in turn obey our constant acceleration equations after the launch process is over. - Obstacle Handling: Instead of setting collision behaviors based on a fixed boundary (which Haverbeke does for collisions with the static grid), I've made each collision an object to object interaction. The user can define the result of a given collision by modifying an object's
interact
method. One consequence of this approach is that an object must have a lot of information about the path it has taken to a given collision. To handle this, Domtastic uses an object's "leading corner" as its reference point. TheyTest
anddZone
methods provide outcomes for various approach vectors, and those outcomes in turn affect the way theLevel.interactWith
method handles the collisions. While this is my favorite part of the program, it also could use extensive conceptual improvement. For those who are interested, there is a taxonomy of weird bounces on Domtastic's Trello Board. In order to really see the odd collisions that do occur, it's best to comment out the sections of the code that shrink and destroy projectiles so that projectiles bounce around indefinitely inside of a level. - The Message Board: What's an old school game without some classic text feedback? The messageboard is a sprawling family of event listeners that deliver near-clever quips in response to various achievements or disasters. In addition, the messageboard (for better or worse) is partially managed by the
pauseToggler
method on theLevel
object. - Interactions and Effects: While not as code-intensive, the special interactions (like the shrinking projectiles or exploding targets) were a lot of fun to conceptualize and code. I hope to improve on a great number of things from this category in future iterations.
Feedback and suggestions are very welcome. This was an exploratory project. I learned a lot, but there is still a long way to go before I can feel at ease with javascript.
##Styling## I used bootstrap's online customization form. Here's the configuration gist. Click here for further customization. From my perspective, the most pressing visual design issues are the non-responsive design, choppy animations and some problems with the color scheme. From a game design perspective, I'd like to add a keystroke interface and improve the overall game mechanics.
##Sound Credits:## All of the sounds came from freesound.org. I normalized volumes and made simple modifications using twistedwave.com.
- Game Winning Theme, zagi2, Hard Bassline Groove
- Earth Theme, cormi, Night in the Forest
- Mars Theme, noirenex, Sci-Fi Alarm
- Jupiter Theme, ERH, Sci-Fi Menace
- Launcher Effect, Setuniman, boing OH_16m
- Small Explosion, juskiddink, Distant Explosion
- Large Explosion, ryansnook, Big Explosion
- Projectile Bounce, martian, Chorused Bounces
- Projectile Vanish, ljudman, TV
- Alien Taunt, james ducket, Feeble Efforts
##To Do List## There is a big to do list for this game. It can be found on trello. I plan to keep it there until there's good reason not to. A lot of the coding and debugging I did is described there. The notes are not necessarily written for clarity but served more as placeholders for me so that I could easily hit the ground running after time off from the project.