0.9.6 • Published 7 months ago

simpledungeongenerator v0.9.6

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

Simple Dungeon Generator

A simple dungeon generator for javascript (typed) and the browser with only one dependency (for seeded random numbers).

Highly configurable, but with sensible defaults.

GitHub release (with filter) GitHub issues GitHub Workflow Status (with event) npm npm bundle size

Demo: https://purukitto.github.io/SDGdemo/

See the latest changelog here

Installation

npm

npm install simpledungeongenerator

yarn

yarn add simpledungeongenerator

Usage

Simplest dungeon with:

// ESM
import simpleDungeon from "simpledungeongenerator";

const dungeon = new simpleDungeon();

dungeon.drawToConsole();
// CJS
const simpleDungeon = require("simpledungeongenerator").default;

const dungeon = new simpleDungeon();

dungeon.drawToConsole();
<!-- Browser -->
<!-- path to bundle -->
<script src="./node_modules//simpledungeongenerator/dist/bundle.js"></script>
<script>
	const dungeon = simpleDungeon();
	const svgContainer = document.getElementById("svg-container"); // SVG container
	dungeon.drawToSVG(svgContainer, 5, {
		withIndex: true,
		withColour: true,
	});
</script>

Options

OptionTypeDefaultDescription
seedstring"purukitto"Seed for the random number generator
maxHnumber50Maximum height of the dungeon
maxWnumber50Maximum width of the dungeon
typestring"Base"Type of the dungeon to generate (Currently has no effect)
roomTriesnumber150Number of times to try to generate a room
extraRoomSizenumber0Extra size to add to the room
windingPercentnumber50Percentage of the dungeon to be winding
tilesObjectdefaultTilesTiles to use for the dungeon
startIndexnumber1Index to start the dungeon from

Properties

PropertyTypeDescription
mapobjectA 2D array representing the dungeon map.
roomsRoom[]An array of rooms in the dungeon
tilesObjectThe tiles used for the dungeon

Methods

MethodDescription
drawToConsole()Draws the dungeon to the console
drawToSVG()Draws the dungeon to an SVG

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Acknowledgements

  • seedrandom - Seedable random number generator
  • Article - Fabulous article on dungeon generation
  • changesets - Used for managing changelogs and releases
  • Rollup - Used for bundling the library
0.9.6

7 months ago

0.9.5

7 months ago

0.9.4

7 months ago

0.9.3

7 months ago

0.9.2

7 months ago

0.9.1

7 months ago

0.9.0

7 months ago

0.8.0

7 months ago

0.7.3

7 months ago

0.7.2

7 months ago

0.7.1

7 months ago

0.7.0

7 months ago

0.6.4

7 months ago

0.6.3

7 months ago

0.6.2

7 months ago

0.6.1

7 months ago

0.6.0

7 months ago

0.5.0

8 months ago

0.4.0

8 months ago

0.3.2

8 months ago

0.3.0

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago