Posted by & filed under Game Development.

Zerk, a 2D game engine prototype written in JavaScript.


I wanted to develop a fun project that my wife could be involved in so I decided to create a game that she could draw the graphics for and that I could code. Toward the end of 2012 I started coding the Zerk game engine in JacaScript. My goal for the project was to create a 2D game engine that could run a decent jump and run game on desktop and mobile devices.

While researching the project I discovered Box2DWeb, a JavaScript port of the Box2D physics engine. It has been very helpful with turning the nasty physics coding into a Box2D discovery process and gave me additional options. Thanks a lot to Erin Catto for writing and sharing Box2D! I also don’t want to forget the many other contributors that helped improving Box2D and ported it into so many languages.

I wanted class inheritance so I could create a decent architecture; to achieve this in JavaScript I came up with an object construction approach that mimics inheritance. The style of the class definitions is inspired by ExtJS. The system also includes an experimental asynchronous autoloader that resolves class dependencies.

For this release I created a YUIDoc code documentation and a small jump and run style demo game that can be played in the browser. It has no textures yet, though – it’s only a technical demo with some functional entities.

(Screenshot of the jump and run demo game)

What’s currently there:

  • Application base structure
  • Class system with classical inheritance
  • Experimental autoloader
  • Entity system
  • World definition
  • Basic canvas rendering, currently without sprites
  • Box2DWeb physics implementation
  • Keyboard and mouse input processing
  • DOM abstraction layer
  • Configuration system
  • Debug message system
  • Jump and run game demo

The engine is available under the MIT license.

More information will follow on the project page.

5 Responses to “Zerk Game Engine Prototype Released”

  1. Chris

    Very nice demo! Currently playing around with the source, trying to build a Super Mario clone. Is there any way to have sprites or sound yet?

    • kristophjunge

      Thanks Chris, this is an early release that does not include sprite rendering or sounds. Please be patient, the features are coming. I am already working on sprite rendering but for now have to focus on creating the Entity-Component-System architecture.

  2. Jan

    Nice engine! I have searched long time for a 2D game engine which i can use on mobile devices because the main products in market like sencha touch aren’t suitable for many types of games. Is there a simple way to scale objects live in zerk?

    • kristophjunge

      Thanks Jan, if you want to resize objects in the physics simulation this is a little complicated because the underlying physics engine Box2D does not support this. An approach to do this is to delete the object and create a resized one on the same position. If you want to resize a sprite independent of the physics simulation this will be possible once sprite rendering is done. However Zerk is only a prototype for now. There are other more evolved JavaScript game engines. I suggest you to visit the Breakouts project.


Leave a Reply

  • (will not be published)