Skip to main content

Programmable automation client for Terraria servers

Project description

Terrex

Programmable automation client for Terraria servers.

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-2.0.0.tar.gz (231.7 kB view details)

Uploaded Source

Built Distribution

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

terrex-2.0.0-py3-none-any.whl (319.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for terrex-2.0.0.tar.gz
Algorithm Hash digest
SHA256 c81ae961dd11af1638870657e055868187b09f184a25d91335a403cfc3b6eb95
MD5 6d792649863ead9651e6a23795a08bda
BLAKE2b-256 28f1e611025bd48e4e9359c70b56458a912e41f374de727cdb9ab15e7ab6e7dd

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for terrex-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 842d987e47b96af8b197e871a341666e339388cb23d62bfc9272d85d8f0ae5ec
MD5 5b929a4522513dbd8e61286d0f01d30d
BLAKE2b-256 4b13b8c63e8c03a3e4649585a9be6213a94d41dc78281848e6f45b856eaef1a0

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