Files
SpaghettiKart/docs/mods-toml.md
T
coco875 02ad54ca72 Refactor yaml and remove segment (#531)
* move yaml (still need to fix header path)

* fix header

* change kart to karts and add migration

* fix include

* Update migration.py

* fix common_texture_debug_font extraction

* Update torch

* update torch and header

* unduplicate texture for tumble

* Update torch

* Update migration.py

* put the sort by default

* fix replace_segmented_textures_with_o2r_textures

* Update torch

* fix yamls

* add manual_segments in data of course

* comment out replace_segmented_textures_with_o2r_textures and segment 3

* remove segment 5

* (wip) remove segment 6

still plenty of thing to do

* more vtx

* more change

* Update torch

* small fix

* Update BansheeBoardwalk.cpp

* fix blockFort

* Delete test.yaml

* fix bowser castle and simplify track sections

* fix choco mountain

* clean banshee

* fix dk jungle

* fix double deck

* fix macos

* fix error

* fix macos ci

* Update torch

* Update torch

* fix frappe snowland

* fix kalimari desert

* fix koopa troopa beach

* fix luigi raceway

* fix mario raceway and simplify thing

* fix moo moo farm

* fix rainbow road

* Update torch

* Update torch

* hopefully fix windows error

* fix a small error

* fix royal raceway (and podium in theory)

* fix sherbet_land

* fix skyscraper

* fix toads turnpike

* fix wario stadium

* fix yoshi valley

* update torch

* more clang tidy rules

* REMOVE totally SEGMENT (sorry for the PR)

* remove unused field in course and props and unused packed asset

* fix kart texture

* fix particle

* fix track section and transparency

* try fix mode extra

* fix macos build and render

* fix collision in extra

* small change and try fix windows error

* a little of clean

* more cleanup

* forget header and more clean up

* Update Makefile

* fix credits

* fix kart texture offset

* remove LoadTextures and add Unload

* fix definitevely mirror mode

* add unload but it's not perfect

* revert a bad fix

* clean no longer used python script

* fix crash with player

* being able to load the same course twice

* add a comment on DrawWater

* fix render of transparent object

* better hack

* add a proper migration instruction

* fix number

* add basic modsmanager

* add meta/mods.toml

* Update EditorMath.h

* Update ModsManager.cpp

* basic modManager (maybe I should rename it ModLoader)

* use range on dependencies

* add information about mods.toml

* fix coment

* some rename around

* Delete beta-to-v1.md

* Update migrations.md

* Update textures-pack.md

* Update modding.md

* Update modding.md

* clean yamls_old

* move to mods in engine

* rename ModsManger to  ModManager

* move init and unload at the top

* rename ModsMetadata to ModMetadata

* fix header

* Update ModManager.cpp

* put core mods at top
2025-12-07 07:34:53 -07:00

3.7 KiB

mods.toml File Structure

The mods.toml file is a metadata file required for all mods and resource packs in SpaghettiKart. It uses the TOML format and defines important information about your mod, including its name, version, and dependencies.

Location

The mods.toml file must be placed at the root of your mod archive (.o2r, .zip) or folder.

MyMod/
├── mods.toml          <- Required at root level
├── textures/
│   └── ...
└── ...

Basic Structure

Here's a minimal mods.toml file:

[mod]
name = "my-awesome-mod"
version = "1.0.0"

Complete Structure

Here's a complete example with all supported fields:

[mod]
name = "my-awesome-mod"
version = "1.0.0"

[dependencies]
spaghettikart-assets = "=1.0.0-alpha1"
another-mod = ">=2.0.0"

Fields Reference

[mod] Section

Field Type Required Description
name String Yes Unique identifier for your mod. Use lowercase letters, numbers, and hyphens.
version String Yes Version of your mod following Semantic Versioning (e.g., 1.0.0, 1.0.0-alpha1).

[dependencies] Section

The [dependencies] section is optional and allows you to specify other mods that your mod requires.

Each dependency is defined as:

[dependencies]
mod-name = "version-requirement"

Version Requirements

Version requirements follow semantic versioning ranges:

Format Description Example
1.0.0 Exact version Only version 1.0.0
>=1.0.0 Greater than or equal Version 1.0.0 or higher
>=1.0.0 <2.0.0 Range Between 1.0.0 (inclusive) and 2.0.0 (exclusive)
>=1.0.0-alpha1 With prerelease Version 1.0.0-alpha1 or higher
see Semantic Versioning for more details.

Core Dependencies

SpaghettiKart defines three core packages that are always available:

  • mk64-assets - The base game resources (version 1.0.0-alpha1) (mk64.o2r)
  • extended-assets - SpaghettiKart additional assets (version 1.0.0-alpha1) (spaghetti.o2r)
  • spaghettikart-core - SpaghettiKart core engine (For verifying that mods support your game version)

If your mod depends on touching base game assets or SpaghettiKart assets, you should declare a dependency on these packages. For example:

[dependencies]
mk64-assets = "=1.0.0-alpha1"

Validation

When SpaghettiKart loads mods, it performs the following validations:

  1. Missing mods.toml: A warning is shown if the file is missing. The mod may still load but is considered incompatible.
  2. Cyclic dependencies: If mod A depends on mod B and mod B depends on mod A, an error is shown.
  3. Missing dependencies: If a required dependency is not found or has an incompatible version, an error is shown.

Load Order

Mods are automatically sorted based on their dependencies:

  • Mods without dependencies are loaded first
  • Mods are loaded after their dependencies

Best Practices

  1. Follow semantic versioning: Use proper version numbers (MAJOR.MINOR.PATCH)
  2. Specify minimal dependencies: Only declare dependencies you actually need
  3. Use version ranges: Prefer =1.0.0 because assets may change between versions

Migration Script Support

When using the migration script (migrations.py), a mods.toml file can be automatically generated for your migrated mod. See Migration Guide for details.

See Also