A tool for procedurally generating Ranvier areas.
How to Install
npm install --save axolemma
How to Use
Axolemma is usable as a CLI tool and can also be used as a library.
To use it as a CLI tool, navigate to the working directory where you would like Axolemma to generate the map files, and type
Axolemma will ask a series of questions and, as a result, generate an area for you.
Here is a recipe for using Axolemma programmatically:
// Require-able like any other library.const Axolemma =const manifest graphic rooms yaml = Axolemma// Returns an old-school ASCII map of your area.console// Returns YAML string.console// Returns area manifest as JS object.console// Returns Ranvier-compatible room definitions.const newRooms = rooms;
When using Axolemma programmatically, you can customize the default options using either a
.axolemmaconfig file or by adding an "axolemma" field in your package.json.
Configuration precedence goes as follows:
- Options passed in programmatically
- Options from
"axolemma"field in package.json
- Axolemma's built-in defaults.
Axolemma accepts the following options:
/*** @typedef* @property* @property* @property* @property* @property* @property* @property* @property* @property* @property* @property*/
Also, check out the ROT-js documentation for the mapper 'type' that you are using, for additional options.
Room Templates & Weighted Tables
As of version 0.5.0, it is possible to use Axolemma to procedurally generate an area with multiple kinds of rooms. See
examples/template-areas/json for the full example, but it works like this:
// .axolemmaconfig.jsmoduleexports =type: 'Digger'areaTitle: 'Abandoned Mines'// ... more options// You could probably inline this but I like to keep 'em separated.weightedRoomsTable:// rooms-table.js// These numbers are arbitrary.// Lower = more rare, higher = more common.// You could use any scale you want, these numbers could be// 10, 50, 100. Feel free to get more granular.const COMMON = 5const UNCOMMON = 3const RARE = 1moduleexports =mineshaft:weight: UNCOMMONtitle: 'Abandoned Mineshaft'description: 'A dark pit looms below you, boarded over by loose planks. The walls around you bear the marks of generations worth of pickaxes.'minefloor:weight: COMMON// ...oredeposit:weight: RARE// ...;
Based on this example, Axolemma will output an area with rooms featuring the properties specified in room-table.js. While it is pseudo-random, approximately 1 out of every 9 rooms will be an ore deposit, 3 out of 9 will be mineshafts, and 5 out of 9 will be a boring floor with rocks on it.
Future goals for this include adding arbitrary properties to the room templates, so that one could specify which NPCs are in a room, which scripts, and more.
Axolemma is currently in an early alpha stage. Use at your own risk.
The areas it generates are fairly generic in this iteration so much hand-editing is still required.
If you're using this in your Ranvier server to dynamically generate large amounts content on the fly, consider using a Cluster or similar to avoid blocking the main process with Axolemma.
In testing on a machine with 8GB RAM, Axolemma can generate a 20x20 area in a matter of milliseconds.
examples directory for code snippets that can be used to make Axolemma play nice with Ranvier, and additional how-tos.