SOVEREIGNREALMSAlpha

Catch-up Simulation

Discuss

From the Sovereign Realms Encyclopedia

Catch-up simulation is how Sovereign Realms keeps tens of thousands of people going without simulating all of them at once. A town that no player is near is not played tick by tick. Instead, time that passes unseen is lived afterwards, a day at a time, against the town's real stores and fields. When you come back you are told what happened, and what now waits on you.

Nothing is conjured. Every loaf eaten is a loaf gone from a chest, every crop harvested was a crop that grew in a field, and a town left without food goes hungry and its people may starve.

Near and far

A town is simulated while a player is within its reach: 160 blocks of its Town Heart (the server's activationRange setting), or as far as its buildings spread if that is further. Its people are given bodies, walk about and are watched by the usual rules when a player is within 112 blocks of them (embodyRange), up to 80 bodies for any one town. Beyond that range a town is bodiless: its people are records and not figures, and the town is not run tick by tick.

Once a town is simulated it stays so while a player is within its reach and 48 blocks more, and for a minute after a player who was about it leaves, as long as they stay in its world within 512 blocks of its reach. Riding along its edge or stepping out to the fields and back therefore does not send its people away and bring them back. Taking a coach, being carried far off by an old stone or waygate, or leaving the game ends it at once.

Time still passes there. The game handles it in two ways.

Far towns live on

By default (distantLife), towns that no one is near go on living in the background, one town at a time, spending only a few milliseconds of each server tick. The towns of the world therefore grow, trade, starve and fail whether or not anyone goes. If this setting is off, far towns stand still until someone comes.

The towns about the players come first, and before them a town a traveller is bound for (the town a coach is carrying someone to, or a newcomer's first home) once it owes a minute. A far town within 2,048 blocks of a player (measured to the edge of its reach, and a town ahead of a player on their way counting as half as far) is lived up to the moment once it owes a quarter of a day, the nearest first. A town you ride or walk to has therefore usually been lived up to date, or nearly, by the time you reach it. A third of the time is kept for the town owed longest anywhere in the world, lived a day at a time while players are on (on a server left running with no one on, all it owes at once), so no town is left behind while the players stay in one country.

The server spends more time on this when its ticks are quick, and less when it is busy. A step that runs past its time is paid back from the next ticks.

Coming back

When you come near a town that is owed time, its missed days are lived in bounded slices, begun ahead of you where they can be. A town begins to catch up when you come within 160 blocks of its reach (the activation range about its heart, or as far as its buildings spread if that is further), or from up to 480 blocks further out than that when you are heading for it: moving at 1.5 blocks a second or more, nearly straight toward it. So far out, someone working in the country about a town, or passing it by, does not set it going. A town a traveller is bound for catches up ahead of them too: a newcomer's first home from the moment they join, and the town a coach is carrying you to. A far town that is being lived in the background (above) is given more of each tick when a player heads for it. On a road a town is therefore often lived up to the moment by the time you reach it. Up to ten missed days of one town are lived in one server tick (the catchUpDays setting limits each tick's work, not the total: every elapsed day is eventually lived). A catch-up takes its whole share of a tick while the server's ticks are quick, falling to a third of it once they average 25 milliseconds and less again as the server nears its limit; what a step takes past that is paid back from the next ticks, so a town catching up does not hold a busy server back.

Towns are caught up in the order they are wanted: first a town a traveller is bound for, then one a player stands in, then one a player is coming toward, and last one begun ahead of a player who went elsewhere. A town wanted later waits its turn, with the days it has lived so far kept. A catch-up interrupted by a restart picks up where it left off.

An absence shorter than a minute is not worth catching up.

The heaviest work of a day is also done in small steps across ticks, with the same result as at one go: a great town's morning (those who leave it in a famine, a fever's toll), far towns' planning, trades and market, and the records an autosave writes. A restart in the middle neither repeats nor skips any of it. A realm of the world's daily business that pays from or into a far town's treasury waits until that land has been loaded in the background, rather than stopping the server to load it.

Arriving before it is done

You never wait on a town. If you come into a town that is still living its unwatched days, what it owes stops at that moment and its people take bodies at once: where you are looking they come round a corner or out of a door, and you meet them as on any other day. The days the town still owed up to the moment they came out are lived on behind them in the background, a few milliseconds of each tick, and those already about are lived in those days with the rest. People, coin and goods still go through the town's real stores, and none of the time it went unwatched is forgiven. If you leave before those days are done and come back later, the time it went unwatched in between is lived as well.

What is lived

Each missed day is a day of the town's ordinary life, in order:

  • Morning: wages and dues are paid, weddings and departures happen.
  • Work: fields grow and are harvested and sown again; herders gather and slaughter; fishers and foresters bring in their catch; miners cut stone; salt is raked and gold is panned; prospectors test ground; bakers bake; the workshops make things; ovens smelt and smoke.
  • Building: building sites advance, and a finished site is recognised as a building.
  • Markets: market stalls are stocked and the market's takings banked.
  • Meals: every household eats, item by item, from its home, the granary or the market. Those with nothing to eat go hungry and may starve.

See Work and Professions, Food, Granaries and Hunger, Construction and Markets and Trade.

Stores whose land is out

A town's unwatched day does not bring in the land its houses and stores stand on. The world keeps a ledger of the towns' chests and barrels, what each held when its land was last saved or let go, and the day takes from and puts into the ledger's copy of a store whose land is out, as it would the chest. When that land next loads, the change is made in the chest itself: what the day put in is added and what it took is taken out, whatever else the chest has come to hold since, once and never twice, a restart between or not. What the chest has no room for is set down beside it in a crate. Only the land the town's work is read from comes in for its day: its heart; its fields, woods, pastures and pits; its furnaces, ovens, hives and salt pans; its building sites; ground it has asked to have looked over for its growth; and, on a morning it lays out a building among its streets, the ground about its heart. A town with a store the ledger has never tallied lives its day with its land brought in.

The ledger serves the far town's dealings with other towns too. A train of relief its realm sends from its stores to another town or a refugee camp (food, coin, timber or stone), a merchant setting out from it, and food it buys abroad go at once, its stores and treasury reached by the ledger, without waiting for its land (food its crown buys of the far ships is decided by the ledgers too, but paid once the paying treasury's land is in, and landed once the harbour's stores are); and a caravan, supply train or carter coming to a town in famine, or home to one, puts its load into the town's stores the same way. What the Command Table reads of a far town's stores is the ledger too, with the changes its days have made.

What you are told

When the missed time was at least a few hours or anything notable happened, the realm is told what happened while no one watched the town:

The report can name harvests, rows sown, loaves baked, logs felled, blocks cut in the mines, salt raked, ground prospected, gold washed from the river, fish landed, what the pastures and hives brought in, things made and smelted, blocks laid (and buildings finished), meals eaten (and how many were bought at market), people who went hungry or starved, and changes in the town's people and treasury. If nothing changed it says "little changed." A long absence (a day or more) is also written into the realm's chronicle.

The briefing

When you log in after a real absence, if something notable happened or something needs you, the game opens While you were away for you a few seconds after you come in, with one line in chat that offers it again, such as "Away 2 days: 3 things happened, 1 need you. [Your briefing]". After a quiet absence it only says so in a line of chat and leaves the sheet shut. You can open it at any time with /briefing (see Commands).

An absence is worth a briefing if it was at least half a day of the world's time, or half an hour by the clock (for example a world that paused while the server was empty or down). A quick reconnect is neither.

The sheet has two tabs, Briefing and Everything. Needs you now comes first: matters waiting on you. Below it, news is grouped as You and yours, Your realm, Done in your name (what your steward and others did) and Word from afar, with what matters most first. Items you have already been shown go under Seen before. Its header says how much of the absence the world actually lived: "The world lived all of it", or part, if the server was down or paused for the rest. See Sheets and Your Steward.

The world while you are gone

  • On a server with players, the world runs while anyone is on.
  • On a server with nobody on, the world pauses a minute after the last player leaves and goes on where it stood when someone comes back. A server's owner may set simulateWhenEmpty so that it never pauses and realms live on unwatched. Hosted servers sleep when empty; see Hosted Servers.

A day of world time is twenty minutes of play, and passes only while the server runs.

Other rules cover people who are away:

  • The world's own realms do not march on a realm none of whose players is on.
  • An envoy waits for someone of yours to be there to answer.
  • Outlaws never raid a homestead while its owner and household are all off the server, and thieves never burgle a player's house or shop in a town while its owner is off. A band waiting on a homestead whose people log off gives it up for the night. See Outlaws and Raiders.
  • A homestead keeps on without you: its hearth tax or tithe, and a watchman's wage, are taken from the coin in its stores when you are not about, its land brought in to settle them even when no one is near it, so being away runs up no arrears while there is coin there. Only what the stores cannot pay is owed, and a watchman left unpaid gives it up; one paid keeps to the order you last gave him. The pedlar's cart still calls if someone of it was there in the past week, whether or not the server lets outlaws raid. What happened (the pedlar's trade, a raid, a tax paid short) waits in your briefing under You and yours. Settlers ask to come only while you are on. See Homesteads.
  • A sovereign who is away is dealt with by the realm's own laws: a regent after three days, and after the number of days the law sets the sovereign is presumed dead and the crown passes, to be given back or not when they return. See Government and Law-making and Dynasties and Succession.

See also

Getting Started, Towns, Townspeople, Installing Sovereign Realms.