World Generator is a React + Vite application for generating procedural island and terrain-inspired worlds.
For instructions on configuring and exploring a world, see the User Guide.
- Node.js 22
- pnpm 10.13.1
corepack enable
pnpm installpnpm devpnpm buildpnpm typecheck
pnpm lint
pnpm lint:scss
pnpm format
pnpm test
pnpm check:allStylelint validates all SCSS files using the rules in tooling/stylelint.config.json.
Use pnpm lint:scss:fix to apply safe automatic fixes.
The application separates configuration, world generation, and map presentation.
- The React forms build a typed
MapConfig. Generation starts explicitly from the settings panel; changing a control does not automatically regenerate. src/utils/map-generatorruns in a Web Worker and contains five stages: World Shape, Macro Regions, BaseClimate, Geology, and Heightmap. Each stage declares the data it reads and writes. The execution order is derived from those dependencies; the presentation order is not itself a dependency graph.- The worker streams stage lifecycle, progress, and output data.
postMessagecopies stage output to the main thread; the sample budget accounts for that copy. The final result contains generation statistics, while map outputs are collected from stage events. - Non-raster metadata travels through
MapInfo.MAP_INFO_CATALOGderives entries such as heat-zone descriptions, macro-region labels, and world dimensions from the generation config.
src/utils/map-layersdeclares the raster and vector layer catalog.src/utils/map-rendererbuilds the preview from generator outputs using progressive, screen-resolution Canvas2D rendering, overlays, a layer cache, and render metrics.- World dimensions use physical units independently of sample-grid resolution. The generation sample budget is derived from an 864 MB data budget and accounts for stage rasters plus their main-thread copy; renderer canvases are measured separately.
For local visual testing, an optional delay can be enabled between stages:
VITE_GENERATION_STAGE_DELAY_MS=500The value is in milliseconds. Restart the Vite server after changing the value.
Leave it unset, or set it to 0, for normal generation speed.
The progress indicator below the map shows the current stage and percentage
during generation. Finished runs keep their map configuration, per-stage
generation statistics and render statistics (layer timings, tiles, source and
buffer resolutions, buffer sizes, first-tile time and presentation/overlay
time); the /statistics page presents them together. All of it lives in memory
for the session, so a full page refresh clears it. The page also exports the
statistics snapshot as JSON.
src/utils/map-generatorcontains the stage pipeline, stages, stage events and worker transport.src/features/world-generatorowns the generator UI: the screen, settings, forms, map preview and generation progress.src/componentscontains shared UI components used across features.src/utils/map-rendererrenders layers and overlays (scene, view, layer cache, metrics and persistence).src/storesholds global UI state: form values per settings tab, generation progress and statistics, map config, preview selection and render statistics.src/features/world-generator/generation-progressrenders the current stage and progress.tooling/contains shared tool configuration for Vite, Vitest, ESLint, Stylelint, commitlint, lint-staged and release-it.- VS Code extension settings point at the
tooling/configs:eslint.options.overrideConfigFile,stylelint.configFileandvitest.rootConfig. docs/roadmap.mddescribes the pipeline, the current and planned stages, and future layer contracts, with per-section status markers.
The repository uses a simplified GitHub Flow:
master— the single long-lived branch (protected)<type>/<issue>-<name>— working branches, e.g.feat/163-stage-indicatorrelease/vX.Y.Z— release branches created by the release script
Recommended flow:
- Create a branch from
master(feat/*,fix/*,refactor/*,chore/*, ...) - Open a PR to
master - After review and green CI, squash and merge into
master
Every push to master is automatically deployed to the dev environment
(see Deployment). Production is promoted manually.
Use Conventional Commits. Subjects start with a lowercase letter; acronyms and module names keep their case.
Examples:
git commit -m "feat: add procedural island generator"
git commit -m "fix: repair noise offset calculation"
git commit -m "docs: update setup instructions"
git commit -m "chore(release): prepare v0.0.1"Common types:
feat:— new featurefix:— bug fixdocs:— docs onlyrefactor:— internal cleanuptest:— test changeschore:— maintenance and release preparation
CI runs on pull requests and pushes to master (ci.yml) with two jobs:
Code Quality — typecheck, ESLint, Stylelint, format and production build.
Tests — the full Vitest suite.
A separate workflow (pr-title-check.yml) validates that PR titles follow
Conventional Commits (type prefix, subject starting with a lowercase letter).
These checks are the main safety gate before merge.
Versioning and changelog generation use release-it with the
@release-it/conventional-changelog plugin (Conventional Commits):
pnpm release # detects the bump and creates release/vX.Y.Z
pnpm release:patch # force patch
pnpm release:minor # force minor
pnpm release:major # force majorpnpm release looks at the commits since the last tag: feat: bumps minor,
while fixes, refactors, chores and docs bump patch. A breaking change
(feat!: or a BREAKING CHANGE: footer) bumps major — or minor while the
project is still on 0.x. The script creates a release/vX.Y.Z branch, updates
package.json and CHANGELOG.md, and commits the result; no git tag or push is
done locally. Changelog entries keep the commit subject and the commit body, so
multi-line descriptions are preserved. Add --dry-run to preview the detected
bump without changing anything.
Flow: run the release on a clean master, push the release/* branch and merge
it through a PR. Merging ships the build to dev. The git tag and GitHub
release are created later, when the tested build is promoted to production.
The Promote to Production workflow calls Create GitHub Release
(create-release.yml) as its final step, which tags the current
package.json version and publishes the matching section of CHANGELOG.md.
A GitHub release therefore always corresponds to something live in production, rollbacks do not create releases, and promoting the same version twice is a no-op.
Every promoted release also gets a permanent alias in the form
wg-<version with dashes>.vercel.app (for example wg-0-6-0.vercel.app), and
the release notes link both the deployment URL and its alias. Aliased
deployments are kept outside the retention policy, so any past release can be
opened straight from its GitHub release page.
Deployment is decoupled from merging: every push to master ships to dev,
and production is promoted manually from a dev deployment that has been tested.
No rebuild happens on promotion — the exact artifact tested on dev is the one
that goes live.
Environments:
- Dev — https://world-generator-dev.vercel.app
- Production — the project's production domain on Vercel
Workflows (.github/workflows/):
- Deploy to Dev (
deploy-dev.yml) — runs automatically on every push tomaster. Deploys a Vercel preview with the Vercel CLI (vercel deploy), aliases it to the dev URL, and posts a commit comment with the dev URL and the unique deployment URL. - Promote to Production (
deploy-production.yml) — manual (workflow_dispatch). Promotes a tested dev deployment to production viavercel promote(no rebuild). Leave the deployment URL empty to promote the current dev deployment, or pass a specific dev deployment URL to promote that one. Requires typingdeployto confirm. After a successful promotion it creates the git tag and GitHub release for the current version (see Versioning and releases). - Rollback Production (
rollback.yml) — manual (workflow_dispatch). Promotes a previous good deployment URL back to production viavercel promote. Requires typingrollbackto confirm.
Promote and rollback share their resolve-and-promote logic through a composite
action (.github/actions/vercel-promote): it resolves the target deployment
(explicit URL, or the current dev deployment when none is given), promotes it,
and exposes both a friendly URL and the deployment id. Both workflows post a
commit comment linking to the promoted deployment.
Deployment auth is provided by the VERCEL_TOKEN, VERCEL_ORG_ID, and
VERCEL_PROJECT_ID repository secrets.
Feature flags are local to the current browser. They are read once at startup
from the feature-flags localStorage entry; there is no remote store, server
endpoint, or shared deployment rollout.
How it works:
src/feature-flags/flags.tsis the typed registry.FLAG_DEFAULTSholds each flag's default and is also the fallback for missing or invalid stored data. Flags can be booleans or strings; string flags declare their allowed values inFLAG_OPTIONS, which becomes the flag's TypeScript union type.FeatureFlagsProviderresolves the stored JSON against the registry; unknown keys, wrong types, and string values outsideFLAG_OPTIONSfall back to the defaults. Consume flags withuseFlag('breadcrumbs').- Breadcrumbs are disabled by default.
To change flags in this browser, set the entry and refresh the page. On the first load, a missing entry is created with the defaults so it can be edited in the browser dev tools:
localStorage.setItem('feature-flags', JSON.stringify({ breadcrumbs: true }));Remove the entry with localStorage.removeItem('feature-flags') to restore the
defaults. This affects only the current browser profile; it is not a way to roll
out flags to all users or a replacement for deployment configuration.
This project includes:
commitlintwith conventional commit ruleshuskyfor git hookseslint,stylelint, andprettiervitestfor testing- GitHub Actions CI
- Vercel deployment for production