flip-threejs-starter

Installation
SKILL.md

Flip: three.js Starter

For 3D, run flip init --template three --dir NEW_DIR (Beacon Orbit). Read its AGENTS.md first.

  • Import * as THREE from './flip-three-0.180.0.js'. It is all of three 0.180.0 plus GLTFLoader, OrbitControls, FlipDRACOLoader and FlipKTX2Loader. Flip pins and serves it, so never commit three.js or import three by package name.
  • There are no workers and no blob URLs in the frame. Decode Draco and KTX2 through Flip: new FlipDRACOLoader((op, p) => flip.runApprovedRuntime(op, p)), and the same for FlipKTX2Loader.
  • Keep the QUALITY presets and follow flip.context.device.quality once connected (the starter does). Coarse pointers (phones) get pixel ratio 1, no antialiasing and lower detail. Stay at or below 150 draw calls, 150k triangles per frame and 2048 px textures; the playtest measures all three.
  • Controls: pad.attach(flip) subscribes pad.js to Flip's input stream; use held for orbit and movement and pressed for actions. Never call navigator.getGamepads() in the game.
  • Graphics: Use WebGL2 (WebGLRenderer). Flip's pinned module does not export WebGPURenderer; do not bundle three/webgpu.
  • Test bridge: a seeded PRNG (createRandom) drives every decorative random value. setSeed(n) reseeds it and stops the RAF-driven update. reset() rebuilds the scene from the seed. step(ms) runs update(ms) then renderer.render. snapshot() returns small JSON such as positions to 3–4 decimals.
  • Merge static meshes, reuse materials, and prefer instancing and compressed textures (KTX2, meshopt) to stay inside the budget. Physics: ./flip-rapier-0.19.1.js, also pinned by Flip (https://flip-sdk-proposal.vercel.app/sdk/guides/approved-runtimes.md).

Recommended 3D controls

For new exploration/action games, follow the recommended controls guide unless the creator or genre calls for another scheme. These are design defaults, not audit rules. Preserve existing controls unless a change is requested; do not add routine keybind approval questions. The guide covers click-to-play/capture, safe resume, touch and the current host controller mapping, which differs from the suggested future opt-in exploration profile.

Optional shared utilities

Import BufferGeometryUtils, mergeGeometries, SkeletonUtils, PointerLockControls and RGBELoader from ./flip-threeaddons-0.180.0.js. It shares the pinned three.js instance and is served by Flip; do not bundle or upload it. Merge only static, compatible geometry with matching materials; use instancing for repeated props and preserve culling. Keep mobile touch controls when using pointer lock. These utilities do not waive phone budgets. See the asset recipes.

Installs
1
First Seen
10 days ago