Madagascar Asset Tools
Loads .stream .dff .txd .bsp .txl .rws .lpa
madkit is a collection of tools for modding the game "Madagascar" (released in 2005): a CLI to unpack, repack and build mods for the game's level files, plus viewers for streams and textures.
Contents
Requirements
- Python >= 3.12
- Your own copy of the game
Getting started
1. Create a modding folder
Make a folder for your mods with its own virtual environment, and install madkit and madlysimple into it:
mkdir my-madagascar-mods
cd my-madagascar-mods
python -m venv .venv
# WINDOWS:
.venv\Scripts\activate
# LINUX/MACOS:
source .venv/bin/activate
pip install madkit madlysimple
madkit is the CLI and tools, madlysimple the helpers you use in your mod scripts.
The environment stays active until you close the terminal. In every new terminal, cd into your modding folder and run the activate line again before using madkit.
To update later: pip install --upgrade madkit madlysimple.
2. Copy the stock levels
Mods are built from the original .stream level files. Copy the game's Levels/ folder into your modding folder:
my-madagascar-mods/
.venv/
Levels/ # copy of <game folder>/Levels, never modified
3. Configure madkit
Tell madkit where the game is installed (once):
madkit config --game-dir "C:/Games/Madagascar"
This writes a settings.toml in the current folder, so run madkit from your modding folder. Use --levels-dir if your stock levels are somewhere other than Levels/.
Mods
Create a mod:
madkit mod init my_mod --level kingofny
This creates:
mods/my_mod/
mod.toml # name, description
build.py # @level(...) functions
assets/ # files the mod imports (.AI scripts, textures, ...)
Each @level function receives the named levels, loaded from Levels/<level>.stream.
After all functions ran, every level they received is saved to mods/my_mod/build/<level>.stream.
from pathlib import Path
from madformats.mod import level
from madformats.stream import RW_StreamFile
ASSETS = Path(__file__).parent / "assets"
@level("kingofny")
def gold_coins(kingofny: RW_StreamFile) -> None:
kingofny.assetByName("DG_Coin_Collectable.AI").importFrom(ASSETS / "scripts/DG_Coin_Collectable.AI")
@level("kingofny") # stacked: runs once per level
@level("kingofny_regen")
def bigger_coins(lvl): ...
@level("street", "kingofny") # several names: one call with all levels
def alex_to_marty(street, kingofny): ...
Build it, or build it and copy the levels into the game:
madkit mod build my_mod # -> mods/my_mod/build/
madkit mod install my_mod # build + copy into <game folder>/Levels
Back up the game's Levels/ folder before installing mods, so you can restore the originals.
CLI
madkit unpack LEVEL.stream output/directory/
madkit repack input/directory/ LEVEL.stream
For more information run
madkit --help
madkit COMMAND --help
Tools
GUI tools are run as modules:
python -m madkit.tools.stream LEVEL.stream # stream viewer
python -m madkit.tools.txd FILE.txd # texture viewer
python -m madkit.tools.analyze FILE # RenderWare file viewer
tfbeditor # TfbPseudo AI script editor
Development
To work on madkit itself you need uv. Clone the repository and install the whole workspace:
git clone https://github.com/MaxStache/madagascar-game-asset-tools.git
cd madagascar-game-asset-tools
uv sync
The repository is a uv workspace with these packages, all installed in editable mode:
| Package | Path | Import |
|---|---|---|
madkit (CLI + tools) |
src/madkit/ |
madkit.cli, madkit.tools.* |
madformats (file formats) |
packages/madformats/ |
madformats |
madlysimple (modding helpers) |
packages/madlysimple/ |
madlysimple |
tfbpseudo (AI script compiler + editor) |
packages/tfbpseudo/ |
tfbpseudo |
tfbscript (.ai parser/decompiler, tfbtool) |
packages/tfbscript/ |
tfbscript |
Each package under packages/ has its own pyproject.toml and is published to PyPI on its own.
License
Apache-2.0. See LICENSE.
Disclaimer
Unofficial fan project, not affiliated with or endorsed by DreamWorks, Activision or Toys for Bob. No game assets are included, you need your own copy of the game.
Metadata
Release files for madkit 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| madkit-0.1.3.tar.gz | 367.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| madkit-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 427.5 kB
Release files / madkit-0.1.3.tar.gz
| Download URL | madkit-0.1.3.tar.gz |
|---|---|
| Size | 367.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cdd84825429df666202e5fdd6efabf023dae20b3d26b0e19d840cf4207c0ad8b
|
|
BLAKE2b-256 checksum How to use checksums |
d2b2c189ed4e14177aa20fda294199fe15a4e7c80cab34abcfcd08f0d5ba449f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.33 {"installer":{"name":"uv","version":"0.11.33","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / madkit-0.1.3-py3-none-any.whl
| Download URL | madkit-0.1.3-py3-none-any.whl |
|---|---|
| Size | 59.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e03c159b161ef8daef49575e41443378a32b7df5417f4e4262ecd125de69804
|
|
BLAKE2b-256 checksum How to use checksums |
dcb28fa7e46d4eb039aaf89025549fa524295b5492a770d1944f6fa5cca1f4d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.33 {"installer":{"name":"uv","version":"0.11.33","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for madkit 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.