melonJS HTML5 game engine

Last year, at the Freakend (a weekend talking, learning and coding mostly videogames stuff) I decided to try some javascript game engine to assess if they were mature enough to build small game prototypes with them or not.

As ImpactJS costs money (not much, but I don't plan to do anything big nor have the time to do it), I read somewhere that melonJS was good for 2D tiled games, and decided I would at least spend some hours with it.

This is a very brief review because I jus spent one night dedicated to it, building the tutorial game, playing around, testing extensibility and how easy would be to develop a 4-directional game instead of the 2D platform games that were available as demos of the framework.

MelonJS works standalone, without needing additional libraries, and just requiring an HTML5 capable browser. It is very small and fast enough to build 2D games with parallax backgrounds and multiple sprites at once (I didn't try with more than half a dozen, not counting level layers, though).

One of the features that I liked most was supporting Tiled maps natively instead of any weird, custom map format. I had to learn to use Tiled but it is really handy for creating the maps and preparing the assets of the game. I wanted randome levels so that would require more effort (mostly learning Tiled format to populate maps) but again, a small tradeoff compared with the flexibility of a mature and tested map editor.

Keyboard handling, graphics rendering and FPS synchronization were really easy to handle, and while the sound API is also very easy to use, here at least a year ago I got lots of problems due to HTML5 Audio "unstable" state: Depending on the browser sounds would not always play, or pay with delay, or require me to use different audio formats... While not a melonJS problem, audio playback was really not ready back then. AFAIK now things are more stable but haven't tried again.

Collision detection and basic physics were also ok, platform slopes and borders not perfectly detected by the engine (si you could have your character almost hanging in the air on borders.

I cannot find the tutorial I followed, but I assure you that building a typical 2D plataform game is damm easy. Where I had problems was switching to 4 directions, the engine was so tailored for side-scrollers that anything else required extending the engine. While I haven't checked current code (0.9.4 at the time of this post), seems things have evolved and is more generic.

Those issues aside, the game run smoothly both on Firefox and Chrome, and as you don't need to compile anything you can code quite fast.

Currently there are a few more examples, most noticeable one a Legend of Zelda clone with 4-directional smooth movement that would have been perfect back then for my purposes.

I'm a bit outdated on current Javascript game engines so there might be others more interesting out there, but I would recommend giving melonJS a try for 2D games, specially if you want to build a side-scroller.

I am still not convinced to attempt (in the future) to build a game prototype as a Javascript browser one having instead some interesting C# frameworks to play with. After all, being for fun (and not to make any money) I prefer to use a fast, stable and way more powerful platform instead of the still unfinished HTML5 and the sometimes painful Javascript debugging process.

Tags: Game Dev

melonJS HTML5 game engine published @ . Author: