Skip to main content

Dragoman

Translate maps between Open Doctrines (.odmap) and Greater Diplomacy 5 (map directories), in both directions, losing as little as the two formats allow — and nothing at all on a round trip.

A dragoman was the interpreter attached to an embassy: the person through whom two powers who shared no language could nonetheless sign something. This is that, for map files.

pip install open-dragoman

dragoman convert 1914.odmap base_maps/1914 --to gd5
dragoman convert base_maps/GD4 gd4.odmap   --to odmap
dragoman roundtrip 1914.odmap              # prove nothing was lost
import dragoman

dragoman.convert("1914.odmap", "base_maps/1914", to="gd5")

world = dragoman.load("1914.odmap")
print(world.name, len(world.provinces), "provinces")

Read the wiki → — what it is, how to use it, what every message means, and what it cannot do.

Status

Every map both games ship round-trips without losing a single modelled field:

Suite Result
Greater Diplomacy 5 maps (12 base maps + 16 scenarios) 28 / 28
Open Doctrines maps (5 scenarios + the world map) 6 / 6
Unit tests (raster, scripts, ABI, versioning, round trip) 5 / 5

Verified against Open Doctrines and against GitGetGot415/Greater-Diplomacy-5. Reproduce with python3 tools/conformance.py <directory of maps>.

Converted maps have also been played in both games, not merely loaded by this library. Open Doctrines' world map converted to GD5 boots through GD5's own Controller and Map state with all 23 screens, its flags drawn, its oceans navigable and every province centre inside its own province; a GD5 map converted to Open Doctrines plays five AI turns under OpenDoctrines --simulate. Nearly everything this library gets right, it gets right because somebody opened the result in the game and looked at it — the flag encoding, the ocean, the political layer's colour key and the province-border fill were all found that way.

One thing crossing to Open Doctrines still needs a human: GD5 starts its nations with an empty stockpile and Open Doctrines expects a starting endowment, so a converted map bankrupts its world on the first turn unless treasuries are set. Reported as od.treasury rather than guessed at.

What "lossless" means here

The two games are not the same game, so a straight translation always loses something: Open Doctrines models a province's population, its port and its ethnic minorities, and GD5 has no field for any of them; GD5 models terrain, province adjacency, unit rosters and research, and Open Doctrines has no field for those.

Dragoman writes the difference down. Everything the destination cannot hold goes into a sidecar beside the map — dragoman_sidecar/ in a GD5 directory, dragoman/ inside a .odmap archive. Both games read a fixed list of filenames and ignore everything else, so the sidecar is invisible to them and costs the converted map nothing.

The result:

  • Converting one way is as faithful as the target format permits, and every approximation is reported by a stable code you can act on.
  • Converting back restores what the target could not hold. A → B → A keeps every province, nation, relation, claim, core, script and carried file, and the province raster hashes identical.

dragoman roundtrip <map> asserts exactly that. Pass --no-sidecar for a smaller, genuinely lossy conversion — the round trip then fails, on purpose.

Not promised: byte-identical container files. Two zip archives holding identical members are different files, because deflate is not reproducible across implementations, and Open Doctrines packs with Python's zlib while this packs with miniz. Every file inside is preserved exactly.

What crosses

Open Doctrines Greater Diplomacy 5
Province raster provinces.png, id packed big-endian id_map.png, id packed little-endian
Province identity preserved exactly — the rasters differ only by swapping red and blue
Owner, name, claims
Cores ✅ (carried)
Sea provinces — (synthesised for GD5)
Population, ports — (carried)
Fortification ✅ 0–5 Fort Lvl N, 1–20 (scaled ×4)
Minorities, political compass, policies — (carried)
Terrain, adjacency, province centres — (derived from the raster)
Units, buildings, research, factions — (armies carried)
Flags a PNG in the archive raw 60x40 pixels, base64
Relations ally, non-aggression, guarantee war and alliance only (rest carried)
Scripts imperative #OD/MapEngine/1 declarative scripted events

Adjacency and centroids are computed from the province raster when converting to GD5, since Open Doctrines derives both at load and never stores them. The centroid finder deliberately handles crescent-shaped provinces, whose mean pixel falls outside themselves.

Full field-by-field detail: docs/mapping.md.

Scripts

Open Doctrines' scripting is imperative and line-based, with loops and waitUntil suspension points. GD5's is a list of declarative events, each a set of conditions and a set of actions. The overlap is the shape both express: a gate, and things that happen when it opens.

An Open Doctrines script written as top-level waitUntil stages becomes GD5 events, one stage at a time. A GD5 event becomes an entry script with a waitUntil and some set lines. Anything outside that overlap — a foreach over a country's provinces, conditions chained with XOR — is reported by name and carried unchanged rather than half-translated. GD5 event types this library has never heard of pass through untouched, so a GD5 → OD → GD5 trip is lossless even for conditions added to the game after this was written.

Details and the full vocabulary: docs/scripting.md.

Installing

pip install open-dragoman

The wheel carries the compiled library inside the package, so there is no compiler needed at install time and nothing to locate afterwards. You get both the Python API and a dragoman command.

Prebuilt binaries for people who want nothing to do with Python are attached to each release. The full set of options — release archives, source builds, CMake FetchContent — is on the Installing page.

Building from source

Needs CMake 3.16 and a C++17 compiler. There are no external dependencies — miniz, stb and nlohmann/json are vendored, all MIT or public domain.

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
ctest --test-dir build --output-on-failure

This produces libdragoman.a, a shared libdragoman.{so,dylib,dll}, and the dragoman command line tool.

Using it from your language

The core is C++17 behind a flat C99 ABI, so anything with an FFI can call it. The whole interchange model is available as JSON through dg_world_to_json, which is how a binding reads or edits a map without needing an accessor per field.

  • C#include <dragoman/dragoman.h>, link dragoman. See bindings/c/example.c.
  • C++#include <dragoman/dragoman.hpp> for an RAII wrapper over the same ABI. See bindings/cpp/example.cpp.
  • Pythonpip install open-dragoman. Pure ctypes, and the wheel carries the library, so no compiler is needed at install time.
  • Anything else — Rust, Go, C#, Java, Lua and WebAssembly all bind the same header. docs/abi.md documents the contract.

Versioning

Two numbers that move for different reasons:

  • Library version (VERSION, semver) — the release. (Look in VERSION file to find current latest version).
  • ABI version (DRAGOMAN_ABI_VERSION) — bumped only when an existing symbol changes meaning, so a binding can refuse to load a library it cannot speak to without parsing semver.

The version lives in VERSION and is mirrored into the C header, the Python package and the CMake project. tools/check_version.py and tests/test_version.cpp both fail if any copy drifts, and CI runs them on every push. Details: docs/versioning.md.

Licence

Dragoman is MIT. It is an independent implementation written from observing both file formats; no code from either game is copied into it. Open Doctrines and Greater Diplomacy 5 remain under their own licences (Open Doctrines Non-Commercial, and GPL-3.0 respectively), and neither project's maps are redistributed here.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

open_dragoman-0.4.1.tar.gz (471.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

open_dragoman-0.4.1-py3-none-win_amd64.whl (350.2 kB view details)

Uploaded Python 3Windows x86-64

open_dragoman-0.4.1-py3-none-win32.whl (324.2 kB view details)

Uploaded Python 3Windows x86

open_dragoman-0.4.1-py3-none-musllinux_1_2_x86_64.whl (3.3 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

open_dragoman-0.4.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

open_dragoman-0.4.1-py3-none-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl (3.4 MB view details)

Uploaded Python 3manylinux: glibc 2.12+ i686manylinux: glibc 2.17+ i686

open_dragoman-0.4.1-py3-none-macosx_11_0_universal2.whl (2.3 MB view details)

Uploaded Python 3macOS 11.0+ universal2 (ARM64, x86-64)

File details

Details for the file open_dragoman-0.4.1.tar.gz.

File metadata

  • Download URL: open_dragoman-0.4.1.tar.gz
  • Upload date:
  • Size: 471.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for open_dragoman-0.4.1.tar.gz
Algorithm Hash digest
SHA256 716f7c9204249e578dcb8cc97b1fe1ca858f29a97cf6cbb1e4745adade5897a4
MD5 83d9da5ac63a0f3392552927c4241a9a
BLAKE2b-256 f9241121ddbb8db708dca875bd467264196961cf3a9aa2dc7081eb139a56cc82

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_dragoman-0.4.1.tar.gz:

Publisher: wheels.yml on Pr1nted/dragoman

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file open_dragoman-0.4.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: open_dragoman-0.4.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 350.2 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for open_dragoman-0.4.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 3be9afb30cb223e1ae7f86a6171a29f3283847dbb0039ea0215f0d310ac23d4a
MD5 fbf8bc58125e2741404b8a9eda43fc7c
BLAKE2b-256 1497dd105ec516f054602bca6a31050a459454a17ed54f7c46d8c7194ff9dd23

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_dragoman-0.4.1-py3-none-win_amd64.whl:

Publisher: wheels.yml on Pr1nted/dragoman

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file open_dragoman-0.4.1-py3-none-win32.whl.

File metadata

  • Download URL: open_dragoman-0.4.1-py3-none-win32.whl
  • Upload date:
  • Size: 324.2 kB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for open_dragoman-0.4.1-py3-none-win32.whl
Algorithm Hash digest
SHA256 7327d10ee35b01f5a78d3bcca581bf2efbb80c706c0b25e0ce8ce832a3a9f9c6
MD5 b4b476ed63ab1efbf13a16de1605cd6c
BLAKE2b-256 8ba2428ed8b20888bd5c117235f6d2185630de54c62c4e7d97c532cd63f327ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_dragoman-0.4.1-py3-none-win32.whl:

Publisher: wheels.yml on Pr1nted/dragoman

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file open_dragoman-0.4.1-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for open_dragoman-0.4.1-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 efe8395ed99c88669211c798107a58797d6f725009ef76356e05e42ba5ddf6e1
MD5 31b8b63c1e353a2636d4f017ad9429e2
BLAKE2b-256 e17e270de1646925fe6edc7a6b5975edf902202a7aed8c8ed373e360c04bb466

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_dragoman-0.4.1-py3-none-musllinux_1_2_x86_64.whl:

Publisher: wheels.yml on Pr1nted/dragoman

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file open_dragoman-0.4.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for open_dragoman-0.4.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 92709391068c602f52bf1888a1ec7830f90152d245703208c075e58c26de5518
MD5 1b7393c873ad3d149d2ca6dc54d37a2a
BLAKE2b-256 5022ba6c17f57a873ad8a0cecbc3b96236447a668b07d5e9efeebd25def28a48

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_dragoman-0.4.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on Pr1nted/dragoman

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file open_dragoman-0.4.1-py3-none-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for open_dragoman-0.4.1-py3-none-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 8f2dd997e7c6734fb3f3e3292761be7fea834ed7e7f4ceff44f94e4bc19eebfd
MD5 e8300c18c2e613aa51a0b643c0690b45
BLAKE2b-256 b0e9a07e16e121277535ab294ab83a3871297c4bb156f3288b57c663f5061f59

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_dragoman-0.4.1-py3-none-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: wheels.yml on Pr1nted/dragoman

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file open_dragoman-0.4.1-py3-none-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for open_dragoman-0.4.1-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 3f9da54c71948f5ad70f1ce25f2326bde59bea58091a7aea8fd3154edaff8448
MD5 540d8a05be92318e20e2f1422b8b0cf2
BLAKE2b-256 70d497dc43ba24159411de1c386ed3a7421e6ce0ff72cbdbcebd4a77d9c01fd2

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_dragoman-0.4.1-py3-none-macosx_11_0_universal2.whl:

Publisher: wheels.yml on Pr1nted/dragoman

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.4.1 This release

7 files

0.4.0

7 files

0.3.2

7 files

0.3.1

7 files

0.3.0

7 files

0.2.2

7 files

0.2.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page