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, sending goods and troops
client.army Units, recruitment and the hospital
client.attack Sending attacks, attack presets, and filling waves like the game does
client.commanders Commanders and castellans
client.skills Generals, abilities and skill trees
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 and incoming attacks
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.player, ranking, events Players, highscores and events

Install

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

Python 3.10 or newer.

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.49.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.49.0
File Size Uploaded
empire_core-0.49.0.tar.gz 1.5 MB Details

Built distribution (wheel)

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

Total release size: 2.2 MB

Release files / empire_core-0.49.0.tar.gz

Download URL empire_core-0.49.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
58840a800bb0297f371c74cc2f62a868bc268e6cc139af718943f9e8757ccc32
BLAKE2b-256 checksum
How to use checksums
3cbe3d6c05b6b67c4ebaa8210fe0c187321b7b123d018c9d5a155d76d6d72235
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 Oct 7, 2026.

Transparency log

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

Download URL empire_core-0.49.0-py3-none-any.whl
Size 729.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d3de86fb50cbebfdb6bf5027932a4b371690458df97f966000090262fb4664e
BLAKE2b-256 checksum
How to use checksums
8b0c88bd6cfe1b1f706bab54765cafea3ec9fcc9b6fc9a30b787119ce8182d8d
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 Oct 7, 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.49.0 This release

2 release files

0.42.0

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