Hello! I have developed Map Editor for this game. This is very cool, now players can create their own maps and load them into the game!
I created it in January, and now I remembered that it would be cool to share some information about creating, because I believe that the code used in it for loading textures may be useful to someone.
All work with images is based on DrawPixels module, in which I added the code needed for the Map Editor.
About map creating
- User prepares some image
- User can modify map image. I only recommend doing this for small changes. Functionality of image editor is small and inconvenient
- When the user clicks on the “Autogenerate” button, the algorithm automatically colors the map so that each province has a unique color
- User clicks “Export”, editor creates map files
more about what happens when the export button is pressed
- The image is blurred. Blur is needed for the effect of distance fields
- The minimum possible texture size is selected for each province. The province image data is adjusted to the texture size and saved
- Data of each province is saved for click tracking using this module
- Information about each province is generated (size, position and information about whether it is water)
- Data is generated about which provinces are neighboring (so that player can move from one to another)
- A scenario is created for this map. It can be opened in the Scenario Editor to make cool scenario
About loading in game
- There is several atlases with prepared textures. The sizes of the images in them are different, because the game can have provinces of very different sizes
- When loading a map, this data is loaded: province texture, click tracking data, center offset (user can customize province center in map editor), province data
- How textures are set:
Loaded custom map in game:
The map editor is currently unfinished and not beautiful, but it is fully working.
I also added the ability to convert maps to in-game format. One fully working map has already been created in the map editor and moved to the game client.
Map Editor sources: GitHub - jalhund/cold-path-map-editor: Map Editor for Cold Path
Map Editor guide: Map Editor | Cold Path