Files
OpenFrontIO/map-generator
jachisc 690b7e1155 Add Manicouagan Map and Credit OpenTopography (#2620)
## Description:

Adds a map based on the Manicouagan Reservoir in Quebec and credits
OpenTopography

## Checklist:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
<img width="1017" height="1017" alt="Screenshot 2025-12-14 214706"
src="https://github.com/user-attachments/assets/030c4bbd-0325-4da4-bef5-71053dc8f183"
/>

## Discord username:

sehentsin
2025-12-15 09:44:15 -08:00
..

MapGenerator

This is a tool to generate map files for OpenFront.

Installation

  1. Install go https://go.dev/doc/install
  2. Install dependencies: go mod download
  3. Run the generator: go run .

Creating a new map

  1. Create a new folder in assets/maps/<map_name>
  2. Create image.png
  3. Create info.json with name and countries
  4. Add the map name in main.go
  5. Run the generator: go run .
  6. Find the output folder at ../resources/maps/<map_name>

By default, this will process all defined maps.

Use --maps to process a single map:

go run . --maps=fourislands

To process a subset of maps, pass a comma-separated list:

go run . --maps=northamerica,world

Create image.png

  1. Download world map (warning very large file)
  2. Crop the file (recommend Gimp)
  • We recommend roughly 2 million pixels for performance reasons
  • Do not go over 4 million pixels.

Create info.json

Example:

{
  "name": "MySampleMap",
  "nations": [
    {
      "coordinates": [396, 364],
      "name": "United States",
      "strength": 3,
      "flag": "us"
    }
  ]
}

To Enable In-Game

  • Add a translation for the map name to resources/lang/en.json
  • Add the MapDescription src/client/components/Maps.ts
  • Add the numPlayersConfig src/core/configuration/DefaultConfig.ts
  • Add the GameMapType src/core/game/Game.ts
  • To add to the map playlist, modify src/server/MapPlaylist.ts

Notes

  • Islands smaller than 30 tiles (pixels) are automatically removed by the script.
  • Bodies of water smaller than 200 tiles (pixels) are also removed.

🛠️ Development Tools

  • Format map-generator code:

    go fmt .