FERRETGame engine over Babylon.js
Ferret

The scene runner

One tool, in a checkout of the engine, for looking at a built scene and checking it: no script of your own for shots, walks, films or ending browsers.

One run: ferret scene#

node tools/ferret/cli.mjs scene <target> [--test f.ferretic]... [--command "name {json}"]... [--eval js]...
     [--frame f.png] [--video f.mp4 --seconds N] [--query q] [--wait ms] [--size WxH] [--timeout s] [--json]
  • The target is a built example (conics: the page in dist/web/conics; the runner never builds), an http(s) URL, or a level folder, a package or a glTF (opened in the model viewer).
  • It opens the scene headless, checks that the renderer is the NVIDIA card, runs the commands and evals in the order given, then the tests, then takes the frame and the video, and closes the browser and the server. The exit code is 1 when a test did not pass or a step failed.
  • A page that does not carry Ferretic or the game language gets them from the runner when a step needs them (test.*, probe.*, game.*); the page is not rebuilt.
  • There is no time limit unless --timeout is given.

Kept open: ferret dev#

node tools/ferret/cli.mjs dev <example> [--game f.fgl|folder]... [--port N] [--query q] [--size WxH] [--no-watch]
node tools/ferret/cli.mjs scene dev:<port> [the same steps] [--reload] [--stop]
  • The example must have been built once. While the session runs, only the example's own code is built (into the temp folder, dist is not touched).
  • A changed .fgl file goes into the running game (edit.game.set: no build, no reload, the state kept; a file with an error is refused and the old game goes on). A changed .motion file goes by edit.motion.set, in a scene that has the motion capability. A changed TypeScript source or page template rebuilds the changed code and reloads the page.
  • The second command runs steps in the open scene: no browser start, no page load. --stop ends the session; run it when the work is done.
  • Run ferret dev in the background and wait for its line that starts with ready:.

Questions answered in text: probes#

Commands, and functions of Ferretic with the same meaning:

CommandFerreticAnswers
probe.view {name}INVIEW, VIEWSHARE, VISIBLE, OCCLUDERis it in view, how much of the frame, how much of it is seen, what hides it
probe.count {what}COUNThow many with a tag, a name prefix or a component
probe.ground {name, tolerance}ONGROUND, HEIGHTdoes it stand on what is under it, and how high over it (negative: sunk)
probe.errorsERRORSerrors of the page and the game so far
probe.color {reference}COMMAND "probe.color"the frame's mean colour, contrast and difference from a reference picture

A question of fact (is the ship in view, did the shot reach the fort, does anyone stand in the air) is a probe or a test, which answers in a line. A picture is for how things look.

Finding what is written already#

docs/mechanics.md lists every source file of every example with what it is, what it exports and which files several examples hold as copies. It is made by node tools/docs/mechanics.mjs (--check fails when it is out of date).