luvcraft/play.lisp
Return the pathname of the ordinary persistent luvcraft world.
Read the persistent world at pathname, or make a new little world.
A video file to play on a screen hanging in front of the player, or NIL.
play reads this so a live image can hang a film in the world without changing
any call site: set it, stop-playing, and play again.
Open the ordinary persistent game in this Lisp and return the session.
Load or create world-pathname, restore its saved camera and player, start
checkpointing, and open the visible game window, on the whole display when
fullscreen-p. *SESSION* names the live
game for later SLY evaluations. stop-playing checkpoints and closes it.
The films the player was carrying come back into the bag, and the ones standing beside walls light them again.
Checkpoint and close the game play opened, releasing its resources.
*SESSION* is cleared whether or not the release succeeds, so a failed teardown
cannot leave the image believing a game is still playing. The failure itself
is not swallowed: stop-luvcraft closes the window first and then signals what
went wrong, and that condition comes out of here.
Whether knob has been folded into a live pipeline's source, so that
turning it rebuilds one. Answered for the live session.
--------------------------------------------------------------------- The verbs the metabar offers.
Whatever gadget offered this button is itself the focus at the moment it is pressed; it must stand down before the world can be looked at.
The live game session in this Lisp, or NIL.
The checkpoint writer for the world PLAY opened, or NIL.
(pathname)(pathname)Read and validate one luvcraft save from PATHNAME. Return the restored world and its still-portable resume description.
(&key (chunk-width 16)
(chunk-height 16)
(chunk-depth 16)
(seed 121))A video file to play on a screen hanging in front of the player, or NIL. PLAY reads this so a live image can hang a film in the world without changing any call site: set it, STOP-PLAYING, and PLAY again.
(&key (provider luv:*gpu-provider*) tracy-p fullscreen-p
(video-pathname *video-pathname*)
(world-pathname (default-luvcraft-world-pathname)))Open the ordinary persistent game in this Lisp and return the session. Load or create WORLD-PATHNAME, restore its saved camera and player, start checkpointing, and open the visible game window, on the whole display when FULLSCREEN-P. *SESSION* names the live game for later SLY evaluations. STOP-PLAYING checkpoints…
()Checkpoint and close the game PLAY opened, releasing its resources. *SESSION* is cleared whether or not the release succeeds, so a failed teardown cannot leave the image believing a game is still playing. The failure itself is not swallowed: STOP-LUVCRAFT closes the window first and then signals what went wrong, and…
If you're lucky, someone has bound this to a working GPU-PROVIDER.
()Start Tracy for luvcraft and answer whether the profiler is running. Nothing is recorded until a viewer connects, so this is safe to leave on. Call it before starting a session if you want the production workers to appear under their own names: a thread can only introduce itself to a profiler that is already running,…
(description)Return CAMERA, PLAYER, selected block, and carried blocks restored from DESCRIPTION.
(pathname)(&key
(title "luv little block world — click, look, walk")
;; NIL means "as much of this display as
;; comfortably fits"; a capture asks for the
;; exact frame it intends to write out. A
;; KMSDRM console can only present at a real
;; display mode, so the environment may pin
;; the canvas to the panel's native size.
(width (let ((value (uiop:getenv "LUVCRAFT_WIDTH")))
(and value (parse-integer value))))
(height (let ((value (uiop:getenv "LUVCRAFT_HEIGHT")))
(and value (parse-integer value))))
(frames-per-second 60)
(visible-p t)
(fullscreen-p nil)
(high-pixel-density-p t)
(world (make-empty-little-block-world))
(mesher (make-instance
'exposed-face-mesher))
(camera (make-instance 'fly-camera))
player
(selected-block *stone-block*)
(inventory (make-block-inventory))
quit-function
;; A hidden capture wanting animals in frame
;; hands in a population it has already
;; placed; the ordinary game grows its own
;; around the player as it plays.
(critters
(make-instance 'critter-population))
checkpoint-writer
(provider *gpu-provider*)
(sky-clock (make-instance 'sky-clock))
(sky-profile (make-default-sky-profile))
(shadow-diagnostic-p nil)
;; The world-text banner is a proof of the
;; Slug path, not scenery: a caller that
;; wants one asks for it, and the ordinary
;; game sky stays empty.
(world-text-string nil)
(world-text-font-pathname
(cl-dejavu:font-pathname "DejaVuSans.ttf"))
(world-text-distance 8.0)
(world-text-lift 3.0)
(world-text-units-per-em 0.55)
(video-pathname nil)
(video-distance 13.0)
(video-lift 4.5)
(video-height 5.0)
(residency-radius 6)
(publication-limit 2)
(load-schedule-limit 4)
(mesh-capture-limit 1))Open a little CPU-meshed block world. Click to capture the pointer, look with the mouse, walk with WASD, and jump with Space. Once captured, left click removes the block at the centre of view and right click places the selected block. Number keys select materials, middle click picks the targeted material, Shift…
(session)Request SESSION's one orderly teardown beside its native canvas thread. Native close and commands may call this without waiting. Exactly one worker runs the PLAY-level quit callback when present, or the session teardown itself otherwise; repeated requests still defer native close to that same owner.
(session)Stop SESSION exactly once and publish its result to every caller. The sole owner attempts every named release step and closes the canvas and device last. Concurrent and later callers observe the same values or RELEASE-ERROR without releasing a native handle twice.
(protected-form &body cleanup-forms)(&body body)(name &body body)(session)Release SESSION after its stop controller has granted sole ownership.
(writer &key (timeout 10.0))(inventory block &optional (quantity 1))Add QUANTITY of BLOCK to finite INVENTORY storage and return its entry. Adding to an unlimited entry leaves it unlimited. A previously unavailable block is appended, preserving the stable order of existing number keys.
(session)(knob)Whether KNOB has been folded into a live pipeline's source, so that turning it rebuilds one. Answered for the live session.
One live value: where it lives, what it measures, and -- by its class -- what SESSION must do after a change for the change to show.
Logical conjunction of tests and raw truth values.
(name (&key label) &body body)(session)(session)
request-luvcraft-quitalready granted this worker sole ownership; do not recursively enterstop-luvcraft.