Fork for creating video replays of Vox Populi (https://forums.civfanatics.com/forums/community-patch-project.497/) autoplay games.
Example:
output.mp4
Meant to be used with https://github.com/artemigkh/civ5-automation and requires community patch
DLL >= v4.3 with LOG_MAP_STATE
mod options.
This is a bit of a hack and slash job; relevant scripts are included for post-processing
turn files, stitching video, pulling colors out of the civ5 db, etc. in the scripts
directory.
Most custom maps designed for Civ 5 will usually provide screenshots of the map, but they will either only show a portion of the map in the game or a zoomed out image which shows all of the cities but not the terrain. This program is designed to provide you a detailed view of the entire map in one single image.
You have the option of generating a physical map or a political map. The physical map focuses on generating the terrain, while the political map shows the civilization boundaries and major cities. This program will convert a Civ 5 map with the file extension .Civ5Map to a PNG image.
The input 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 input filename.
./Civ5MapImage.exe -input=[input filename] -mode=[drawing mode (optional)] -output=[output filename (default is output.png)]
The default map mode is physical, which shows the different types of terrain.
./Civ5MapImage.exe -input=earth.Civ5Map -output=earth.png
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 -input=maps/europe1939.json -mode=political -output=europe1939.png
Set output to have a filename ending in .json and the program will just convert the .civ5map file to a .json file. No image will be generated.
./Civ5MapImage.exe -input=earth.Civ5Map -output=earth.json
This file format covers .civ5map files, which stores the map data. All data is stored in little endian.
Type | Size | Description |
---|---|---|
uint8 | 1 byte | ScenarioVersion (The leftmost 4 bits are for scenario. The rightmost 4 bits are for version, which is set to 12 for newer files.) |
uint32 | 4 bytes | Map width |
uint32 | 4 bytes | Map height |
uint8 | 1 byte | Number of players |
uint8[4] | 4 bytes | Settings (hasWorldWrap, hasRandomResources, hasRandomGoodies) |
uint32 | 4 bytes | TerrainDataSize (Length of terrain list) |
uint32 | 4 bytes | FeatureTerrainDataSize (Length of feature terrain list) |
uint32 | 4 bytes | FeatureWonderDataSize (Length of feature wonder list) |
uint32 | 4 bytes | ResourceDataSize (Length of resource list) |
uint32 | 4 bytes | ModDataSize |
uint32 | 4 bytes | MapNameLength |
uint32 | 4 bytes | MapDescriptionLength |
Following the header, is a list of strings whose size is determined in the header. Each string list will have a zero byte to split items.
Type | Size | Description |
---|---|---|
String list | TerrainDataSize bytes | Terrain (e.g. TERRAIN_GRASS) |
String list | FeatureTerrainDataSize bytes | Feature terrain (e.g. FEATURE_ICE) |
String list | FeatureWonderDataSize bytes | Feature wonders(e.g. FEATURE_CRATER, FEATURE_FUJI) |
String list | ResourceDataSize bytes | Resources (e.g. RESOURCE_IRON) |
String | ModDataSize bytes | modData |
String | MapNameLength bytes | Map name |
String | MapDescriptionLength bytes | Map description |
uint32 | 4 bytes | WorldSizeLength (Only if version >= 11) |
String | WorldSizeLength bytes | WorldSize (Only if version >= 11) |
The map data is inverted, which means that the bottommost row rendered on the screen is stored on the top row of the array and the topmost row rendered on the screen is stored on the last row of the array.
Type | Size | Description |
---|---|---|
MapTile[Height][Width] | (Height * Width * 8) bytes | Map geography |
The size of this struct is 8 bytes.
Type | Size | Description |
---|---|---|
uint8 | 1 byte | TerrainType (index in terrain list) |
uint8 | 1 byte | ResourceType (index in resource list, 0xFF if none) |
uint8 | 1 byte | FeatureTerrainType (index in feature terrain list, 0xFF if none) |
uint8 | 1 byte | RiverData (The low 3 bits means the tile border has a river. Only 3 edges needs to be marked per tile. 4 (>>2) is southwest edge, 2 (>>1) is southeast edge, 1 (>>0) is eastern edge) |
uint8 | 1 byte | Elevation (0 = flat, 1 = hills, 2 = mountain) |
uint8 | 1 byte | Continent (0 = none, 1 = Americas, 2 = Asia, 3 = Africa, 4 = Europe) |
uint8 | 1 byte | FeatureWonderType (index in feature wonder list, 0xFF if none) |
uint8 | 1 byte | ResourceAmount |
Type | Size | Description |
---|---|---|
byte[68] | 68 bytes | Unknown, seems related to GameSpeed |
uint32 | 4 bytes | MaxTurns |
byte[4] | 4 bytes | Unknown |
uint32 | 4 bytes | StartYear |
uint8 | 1 byte | PlayerCount (Number of playable civs) |
uint8 | 1 byte | CityStateCount |
uint8 | 1 byte | TeamCount (should be the sum of PlayerCount and CityStateCount) |
byte | 1 byte | Unknown |
uint32 | 4 bytes | ImprovementDataSize |
uint32 | 4 bytes | UnitTypeDataSize |
uint32 | 4 bytes | TechTypeDataSize |
uint32 | 4 bytes | PolicyTypeDataSize |
uint32 | 4 bytes | BuildingTypeDataSize |
uint32 | 4 bytes | PromotionTypeDataSize |
uint32 | 4 bytes | UnitDataSize |
uint32 | 4 bytes | UnitNameDataSize |
uint32 | 4 bytes | CityDataSize |
uint32 | 4 bytes | VictoryDataSize (Only if version >= 11) |
uint32 | 4 bytes | GameOptionDataSize (Only if version >= 11) |
Type | Size | Description |
---|---|---|
String list | ImprovementDataSize bytes | Improvements (e.g. IMPROVEMENT_FARM) |
String list | UnitTypeDataSize bytes | Unit types (e.g. UNIT_SETTLER) |
String list | TechTypeDataSize bytes | Tech types (e.g. TECH_AGRICULTURE) |
String list | PolicyTypeDataSize bytes | Policy types (e.g. POLICY_LIBERTY) |
String list | BuildingTypeDataSize bytes | Building types (e.g. BUILDING_STADIUM) |
String list | PromotionTypeDataSize bytes | Promotion types (e.g. PROMOTION_DRILL_1) |
Unit data array | UnitDataSize bytes | Unit data |
Unit name array | UnitNameDataSize bytes | Unit names |
City array | CityDataSize bytes | City information |
String list | VictoryDataSize bytes | Victory types (e.g. VICTORY_CULTURAL) |
String list | GameOptionDataSize bytes | Game options (e.g. GAMEOPTION_NO_CITY_RAZING) |
In version 11, the sizeof this struct is 48 bytes.
In version 12, the sizeof this struct is 84 bytes.
Type | Size | Description |
---|---|---|
byte[2] | 2 bytes | Unknown |
uint16 | 2 bytes | Index to custom unit name data |
uint32 | 4 bytes | Experience |
uint32 | 4 bytes | Health (100% health is 100000) |
uint8 (version 11) or uint32 (version 12) | 1 byte for version 11, 4 bytes for version 12 | Unit type |
uint8 | 1 byte | Owner |
uint8 | 1 byte | Facing direction |
uint8 | 1 byte | Status (The low 3 bits are used. 4 (>>2) is garrisoned, 2 (>>1) is embarked, 1 (>>0) is fortified) |
byte | 1 byte | Unknown (Only for version 12) |
byte[] | 32 bytes for version 11, 64 bytes for version 12 | Promotion data |
In version 11, the sizeof this struct is 104 bytes.
In version 12, the sizeof this struct is 136 bytes.
Type | Size | Description |
---|---|---|
byte[64] | 64 bytes | City name |
uint8 | 1 byte | Owner |
uint8 | 1 byte | Settings |
uint16 | 2 bytes | Population |
uint32 | 4 bytes | Health (100% health is 100000) |
byte[] | 32 bytes for version 11, 64 bytes for version 12 | Building data |
There is a section between the city data and team data that doesn't seem to be used anywhere, except for padding. The sizeof this block is unknown, but this block size increases as the number of civs increases.
Type | Size | Description |
---|---|---|
byte[] | Unknown bytes | This block doesn't seem to correspond to anything in the game |
The sizeof this struct is 64 bytes. The team name is usually the default value, e.g. Team 1.
Type | Size | Description |
---|---|---|
byte[64] | 64 bytes | Team name |
The sizeof this struct is 436 bytes.
Type | Size | Description |
---|---|---|
byte[32] | 32 bytes | Policies |
byte[64] | 64 bytes | Leader name (override leader name) |
byte[64] | 64 bytes | Civ name (override civ name) |
byte[64] | 64 bytes | Civ type (default civ name) |
byte[64] | 64 bytes | Team color |
byte[64] | 64 bytes | Era |
byte[64] | 64 bytes | Handicap |
uint32 | 4 bytes | Culture |
uint32 | 4 bytes | Gold |
uint32 | 4 bytes | Start position X |
uint32 | 4 bytes | Start position Y |
uint8 | 1 byte | Team |
uint8 | 1 byte | Playable |
byte[2] | 2 bytes | Unknown |
This block is always placed at the end of a file.
Type | Size | Description |
---|---|---|
MapTileImprovement[Height][Width] | (Height * Width * 8) bytes | 2D array of map tile improvements |
The size of this struct is 8 bytes.
Type | Size | Description |
---|---|---|
uint16 | 2 bytes | City id (0xFFFF if none) |
uint16 | 2 bytes | Unit id (0xFFFF if none) |
uint8 | 1 byte | Owner |
uint8 | 1 byte | Improvement |
uint8 | 1 byte | RouteType (0 = road, 1 = railroad, 0xFF = none) |
uint8 | 1 byte | RouteOwner |