The Hex Flower Movement Simulator is used to simulate X number of turns of player movement throughout a hex grid, with the goal of aiding in designing DnD maps to encourage specific outcomes. The simulator uses a config file to determine the starting position, number of turns to simulate, and the blockers and teleporters. The script then outputs the number of times the player landed on each tile, as well as the entire path of the player.
- Node.js (https://nodejs.org/en/)
Download the repository to your computer. This can be done by clicking the green Code button and selecting Download ZIP.
Once downloaded and extracted, open a terminal in the folder. Then run the following command:
npm install
npm run build
mkdir dist/results
mkdir dist/configs
- Create a config file in
dist/configs
(see below for more information on creating a config file) - Open a terminal in in the root of the project directory, and enter the following command:
npm start config_file.json
Note: The config file must be located in the
dist/configs
folder. However, you do not need to specify the full path to the config file. The script will automatically look in thedist/configs
folder.
Two files are created in the dist/results
folder, one for a summary of the tile results, and the other for the entire path of the player.
The files are prepended with the name of the config_file.json
from the script running
A config file is a JSON file that contains information necessary for the simulation.
{
"starting_position": 1,
"turns_to_simulate": 10000,
"blockers": [],
"teleporters": []
}
{
"starting_position": 1,
"turns_to_simulate": 10000,
"blockers": [
{ "tile": 19, "edge": 12 },
{ "tile": 11, "edge": 4 },
{ "tile": 4, "edge": 9 },
{ "tile": 14, "edge": 11 }
],
"teleporters": [
{ "tile": 9, "edge": 8, "target": 18 },
{ "tile": 2, "edge": 6, "target": 14 }
]
}
Tiles are numbered from 1 to 19, starting at the bottom center.
Edges are numbered from 2 to 12, starting at the top edge and moving clockwise. The edges are numbered based on the hex flower navigation rules. In most cases, the same edge can be denoted by two numbers. For example, Edge 2 and Edge 3 are both for the top-left edge of a tile.
The starting position (tile) of the player. This is a number between 1 and 19.
The number of times the dice should roll and the player should move.
An array of objects showcasing which edges of a tile the player cannot pass through
An array of objects that represent teleporters. Teleporters are edges of a tile
that teleport the player to another tile (denoted by the target
value).
The config file name. Config file must be located in the dist/configs
folder.
npm start config_file.json