Crusader_Decomp/map_renderer
Marco 549ff38334 Enhance map rendering with WebP support and loading feedback
- Update tile rendering to support both PNG and WebP formats.
- Introduce a loading spinner and progress bar for build feedback.
- Remove the manual build button; builds now trigger automatically on map selection.
- Add a phase plan document outlining future improvements and goals.
2026-03-27 11:02:30 +01:00
..
src Enhance map rendering with WebP support and loading feedback 2026-03-27 11:02:30 +01:00
.dockerignore Added node based web map renderer 2026-03-27 10:04:44 +01:00
.gitignore Added node based web map renderer 2026-03-27 10:04:44 +01:00
compose.yaml Added node based web map renderer 2026-03-27 10:04:44 +01:00
Dockerfile Added node based web map renderer 2026-03-27 10:04:44 +01:00
package-lock.json Added node based web map renderer 2026-03-27 10:04:44 +01:00
package.json Added node based web map renderer 2026-03-27 10:04:44 +01:00
phase-plan.md Enhance map rendering with WebP support and loading feedback 2026-03-27 11:02:30 +01:00
README.md Added node based web map renderer 2026-03-27 10:04:44 +01:00

Crusader Map Renderer

Node web app that renders Crusader maps on the server and streams only finished PNG tiles to the browser.

Goals

  • Keep Crusader source assets server-side.
  • Detect maps from STATIC and STATIC_REGRET automatically.
  • Build map render state on demand after the user selects a map.
  • Serve large maps as draggable and zoomable image tiles.
  • Run locally with Node or inside Docker.

Local Run

cd map_renderer
npm install
npm start

Open http://localhost:3000.

Viewer behavior:

  • drag with the mouse or one finger to pan
  • use the scroll wheel to zoom directly at the pointer
  • pinch to zoom on touch devices
  • toggle roofs and editor-only elements independently before building

The app expects asset folders under the app root:

  • map_renderer/STATIC
  • map_renderer/STATIC_REGRET

Docker Run

The Docker image excludes the Crusader assets on purpose. Mount them at runtime so they stay outside the image and are never served directly to clients.

cd map_renderer
docker build -t crusader-map-renderer .
docker run --rm -p 3000:3000 `
  -v ${PWD}/STATIC:/app/STATIC:ro `
  -v ${PWD}/STATIC_REGRET:/app/STATIC_REGRET:ro `
  crusader-map-renderer

If only one game is available, mount only that folder.

Docker Compose

The compose file mounts STATIC and STATIC_REGRET from the host filesystem into the container as read-only volumes. They are excluded from the image build by .dockerignore, so the assets are never copied into the image.

cd map_renderer
docker compose up --build

HTTP Surface

  • GET /api/maps returns the detected catalog.
  • POST /api/builds starts or reuses a build.
  • GET /api/builds/:id returns build status.
  • GET /api/maps/:game/:mapId/metadata?buildId=... returns map bounds and tile settings.
  • GET /api/maps/:game/:mapId/tiles/:tileX/:tileY.png?buildId=... returns rendered PNG tiles.

No raw Crusader asset files are exposed over HTTP.