Skip to content
Axiom/Docs
Adding a game / Packs

Packs

A pack is how Axiom knows what one game's bytes mean. The backend knows how to read a process; the pack says where in it to look. A mod never sees the difference: it asks entity.query@1 and gets an answer, whichever of the two gave it.

The split

Reading memory, resolving names, hooking functions, drawing the overlay and taking input are the same on every game built on one runtime, so a backend ships them once per runtime family. Which region is the entity pool is not a property of a runtime, so no backend can ever supply it. That is the pack's whole job: not implementing the surface, just telling it where to look in one game.

The SDK overview has a table of how mods, packs and providers differ.

What a pack answers

entities, transform and camera are the answers built today. A pack answers the ones its game lets it and stays silent on the rest, and silence is not an offer: the host publishes a capability only for an answer the pack has, so a mod that needs one the pack is silent on is refused at load rather than mid-frame.

Answer
Gives a mod
entities
Which entities are alive, as handles. Read once a frame and cached by frame index. A read that fails partway returns nothing, because half a world is worse than a refused one.
transform
Where an entity is. It checks the handle's generation itself, so a slot reused since the mod got the handle is not read.
camera
The view, the projection and the eye. world_to_screen is computed by the host from them, and a point behind the camera is offscreen rather than a pixel that looks real.

pack.toml

A pack is either a pack.toml or code. The two pool shapes Axiom reads need only a pack.toml, and a pack has at most one pool.

Flat, for a native game that keeps a dense array and a live count at fixed symbols:

PACK.TOMLa flat pool
id = "pack.alice.mygame"
game = "alice.mygame"
builds = ">=1.2.0"

[entities]
kind = "flat"
count = "entityCount"       # a symbol, resolved to an address at attach
array = "entityBuffer"
stride = 32
generation = 0
position = 8                # optional: present means transform is answered too

[camera]
kind = "fixed"
view = "cameraView"
projection = "cameraProjection"
position = "cameraEye"

It names symbols, not addresses. A game loads at a different address every run, so the pack names where the pool is and the backend resolves that to an address at attach.

Sparse, for a managed game, which is the shape Cities: Skylines needs:

PACK.TOMLa sparse pool
[entities]
kind = "sparse"
array = "ColossalFramework.Singleton<VehicleManager>.sInstance.m_vehicles.m_buffer"
record = "Vehicle"
live = "m_flags"
mask = 1
position = ["m_frame0.m_position", "m_frame1.m_position", "m_frame2.m_position", "m_frame3.m_position"]
frame = "m_lastFrame"
writes = ["position"]

It names fields, not offsets. The backend resolves each one from the game's own assemblies, for the build that is installed, so a game update that moves a field moves the offset with it, and a field that is gone is a pack that does not build rather than one that reads the wrong bytes. A slot is live when its live field has any bit of mask set. position is one field, or up to four frames with a frame field saying which was written last. writes = ["position"] lets mods move entities.

A game with any other shape, such as a free list or an entity component system, needs a reader of its own written in Axiom, which a pack.toml cannot describe.

How a pack fails

A pack is read and checked on its own first, then built by resolving its names through the backend. Only then is there a pack that can read memory. Every step fails closed:

  • A pack that answers nothing is refused, and a key nothing reads is a fault. Every fault is reported at once, the same as a mod's manifest.
  • A name that does not resolve means no pack. A missing address is never guessed.
  • A resolved offset that would put a field past the end of its record, a record of no bytes or more than 64 KiB, and an array of no slots or more than two million are each refused.

The pack never holds a real pointer. It asks the backend for bytes at an address, and the backend decides whether that is a read it will make. That is also what lets a pack be verified against a buffer laid out like the game, before it ever attaches.

One pack per game

A pack is installed from the registry, signed, with axiom pack install, to packs/<id>/ in Axiom's data directory, and answers only from its signed package. A pack.toml put there by hand never answers. One pack answers for a game at a time. With one installed, it answers. With several, none does until you pick one:

Terminal
$ axiom pack list --game alice.mygame
$ axiom pack switch pack.alice.mygame --game alice.mygame
$ axiom pack status --game alice.mygame

A pick whose pack has been removed, or that is for another game, leaves the game unanswered rather than falling back to another pack, because a pack chosen by directory order is a pack nobody chose. axiom pack verify reads and checks a pack directory without a game.

Cities: Skylines

The first real pack is com.axiommods.packs.citiesskylines, for build 1.21.1-f9. Its world is Mono objects with no native symbols, so it is written as names. It answers vehicles as entities, their positions, and lets mods move them; it is silent on camera, which belongs to the Unity backend. Every name in it was resolved against the installed game with axiom pack verify --managed, and the Unity backend has read the live game through it.

Not built yet

  • A pack written as code, for a shape pack.toml cannot describe.
  • A camera on the Unity backend, and backends that resolve a flat pack's native symbols in a real game.

Writing a pack in the SDK has every key, the checks and the commands.