Skip to content

jengine-glass

A light puzzle scored by the renderer’s own light, and Vesper Glass.

KindProject package: linked into the builds of the projects that list it
Sourcepackages/jengine-glass
Version0.1.0
Entry pointjengine_glass::GlassPackage
Script namespaceGlass
Listed byprojects/arcade-classics

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

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

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 Glass == nil then return end.

Scene keyRust type
vg_chapelChapelpackage 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
Glass.start(e, level)vg_start
Glass.stop(e)vg_stop
Glass.reset(e)vg_reset
Glass.press(e, x, y)vg_press
Glass.drag(e, x, y)vg_drag
Glass.release(e)vg_release
Glass.cancel(e)vg_cancel
  • projects/arcade-classics/assets/scenes/vesper.scene

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

A light puzzle scored by the renderer’s own light - and Vesper Glass, the arcade’s chapel of lamps and stained glass.

chapel is the puzzle: rooms on a grid, lamps that add, panes that keep one colour, stone that keeps none, a window whose light is baked, and sensors that each want one colour. It is pure and proved - every shipped room is solved by exhaustive search in a test.

This module puts a room in the world and lets a player move its pieces. Every piece is an ordinary entity with the engine’s own lighting components - a lamp carries a point_light, a pane or a stone a light_occluder (a pane’s shadow_tint is its colour), a window a lightmap - and the sensors are read each frame from renderer::lighting::gather_lights(world) and light_at_textured, with the frame’s AssetManager for the window’s pixels. So the rules read the light the renderer draws, from the same entities, in the same frame.

One vg_chapel on a manager entity: levels (see chapel::Level), optics (see chapel::Optics), the board’s centre, and the art - atlas and the region names in art.

CallDoes
Glass.start(e, level)lay out a room (0-based)
Glass.stop(e)clear it
Glass.reset(e)put every piece back where the room started it
Glass.press(e, x, y)pick up the movable piece at a world point
Glass.drag(e, x, y)move it - it follows the pointer from open cell to open cell
Glass.release(e)put it down where it is
Glass.cancel(e)put it back where it was picked up

The vg_chapel bag: level, levels, name, hint, moves, par, the board’s geometry (ox, oy - its top-left corner - and cell), solved, holding, sensors ({ x, y, want, got, ok, r, g, b }), pieces ({ x, y, kind, hue, fixed, held }), boxes (occluder boxes the room authors), edges and budget (what they cost the renderer’s occluder pool, and its size) and events (picked, placed, returned, lit - a sensor newly satisfied - solved, and fixed with what (lamp, glass, stone) when a press lands on a piece that is bolted down).