flip-threejs-starter
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 ofthree0.180.0 plusGLTFLoader,OrbitControls,FlipDRACOLoaderandFlipKTX2Loader. Flip pins and serves it, so never commit three.js or importthreeby 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 forFlipKTX2Loader. - Keep the QUALITY presets and follow
flip.context.device.qualityonce 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)subscribespad.jsto Flip's input stream; useheldfor orbit and movement andpressedfor actions. Never callnavigator.getGamepads()in the game. - Graphics: Use WebGL2 (
WebGLRenderer). Flip's pinned module does not exportWebGPURenderer; do not bundlethree/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)runsupdate(ms)thenrenderer.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.