Terraria world parser in Python
Project description
Lihzahrd
Terraria game world parser for Python.
Links
Installation
Lihzahrd can be installed from PyPI like any other public Python package.
Using uv, that means:
uv add lihzahrd
Usage
You can open a world file and get a World
object by calling:
import lihzahrd
world = lihzahrd.World.create_from_file("filename.wld")
It will take a while to process: a small Terraria world contains more than 5 million tiles!
Once you have a World
object, you can use all data present in the save file by accessing its attributes.
[!Warning]
Maliciously designed Terraria worlds can drain system resources, crash the interpreter, or possibly do other evil things!
Make sure you trust worlds before parsing them!
Documentation
The documentation is available here.
If you know something that is missing in the documentation, please let me know with an issue!
PyPy
lihzahrd
is compatible with PyPy, an alternative implementation on Python!
If you think that parsing a world takes too much time, you can use PyPy to reduce the required time by a factor of ~3!
Benchmarks
Time to parse the same large world:
- CPython took 11.45 s.
- Pypy took 3.57 s!
Building docs
You can build the docs by entering the docs_source
folder and running make html
, then committing the whole docs
folder.
References used
- The TEdit World Parser, the most accurate source currently available.
- The tModLoader wiki, containing lists of all possible IDs.
- The Terrafirma world documentation, accurate for old worlds (version <69)
- The 1.3.x.x world documentation, a bit incomplete, but an useful source nevertheless.
- A JS World Parser on GitHub.
- A Background Guide on Steam that displays all possible world backgrounds.
See also
- flyingsnake, a map renderer using this package
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
File details
Details for the file lihzahrd-3.1.1.tar.gz
.
File metadata
- Download URL: lihzahrd-3.1.1.tar.gz
- Upload date:
- Size: 8.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4be3a65e584a5d2c0fe059ff0f4da7910f0028fd5eca6e3500ac1840b05a0985 |
|
MD5 | ef095a0aaa0bb80f43be32a4e3a17419 |
|
BLAKE2b-256 | 4759a440d77f55d53f619200b2efedf3c606148549e58db69f371c1375817c26 |
File details
Details for the file lihzahrd-3.1.1-py3-none-any.whl
.
File metadata
- Download URL: lihzahrd-3.1.1-py3-none-any.whl
- Upload date:
- Size: 111.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa7d90fc6a5fb93a52ebf0c3e91aa80bed408c7f57a2b7db05eab4d4fe5dbee2 |
|
MD5 | 4b8a7d859a1994ce879471cbc350a324 |
|
BLAKE2b-256 | 4d93741a7d6be448734b698849e26b9726042d5cae5b4363729118578a3b90b8 |