Personal Projects and Mucking Around

© Luke Wallin 2005-2017

Javascript 2D Game Engine

The Javascript 2D Game Engine (for want of a more exciting name), is more or less just that. It's a 2D engine I've developed, in javascript, with the primary purpose for creating games. It models shapes as rigid bodies, which can collide and be influenced by forces. Runga Kutta 4 is used to produce (fairly) stable integration for springs and and charge.

Now at version 4, the 2D engine now uses HTML 5's canvas tag, and Google's ExplorerCanvas to get it working in IE. The canvas is fairly widespread these days, so it should be supported fairly widely.

Version 4 is currently being developed and aims to add more features (see list below) without increasing CPU usage. This will enable me to make several games I've got planned. Hopefully.

Games using the engine include Planet Wars 1 (in engine v2) + 2 (in engine v3), Breakout, Physics Sandbox.

Engine Features

Currently Supported:

  • Gravity
  • Collision detection between regular and custom polygons, rods and circles.
  • Rigid Body Dynamics for collision response.
  • Static shapes.
  • World borders.
  • Abstracted class structure for easy integration into custom games.
  • Charged particles (Coloumb's law).
  • Springs (Hooke's Law).
  • String (Series of rods connect with springs).
  • Multiple draggable and zoomable viewports.
  • Saving and loading system JSON.

In Development and Planned:

  • Resting contact between shapes - should solve a lot of the more interesting problems.
  • Breakable springs.
  • Optimisation, especially with regard to polygon collision detection.

Planet wars makes extensive use of the Coloumb's Law implementation to simulate gravity.

History