Generate offline, ship data
dungeonmaker-js is GPL-3.0-or-later (see License). That matters most when the code travels with your product, and it does not have to.
The catch with web bundles
A web page that imports the package ships JavaScript and WebAssembly to every visitor. That is distribution of GPL-licensed object code. For code that imports the package and runs in the same bundle, the Free Software Foundation reads the combination as one work, so the application should be released under a GPL-compatible license. The postMessage boundary of the worker is a grey area; do not build a business model on it.
The conservative rule of thumb: if you build this package into an application you ship (a web bundle counts), assume that the application must be released under a GPL-compatible license.
The recipe
Generated files are program output and are not covered by the GPL. So run the generator on your machine and ship only the result:
- Generate the dungeons at build time, with the CLI or
generateToFilesfromdungeonmaker-js/nodein a build script. - Import the files in your game with your own code. The dungeon file format is released under CC0-1.0, and a Tiled
.tmjor a raw.binneeds no package at all. - Ship the data files, not the package.
npx dungeonmaker-js generate --preset design3A --seeds 1..100 --format json --out ./assets/dungeonsimport { generateToFiles } from 'dungeonmaker-js/node';
await generateToFiles({
preset: 'design3A',
seeds: [1, 2, 3],
formats: ['json', 'tmj'],
outDir: './assets/dungeons',
});Three rules for export files
The exporters follow these rules, and tests guard them:
- No code in export files. Only map, layers, metadata and legend. The legend holds names like
"open"or"door": facts, not code. - Upstream designs by reference only. The eleven presets come from the GPL distribution of DungeonMaker, so a file names a preset (
"source": { "preset": "design3A" }) and never embeds it. Your own designs appear only as a hash, unless you pass--embed-design. - The format is free, the library is not. The specification and
dungeon.schema.jsonare CC0-1.0, so anyone can write an importer in any language under any license.
Not legal advice
This page describes how the files are built and how the project reads the license. It is not legal advice. If your product depends on the answer, ask a lawyer.
