Skip to main content

Madagascar Asset Tools

Python >= 3.12

Loads .stream .dff .txd .bsp .txl .rws .lpa

This repo is a collection of tools used for modding the game "Madagascar" (released in 2005).

Contents

Requirements

Installation

1. Install uv

If you don't already have uv, install it from the official documentation:

https://docs.astral.sh/uv/getting-started/installation/

Restart your terminal / vscode after installation if necessary.

2. Clone the repository

git clone https://github.com/MaxStache/madagascar-game-asset-tools.git
cd madagascar-game-asset-tools

3. Install dependencies

Run:

uv sync

This automatically creates a virtual environment and installs the dependencies specified by the project.

4. Running scripts with UV

You can run Python scripts through uv without manually activating the virtual environment:

uv run python <script>.py
uv run python -m <module>

Alternatively, activate the virtual environment manually:

# WINDOWS:
.venv\Scripts\activate
# LINUX/MACOS:
.venv/bin/activate

Package layout

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 can be installed on its own.

Tools are run as modules:

uv run python -m madkit.tools.stream LEVEL.stream
uv run python -m madkit.tools.txd FILE.txd
uv run python -m madkit.tools.analyze FILE
uv run tfbeditor            # TfbPseudo editor

Usage

CLI

uv run madkit unpack LEVEL.stream output/directory/

uv run madkit repack input/directory/ LEVEL.stream

For more information run

uv run madkit --help

or

uv run madkit COMMAND --help

Mods

A mod is a folder in mods/ that edits the stock levels in Levels/:

mods/<name>/
  mod.toml      # name, description
  build.py      # @level(...) functions
  assets/       # files the mod imports (.AI scripts, textures, ...)
  build/        # output (gitignored)

Each @level function receives the named levels, loaded from Levels/<level>.stream. After all functions ran, every level they touched is saved to build/<level>.stream.

from pathlib import Path
from madagascar.mod import level

ASSETS = Path(__file__).parent / "assets"

@level("kingofny")
def gold_coins(kingofny):
    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): ...
uv run madkit config --game-dir "C:/Games/Madagascar"  # once, writes settings.toml
uv run madkit mod init my_mod --level kingofny
uv run madkit mod build my_mod
uv run madkit mod install my_mod

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for madkit 0.1.0
File Interpreter ABI Platform
madkit-0.1.0-py3-none-any.whl Python 3 none any Details

Release files / madkit-0.1.0-py3-none-any.whl

Download URL madkit-0.1.0-py3-none-any.whl
Size 59.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
786c251023b373f9ad9357b214744b633faab0f00b0f8921dfd8cf225b1cb9de
BLAKE2b-256 checksum
How to use checksums
5105a38b83ecbe312c4abcce8eb4b703de9444c2ff014e7329790e8beb680893
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.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page