Phaser AE

Settlement survival

Pro packv3.0.0-32DLogic

Survival rules for a village on a work yard. Villagers eat, keep warm and rest through the seasons, houses fill and draw newcomers, winter closes the fields, and the village wins by lasting the year with enough people.

This is a Pro pack. Upgrade to Phaser Pro to use it in your games.See Phaser Pro →

Released October 14, 2026 · updated October 19, 2026

Settlement survival: a screenshot of its demo
A note about these graphics

Expansion packs don't come with graphics. This screenshot is one way of drawing what the pack does, made for its demo: none of the sprites, tiles or backgrounds in it are in the pack.

That's by design. A pack is a game's logic, mechanics and effects, and it works with whatever art you give it. Some packs draw effects, backdrops or 3D scenes of their own, but none carries a game's sprites.

So the look is yours. Make the art on phaser.io, bring your own, or let your agent draw it in code: the same pack can look like anything.

The pack

settlement

function settlement(): Pack<{ settlement: SettlementApi }>

Village life on a work yard: hunger, cold and rest through the seasons, houses, newcomers and a year's goal.

Helpers

createSettlement

function createSettlement(def: SettlementDef): Settlement

Found a settlement. Throws, with every fault, on one validateSettlement or the yard refuses.

createSteward

function createSteward(town: Settlement, options: { every?: number } = {}): Steward

A steward for a settlement, setting priorities every every seconds (default 1).

defaultSeasons

const defaultSeasons: Season[]

The default year.

planVillage

function planVillage(options: VillageOptions = {}): SettlementDef

Plan a village: its map, stores, jobs, villagers and the rules of its year.

validateSettlement

function validateSettlement(def: SettlementDef): string[]

Check a settlement. Every fault, or empty when it can be run.

villagePresets

const villagePresets: Record<'hearthguard' | 'frostmere' | 'meadowend', VillageOptions>

Three villages: Hearthguard by its river, Frostmere with one bridge and a long hard winter, and Meadowend with no river and a mild year but more mouths to feed.

Types

Season

interface Season

A season.

  • name: string — Season name, shown to the player and carried by the season event.
  • length: number — Seconds.
  • cold: number — How fast, a second, a villager without a warm home grows cold. 0 is a mild season: no fuel is burnt.
  • closed?: string[] — Jobs that cannot be worked this season.

Settlement

interface Settlement

A settlement.

  • readonly def: SettlementDef — The definition the settlement was built from.
  • readonly state: SettlementState — Where the settlement stands now.
  • readonly yard: Yard — The yard its villagers work in. Change roles there; set priorities here.
  • priority(job: string, priority: number): string | null — Ask for a job's priority. A job closed this season stays at 0 until it opens.
  • season(): Season — The season now.
  • left(): number — Seconds left in the year.
  • beds(): number — Beds in standing houses.
  • food(): number — Food in the storehouse, of every kind.
  • step(dt: number): void — Advance by dt seconds of play in fixed yard ticks (at most 0.25 s counts per call); does nothing once the year is won or lost. Throws for a negative or non-numeric dt.
  • drain(): SettlementEvent[] — Settlement events since the last drain (the latest 512). The yard's are yard.drain().
  • snapshot(): SettlementSave — A copy of the whole settlement, yard included, as plain data.
  • restore(save: SettlementSave): void — Restore a snapshot; pending events are discarded.

SettlementApi

interface SettlementApi

What the pack adds to the game as game.settlement.

  • create(def: SettlementDef): Settlement — Found a settlement.
  • validate(def: SettlementDef): string[] — Check a settlement: every fault, or empty.
  • plan(options?: VillageOptions): SettlementDef — Plan a village from options.
  • steward(town: Settlement, options?: { every?: number }): Steward — A steward who runs a settlement through its priorities.
  • presets: typeof villagePresets — Three villages' options.
  • seasons: typeof defaultSeasons — The default year.

SettlementDef

interface SettlementDef

A settlement: its yard and the rules of village life.

  • yard: YardDef — The work yard the villagers work in: its map, stores, jobs and workers (one villager per worker).
  • storehouse: string — The store villagers eat from and houses burn fuel from.
  • food: string[] — What can be eaten, in the order it is eaten.
  • fuel: string — What houses burn.
  • houses: { store: string; beds: number }[] — The houses: a house stands once its store holds built; it sleeps beds.
  • built?: string — The item that marks a house standing. Default 'house'.
  • seasons: Season[] — The year, in order; its length is the sum of the seasons' lengths. At least one.
  • hunger: { rate: number; eat: number; meal: number } — Hunger rises rate a second; at eat a villager eats one food, which takes meal off.
  • warmth: { heal: number; fuel: number; every: number } — Cold falls heal a second in a warm home or a mild season; in a cold season each occupied house burns fuel every every seconds, and is cold until the next burn if there is none.
  • fatigue: { work: number; rest: number; stop: number; resume: number } — Fatigue rises work a second on a task and falls rest a second off one; at stop a villager stops work until it falls to resume.
  • leave: number — Seconds a villager stays at the limit (100) of hunger or cold before leaving.
  • arrivals?: { every: number; spare: number; at: [number, number]; names?: string[]; skills?: Stock; speed?: number; carry?: number } — Newcomers: one after every seconds while a bed is free and the storehouse holds spare food a villager (counting them). They start at at, with these skills, speed and carry, named from names.
  • goal: { population: number; stock?: Stock } — At the end of the last season: at least this many villagers, and this stock in the storehouse.

SettlementEvent

type SettlementEvent = | { kind: 'season'; name: string } | { kind: 'ate'; villager: string; item: string } | { kind: 'hungry'; villager: string } | { kind: 'cold-house'; house: string } | { kind: 'built'; house: string } | { kind: 'tired'; villager: string } | { kind: 'rested'; villager: string } | { kind: 'arrive'; villager: string } | { kind: 'leave'; villager: string; why: 'hunger' | 'cold' } | { kind: 'won' } | { kind: 'lost'; why: string }

Something that happened.

SettlementSave

interface SettlementSave

A settlement saved as plain JSON.

  • state: SettlementState — The settlement state.
  • carry: number — Seconds of play stepped but not yet consumed by a fixed tick.
  • yard: YardSave — The yard's own save.

SettlementState

interface SettlementState

Where the settlement stands. Plain JSON.

  • time: number — Seconds elapsed in the year.
  • season: number — The season, by index.
  • villagers: Villager[] — The villagers now in the settlement.
  • standing: string[] — The houses that stand.
  • warm: Record<string, boolean> — Whether each standing house is warm.
  • heatIn: number — Seconds to the next burn.
  • waited: number — Seconds of free bed and spare food so far, towards the next newcomer.
  • arrived: number — Newcomers who have arrived so far.
  • left: number — Villagers who have left so far.
  • priorities: Record<string, number> — The priority asked for each job (a closed job runs at 0 whatever is asked).
  • phase: 'play' | 'won' | 'lost' — play while the year runs, won or lost once it has ended.
  • message: string — What happened at the end, or ''.

Steward

interface Steward

A steward.

  • act(dt: number): void — Run on by dt seconds; every every seconds the priorities are set again.
  • readonly focus: string — What the steward is seeing to most, in a few words.

VillageOptions

interface VillageOptions

What a village is made of.

  • seed?: number — Seed for the layout and placement; the same seed and options make the same village. Default 1.
  • width?: number — Cells. Default 28 by 16. At least 18 by 12.
  • height?: number — Rows of cells. Default 16. At least 12.
  • villagers?: number — Villagers at the start; the longhouse sleeps them all. Default 5.
  • plots?: number — House plots, 1 to 9. Default 3.
  • beds?: number — Beds a house sleeps. Default 2.
  • river?: boolean — Whether a river divides the village from the woods and quarry. Default true.
  • bridges?: number — Bridges over the river, 1 or more. Default 2.
  • seasons?: Season[] — The year. Default spring, summer and autumn of 60 seconds and a 90-second winter that closes the fields.
  • goal?: number — Villagers needed at the year's end. Default the starting villagers and 4 more.
  • stock?: Record<string, number> — What the storehouse starts with.
  • arrivals?: number — Newcomers every this many seconds while a bed is free and food is spare; 0 for none. Default 25.

Villager

interface Villager

A villager's needs, each from 0 (fine) to 100 (the limit).

  • id: string — Villager id: the id of the yard worker they are.
  • hunger: number — Hunger, 0 (fed) to 100 (the limit); rises with time and falls when they eat.
  • cold: number — Cold, 0 (warm) to 100 (the limit); rises in a cold season without a warm home.
  • fatigue: number — Fatigue, 0 (fresh) to 100; rises while working and falls at rest.
  • tired: boolean — Worn out: not working until rested.
  • suffering: number — Seconds at the limit of hunger or cold.
  • home: string | null — The house store they sleep in, or null.