Skip to content

Latest commit

 

History

84 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Civ5MapImage

Table of Contents

Introduction

Custom Civ 5 maps are usually shared as screenshots, which either show only part of the map in-game or a zoomed-out view with all the cities but none of the terrain. This program renders the entire map as a single, detailed image instead.

You can generate a physical map, showing terrain, or a political map, showing civilization borders and major cities. Either way, it converts a .Civ5Map file into a PNG image.

Command-Line Usage

The map filename can either be a .civ5map or .json file. To start using this application, you can use any of the map files in the maps/ folder or you can load a .civ5map in your game directory.

If you generated the map image and want to modify the map, you can export the .civ5map as a .json by providing an output filename with the file extension .json and reuse the exported json as the map filename.

./Civ5MapImage.exe -map=[map filename] -mode=[drawing mode (optional)] -output=[output filename (default is output.png)]

-input is also accepted as an older alias for -map.

Generate Physical Map Image

The default map mode is physical, which shows the different types of terrain.

./Civ5MapImage.exe -map=earth.Civ5Map -output=earth.png
earth

Generate Political Map Image

To generate a political map with the civilization and city state borders, you must pass in -mode=political to specify the drawing mode.

./Civ5MapImage.exe -map=maps/europe1939.json -mode=political -output=europe1939.png
europe

Generate Replay

To generate a replay, provide the base map and the replay file of a game. Passing -replay alone implies -mode=replay and defaults -output to output.gif:

./Civ5MapImage.exe -map=[map filename] -replay=[replay filename]

which is shorthand for the fully explicit form:

./Civ5MapImage.exe -mode=replay -map=[map filename] -replay=[replay filename] -output=[gif filename]
Flag Expected extension(s) Notes
-map .civ5map or .json The base map. Use the same map the replay was recorded on.
-replay .civ5replay, .civ5save, or .json The replay event log. A .civ5save is read and converted on the fly (see Extract Replay From Save File below). A .json here must be a replay previously exported with -mode=exportjson.
-output .gif Replays are always GIF-encoded; any other extension is rejected before rendering.
-maxturns (integer) Render at most this many turns instead of the whole replay; omit it (or pass 0) to render every turn. Useful for a quick preview.

Any other extension on -map or -replay is also rejected immediately. Before rendering, the map and replay are cross-checked: grid dimensions, tile-by-tile geography, and whether -map's filename matches the one the replay recorded (a mismatch there is only a warning). A geography mismatch fails fast with a descriptive error instead of rendering a wrong or partial animation.

Extract Replay From Save File

A .civ5save can be passed directly as -replay, no conversion needed:

./Civ5MapImage.exe -map=[map filename] -replay=[save filename]

To instead save the extracted replay events as reusable .json (e.g. to avoid re-parsing the save file each render), convert it with -mode=exportjson first, then render using the resulting json as -replay:

./Civ5MapImage.exe -mode=exportjson -input=[save filename] -output=[json filename]
./Civ5MapImage.exe -map=[map filename] -replay=[json filename]

Convert .civ5map to .json

Set -mode=exportjson and output to have a filename ending in .json. No image will be generated.

./Civ5MapImage.exe -mode=exportjson -input=earth.Civ5Map -output=earth.json

Examples

europe europe europe
europe world earth 1900
earth 1936 earth 1939 earth 1942
earth 2014 huge 1 earth 2014 huge 2 earth 2022
mongol india stalingrad

Running Tests

This project has unit tests for the fileio and graphics packages. To run the full test suite:

go test ./...

To see individual test names as they run, add -v:

go test ./... -v

To check test coverage:

go test ./... -cover

File Format Documentation

For detailed technical specifications of the Civ5 file formats, see FORMAT.md.

This document covers:

  • Map File Format (.civ5map) - Complete structure and data types
  • Replay File Format (.civ5replay) - Event data and civilization information
  • Save File Format (.civ5save) - Compressed game state data

The format documentation is intended for developers who need to understand the binary structure of Civ5 files or want to extend the functionality of this tool.

About

Convert Civ 5 map to an image

Topics

Resources

Stars

23 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages