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:Install Go
Download and install Go from https://go.dev/doc/install
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
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
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)
Register the Map
Add the map to the registry in The
map-generator/main.go:Name should match your <map_name> folder.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:Development 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.