JavaScript Roguelike Template - A basic roguelike you can build upon to create your own
JSRL is a bare-bones roguelike featuring both tiles and character-based displays. It can be player via web browser or as a native app for Windows, Mac and Linux.
Check out the online demo at: https://slashie.net/jsrl
What is this good for? the idea is: you take this simple game and start adding and transforming it into what makes your roguelike unique!
The unique goal of JSRL is to provide an advanced "starting point" for your project and then NOT get in your way. That is why it isn't structured as an engine whose abstractions you have to learn in order to build upon it, but rather as a small set of classes and objects that you will very likely progressively replace with your own.
JSRL-based projects are completely detached from the JSRL template; once you start developing your project you are on your own. In other words, the main thing you have to understand is that JSRL is just a sample roguelike.
The development of JSRL is driven by developers optionally back-porting the improvements made while developing their own games into it; contributions are cherry-picked for JSRL to remain as simple as possible while providing future developers with added utilities for their games. (An example is the addition of automatic viewport scaling).
As you can see in the JSRL demo, you will get quite a boost with tile-based display, keyboard-based movement, level handling, a turns system controlling the sequence of the actions of simulated world populators, and a simple inventory.
Along with that you also get all the tooling to develop the game and deploy it for web or PC via electron.
- Player can walk around using keyboard
- Raycasting Field of View algorithm
- Player can move between persistent levels
- Enemies move around chasing the player
- Player can pick up, drop and use items (including using items on a given direction)
- Player remember visited maps
- Infrastructure for Level Generation
- Line wrap text boxes
JSRL is designed for you to take a snapshot of the repository, and then part ways with it to create your game.
Tutorials on how to create your game around the basic codebase will come soon.
- Download a copy of the repository (https://github.com/slashman/jsrl/archive/refs/heads/master.zip).
- Alternatively you can use github's Template feature https://github.com/slashman/jsrl/generate
- Modify the code within the
./src/js
folder to create your game.
Local development can occur in two flavours: web, or electron. In both environments, changes to your source are hot-reloaded.
npm install
npm run web
ORnpm run web:pixi
- Open your browser to
http://localhost:8080
npm install
npm run electron
ORnpm run electron:pixi
Distribution files are also seperated by either web or electron targets.
npm run build:web
ORnpm run build:web:pixi
- Directory
dist/web
will contain the web directory contents you can serve or FTP
npm run package:<one of *win32*, *mac* or *linux*>
ORnpm run package:<one of *win32*, *mac* or *linux*>:pixi
- Directory
dist
will contain the distribution folders for the given platform
- 0.0.4 - November 26, 2022 - PIXI graphical version
- 0.0.3 - November 19, 2022 - Electron packaging, viewport scaling
- 0.0.2 - March 2021 - Added support for static maps loading
- 0.0.1 - November 2017 - Initial version based on PokemonRL codebase
- Uses unicodetiles for IO - https://tapiov.net/unicodetiles.js/
- Uses PIXI.JS for display
MIT License
Copyright (c) 2017-2022 Santiago Zapata
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.