Skip to main content

Game systems

These pages cover the systems a player interacts with: stats and hunger, eating and drinking, crafting, heat, smelting and forging, cooking, XP and skills, farming, trading and a few smaller ones. Everything here is in Root.Township (build main-1.7.2.1.42203).

Pages​

PageWhat it covers
StatsStatManager, Stat, StatDefinition, modifiers. Health, hunger and every other number on a body.
Hunger, eating and drinkingHungerStat, FullnessStat, ConsumptionManager, EdibleObject, PlayerDrinkingMouth.
EffectsAlta.Alchemy: what food, drinks and potions do to the body.
ProgressionPlayerProgressionManager, PathExperience, ProgressionSettings. Where XP comes from.
Skills and unlocksSkill trees, shrines and orbs, and the climbing tower's stations (PlayerUnlockStation).
CraftingJoining parts, generic crafting stations (recipe page and nails), RaycastCrafter.
HeatHeatPoint, heat sources, fires and fuel.
Smelting and forgingSmelter, smelting recipes, moulds, bellows, ForgedModel, the recycler.
CookingRoasting (Cookable) and stews (CookingPot, StewManager, StewRecipe).
LiquidsLiquid containers, liquid data and how liquid moves.
Farming, woodcutting and carpentryGrowing plants, trees, chiselling.
TradingTrade vendors, tax, the ATM bank, postboxes.
CustomizationCosmetics, outfits and armour visuals.
Other systemsEnchantments, mechanisms, logic circuits, fuses, GameTaskManager.

Who runs what​

Almost all game rules run on the server. The pattern is the same everywhere:

  • A component subscribes to its events in InitializeAsServer, or checks NetworkSceneManager.IsServer before it acts. Docking an ore in a smelter, a pot reaching temperature, food finishing a bite: the client sees the same events, but only the server's copy does anything.
  • The server sends results to clients with the entity's MethodSync messages (stat syncs, smelter icons, stew changes). A client never decides an outcome. Changing a value on a client changes only what that player sees until the next sync overwrites it.
  • Clients run visuals: particles, sounds, the stat bar, the bellows' light. Most visual code is skipped when ApplicationManager.IsHeadless is true, which it is on a dedicated server.

So a mod that changes rules (recipe results, XP, hunger, fuel) only needs to be on the server. A mod that adds something players must see in a new way (a new stat bar, a new liquid colour no client knows) needs a client part too, and the client half has to handle a server without it. See Networking for how messages work, and Entity sync for MethodSync.

Shared building blocks​

You meet these in every system:

  • Assets with hashes. Recipes, stat definitions, effects, liquids, moulds and smelter upgrades are ScriptableObjects that derive from HashedGeneralValue<T> (in Alta.Values). T.All lists every loaded one, T.Get(uint hash) finds one by hash, and T.Get(string name) finds one by asset name. The name lookup strips spaces from what you pass but doesn't lower-case it, while the table is lower-cased, so pass lower case with no spaces ("hungerstat", not "Hunger Stat"). The network sends these by hash, so a client can only understand assets it has too.
  • Global settings. Tuning lives in GlobalSettings<T>.Instance (Alta.Global): ProgressionSettings, CookingSettings, GenericCraftingSettings, LiquidSettings. They're shared assets, so changing a field changes it for the whole process.
  • Server settings. The host's ServerSettings (ServerHandler.Current.ServerConfig.Settings) holds knobs these systems read every time they run. Prefer these over a patch when they do what you need:
SettingDefaultRead by
HungerTick0.0005HungerStat, every stat tick
HealthRegenMultiplier1HungerStat regeneration
HungerDealsDamagetrueHungerStat starvation
IsResetingHungerOnDeathfalseStatManager.DeathReset
XPX and ForgingXPX, WoodcuttingXPX, MiningXPX, ChiselingXPX, CookingXPX, MeleeXPX, RangedXPX1PathExperience.GainExperience
UnspentExperienceLostOnDeath0PlayerProgressionManager on death
DecayMultiplier, SpawningRateMultiplier1decay and spawning, through NetworkScene
TimeSpeedMultiplier1Timeline.Instance.TimeSpeed (set by TimeManager). Everything scheduled on the Timeline speeds up with it: stat ticks (so hunger and regeneration), timed modifiers, growth stages, vendor tax and tree respawns.

Real values​

Pages in this area quote values from the game's assets (build main-1.7.2.1.42203) where they matter, marked as asset values: player stats, hunger levels, cooking temperatures, stew and smelting recipes, fuel, the XP curve, skill trees and trading costs. The full generated lists of items, recipes and stats are in the reference tables: Items and materials, Recipes and Stats.

Hooks that cover a lot​

A few methods sit where many systems meet:

What existing mods hook​

Real mods are a good map of what works. From their source:

All of these have to work against the vanilla client, which is why most of them change server-side rules and leave the visuals alone.