Categorygithub.com/samuelyuan/TOAWMap
repositorypackage
0.0.0-20241114011014-af0f7a414964
Repository: https://github.com/samuelyuan/toawmap.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# README

TOAWMap

This program will read scenario files (.sce) and render the maps.

The following games are supported:

  • The Operational Art of War: Century of Warfare
  • The Operational Art of War III
  • The Operational Art of War IV

Command-Line Usage

./TOAWMap.exe -input=[input filename] -output=[output filename]

Example

./TOAWMap.exe -input=scenario.sce -output=scenario.png
korea50 manchuria

About

There have been many maps generated for The Operational Art of War (TOAW) series, but there isn't much information on the file formats and there is no way to parse the data. This project analyzes the different games and you can see how there is a lot of overlap between the various file formats.

TOAW Game Version Notes

The Operational Art of War IV (TOAW4) uses gzip to compress the files. The file will begin with the gzip header, where the magic number is 0x1f8b and the compression method is 08 for DEFLATE.

TOAW3 and earlier games use PKWare Compression Library to compress each of the blocks. The header will begin with "TOAC".

Map Header

TypeSizeDescription
byte[16]16 bytesHeader
uint324 bytesUnknownInt1
byte[264]264 bytesMap title
uint324 bytesVersion
uint324 bytesUnknownInt3
byte[8192]8192 bytesMap description
byte[8192]8192 bytesEnd message for Team1, 1st victory message
byte[8192]8192 bytesEnd message for Team1, 2nd victory message
byte[8192]8192 bytesEnd message draw 1
byte[8192]8192 bytesEnd message for Team2, victory message
byte[8192]8192 bytesUnknownBlock1
byte[8192]8192 bytesEnd message draw 2
byte[8192]8192 bytesUnknownBlock2
uint324 bytesTeam goes first
byte[36]36 bytesTeamNameBlock3

Tile Data

In the decompressed blocks array, this is the block with index 1, which would be the 2nd element starting from index 0.

In TOAW4, the maximum map size is 700x700. In TOAW3 and earlier games, the maximum map size is either 300x300 or 100x100.

Each tile is 47 bytes, which is represented as a byte array in the code.

IndexDescription
1-4Sand tile flag (index 1 = arid, 2 = sandy, 3 = r_sandy, 4 = badlands)
5Hills tile flag
6Mountains tile flag
7Impassable tile flag
8Marsh tile flag
9Flooded marsh tile flag
10Shallow water tile flag
11Deep water tile flag
14-17Urban tile flag
22River tile flag
23Major river tile flag
26-29Forest tile flag (index 26 = c_forest, 27 = d_forest, 28 = m_forest, 29 = t_forest)
31Road tile flag
33Railroad tile flag
38Tile type