Quick Start
The fastest way to generate maps is using the npm script:- Navigates to the
map-generator/directory - Runs
go run .to process all maps - Automatically formats the output files
Installation
Before using the map generator, ensure you have Go installed:1
Install Go
Download and install Go from https://go.dev/doc/install
2
Install Dependencies
3
Run the Generator
Command Line Usage
Basic Commands
Command Line Flags
Map Selection
--maps: Comma-separated list of maps to process
Logging Flags
The
--log-performance and --log-removal flags are opt-in on top of DEBUG level. To see all possible logs, use --log-level=ALL.Creating a New Map
1
Create Map Folder
Create a new directory in
assets/maps/<map_name>2
Add Source Image
Create
assets/maps/<map_name>/image.pngThe image should use blue channel values to represent terrain:- Blue < 140: Plains
- Blue 140-158: Plains with elevation
- Blue 159-178: Highlands
- Blue 179-200: Mountains
- Blue = 106 or Alpha < 20: Water
3
Create Map Info
Create
assets/maps/<map_name>/info.json with map metadata:coordinates: [x, y] spawn position (origin at top-left)name: Nation display nameflag: ISO 3166 country code (seesrc/client/data/countries.json)
4
Register the Map
Add the map to the registry in The
map-generator/main.go:Name should match your <map_name> folder.5
Run the Generator
6
Find Output Files
Generated files will be in
resources/maps/<map_name>/:map.bin,map4x.bin,map16x.binmanifest.jsonthumbnail.webp
Creating the Source Image
You can createimage.png by:
-
Cropping the world map:
- Download world map (large file)
- Use GIMP or similar tools to crop your desired region
-
Custom creation:
- Use any image editing software
- Paint terrain using blue channel values (see terrain mapping table)
- Save as PNG
The generator only reads the blue channel. Red and green values are ignored, so grayscale images work perfectly.
Map Processing Notes
Automatic Cleanup
- Small Islands: Islands smaller than 30 tiles are automatically removed
- Small Lakes: Bodies of water smaller than 200 tiles are removed
- Test Maps: Use
IsTest: trueinmain.goto disable automatic cleanup
Dimension Normalization
The generator normalizes dimensions to multiples of 4:- Width becomes:
Width - (Width % 4) - Height becomes:
Height - (Height % 4) - Any pixels beyond these bounds are cropped
Performance Considerations
For optimal game performance:- Keep map area between 2-3 million pixels
- Aim for 1-2 million land tiles
- Avoid exceeding 3 million land tiles
Enabling Maps In-Game
After generating map files, enable the map in-game:1
Update Game Types
Add to
GameMapType and mapCategories in src/core/game/Game.ts2
Update Map Playlist
Add to
src/server/MapPlaylist.ts3
Add Translation
Add to the
map object in resources/lang/en.json4
Update Credits
Add license and attribution to
CREDITS.mdDevelopment Tools
Adding Custom Flags
To add nation flags:- Add SVG flag to
resources/flags/<iso_code>.svg - Register country in
src/client/data/countries.json - Use the ISO code in your map’s
info.json
Troubleshooting
Map has 0 land tiles
Ensure your source image has pixels with blue values ≠ 106 and alpha ≥ 20.Map not found error
Verify the map name in--maps flag matches an entry in the maps array in main.go.