Skip to content

An offline-first hub that bundles several Watabou map generators into one consistent web app: same UI patterns, local assets, and modern import/export. It adds OpenAPI docs, proto-first serialization, and a PWA build so everything works without an internet connection.

License

Notifications You must be signed in to change notification settings

voluminor/maphub

Repository files navigation

Fantasy MapHub Generators

Перейти к Русской версии

Technical part

Build and publishing

To build, it’s enough to run npm run build so that the project is fully built into the dist folder.

To make it available locally in the browser, run npm run preview.

When deploying to a server, it’s enough to move the contents of the dist folder to the root.

Other features

This project is built based on predefined values and page templates; to make changes, it’s enough to interact with these files:

-package.json -static.config.mjs -pages.config.mjs

If needed, you can “cut out” only one specific generator — at the code level they are self-contained and independent of their neighbors.

Work with data is built on the proto-first principle, while keeping support for older JSON export formats. If you plan to create your own solution using this generator, I recommend relying only on binary proto files, because JSON import/export is primarily focused on supporting older variants and the original watabou generators. Proto files, in turn, guarantee long-term support even if new functionality is added — old saved files will be supported in new versions without losing backward compatibility.

Binary file structure

All binary files are generated from proto definitions located in the protobuf directory.

Import accepts both raw binary proto objects from root structures and objects wrapped in a typed envelope with CRC32.

The envelope follows a simple format: |DataType uint32|{protobuf binary}|crc32IEEE({protobuf binary})

Type identifiers are also defined in proto: DataType

Root structures:

About the project

This project is a consolidation into one project of map generators by watabou that he published at watabou.github.io. Not all of them are publicly available, and even what is available is written in a not-so-popular language.

I took the web version implemented in JS and made many changes to it.

The work is not finished yet; the final goal is to get a fully self-contained generator and editor that requires no external resources and can conveniently describe an entire world, from a high level (planet) down to a low level (houses, clearings, and caves).

What was changed overall:

  • These generators are now fully local. That is, they can work without the internet: all connections are internal, and the downloaded files are included in the project.
  • Maximum automation has been implemented. You can conveniently assemble everything for your use case by interacting only with constructors and JSON parameters.
  • I wrote openapi.json for the generators and made it available directly via RapiDoc.
  • I changed the marshalling approach, making it proto-first.
  • I added import/export to a binary file: pure protobuf. Backward compatibility is preserved.
  • I tried to standardize the context menu so that items in different generators are in the same places and have the same names. I also added functionality for those generators that didn’t have it (Permalink..., Fullscreen).
  • I added the ability to open cities and villages directly in the 3D viewer (View in 3D).
  • I made dialogs more user-friendly (for example, it now clearly reports what the problem is during import).
  • I added prefixes for exported files (*.palette.mf.json, *.mf.json) so it’s clear what relates to what without looking inside.
  • I published it as a separate web resource, including a PWA, which makes it possible to install it as an app that doesn’t need the internet.

Plans for the future:

  • Move palette import/export to proto.
  • Add export for Cave/Glade Generator.
  • Add the ability to import schemes from a file for all generators except City Viewer (since City Viewer already has import).
  • Add a 3D visualizer for buildings (separate or just extend City Viewer functionality).
  • Add an advanced export mode that transfers names, labels, and other fields.
  • Add generation of Cave/Glade pointers in Medieval-Fantasy-City/Village Generator.
  • After advanced export, it will be possible to link Cave/Glade/Dwellings Generator and Medieval-Fantasy-City/Village Generator.
  • Make it separately buildable or extend the current build with a list of saved maps and palettes directly in the app.

Gallery

How the context menu changed

Cave/Glade Generator

to_cave

Dwellings Generator

to_dwellings

Village Generator

to_village

Medieval-Fantasy-City Generator

to_mfcg

City Viewer

to_viewer

Example of an installed app

Installed on a phone: a separate icon, works even without the internet

to_village

Example of working without the internet

to_village

CONTRIBUTING

If you want to join or just fix a bug — send a pull request with a description.

LICENSE

The source code is published under MPL-2.0.

Contact email: [email protected].

About

An offline-first hub that bundles several Watabou map generators into one consistent web app: same UI patterns, local assets, and modern import/export. It adds OpenAPI docs, proto-first serialization, and a PWA build so everything works without an internet connection.

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages