Skip to main content

Traps in the game's code

Things in Alta's code that look like they work one way and don't, found while writing the type pages. Each was read from the decompiled server build, not tested in the game, so check the code before you rely on one. The type pages say more about each.

The server trusts the client​

Limits that break quietly​

  • Stat values are packed into fixed ranges when they're sent to players: base, minimum and maximum 0 to 127, extras and multipliers -63 to 64, in steps of 0.01. A value outside those reaches players wrong.
  • LocationChunk clamps positions to the chunk's box plus 10 units.
  • PlayerUnlockManager sends orb indexes in 4 bits, so only 0 to 15 reach players correctly.
  • EntityManager has 100,000 entity ids, and ids 0 and 1 of every block of 50 are markers, so about 96,000 are usable. A broken free list quits the server ("Corrupt entity list").
  • OutgoingPacketManager disconnects a player once 64 reliable packets back up for them ("Reliable overflow").
  • ChunkEntityManager.CompareFeet measures distance as x*x + z + z, so sending the nearest entities first (for Quest players) is out of order.

Names that mislead​

Things that run once, or never again​

Saved but not loaded, declared but never used​

Items and the world​

  • Taking an item out of a PickupDock stack spawns a new copy, so a reference to the docked one goes stale.
  • BuildupPickup fills every child slot on spawn, whatever its minimum and maximum say; the random count only picks the starting slot.
  • PositionRestrictor snaps loose items outside its radius back, and yanks held ones back after heldLimit seconds. Items that "teleport" in the tutorial or mould areas are usually this.
  • A container only pours into containers with a lower ContainerPriority.
  • DecraftingComponent only knocks off outer parts (nothing attached to them), and needs a hit of at least 0.2.
  • ChiselDefinition.GetBest picks an exact match if there is one; otherwise it picks at random, weighted by the squared error, so worse matches are more likely.
  • StewRecipe.PrefabQuantities only counts prefabs with "Ripe" in their name.
  • VelocityPickupSettings grip strengths only apply on clients; the server always uses 9 and 75.
  • ForestGenerator.Wipe ignores the seed you pass. See Resetting the forest.

Console commands​

  • Command methods must be static: Command.Invoke calls them with no instance.
  • The settings command ignores the JsonMin, JsonMax and JsonRange limits when it sets a whole number.

See also​