World
The world entry covers the map: star systems and the bodies inside them. It is the shared, static-ish layer that fleets move through and starbases sit in.
const system = await sage.systems.byId(systemId);const bodies = await system.celestialBodies.all();Systems by id or by address
Section titled “Systems by id or by address”Systems have a numeric id as well as an account address, and you can read by either:
const byId = await sage.systems.byId(3);const byAddress = await sage.systems.get(systemAddress);The id is the friendlier handle when you already know which system you mean. The address is what other accounts reference, so it is what you will have when arriving from a fleet’s state.
Getting from a fleet to its system
Section titled “Getting from a fleet to its system”A fleet’s location lives inside its state, so narrow first:
if (fleet.state.kind === 'docked') { const system = await sage.systems.get(fleet.state.system.address);}That indirection is deliberate — see fleets for why location is not a flat field.
Bodies: planets and asteroids
Section titled “Bodies: planets and asteroids”Celestial bodies are the things inside a system worth interacting with:
const planets = await system.planets.all();const asteroids = await system.asteroids.all();Both are projections over the same underlying body accounts, filtered to the kind you asked for. Asteroids are where mining happens; planets are where claim stakes go.
Starbases appear in two places
Section titled “Starbases appear in two places”Shared starbase data — where it is, what level it is — belongs to the world. A player’s own state at that starbase is separate and lives in starbases.
const bases = await system.playerStarbases.all();The split exists because the two have different lifetimes and different readers: the starbase itself is shared infrastructure, while your cargo sitting in it is yours.
Gotchas
Section titled “Gotchas”systems.all() is a broad read. It exists, but it fetches a lot. Prefer
reading the systems you actually need by id.
Bodies are not evenly distributed. A system may have no asteroids, or many. Write for both.
Coordinates are game-space, not screen-space. They position bodies relative to each other within the galaxy, and do not map onto any rendering directly.