Skip to main content

Programmable automation client for Terraria servers

Project description

Terrex

Programmable automation client for Terraria worlds.

PyPI version

Terrex logo


What is Terrex?

Terrex is a Python framework for building programmable Terraria agents (bots).

It provides a clean event-driven API for connecting to servers, reacting to world state, parsing packets and executing scripted behaviors.

Originally inspired by an archived TerraBot project by Alexander Freeman (MIT licensed) (inactive for ~10 years),
Terrex is a modernized, extended and actively developed fork focused on:

  • automation
  • simulation
  • protocol control
  • scalable multi-agent systems

Think of it as a runtime for Terraria agents — not just a bot.


Installation

pip3 install terrex

Core Features

  • Connect to Terraria servers as a client
  • Full chat interaction
  • Event-driven packet handling
  • Live world & player state parsing
  • Item & tile updates tracking
  • Programmatic movement (teleport + control layer)
  • Extensible event system for custom logic

Minimal Example

A basic bot that connects to a server and reacts to chat messages:

from terrex import Terrex
from terrex.events import Events

bot = Terrex("127.0.0.1")
events = bot.get_event_manager()

@events.on_event(Events.Chat)
def on_chat(event_id, message):
    print(message)

    if "stop" in message.lower():
        bot.stop()

bot.start()

while bot.client.running:
    pass

More examples are available in the examples/ directory.


Project Philosophy

Terrex is built as an automation engine — not a cheat client.

Primary use cases include:

  • programmable agents
  • server testing & simulation
  • AI experiments
  • scripted behaviors
  • world interaction automation

Anything else is simply an emergent property.


Contributing

Terrex is under active development and contributions are welcome.

Current high-priority areas:

  • NPC packet parsing
  • Item interactions & drops
  • Player synchronization packets
  • Tile placement & world modification
  • Movement & physics layer

Packet documentation reference: https://github.com/MakStashkevich/terrex/blob/master/docs/packets.md


Origins

Terrex is based on a fork of the original TerraBot project by Alexander Freeman (MIT licensed) (now archived and unmaintained). The codebase has been refactored, extended and re-architected for modern Python workflows.


Roadmap (high level)

  • stable protocol layer
  • multi-agent orchestration
  • scripting behaviors (FSM / behavior trees)
  • performance scaling
  • cleaner API surface

Project details


Download files

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

Source Distribution

terrex-1.0.0.tar.gz (203.6 kB view details)

Uploaded Source

Built Distribution

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

terrex-1.0.0-py3-none-any.whl (292.6 kB view details)

Uploaded Python 3

File details

Details for the file terrex-1.0.0.tar.gz.

File metadata

  • Download URL: terrex-1.0.0.tar.gz
  • Upload date:
  • Size: 203.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for terrex-1.0.0.tar.gz
Algorithm Hash digest
SHA256 01a09d67f3d38015933cb2e6082c1005ae0fcd92ec519360c70c994f382e7b8a
MD5 422b6b0f6aa06ef69d34ba7eed4c9539
BLAKE2b-256 d22b493814e67eff4c2eae88787a7b6acd5aab4e380da2bd09230afff51bd838

See more details on using hashes here.

File details

Details for the file terrex-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: terrex-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 292.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for terrex-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23053e839f823dc80ba10ff689b55f9d59ba49bb49e40c502e76f31b016df47a
MD5 34a805cc7967c02c35ca2a5cc32d0ffc
BLAKE2b-256 f30a13ef086e88d10d2f44dcebf81e3b020d2099be23c04598e768a23a3a7631

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page