Ondrej Zara's ROguelike Toolkit for Node.js
There is an incredible interactive manual to learn rot.js. The notes below are specific to the Node.js version.
The Node.js version does not have a <canvas> element, and so the standard
layout algorithms (rect and hex) do not work. The Node.js version does,
however, have its own layout type: term
var display = new ROT.Display({width:40, height:9, layout:"term"});
display.draw(5, 4, "@");
display.draw(15, 4, "%", "#0f0"); /* foreground color */
display.draw(25, 4, "#", "#f00", "#009"); /* and background color */
RGB colors are supported for xterm compatible terminals.
A set of unit tests offering nearly universal coverage is available.
git clone https://github.com/ondras/rot.js
cd rot.js
make node
npm install
cake coverage
-
src/js/object.jsprovidesObject.createfor environments that do not have their ownObject.create. Node.js provides this method, so the code provided by rot.js will never execute. -
src/js/raf.jsprovidescancelAnimationFrameandrequestAnimationFramefor environments that provide awindowobject, but do not provide their own animation frame functions. Node.js does not provide awindowobject, so the code provided by rot.js will never execute. -
src/path/astar.jsdefines a methodROT.Path.AStar.prototype._distancethat contains a switch statement. There are some unreachable break statements here to improve code aesthetics (case/break balance). -
Some of the tests rely on the random generation process to cover the cases of the generator. On bad runs, a poor random seed will leave coverage gaps. In this case, re-run the tests until you are happy. :-)