rot.js: ROguelike Toolkit in JavaScript


rot.js is a JavaScript library created by Ondrej Zara that allows you to create your own Roguelike game with ease. What’s a Roguelike? The guys at RogueBasin sum it up best:

“A Roguelike is usually described as a free turn-based computer game with a strong focus on intricate gameplay and replayability, and an abstract world representation using ASCII-based display, as opposed to 3D graphics. Of course, as with any genre, there are deviations from the norm.

Roguelikes allow the player an indefinite amount of time in which to make a move, making gameplay comparable more to chess than to reflex-based games like first-person shooters. Since graphics are limited (if not completely shunned), the player’s imagination must come into play – gameplay is more like reading a book than watching a movie.

Of course, the best way to understand what Roguelikes are is to download and play one.”

The toolkit consists of handy features to speed-up game development:

  • Seeded random number generator, for repeatable random numbers
  • Several different map generation routines (Maze, Cellular and Dungeon)
  • Field of View computation
  • Colour and lighting effects
  • Pathfinding
  • Noise generation
  • Turn scheduling
  • Async game engine
  • Hex support

It requires a modern browser in that it must support canvas (so IE9+ and pretty much everything else) but otherwise is quite low on system requirements as you’d imagine. It’s easy to create maps and customise the layout and style and there are tutorials, examples and a particularly smart interactive manual which allows you to actually edit the code directly on the page to see the results in real-time.

So if you’re participating in the 7-day Roguelike contest or just want to make a game like this then rot.js is an excellent place to start.

Download rot.js from its home page or play The Royal Wedding, a game made with it.