Skip to main content

EmpireCore

A fully typed Python client for Goodgame Empire.

PyPI Python versions CI Docs

EmpireCore lets Python code play Goodgame Empire the way the game's own client does. Log in, read your account and castles, react to incoming attacks and other events as they happen, send armies and spies, and run several accounts side by side.

Why EmpireCore

  • Fully typed. Every request and reply is a pydantic model with readable field names, so your editor completes them and your type checker checks them.
  • Behaves like the real game client. Logins, requests and their checks follow the game's own client code, so the server sees what it expects.
  • Live state and events. A background thread keeps your account's state current. Register callbacks, or stream events with asyncio.
  • Built to keep running. keep_session logs back in after a dropped connection, and AccountPool shares several logged-in accounts across threads.

What it covers

Service What it does
client.castle Castles, buildings, resources, horses, tax, research and the mercenary camp
client.army Units, recruitment and the hospital
client.attack Sending attacks, attack presets, and filling waves like the game does
client.commanders Commanders, castellans and generals
client.equipment The equipment inventory
client.spy Spy missions, sabotage and spy reports
client.map Kingdom scans and map lookups
client.movements Army movements, recalls, incoming attacks, and sending goods, support and troops
client.alliance Chat, help requests, members and the treasury
client.messages The mailbox, mail and battle reports
client.defense Reading and setting castle defense
client.rewards The free daily rewards
client.quests Your active quests, the quest book and the daily quests
client.player, ranking, events Players, highscores and events

Install

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

Python 3.10 or newer.

For an interactive console on a live client, with completion and a live view of every socket frame, install the console extra and run empire-console (Linux and macOS; untested on Windows):

pip install 'empire-core[console]'
empire-console                    # asks for the username and password; --zone for another world
empire-console: Python output and input on the left; the socket frames, with the selected reply parsed into its model, on the right

Quick start

import time

from empire_core import EmpireClient, Movement


def warn(attack: Movement) -> None:
    print(f"Attack from {attack.source_player_name}, "
          f"landing in {attack.time_remaining}s")


with EmpireClient(
    username="you", password="...", keep_session=True
) as client:
    client.login()

    for castle in client.castle.get_all():
        res = client.castle.get_resources(castle.castle_id)
        print(f"{castle.castle_name}: {res.wood:,} wood, "
              f"{res.stone:,} stone, {res.food:,} food")

    client.state.on_incoming_attack(warn)
    time.sleep(3600)

Documentation: https://eschnitzler.github.io/EmpireCore/, with a guide for each part of the game and the full API reference.

Contributing

Contributions are welcome; see CONTRIBUTING.md. Bugs and feature requests are best filed as issues.

Contact

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

Metadata

Release files for empire-core 0.62.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.62.0
File Size Uploaded Provenance Actions
empire_core-0.62.0.tar.gz 2.5 MB With provenance Details for empire_core-0.62.0.tar.gz

Built distribution (wheel)

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

Total release size: 3.7 MB

Release files / empire_core-0.62.0.tar.gz

Download URL empire_core-0.62.0.tar.gz
Size 2.5 MB
Tags Source
SHA-256 checksum
How to use checksums
b5f554513fd3c9abd5e50bb480ea9140039525975cb3adc54528a82ab7cc361e
BLAKE2b-256 checksum
How to use checksums
5fd05da29cf72311481f250cfa1ad2c2666e6902ae445c7b177010c32a02e046
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

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

Download URL empire_core-0.62.0-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
6194c327b9aeabb831ab0a0d28c8e83e9aecc6be6ab6c601bf20ef19875a217f
BLAKE2b-256 checksum
How to use checksums
74b4f384f0e744c263c8a1c5cce4f06ae102d582e2fb230e70a934f89f42c699
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

Security for empire-core 0.62.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for empire_core-0.62.0.tar.gz

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 Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.62.0 This release

2 release files Full provenance

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