ROguelike Toolkit in JavaScript. Cool dungeon-related stuff, interactive manual, documentation, tests!
Find a file
2026-03-28 12:52:20 -04:00
.github/workflows Add github action for typos. 2024-04-22 19:43:30 +08:00
_old cleaning up 2018-10-27 20:59:40 +02:00
addons watch, eventqueue, schedulers, engine 2018-09-24 10:19:57 +02:00
dist rebuild 2024-03-04 11:09:40 +01:00
doc rebuild 2024-03-04 11:09:40 +01:00
docs/plans feat: Port rot.js to C, Python, and Lua 2026-03-28 12:03:58 -04:00
examples finalizing 2018-10-22 22:15:17 +02:00
hp Fix link to tutorial 2022-10-08 21:47:28 +03:00
lib rebuild 2024-03-04 11:09:40 +01:00
manual Fixes broken roguebasin links 2023-03-16 14:23:38 -05:00
ports feat: Add remaining modules and HAL demo 2026-03-28 12:47:24 -04:00
src Fix src & tests directories' typos. 2024-04-22 19:45:59 +08:00
tests Fix src & tests directories' typos. 2024-04-22 19:45:59 +08:00
tools Make the script executable 2021-12-20 21:37:35 -06:00
.gitignore cleanup 2018-09-27 14:44:47 +02:00
.nojekyll turning jekyll off 2018-11-05 09:11:19 +01:00
build.dot make 2018-09-20 15:43:19 +02:00
build.png make 2018-09-20 15:43:19 +02:00
index.html engine 2012-09-03 16:04:31 +02:00
license.txt tests, performance manual page 2013-01-28 14:51:21 +01:00
Makefile node support; display refactored 2018-10-22 21:50:25 +02:00
package-lock.json npm install with modern npm 2023-03-17 08:35:45 -05:00
package.json #223 link+version 2024-11-13 08:21:57 +01:00
README.md Basic documentation of build process 2023-03-17 08:53:04 -05:00
rollup.config.js node support; display refactored 2018-10-22 21:50:25 +02:00
TODO fixing the manual 2018-10-26 10:48:36 +02:00
tsconfig.json Remove "removeComments" from tsconfig 2018-11-30 06:24:47 -06:00

rot.js

ROguelike Toolkit in JavaScript. For more info, see https://ondras.github.io/rot.js.

Library

There are multiple ways of including rot.js in your project.

Downloading

You can get rot.js using either of these methods:

Usage

Rot.js is written in TypeScript, but its code is available in multiple formats. You can pick the one that best suits your development needs.

  1. The lib/ directory contains the code in ES2015 modules. These can be used in modern browsers directly, without any transpilation/bundling step. An example shows how to do that.

  2. For practical reasons, individual modules should be bundled to make your application more compact. You are free to use any bundler that understands ES2015 modules. If you want to support older browsers, you should also transpile your code -- there is an example using babel and rollup that shows how to do that. This is the recommended way of using rot.js.

  3. If you do not fancy modern modules and/or transpilation, you can grab a pre-built bundle and include it in your page using traditional <script> tag. This bundle puts rot.js into a global ROT namespace and uses ES5 (supported even by older browsers). See an example of this approach.

  4. Finally, the pre-built budle also comes with a minified version that works the same, but its size has been reduced. The usage is the same as in the previous example.

Node.js

Most parts of rot.js are usable from within node.js (server-side JavaScript). The Display class needs to use the "term" layout backend:

let 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

Usage

The pre-bundled rot.js package can be loaded as a CommonJS module. There is an example that shows basic usage.

Contributing

ROguelike Toolkit is largely considered "feature-complete", but bugfixes, documentation, and some new features are welcomed. Development should happen in the /src folder, and then the build process creates the /lib, /dist, and /doc folders before serving the project.

Visual layout of the build process

The command to rebuild everything:

npm install
make all

Misc

RogueBasin page (with links to some rot.js-based games): http://roguebasin.com/index.php/Rot.js