Skip to content

jengine-stand

A lemonade stand’s economy, simulated a day at a time, and Lemon Row (a management sim played entirely in entity UI).

KindProject package: linked into the builds of the projects that list it
Sourcepackages/jengine-stand
Version0.1.0
Entry pointjengine_stand::StandPackage
Script namespaceStand
Listed byprojects/arcade-classics

List it in the top-level "packages" array of project.jengine:

{
"packages": [
{ "name": "jengine-stand", "source": { "type": "path", "path": "../../packages/jengine-stand" } }
]
}

Then rebuild the editor viewport for the project (jengine viewport-build projects/<name>, or the editor’s Rebuild viewport banner). Native and web builds link it on their own.

A scene that uses its components must be a v2 scene ("version": 2): a v1 scene has no field for a package component and keeps it as inert custom data.

A script can check that the package is linked with if Stand == nil then return end.

Scene keyRust type
lr_standStandpackage only: needs a v2 scene

Commands run in every runtime and return nothing; a package publishes what scripts read onto components (see the notes below). The flat name also works.

CallFlat name
Stand.new(e)lr_new
Stand.quit(e)lr_quit
Stand.buy(e, item, packs)lr_buy
Stand.plan(e, lemons, sugar, ice, price, sign)lr_plan
Stand.open(e)lr_open
Stand.next(e)lr_next
  • projects/arcade-classics/assets/scenes/lemonrow.scene

From packages/jengine-stand/src/lib.rs.

A lemonade stand’s economy - and Lemon Row, the management game played on it entirely in entity UI.

market is the reusable part and the part that is proved: the weather, who walks past, who buys, what a cup is worth to them, and the unit tests that say the sliders are real decisions. This module runs a season on it - mornings to plan, a day that plays back on the street, evenings to read the ledger - and walks the day’s customers past the stand as sprites.

The interface is the game’s, not this package’s: every widget is an entity-UI widget the script reads with get_ui_prop and sends here as a plan. That split is on purpose. Lemon Row exists to find out whether entity UI - the engine’s second UI system, which until it had only ever carried a Test Lab scene - can carry a whole game, and a package drawing its own widgets would have answered a different question.

One lr_stand on a manager entity: the tuning (see market::Tuning), the season’s length and seed, the street (stand_x, street_y, street_half, walk_speed), and the art - atlas, looks (two frames per look) and emotes (delighted, fine, sour, too pricey, sold out).

CallDoes
Stand.new(e)begin a season: first morning, starting money, empty shelves
Stand.quit(e)end it and clear the street
Stand.buy(e, item, packs)buy packs of a supply (0 lemons, 1 sugar, 2 ice, 3 cups), mornings only
Stand.plan(e, lemons, sugar, ice, price, sign)today’s recipe, price in cents, and whether to pay for the sign
Stand.open(e)open for the day: the day is simulated and starts playing on the street
Stand.next(e)from the evening, on to the next morning - or the end of the season

The lr_stand bag: phase (idle / morning / day / evening / over), day, days, money (cents), stock, reputation, forecast and weather ({ sky, temp }), plan, cup_cost, packs, clock (0..1 through the day), sold and revenue so far, pitcher (0..1 of the current pitcher left), report (the evening’s ledger), season (the money at each evening), and events.