İçeriğe geç
Tüm projeler

GitHub · growtopia-world-toolkit

Lossless Rust codecs for Growtopia's items.dat (v1–27), RTTEX textures and worlds, with a seeded generator, sprite renderer and CLI.

Rust 0 0Güncellendi: 28 Kasım 2026
binary-formatclifuzzinggame-toolsgrowtopiaparserproptestreverse-engineeringrustserializer

growtopia-world-toolkit

CI Rust 1.85+ unsafe: forbidden License: MIT

Lossless parsers and serializers for Growtopia's data formats, as a Rust library and a CLI.

  • items.dat, versions 1–27: decode, edit, re-encode byte for byte. The public parsers I could find stop at v18; this one also maps the v19–v27 fields (item descriptions, hit effects), verified against the live 16 580-item file.
  • RTTEX textures: RTPACK/RTTXTR ↔ PNG. Decodes all 863 textures the game ships.
  • Worlds: a model, a compact checksummed binary format (GTWD), JSON, a seeded generator, and a renderer that draws worlds with the game's own sprite sheets.

A generated 100×60 world rendered with the game's sprites

A generated world (seed 2026), rendered at 8 px per tile in 38 ms. Sprites © Ubisoft, read from a local game install.

Quick start

cargo install --git https://github.com/WaestaCode/growtopia-world-toolkit gtk-cli

ITEMS="$LOCALAPPDATA/Growtopia/cache/items.dat"   # Windows default location
GAME="$LOCALAPPDATA/Growtopia/game"

gtk items info  "$ITEMS"
gtk items find  "$ITEMS" "world lock"
gtk items show  "$ITEMS" 242
gtk items export "$ITEMS" -o items.json            # lossless JSON
gtk items import items.json -o items.dat           # and back

gtk tex to-png "$GAME/tiles_page1.rttex" -o tiles.png
gtk tex batch  "$GAME" -o textures/                # every texture → PNG

gtk world generate start --seed 42 -o start.gtwd
gtk world render start.gtwd -o start.png --items "$ITEMS" --game "$GAME" --tile-size 16
gtk world convert start.gtwd -o start.json         # edit, then convert back
$ gtk items info items.dat
size      5793900 bytes
hash      0xedbf91b5 (proton)
version   27
items     16580 (8290 items + 8290 seeds)
decoded   in 12.5 ms

top item types:
    4063  Clothing
    1629  Foreground
     564  Consumable
     ...

Library

use growtopia::items::{ActionType, ItemsDat};
use growtopia::render::{DirTextures, RenderOptions, Renderer};
use growtopia::world::{generate, GenOptions};

let bytes = std::fs::read("items.dat")?;
let db = ItemsDat::decode(&bytes)?;
assert_eq!(db.encode()?, bytes); // exact round trip

let locks: Vec<_> = db.items.iter().filter(|i| i.kind() == ActionType::Lock).collect();

let world = generate("start", 42, &GenOptions::default());
let (png, stats) = Renderer::new(&db, DirTextures::new("game/")).render(&world, &RenderOptions::default());
std::fs::write("start.png", png.to_png()?)?;
std::fs::write("start.gtwd", world.encode()?)?;

Errors say what failed and where:

invalid value at offset 0x1a2 for item id: expected sequential id 1, found 5
unexpected end of input at offset 0x5862a8 while reading ext_v27.description (14 more bytes needed)
invalid value at offset 0x182 for crc32: stored 0x8c1f02aa, computed 0x0be7d1c4: the file is corrupt

How it's tested

Layer What it proves
Unit tests (27) Primitives, name cipher, hash, image ops, codec edge cases
Property tests (proptest, 256 cases each) decode(encode(x)) == x for random item databases across 13 versions and random worlds; JSON round trips; no decoder panics on random bytes; any single bit flip in a world file is detected
Real-file tests The live v27 items.dat re-encodes byte-identical, JSON round trip is lossless, all 863 game textures decode (opt-in via GT_ITEMS_DAT / GT_GAME_DIR, since game files are not redistributable)
Fuzzing cargo +nightly fuzz run items_dat (also rttex, world): decode → encode → decode stability
CI fmt, clippy -D warnings, tests on Linux / Windows / macOS, MSRV 1.85

Performance

Criterion, real 5.8 MB v27 file, release build:

Time Throughput
items.dat decode 15.3 ms 360 MiB/s
items.dat encode 22.2 ms 249 MiB/s
world 100×60 → GTWD 9.5 µs 6 000 tiles → 392 bytes
world 100×60 render 38 ms 7 200 sprites

Documentation

Project layout

crates/growtopia/      library (no unsafe, no panics on input)
  src/binary.rs        bounds-checked reader/writer with field+offset errors
  src/items/           items.dat model, codec, typed ActionType
  src/rttex.rs         texture containers
  src/world/           model, GTWD codec, generator
  src/render.rs        sprite renderer
  tests/               property tests, real-file tests
  benches/             criterion benchmarks
crates/gtk-cli/        the `gtk` binary
fuzz/                  cargo-fuzz targets

Roadmap

  • Auto-tiling (spread_type) so dirt edges and grass render like in game
  • WebAssembly build + in-browser world viewer
  • Map the v19–v26 field boundaries individually
  • Zero-copy decoding (&[u8]-borrowing item view)

Legal

This project is not affiliated with or endorsed by Ubisoft or Robinson Technologies. It contains no game assets: tests and tools read files from your own installation. It only reads and writes data files. It does not touch the game's network protocol or modify the client.

Licensed under MIT.