Deep Field
README.md
The field journal
The notebook the game is played out of. Ruled rag paper, printed plates and binomials, tabs down the outer edge for the four reaches, a hand-lettered depth index in the gutter, and a foot where the identification is committed.
Open it with J. Close it with J or Escape. ←/→ turn to another reach, ↑/↓ move down the plates, Return opens the plate the cursor is on and then records it. Everything is a click as well.
Screen id df-journal (Core.SCREENS.journal), drawn at layer 560 — above
the HUD, below the pause card.
Files
| Path | What it is |
|---|---|
df_boot.module | start() / stop(). The scene entrypoint calls it. |
df_journal.module | The book: state, pages, keyboard, callbacks. |
df_paper.module | The paper, the ink and the three typefaces. |
df_plates.module | The plate vocabulary, and the book's own ink drawings. |
df_roster.module | The printed index of the thirteen. |
DfChancery.font | The hand — a chancery italic for headings and the index. |
Reaching the book from another slice
ui.journal.df_boot exports the whole surface, so a slice that wants to open
the journal, or bind it to its own key, requires the boot module and calls it:
local Journal = require("ui.journal.df_boot")
Journal.open() -- opens at the reach the lamp is hanging in
Journal.close()
Journal.toggle()
Journal.turnTo(3) -- turn to a reach, 1..4
Journal.select("moonjelly")
Journal.commit() -- emits identify:submit for the selected plate
Journal.isOpen() -- boolean
The book emits identify:submit { guessId } and journal:open /
journal:close, and listens for identify:result, sighting:begin,
sighting:end, stratum:unlocked and dive:end. It writes exactly one field
of Core.state: journalOpen.
identify:result is read for correct, actualId, guessId and — when the
rules slice sends one — note, which is written into the foot of the page
verbatim in the naturalist's hand instead of the book's own wording.
The plate vocabulary
A species module's plate(size) returns a widget tree that the journal
draws inside a framed square size pixels across. Every plate passes through
df_plates.normalise before it reaches the page, so a plate can neither break
the layout it sits in nor take the click that selects the specimen.
Draw it as an svg
An svg node is the primitive a plate should be made of. It rasterises at the
element's display resolution, so one drawing serves the 108 px thumbnail on
the index page and the 272 px figure on the specimen page.
function Species.plate(size: number)
return {
type = "svg",
props = {
svg = "<svg viewBox='0 0 200 200'>"
.. "<g fill='none' stroke='currentColor' stroke-width='2.4'>"
.. "<path d='M40 96 C40 52 62 34 100 34 C138 34 160 52 160 96 Z'/>"
.. "</g></svg>",
},
style = { width = size, height = size },
}
end
- Stroke in
currentColor. It resolves to the element's CSScolor, and the page sets that to its own ink, so a plate matches every other plate on the sheet. Name a colour explicitly only for something that is genuinely a different colour — a bioluminescent organ, say. - Draw on a square
viewBox(0 0 200 200is what the book's own plates use) and let the frame letterbox it.fitdefaults to"meet". - Line weights of 1 to 3 on a 200-unit field read as engraving. Fills are for eyes, photophores and small solid organs, not for bodies.
- The supported grammar is the full path grammar (
M/L/H/V/C/S/Q/T/A/Z),rect/circle/ellipse/line/polyline/polygon,<g>with inherited paint and transforms, and gradients byurl(#id).
The node types a plate may use
type | Use |
|---|---|
svg | The drawing. |
label | A hand annotation on the plate — a scale bar caption, an arrow's label. |
image | An imported texture, by asset name. |
vertical / horizontal | Boxes, to compose several of the above. |
spacer | Space. |
container, column, box, row, text and figure are accepted as
spellings of the four box/text types above, so a plate written against the
worked example still draws.
Anything else is dropped from the tree. Depth is capped at 12 and each node keeps at most 96 children.
style and props
style is the ordinary CSS surface — the same vocabulary as any screen. The
root node's width, height, alignItems and justifyContent are filled in
from the frame if the plate does not set them.
props carries the widget's DATA: svg, src, fit, text, wrap. The
book also accepts those written at the top level of the node and lifts
them into props for you, because that is an easy thing to get wrong and a
plate is too much work to lose to it.
onClick, onChange and the other callback keys are stripped. The row the
plate sits in owns the click.
What a plate is drawn on
- Before the animal has been identified, the frame holds a blank field — ruled for a drawing, with the engraver's registration mark in the middle. A species' own plate is never shown before it has been named; that is the game.
- On a correct identification, the plate draws itself on over a second and a half, out of focus and into focus, as though the ink were soaking in.
- A species with no printed plate — the specimen in the trench — sets
unplated = trueon its spec. Its page shows the empty printer's field until it is named, and its ownplate()after.
If a species ships no plate()
The book draws it anyway: df_plates carries an ink figure for each of the
thirteen, keyed on the species id, and a caption for it in df_roster. A
species module that provides its own plate() always wins. The fallback
exists so the book is a complete object, not so a plate can be skipped — a
drawing made by the naturalist who watched the animal will always beat one
made from a name.