Skip to main content

EmpireCore

A fully typed Python client for Goodgame Empire

PyPI Python versions CI Docs PEP 561 typed MIT licence

Documentation · Getting started · Guides · API reference · Changelog


EmpireCore logs in to Goodgame Empire the way the game's own client does, then gives you typed services for your castles, army, commanders, alliance, mail, spies and the world map. Every request and reply is a pydantic model written against the game client's code, every failure is a typed exception, and a background thread keeps a thread-safe picture of your account current while your code runs.

What you get

  • Services for the whole game: client.alliance, castle, army, attack, commanders, equipment, skills, spy, map, movements, messages, player, defense, ranking and events.
  • Typed end to end: pydantic v2 models with snake_case fields over the wire keys, and a py.typed marker so your type checker sees them.
  • Honest failures: one EmpireError base, no leaked pydantic or socket errors, and no empty list that secretly means "the request failed".
  • Live, thread-safe state with callbacks for incoming attacks, arrivals and recalls.
  • Wave filling from nothing but a target's coordinates, the way the game's "Fill waves" button does it.
  • Fast map scans and an account pool for running many accounts.

Install

uv add empire-core        # or: pip install empire-core

Python 3.10 or newer.

Quick start

from empire_core import EmpireClient, Kingdom, MapItemType

with EmpireClient(username="your_user", password="your_pass") as client:
    client.login()

    for castle in client.castle.get_all():
        print(f"{castle.castle_name} at ({castle.x}, {castle.y})")

    scan = client.map.scan_kingdom(Kingdom.GREEN, item_types=[MapItemType.CASTLE])
    print(f"{len(scan.items)} castles, {len(scan.failed_chunks)} chunks failed")

    client.state.on_incoming_attack(lambda m: print("incoming from", m.source_player_name))

The getting started guide covers choosing a server, login tokens, reading state and handling errors.

Highlights

  • Checked against the game client. Requests follow the client's own command objects, key order included; models cite the client class and line they mirror; and the command ids are checked weekly against the live client.
  • Live-verified where the code can't tell. Where the client's code cannot settle what the server does, the library goes by what a live server did and says so, and the docs mark what is still unknown.
  • Fast scans. Map requests go out back to back, as the client sends them: a live scan of 289 chunks ran at about 17 requests a second without a refusal. Re-scanning only the chunks that held anything takes roughly a third fewer requests.

Documentation

Everything else lives at https://eschnitzler.github.io/EmpireCore/: a guide for each part of the game, diagrams of the login and request flow, and an API reference generated from the source with every model's fields, wire keys and descriptions. Runnable scripts are in examples/.

Contributing

Contributions are welcome. See CONTRIBUTING.md for adding protocol commands and services, the model conventions and the tests.

git clone https://github.com/eschnitzler/EmpireCore.git
cd EmpireCore
uv sync --extra dev
uv run pytest

Contact

Bugs and feature requests are best filed as issues.


MIT licensed. Not affiliated with Goodgame Studios. For educational purposes only; use responsibly.

Metadata

Release files for empire-core 0.42.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for empire-core 0.42.0
File Size Uploaded
empire_core-0.42.0.tar.gz 979.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for empire-core 0.42.0
File Interpreter ABI Platform
empire_core-0.42.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / empire_core-0.42.0.tar.gz

Download URL empire_core-0.42.0.tar.gz
Size 979.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d51e2d2110bc08a1df9200009c3216dd90c209f8b99227b1fb512af72a7cc997
BLAKE2b-256 checksum
How to use checksums
e8e9356bf3919f4c11043656ec6b521576c9769c8fb6e049edb7807b2d696403
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / empire_core-0.42.0-py3-none-any.whl

Download URL empire_core-0.42.0-py3-none-any.whl
Size 520.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f9daa0ef3a601e0e4b22e8b9f9c2a20cb60740c7186160898e2e545b8860dfa
BLAKE2b-256 checksum
How to use checksums
af2697c51d4459e710bf988d50e792a00bac8e8f0b5f5f4a9d60ae68da4c7a3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release history Release notifications | RSS feed

0.54.0

2 release files

0.53.0

2 release files

0.52.0

2 release files

0.51.2

2 release files

This release

0.42.0 This release

2 release files

0.41.0

2 release files

0.40.0

2 release files

0.39.0

2 release files

0.38.0

2 release files

0.37.0

2 release files

0.36.0

2 release files

0.35.3

2 release files

0.35.2

2 release files

0.35.1

2 release files

0.35.0

2 release files

0.33.0

2 release files

0.32.1

2 release files

0.32.0

2 release files

0.31.0

2 release files

0.30.3

2 release files

0.30.2

2 release files

0.30.1

2 release files

0.30.0

2 release files

0.29.0

2 release files

0.27.0

2 release files

0.26.0

2 release files

0.25.3

2 release files

0.25.2

2 release files

0.25.0

2 release files

0.24.2

2 release files

0.24.1

2 release files

0.24.0

2 release files

0.23.1

2 release files

0.22.1

2 release files

0.20.0

2 release files

0.19.2

2 release files

0.19.1

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.1

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release 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