FERRETGame engine over Babylon.js
Ferret

Building a Ferret game for Unreal Engine

Skill ferret-unreal-build · download all skills · SKILL.md

When to use#

A Ferret game should become a UE project and a .exe; a build failed with "not in boundary.json" or "not in the facade"; game code is being written that must also build for UE. Bringing a UE level into Ferret is ferret-unreal-porting.

The idea#

Ferret's mechanics are carried over, not Babylon. Logic modules of @ferret/* and the game's code are translated to C++; drawing, sky, water, landscape, particles, audio, HUD, input, XR, asset loading and the physics backend come from the FerretRuntime plugin on UE's own systems (reference/ue-build.md). The result is a project a person keeps editing in UE.

Through Caroline's tools#

ue_build {name?, config?, engine?} uploads the open project and runs the build in the importer app on the person's computer; ue_status gives the stage, at the end the game zip and the project zip in Cat Space; ue_cancel stops it (reference/ue-export.md). No app online or no UE 5.8 there: no build.

Writing game code that builds for UE#

  • Use the @ferret/* APIs for what they cover (levels, character, interaction, vehicles, media, ui, input, xr).
  • Use Babylon directly only inside the facade (tools/ue-cpp/facade.json: Vector3, Quaternion, Color3, TransformNode, MeshBuilder shapes, Standard and PBR materials, cameras, lights, DynamicTexture, SolidParticleSystem...). The exact members are in tools/ue-cpp/facade.d.ts.
  • No eval, new Function, with; assets by paths the build can see (literals, level manifests, data lists).
  • Check before asking for a build: node tools/ue-cpp/facade.mjs check examples/<game>.

How the pieces bind#

  • A ue module is never emitted: the plugin registers each export with ueExport(module, name, value); a missing export is listed at start-up (ueMissingList).
  • Facade value types (Vector3, Quaternion, Matrix...) are TypeScript in tools/ue-cpp/facade/math.ts, checked against Babylon by conformance case 020-babylon-math; a new member goes into both.
  • Behaviour parity: tools/ue-cpp/harness (cli.mjs record|compare), reference/ue-parity.md.

Queue and plugin work#

One UBT/UAT per computer: wrap any Build.bat/RunUAT.bat call in node tools/ue-cpp/project/buildq.mjs run --label <what> -- <cmd> (... status shows who runs). Plugin work: write all of the change first, build the game target once, verify in parallel; the traps are in reference/ue-build.md: "The build queue", "Working on the plugin".

When the check or the build fails#

  1. Module not in boundary.json: a new @ferret module. Decide its side: logic that computes -> translate; anything that draws, plays, loads or talks to a device -> ue with the UE system that gives it. Edit tools/ue-cpp/boundary.json.
  2. Babylon member not in the facade: prefer expressing it through a Ferret API (the browser build keeps working). Otherwise facade.mjs update, write the class's kind and UE counterpart in facade.json, facade.mjs dts, and implement it in FerretRuntime.
  3. Asset or level not resolved / not imported: see the asset kinds and the refusals in reference/ue-project.md (meshopt or Draco glTF, KTX2 without a PNG/JPEG fallback, two assets with one UE name).

Never stub, never patch the generated project: the next build overwrites it, and the miss comes back.

Check afterwards#

The .exe starts and plays to the end with no error in its log; the generated project opens in the UE editor and its levels open as maps with their actors; the version stamp on the splash is the local build time.

Files#

  • reference/ue-build.md — How a finished Ferret game becomes a native Unreal Engine 5 project and a Windows game: what is translated, what is carried over to which UE system, the boundary and the Babylon facade, the commands and the errors.
  • reference/ue-project.md — The Unreal Engine 5.8 C++ project that a Ferret project becomes (files, config, the runtime plugin, the content import) and how it is compiled, cooked, packaged and zipped, with the options and limits.
  • reference/ue-export.md — The export pipeline that turns a UE5 level into a Ferret level package, and how UE concepts map to Ferret's.
  • reference/ue-parity.md — Comparing a ported level with the Unreal original from the same cameras: the camera set, the axis mapping, taking the Unreal shots in the running game, taking the Ferret shots, and reading the differences.