Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·originates fromworld 0a0b119f-a…

driver

The engine-free half of the host: it runs the game against the thirteen

byzero-proxy @ DESKTOP-DB3UJOJ·posted 11d ago
What it does

driver

The engine-free half of the host: it runs the game against the thirteen

interfaces (metropolisGame.interfaces). A scene supplies one thin adapter per interface and calls
`driver:tick(dt)`; a test supplies metropolisGame.fake.world. Nothing in here touches the engine.

Each tick it: reads each player's body, vehicle, reticle and controls; turns presses into the session's actions
(take a wheel, change arm, shed a jacket); gathers who can watch (fixed eyes, passers-by dealt into informers
and friends by the district's rule, the response units); runs the game; moves every response unit by the
intent the game gave it (people through `actors.move`, cars through `vehicles.drive`); keeps the number of
Wardens in the world at what the heat asks for, bringing them in out of sight; sends witnesses to their call
boxes; hands the frame's paint to `fx`; and turns hub events into gestures, sounds, camera shots, UI calls and
the host verbs of mission stage directions. It autosaves through `save`.

  local Driver = require("metropolisGame.logic.driver")
  local driver = Driver.new(host, { seed = 20261122, autosave = 60 })     -- raises with the missing functions
  driver.game                                   -- logic.game
  driver:addPlayer("p1")                        -- her session, loaded from her store if there is a save
  driver:removePlayer("p1")                     -- saved and dropped
  local views = driver:tick(dt)                 -- { [playerId] = view }
  driver:save()                                 -- write the world and every player now
  What the host tells it (from interactKit, dialogueKit, its own triggers):
  driver:interacted("p1", id)                   -- she used something the driver offered through `interact`
  driver:event("p1", name, payload)             -- something happened that missions listen for (arrived, freight_gone ...)
  driver:choose("p1", option)                   -- she answered the decision a mission or activity is waiting on
  driver:facts("p1")                            -- the facts her missions see now (for a dialogue's conditions)
  driver.units                                  -- [unitId] = { id, kind, player, actor, vehicle, crew = { actorId } }
  driver.staged                                 -- [stageId] = { kind = "actor" | "vehicle", id } things missions put in the world
  Driver.REACTIONS                              -- hub event -> { sound, gesture, shot, note } (data: retune it freely)
  Driver.citizenKind(seed, shares, def, night)  -- what a passer-by is to the game (the host may label its crowd with it)

What it expects of the city for response units: places of kind "post" (content.places) to bring Wardens in
from, and `city.route` for their paths.

The interface is documented in the header of init.luau; this file repeats it for the asset browser.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

metropolisGame.logic.driver — the engine-free half of the host: it runs the game against the thirteen interfaces (metropolisGame.interfaces). A scene supplies one thin adapter per interface and calls `driver:tick(dt)`; a test supplies metropolisGame.fake.world. Nothing in here touches the engine. Each tick it: reads each player's body, vehicle, reticle and controls; turns presses into the session's actions (take a wheel, change arm, shed a jacket); gathers who can watch (fixed eyes, passers-by dealt into informers and friends by the district's rule, the response units); runs the game; moves every response unit by the intent the game gave it (people through `actors.move`, cars through `vehicles.drive`); keeps the number of Wardens in the world at what the heat asks for, bringing them in out of sight; sends witnesses to their call boxes; hands the frame's paint to `fx`; and turns hub events into gestures, sounds, camera shots, UI calls and the host verbs of mission stage directions. It autosaves through `save`. local Driver = require("metropolisGame.logic.driver") local driver = Driver.new(host, { seed = 20261122, autosave = 60 }) -- raises with the missing functions driver.game -- logic.game driver:addPlayer("p1") -- her session, loaded from her store if there is a save driver:removePlayer("p1") -- saved and dropped local views = driver:tick(dt) -- { [playerId] = view } driver:save() -- write the world and every player now What the host tells it (from interactKit, dialogueKit, its own triggers): driver:interacted("p1", id) -- she used something the driver offered through `interact` driver:event("p1", name, payload) -- something happened that missions listen for (arrived, freight_gone ...) driver:choose("p1", option) -- she answered the decision a mission or activity is waiting on driver:facts("p1") -- the facts her missions see now (for a dialogue's conditions) driver.units -- [unitId] = { id, kind, player, actor, vehicle, crew = { actorId } } driver.staged -- [stageId] = { kind = "actor" | "vehicle", id } things missions put in the world Driver.REACTIONS -- hub event -> { sound, gesture, shot, note } (data: retune it freely) Driver.citizenKind(seed, shares, def, night) -- what a passer-by is to the game (the host may label its crowd with it) What it expects of the city for response units: places of kind "post" (content.places) to bring Wardens in from, and `city.route` for their paths.

new(host: any, opts: any?) → any

A driver over a host. opts = { seed, autosave = seconds (0: never), ambientRadius = 45, fixtureRadius = 60, residents = true (keep each district's own patrols in the world while a player is in it) }.

argtypedescription
hostany
optsany?

hasLine(observer: any, suspect: any) → void

argtypedescription
observerany
suspectany

addPlayer(id: string) → any

A player joins: her session is made, and loaded from her store when it holds a save.

argtypedescription
idstring

removePlayer(id: string) → void

argtypedescription
idstring

savePlayer(id: string) → void

argtypedescription
idstring

save( ) → void

Write the world and every player now.

variant(self: any, line: string, n: number) → number

One written variant of a line, never the same one twice running for the same line.

argtypedescription
selfany
linestring
nnumber

bark(actorId: string, kind: string, situation: string) → void

An actor says one of the lines written for a situation (the kind of actor decides whose lines).

argtypedescription
actorIdstring
kindstring
situationstring

radio(event: string) → void

The Wardens' radio says one of the lines written for an event.

argtypedescription
eventstring

_unitBark(id: string?, situation: string) → void

a response unit's (or any actor's) bark, by unit id or actor id

argtypedescription
idstring?
situationstring

_listen( ) → void

verdict(name: string, how: string, giverOf: (string) → void

how a job went is the first thing its giver says next time

argtypedescription
namestring
howstring
giverOf(string

missionGiver(id: string) → string

argtypedescription
idstring

activityGiver(id: string) → string

argtypedescription
idstring

_post(district: string?) → any

the Wardens' post of a district (a place of kind "post"), or, where it has none, the first post there is

argtypedescription
districtstring?

_stage(player: string, list: { any }?) → void

The host verbs of a step's or twist's stage directions (the game's own verbs are logic.session's).

argtypedescription
playerstring
list{ any }?

_dropUnit(id: string) → void

argtypedescription
idstring

countUnits(self: any, player: string) → any

argtypedescription
selfany
playerstring

_spawnUnit(player: string, kind: string, pose: any, origin: any?) → string

bring one unit in for a player: at a post far enough away and out of her sight

argtypedescription
playerstring
kindstring
poseany
originany?

_manageUnits(player: string, pose: any, view: any) → void

argtypedescription
playerstring
poseany
viewany

_residents(player: string, district: string?) → void

The district's own police (content.districts[..].police): present while a player is in the district, each at a beat (a place of kind "beat", else a post) it walks back to when it has no order. Security keeps to its leash.

argtypedescription
playerstring
districtstring?

_moveUnits(player: string, view: any) → void

argtypedescription
playerstring
viewany

citizenKind(seed: number, shares: any, def: any, night: boolean) → string

What a passer-by is to the game: an observer kind (the district's reporting kind, or "friend") or nil for someone who looks away. A stable roll per passer-by (`seed`): the first share reports, the next cheers. `shares` = districtState:citizens(district); `def` = the district's content entry.

argtypedescription
seednumber
sharesany
defany
nightboolean

_frame(id: string, dt: number) → any

argtypedescription
idstring
dtnumber

route(unit: any, x: number, z: number) → void

argtypedescription
unitany
xnumber
znumber

_offers(player: string) → void

the things every player can use: the people she has met (and anyone with work for her), where they are found

argtypedescription
playerstring

interacted(player: string, id: string) → boolean

A player used something the driver offered through `interact`. Returns false for an id it does not know.

argtypedescription
playerstring
idstring

_work(player: string, contact: string) → void

the missions a contact can give her now

argtypedescription
playerstring
contactstring

event(player: string, name: string, payload: any?) → void

Something happened that missions and activities listen for (the host saw it: arrived, freight_gone, rammed ...).

argtypedescription
playerstring
namestring
payloadany?

choose(player: string, option: string) → boolean

She answered the decision the running mission or activity is waiting on.

argtypedescription
playerstring
optionstring

facts(player: string) → any

The facts her missions see now (for a dialogue's conditions, a debug overlay).

argtypedescription
playerstring

tick(dt: number) → any

One tick of everything. Returns { [playerId] = view }.

argtypedescription
dtnumber

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.