Programmable automation client for Terraria servers
Project description
Terrex
Programmable automation client for Terraria servers.
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:
import asyncio
from terrex import Terrex
from terrex.event.filter import NewMessage
from terrex.event.types import ChatEvent
async def main() -> None:
async with Terrex("127.0.0.1", 7777) as client:
@client.on(NewMessage())
async def on_chat(event: ChatEvent) -> None:
print(event.text)
if "stop" in event.text.lower():
await client.stop()
await client.run_until_disconnected()
if __name__ == "__main__":
asyncio.run(main())
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file terrex-2.0.1.tar.gz.
File metadata
- Download URL: terrex-2.0.1.tar.gz
- Upload date:
- Size: 230.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9684a1020c0c9f79f07c212f3e5ade495fc9ba8b4f773709709e663c4dea87fd
|
|
| MD5 |
50f1733a185407e512fecf273aed037c
|
|
| BLAKE2b-256 |
827cab747a9dadd889f0860ffbea587310a2ec2017beb5a6bf627ffa67e6678a
|
File details
Details for the file terrex-2.0.1-py3-none-any.whl.
File metadata
- Download URL: terrex-2.0.1-py3-none-any.whl
- Upload date:
- Size: 319.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f3c334d290ccfaf759361ab31a312b114dce150eed2660749d4c82ce86c2b47
|
|
| MD5 |
9677a680a00d2c5d9b28aad0ca493efe
|
|
| BLAKE2b-256 |
c2a0118fb3be843955130e71bf36faf7a7ece9302194ce3e74e095d42e93fcdf
|