@fleox/agent3d 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +143 -0
- package/README.md +172 -2
- package/changelog.json +56 -0
- package/dist/agent/agent3d.mjs +11242 -0
- package/dist/agent/chunks/assets-BUUM9TUB.mjs +2448 -0
- package/dist/agent/chunks/browser-t_JL_B82.mjs +226 -0
- package/dist/agent/chunks/cdp-CaKRRzMX.mjs +177 -0
- package/dist/agent/chunks/check-CBO3Ekx1.mjs +971 -0
- package/dist/agent/chunks/export-BCI8vKw8.mjs +1130 -0
- package/dist/agent/chunks/gif-DQznzHTL.mjs +319 -0
- package/dist/agent/chunks/gltf-f_f0-OiV.mjs +207 -0
- package/dist/agent/chunks/imageCodec-BpDU9Lsq.mjs +101 -0
- package/dist/agent/chunks/jsonPath-DUCe1JpS.mjs +155 -0
- package/dist/agent/chunks/meshoptimizer-C-tN9jn5.mjs +1165 -0
- package/dist/agent/chunks/mp4-aOALfp3s.mjs +130 -0
- package/dist/agent/chunks/objects-DBAws7uf.mjs +53 -0
- package/dist/agent/chunks/optimizeSizing-CkZ3fZRp.mjs +540 -0
- package/dist/agent/chunks/package-Ck7_Nszg.mjs +75 -0
- package/dist/agent/chunks/png-DXfSGJZt.mjs +91 -0
- package/dist/agent/chunks/render-Cbuhz5uW.mjs +1511 -0
- package/dist/agent/chunks/rolldown-runtime-ebOQtxsr.mjs +18 -0
- package/dist/agent/chunks/scene-BgajNvBf.mjs +444 -0
- package/dist/agent/chunks/server-CACCerkZ.mjs +237 -0
- package/dist/agent/chunks/suggest-Cpcgv1RP.mjs +46 -0
- package/dist/agent/chunks/tools-DT2tetIK.mjs +1412 -0
- package/dist/agent/chunks/tree-BrNYGui2.mjs +75 -0
- package/dist/agent/chunks/webpAnim-qaq9YgKl.mjs +132 -0
- package/dist/runtime/agent3d-runtime.js +373 -0
- package/dist/runtime/agent3d-runtime.single.js +7360 -0
- package/dist/runtime/chunks/BufferGeometryUtils-Re3wQkXp.js +1 -0
- package/dist/runtime/chunks/EXRLoader-Bzm84si5.js +1 -0
- package/dist/runtime/chunks/FontLoader-BocwqK8V.js +2 -0
- package/dist/runtime/chunks/GLTFLoader-DHp1wv6J.js +1 -0
- package/dist/runtime/chunks/GroundedSkybox-esvlRCO0.js +1 -0
- package/dist/runtime/chunks/HDRLoader-DHrHp8fs.js +5 -0
- package/dist/runtime/chunks/OrbitControls-sjN2MF0e.js +1 -0
- package/dist/runtime/chunks/RectAreaLightUniformsLib-_mZ62yWn.js +1 -0
- package/dist/runtime/chunks/RoomEnvironment-CL4UR6ZW.js +1 -0
- package/dist/runtime/chunks/RoundedBoxGeometry-x-ot8ZSh.js +1 -0
- package/dist/runtime/chunks/SVGLoader-hRF0EwD-.js +1 -0
- package/dist/runtime/chunks/SkeletonUtils-DHlReJx3.js +1 -0
- package/dist/runtime/chunks/Sky-BrLN9Fk5.js +243 -0
- package/dist/runtime/chunks/audio-DbVNbf-r.js +1 -0
- package/dist/runtime/chunks/catalog-DL6sgPay.js +1 -0
- package/dist/runtime/chunks/easing-CXSz2e6P.js +1 -0
- package/dist/runtime/chunks/extrude-m04mghOS.js +1 -0
- package/dist/runtime/chunks/game-BoG2S6g4.js +20 -0
- package/dist/runtime/chunks/generators-OHhFCc2E.js +331 -0
- package/dist/runtime/chunks/materials-C2uffFEd.js +107 -0
- package/dist/runtime/chunks/meshGradient.glsl-BMatplLA.js +88 -0
- package/dist/runtime/chunks/meshopt_decoder.module-DXTYc6wn.js +1 -0
- package/dist/runtime/chunks/model-D-4xZz21.js +1 -0
- package/dist/runtime/chunks/params-DdApDOBw.js +1 -0
- package/dist/runtime/chunks/physicsHost-DPaVdM0R.js +1 -0
- package/dist/runtime/chunks/postfx-BpBXjLX3.js +1527 -0
- package/dist/runtime/chunks/postfx-i_J5Vf-l.js +1 -0
- package/dist/runtime/chunks/random-eeej60NW.js +1 -0
- package/dist/runtime/chunks/shaders-CmeJRio1.js +443 -0
- package/dist/runtime/chunks/svg-B3nZaQFD.js +1 -0
- package/dist/runtime/chunks/text-CmkU-b0C.js +2 -0
- package/dist/runtime/chunks/three.module-W4hp4qHb.js +4225 -0
- package/dist/runtime/chunks/toon-B5Jhf37V.js +6 -0
- package/dist/runtime/chunks/util-THUewKBk.js +1 -0
- package/dist/studio/assets/BufferGeometryUtils-wW9vV1l2.js +1 -0
- package/dist/studio/assets/EXRLoader-f8U8jnlr.js +1 -0
- package/dist/studio/assets/FontLoader-9sHudKzD.js +2 -0
- package/dist/studio/assets/GLTFLoader-C3C_3K62.js +1 -0
- package/dist/studio/assets/GroundedSkybox-BTqmv4fv.js +1 -0
- package/dist/studio/assets/HDRLoader-CkQyrTWY.js +5 -0
- package/dist/studio/assets/OrbitControls-fcOgB96a.js +1 -0
- package/dist/studio/assets/RectAreaLightUniformsLib-CZHWO9xf.js +1 -0
- package/dist/studio/assets/RoomEnvironment-BsISzuCp.js +1 -0
- package/dist/studio/assets/SVGLoader-BIkQDT66.js +1 -0
- package/dist/studio/assets/SkeletonUtils-CG5akqME.js +1 -0
- package/dist/studio/assets/Sky-C282PFL1.js +243 -0
- package/dist/studio/assets/audio-JD1kyX0A.js +1 -0
- package/dist/studio/assets/camera-BhKdE9ej.js +2 -0
- package/dist/studio/assets/editor-BgY_RoRd.js +1 -0
- package/dist/studio/assets/extrude-CnayHczh.js +1 -0
- package/dist/studio/assets/game-Dv5s4eMN.js +19 -0
- package/dist/studio/assets/generators-DVX3bAxe.js +331 -0
- package/dist/studio/assets/index-BQT0otii.css +1 -0
- package/dist/studio/assets/index-Dh-2Y34U.js +479 -0
- package/dist/studio/assets/meshopt_decoder.module-DXTYc6wn.js +1 -0
- package/dist/studio/assets/meshoptimizer-BCSwHBL3.js +1 -0
- package/dist/studio/assets/model-XZSP52pV.js +2 -0
- package/dist/studio/assets/physicsHost-C84FddIe.js +1 -0
- package/dist/studio/assets/postfx-BWWXb8i8.js +1527 -0
- package/dist/studio/assets/runtime-k_MFerbJ.js +572 -0
- package/dist/studio/assets/shaders-BEznGIct.js +443 -0
- package/dist/studio/assets/svg-DT8kx37i.js +2 -0
- package/dist/studio/assets/text-5DsJJHcj.js +3 -0
- package/dist/studio/assets/three.module-ByMn_ZTv.js +4225 -0
- package/dist/studio/index.html +16 -0
- package/library/LICENSES.md +77 -0
- package/library/fonts/LICENSES.md +42 -0
- package/library/fonts/anton.typeface.json +1 -0
- package/library/fonts/bebas-neue.typeface.json +1 -0
- package/library/fonts/display.typeface.json +1 -0
- package/library/fonts/inter-black.typeface.json +1 -0
- package/library/fonts/lobster.typeface.json +1 -0
- package/library/fonts/mono.typeface.json +1 -0
- package/library/fonts/montserrat-extrabold.typeface.json +1 -0
- package/library/fonts/pacifico.typeface.json +1 -0
- package/library/fonts/sans-bold.typeface.json +1 -0
- package/library/fonts/sans.typeface.json +1 -0
- package/library/fonts/serif-bold.typeface.json +1 -0
- package/library/fonts/serif.typeface.json +1 -0
- package/library/fonts/space-grotesk-bold.typeface.json +1 -0
- package/library/hdri/beach.hdr +0 -0
- package/library/hdri/beach.jpg +0 -0
- package/library/hdri/city.hdr +0 -0
- package/library/hdri/city.jpg +0 -0
- package/library/hdri/forest.hdr +0 -0
- package/library/hdri/forest.jpg +0 -0
- package/library/hdri/night-city.hdr +0 -0
- package/library/hdri/night-city.jpg +0 -0
- package/library/hdri/night.hdr +0 -0
- package/library/hdri/night.jpg +0 -0
- package/library/hdri/sky.hdr +0 -0
- package/library/hdri/sky.jpg +0 -0
- package/library/hdri/softbox.hdr +0 -0
- package/library/hdri/softbox.jpg +0 -0
- package/library/hdri/studio.hdr +0 -0
- package/library/hdri/studio.jpg +0 -0
- package/library/hdri/sunset.hdr +0 -0
- package/library/hdri/sunset.jpg +0 -0
- package/library/hdri/warehouse.hdr +0 -0
- package/library/hdri/warehouse.jpg +0 -0
- package/library/index.json +5510 -0
- package/library/models/animals/fish.glb +0 -0
- package/library/models/animals/fox.glb +0 -0
- package/library/models/buildings/castle.glb +0 -0
- package/library/models/buildings/house.glb +0 -0
- package/library/models/buildings/market.glb +0 -0
- package/library/models/buildings/tavern.glb +0 -0
- package/library/models/buildings/tower.glb +0 -0
- package/library/models/buildings/windmill.glb +0 -0
- package/library/models/characters/barbarian.glb +0 -0
- package/library/models/characters/knight.glb +0 -0
- package/library/models/characters/mage.glb +0 -0
- package/library/models/characters/mini-soldier.glb +0 -0
- package/library/models/characters/platformer-hero.glb +0 -0
- package/library/models/characters/robot.glb +0 -0
- package/library/models/characters/rogue.glb +0 -0
- package/library/models/characters/skeleton.glb +0 -0
- package/library/models/city/building-a.glb +0 -0
- package/library/models/city/building-b.glb +0 -0
- package/library/models/city/building-tall.glb +0 -0
- package/library/models/city/fire-hydrant.glb +0 -0
- package/library/models/city/road-corner.glb +0 -0
- package/library/models/city/road-crossing.glb +0 -0
- package/library/models/city/road-junction.glb +0 -0
- package/library/models/city/road-straight.glb +0 -0
- package/library/models/city/streetlight.glb +0 -0
- package/library/models/city/suburban-house.glb +0 -0
- package/library/models/city/traffic-light.glb +0 -0
- package/library/models/city/water-tower.glb +0 -0
- package/library/models/food/apple.glb +0 -0
- package/library/models/food/avocado.glb +0 -0
- package/library/models/food/baguette.glb +0 -0
- package/library/models/food/bread-loaf.glb +0 -0
- package/library/models/food/burger.glb +0 -0
- package/library/models/food/carrot.glb +0 -0
- package/library/models/food/cheese.glb +0 -0
- package/library/models/food/cookie.glb +0 -0
- package/library/models/food/croissant.glb +0 -0
- package/library/models/food/cupcake.glb +0 -0
- package/library/models/food/dinner-plate.glb +0 -0
- package/library/models/food/donut.glb +0 -0
- package/library/models/food/ketchup.glb +0 -0
- package/library/models/food/mug.glb +0 -0
- package/library/models/food/pain-au-chocolat.glb +0 -0
- package/library/models/food/stew.glb +0 -0
- package/library/models/food/tomato.glb +0 -0
- package/library/models/food/veggie-burger.glb +0 -0
- package/library/models/nature/bush.glb +0 -0
- package/library/models/nature/cactus.glb +0 -0
- package/library/models/nature/cloud.glb +0 -0
- package/library/models/nature/fir-tree.glb +0 -0
- package/library/models/nature/forest-patch.glb +0 -0
- package/library/models/nature/grass-small.glb +0 -0
- package/library/models/nature/grass.glb +0 -0
- package/library/models/nature/hex-grass.glb +0 -0
- package/library/models/nature/hex-water.glb +0 -0
- package/library/models/nature/hills.glb +0 -0
- package/library/models/nature/mountain.glb +0 -0
- package/library/models/nature/pine-autumn.glb +0 -0
- package/library/models/nature/pine-tree.glb +0 -0
- package/library/models/nature/pumpkin.glb +0 -0
- package/library/models/nature/rock-flat.glb +0 -0
- package/library/models/nature/rock.glb +0 -0
- package/library/models/nature/tree-dead.glb +0 -0
- package/library/models/nature/tree-slim.glb +0 -0
- package/library/models/nature/trees-cluster.glb +0 -0
- package/library/models/nature/waterlily.glb +0 -0
- package/library/models/platformer/blaster.glb +0 -0
- package/library/models/platformer/block-coin.glb +0 -0
- package/library/models/platformer/brick.glb +0 -0
- package/library/models/platformer/coin.glb +0 -0
- package/library/models/platformer/enemy-flying.glb +0 -0
- package/library/models/platformer/flag.glb +0 -0
- package/library/models/platformer/platform-falling.glb +0 -0
- package/library/models/platformer/platform-grass-round.glb +0 -0
- package/library/models/platformer/platform-large.glb +0 -0
- package/library/models/platformer/platform-medium.glb +0 -0
- package/library/models/platformer/platform.glb +0 -0
- package/library/models/platformer/target.glb +0 -0
- package/library/models/platformer/track-corner.glb +0 -0
- package/library/models/platformer/track-straight.glb +0 -0
- package/library/models/platformer/wall-low.glb +0 -0
- package/library/models/products/boombox.glb +0 -0
- package/library/models/products/iridescent-lamp.glb +0 -0
- package/library/models/products/lantern.glb +0 -0
- package/library/models/products/lounge-chair.glb +0 -0
- package/library/models/products/sneaker.glb +0 -0
- package/library/models/products/velvet-sofa.glb +0 -0
- package/library/models/products/water-bottle.glb +0 -0
- package/library/models/props/alarm-clock.glb +0 -0
- package/library/models/props/armchair.glb +0 -0
- package/library/models/props/barrel.glb +0 -0
- package/library/models/props/bench.glb +0 -0
- package/library/models/props/brass-vase.glb +0 -0
- package/library/models/props/chest.glb +0 -0
- package/library/models/props/coffee-table.glb +0 -0
- package/library/models/props/coin-stack.glb +0 -0
- package/library/models/props/coin.glb +0 -0
- package/library/models/props/couch.glb +0 -0
- package/library/models/props/crate.glb +0 -0
- package/library/models/props/flag.glb +0 -0
- package/library/models/props/gravestone.glb +0 -0
- package/library/models/props/key.glb +0 -0
- package/library/models/props/lamp.glb +0 -0
- package/library/models/props/lantern.glb +0 -0
- package/library/models/props/marble-bust.glb +0 -0
- package/library/models/props/modern-armchair.glb +0 -0
- package/library/models/props/potted-succulent.glb +0 -0
- package/library/models/props/rubber-duck.glb +0 -0
- package/library/models/props/shield.glb +0 -0
- package/library/models/props/sword-shield.glb +0 -0
- package/library/models/props/sword.glb +0 -0
- package/library/models/props/table.glb +0 -0
- package/library/models/props/tent.glb +0 -0
- package/library/models/props/torch.glb +0 -0
- package/library/models/props/trophy.glb +0 -0
- package/library/models/space/base-module.glb +0 -0
- package/library/models/space/lander.glb +0 -0
- package/library/models/space/landing-pad.glb +0 -0
- package/library/models/space/rocks.glb +0 -0
- package/library/models/space/solar-panel.glb +0 -0
- package/library/models/space/space-truck.glb +0 -0
- package/library/models/space/wind-turbine.glb +0 -0
- package/library/models/vehicles/car.glb +0 -0
- package/library/models/vehicles/hatchback.glb +0 -0
- package/library/models/vehicles/motorcycle.glb +0 -0
- package/library/models/vehicles/police-car.glb +0 -0
- package/library/models/vehicles/taxi.glb +0 -0
- package/library/models/vehicles/truck.glb +0 -0
- package/library/sources.json +2856 -0
- package/library/textures/brick-color.jpg +0 -0
- package/library/textures/brick-normal.jpg +0 -0
- package/library/textures/brick-roughness.jpg +0 -0
- package/library/textures/concrete-color.jpg +0 -0
- package/library/textures/concrete-normal.jpg +0 -0
- package/library/textures/concrete-roughness.jpg +0 -0
- package/library/textures/fabric-color.jpg +0 -0
- package/library/textures/fabric-normal.jpg +0 -0
- package/library/textures/fabric-roughness.jpg +0 -0
- package/library/textures/grass-ground-color.jpg +0 -0
- package/library/textures/grass-ground-normal.jpg +0 -0
- package/library/textures/grass-ground-roughness.jpg +0 -0
- package/library/textures/rusty-metal-color.jpg +0 -0
- package/library/textures/rusty-metal-normal.jpg +0 -0
- package/library/textures/rusty-metal-roughness.jpg +0 -0
- package/library/textures/wood-planks-color.jpg +0 -0
- package/library/textures/wood-planks-normal.jpg +0 -0
- package/library/textures/wood-planks-roughness.jpg +0 -0
- package/package.json +67 -4
- package/plugin/.claude-plugin/plugin.json +19 -0
- package/plugin/skills/agent3d-assets/SKILL.md +140 -0
- package/plugin/skills/agent3d-assets/references/sources.md +33 -0
- package/plugin/skills/agent3d-create/SKILL.md +141 -0
- package/plugin/skills/agent3d-create/references/art-direction.md +144 -0
- package/plugin/skills/agent3d-create/references/recipes.md +1357 -0
- package/plugin/skills/agent3d-edit/SKILL.md +121 -0
- package/plugin/skills/agent3d-edit/references/patch-ops.md +278 -0
- package/plugin/skills/agent3d-game/SKILL.md +111 -0
- package/plugin/skills/agent3d-game/references/game-patterns.md +262 -0
- package/plugin/skills/agent3d-game/references/script-api.md +211 -0
- package/plugin/skills/agent3d-publish/SKILL.md +161 -0
- package/plugin/skills/agent3d-publish/references/integrations.md +221 -0
- package/templates/banner-aurora-night/README.md +15 -0
- package/templates/banner-aurora-night/agent3d.json +8 -0
- package/templates/banner-aurora-night/preview.png +0 -0
- package/templates/banner-aurora-night/scene.json +327 -0
- package/templates/banner-aurora-night/template.json +24 -0
- package/templates/banner-data-bars/README.md +15 -0
- package/templates/banner-data-bars/agent3d.json +8 -0
- package/templates/banner-data-bars/preview.png +0 -0
- package/templates/banner-data-bars/scene.json +222 -0
- package/templates/banner-data-bars/template.json +25 -0
- package/templates/banner-floating-shapes/README.md +15 -0
- package/templates/banner-floating-shapes/agent3d.json +8 -0
- package/templates/banner-floating-shapes/preview.png +0 -0
- package/templates/banner-floating-shapes/scene.json +703 -0
- package/templates/banner-floating-shapes/template.json +24 -0
- package/templates/banner-gradient-blob/README.md +16 -0
- package/templates/banner-gradient-blob/agent3d.json +8 -0
- package/templates/banner-gradient-blob/preview.png +0 -0
- package/templates/banner-gradient-blob/scene.json +330 -0
- package/templates/banner-gradient-blob/template.json +21 -0
- package/templates/banner-liquid-chrome/README.md +16 -0
- package/templates/banner-liquid-chrome/agent3d.json +8 -0
- package/templates/banner-liquid-chrome/preview.png +0 -0
- package/templates/banner-liquid-chrome/scene.json +290 -0
- package/templates/banner-liquid-chrome/template.json +24 -0
- package/templates/banner-logo-extrude/README.md +24 -0
- package/templates/banner-logo-extrude/agent3d.json +8 -0
- package/templates/banner-logo-extrude/assets/logo.svg +6 -0
- package/templates/banner-logo-extrude/assets/manifest.json +13 -0
- package/templates/banner-logo-extrude/preview.png +0 -0
- package/templates/banner-logo-extrude/scene.json +332 -0
- package/templates/banner-logo-extrude/template.json +22 -0
- package/templates/banner-neon-title/README.md +18 -0
- package/templates/banner-neon-title/agent3d.json +8 -0
- package/templates/banner-neon-title/preview.png +0 -0
- package/templates/banner-neon-title/scene.json +494 -0
- package/templates/banner-neon-title/template.json +25 -0
- package/templates/banner-wave-grid/README.md +18 -0
- package/templates/banner-wave-grid/agent3d.json +8 -0
- package/templates/banner-wave-grid/preview.png +0 -0
- package/templates/banner-wave-grid/scene.json +217 -0
- package/templates/banner-wave-grid/template.json +23 -0
- package/templates/card-hover-3d/README.md +16 -0
- package/templates/card-hover-3d/agent3d.json +8 -0
- package/templates/card-hover-3d/preview.png +0 -0
- package/templates/card-hover-3d/scene.json +359 -0
- package/templates/card-hover-3d/template.json +21 -0
- package/templates/card-product-tilt/README.md +14 -0
- package/templates/card-product-tilt/agent3d.json +8 -0
- package/templates/card-product-tilt/preview.png +0 -0
- package/templates/card-product-tilt/scene.json +296 -0
- package/templates/card-product-tilt/template.json +23 -0
- package/templates/character-mascot-hero/README.md +19 -0
- package/templates/character-mascot-hero/agent3d.json +8 -0
- package/templates/character-mascot-hero/preview.png +0 -0
- package/templates/character-mascot-hero/scene.json +512 -0
- package/templates/character-mascot-hero/template.json +8 -0
- package/templates/character-showcase/README.md +27 -0
- package/templates/character-showcase/agent3d.json +8 -0
- package/templates/character-showcase/preview.png +0 -0
- package/templates/character-showcase/scene.json +440 -0
- package/templates/character-showcase/template.json +24 -0
- package/templates/diorama-city/README.md +21 -0
- package/templates/diorama-city/agent3d.json +8 -0
- package/templates/diorama-city/preview.png +0 -0
- package/templates/diorama-city/scene.json +432 -0
- package/templates/diorama-city/template.json +21 -0
- package/templates/game-basket/README.md +25 -0
- package/templates/game-basket/agent3d.json +8 -0
- package/templates/game-basket/preview.png +0 -0
- package/templates/game-basket/scene.json +640 -0
- package/templates/game-basket/scripts/basket.js +176 -0
- package/templates/game-basket/template.json +8 -0
- package/templates/game-coin-collector/README.md +28 -0
- package/templates/game-coin-collector/agent3d.json +8 -0
- package/templates/game-coin-collector/preview.png +0 -0
- package/templates/game-coin-collector/scene.json +900 -0
- package/templates/game-coin-collector/scripts/collector.js +210 -0
- package/templates/game-coin-collector/template.json +19 -0
- package/templates/game-maze/README.md +24 -0
- package/templates/game-maze/agent3d.json +8 -0
- package/templates/game-maze/preview.png +0 -0
- package/templates/game-maze/scene.json +315 -0
- package/templates/game-maze/scripts/maze.js +168 -0
- package/templates/game-maze/template.json +18 -0
- package/templates/game-physics-playground/README.md +30 -0
- package/templates/game-physics-playground/agent3d.json +8 -0
- package/templates/game-physics-playground/preview.png +0 -0
- package/templates/game-physics-playground/scene.json +1712 -0
- package/templates/game-physics-playground/scripts/playground.js +151 -0
- package/templates/game-physics-playground/template.json +19 -0
- package/templates/game-platformer/README.md +26 -0
- package/templates/game-platformer/agent3d.json +8 -0
- package/templates/game-platformer/preview.png +0 -0
- package/templates/game-platformer/scene.json +1063 -0
- package/templates/game-platformer/scripts/platformer.js +222 -0
- package/templates/game-platformer/template.json +8 -0
- package/templates/game-runner/README.md +30 -0
- package/templates/game-runner/agent3d.json +8 -0
- package/templates/game-runner/preview.png +0 -0
- package/templates/game-runner/scene.json +1317 -0
- package/templates/game-runner/scripts/runner.js +263 -0
- package/templates/game-runner/template.json +18 -0
- package/templates/game-tap-targets/README.md +21 -0
- package/templates/game-tap-targets/agent3d.json +8 -0
- package/templates/game-tap-targets/preview.png +0 -0
- package/templates/game-tap-targets/scene.json +924 -0
- package/templates/game-tap-targets/scripts/targets.js +159 -0
- package/templates/game-tap-targets/template.json +19 -0
- package/templates/hero-floating-island/README.md +18 -0
- package/templates/hero-floating-island/agent3d.json +8 -0
- package/templates/hero-floating-island/preview.png +0 -0
- package/templates/hero-floating-island/scene.json +658 -0
- package/templates/hero-floating-island/template.json +8 -0
- package/templates/hero-perfume-luxury/README.md +18 -0
- package/templates/hero-perfume-luxury/agent3d.json +8 -0
- package/templates/hero-perfume-luxury/preview.png +0 -0
- package/templates/hero-perfume-luxury/scene.json +529 -0
- package/templates/hero-perfume-luxury/template.json +27 -0
- package/templates/hero-product-turntable/README.md +16 -0
- package/templates/hero-product-turntable/agent3d.json +8 -0
- package/templates/hero-product-turntable/preview.png +0 -0
- package/templates/hero-product-turntable/scene.json +225 -0
- package/templates/hero-product-turntable/template.json +21 -0
- package/templates/hero-saas-globe/README.md +16 -0
- package/templates/hero-saas-globe/agent3d.json +8 -0
- package/templates/hero-saas-globe/preview.png +0 -0
- package/templates/hero-saas-globe/scene.json +318 -0
- package/templates/hero-saas-globe/template.json +24 -0
- package/templates/hero-scroll-story/README.md +26 -0
- package/templates/hero-scroll-story/agent3d.json +8 -0
- package/templates/hero-scroll-story/preview.png +0 -0
- package/templates/hero-scroll-story/scene.json +642 -0
- package/templates/hero-scroll-story/template.json +22 -0
- package/templates/hero-sneaker-showcase/README.md +19 -0
- package/templates/hero-sneaker-showcase/agent3d.json +8 -0
- package/templates/hero-sneaker-showcase/preview.png +0 -0
- package/templates/hero-sneaker-showcase/scene.json +523 -0
- package/templates/hero-sneaker-showcase/template.json +23 -0
- package/templates/hero-space-planet/README.md +17 -0
- package/templates/hero-space-planet/agent3d.json +8 -0
- package/templates/hero-space-planet/preview.png +0 -0
- package/templates/hero-space-planet/scene.json +330 -0
- package/templates/hero-space-planet/template.json +21 -0
- package/templates/landscape-island/README.md +21 -0
- package/templates/landscape-island/agent3d.json +8 -0
- package/templates/landscape-island/preview.png +0 -0
- package/templates/landscape-island/scene.json +716 -0
- package/templates/landscape-island/template.json +24 -0
- package/templates/landscape-night-galaxy/README.md +25 -0
- package/templates/landscape-night-galaxy/agent3d.json +8 -0
- package/templates/landscape-night-galaxy/preview.png +0 -0
- package/templates/landscape-night-galaxy/scene.json +403 -0
- package/templates/landscape-night-galaxy/template.json +8 -0
- package/templates/landscape-valley-sunset/README.md +20 -0
- package/templates/landscape-valley-sunset/agent3d.json +8 -0
- package/templates/landscape-valley-sunset/preview.png +0 -0
- package/templates/landscape-valley-sunset/scene.json +265 -0
- package/templates/landscape-valley-sunset/template.json +22 -0
- package/templates/scene-cozy-room/README.md +21 -0
- package/templates/scene-cozy-room/agent3d.json +8 -0
- package/templates/scene-cozy-room/preview.png +0 -0
- package/templates/scene-cozy-room/scene.json +728 -0
- package/templates/scene-cozy-room/template.json +8 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent3d-edit
|
|
3
|
+
description: Change an existing Agent3D project - summarise the scene, then patch objects, materials and textures, lights and light rigs, sky / fog / background, camera and camera shots, post effects and looks, timeline keyframes (easing, stagger, letters, segments, scroll), behaviours and hover / click interactions, rebrand it (swap the text, colours, logo), re-time animations, fix framing on phones, and re-render to check every change visually. Use when the user wants to modify a 3D banner, hero, character, landscape, product scene or game that already exists as an Agent3D project folder (scene.json), or a template.
|
|
4
|
+
license: PolyForm-Noncommercial-1.0.0
|
|
5
|
+
compatibility: Requires Node.js 22+ and Google Chrome (or Chromium/Edge) for renders.
|
|
6
|
+
metadata:
|
|
7
|
+
version: "0.2.0"
|
|
8
|
+
repository: "https://github.com/fleox/agent3d"
|
|
9
|
+
allowed-tools: Bash Read Write
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Edit an Agent3D project
|
|
13
|
+
|
|
14
|
+
A project is a folder with `agent3d.json`, `scene.json` (the scene), `assets/` (+ `assets/manifest.json` with licences), `scripts/`, `renders/` and `dist/` (exports). Edit it through the CLI, not by hand: patches are validated and atomic, and the plan tells you exactly what changed.
|
|
15
|
+
|
|
16
|
+
**Language:** talk to the user in their language; keep commands, ids and files in English.
|
|
17
|
+
|
|
18
|
+
Every command is `npx -y @fleox/agent3d@0.2.0 <command> --json` with `--project <dir>`. Read `error.hint` when `ok` is false.
|
|
19
|
+
|
|
20
|
+
## 1. Understand before changing
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx -y @fleox/agent3d@0.2.0 info --project my-banner --json
|
|
24
|
+
npx -y @fleox/agent3d@0.2.0 scene summary --project my-banner --json
|
|
25
|
+
npx -y @fleox/agent3d@0.2.0 render --project my-banner --sheet --json
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Look at the sheet (Read the `data.sheet` PNG, relative to the project folder `data.dir`), then tell the user in two or three sentences what the scene contains (target and aspect, the main objects, the motion) before proposing changes. Read details on demand:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx -y @fleox/agent3d@0.2.0 object get title --project my-banner --json
|
|
32
|
+
npx -y @fleox/agent3d@0.2.0 scene get --path objects#title.material --project my-banner --json
|
|
33
|
+
npx -y @fleox/agent3d@0.2.0 timeline get --project my-banner --json
|
|
34
|
+
npx -y @fleox/agent3d@0.2.0 catalog behaviours float --json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 2. Patch
|
|
38
|
+
|
|
39
|
+
Put the ops in a file (or pass them inline as one JSON argument) and apply:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx -y @fleox/agent3d@0.2.0 scene patch --project my-banner --file ops.json --dry-run --json
|
|
43
|
+
npx -y @fleox/agent3d@0.2.0 scene patch --project my-banner --file ops.json --json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
| Op | Shape | Use |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| `set` | `{ "op": "set", "path": "camera.position", "value": [0, 1, 9] }` | Replace a value (creates missing keys; replacing a whole collection — `lights`, `postfx`, `objects`, `timeline.tracks`, `ui.elements`… — is a plan that needs `--yes`) |
|
|
49
|
+
| `merge` | `{ "op": "merge", "path": "target", "value": { "posterTime": 2, "height": null } }` | Deep merge (RFC 7396: `null` deletes a key) |
|
|
50
|
+
| `remove` | `{ "op": "remove", "path": "postfx[1]" }` | Delete a value (plan, needs `--yes`) |
|
|
51
|
+
| `addObject` | `{ "op": "addObject", "object": { … }, "parent": "group-id", "index": 0 }` | New object (top level without `parent`) |
|
|
52
|
+
| `updateObject` | `{ "op": "updateObject", "id": "title", "set": { "text": "Hello", "size": 0.9 } }` | Deep merge into an object (`id` and `children` can't change) |
|
|
53
|
+
| `removeObject` | `{ "op": "removeObject", "id": "pill" }` | Delete with its children and its timeline tracks (plan, needs `--yes`) |
|
|
54
|
+
| `moveObject` | `{ "op": "moveObject", "id": "gem", "parent": "props" }` | Re-parent (`"parent": null` = top level) or reorder (`index`) |
|
|
55
|
+
| `addBehaviour` | `{ "op": "addBehaviour", "id": "key", "behaviour": { "type": "flicker", "amount": 0.2 } }` | Append a behaviour to an object or a light |
|
|
56
|
+
| `addTrack` | `{ "op": "addTrack", "track": { "target": "title.rotation.y", "keys": [[0, -5], [4, 5], [8, -5]], "ease": "inOutSine" } }` | Add or replace a timeline track (creates the timeline) |
|
|
57
|
+
| `removeTrack` | `{ "op": "removeTrack", "target": "title.rotation.y" }` | Delete a track (plan, needs `--yes`) |
|
|
58
|
+
|
|
59
|
+
**Paths**: `camera.fov`, `lights[0].intensity`, `lights#key.color` (a light by id), `objects#title.material.color` (an object by id anywhere in the tree), `objects#torus.position[1]` (one coordinate), `environment.background`, `target.posterTime`, `postfx[0].strength`.
|
|
60
|
+
|
|
61
|
+
**The deep-merge gotcha**: `updateObject` / `merge` keep keys you don't mention. Switching a material preset that way keeps the old `color`, `roughness`… (gold stays white). Replace the whole material with `set` on `objects#<id>.material` when you change the look; use `updateObject` for small tweaks (`{ "material": { "color": "#ff3366" } }`).
|
|
62
|
+
|
|
63
|
+
Shortcuts for one object (same validation, same plans):
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx -y @fleox/agent3d@0.2.0 object update title --set material.color="#ffd166" --set size=0.9 --project my-banner --json
|
|
67
|
+
npx -y @fleox/agent3d@0.2.0 object add --id ball --geometry sphere --set geometry.radius=0.4 --set 'position=[3,0,0]' --project my-banner --json
|
|
68
|
+
npx -y @fleox/agent3d@0.2.0 object move gem --parent props --project my-banner --json
|
|
69
|
+
npx -y @fleox/agent3d@0.2.0 object remove pill --project my-banner --json
|
|
70
|
+
npx -y @fleox/agent3d@0.2.0 object remove pill --yes --project my-banner --json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`--set` takes dotted keys and JSON values (`--set 'position=[0,1,0]'`, `--set visible=false`). More recipes per task (materials, lights, camera, timeline, behaviours, post effects): [references/patch-ops.md](references/patch-ops.md).
|
|
74
|
+
|
|
75
|
+
## 3. Timeline, behaviours and interactions
|
|
76
|
+
|
|
77
|
+
- **Behaviours** are procedural, per object or light, always running (or `when`: hover, click, visible, scroll; `delay` in seconds). Change parameters with `updateObject` on `behaviours` (an array: `set` it whole) or a path like `objects#title.behaviours[1].speed`.
|
|
78
|
+
- **Timeline** tracks animate a property between keyframes. `target` is `<selector>.<property>`:
|
|
79
|
+
- selector: an object or light id, `camera`, `environment`, `postfx`, a comma list `a,b`, `tag:<tag>`, `children:<id>`, or one letter of a text `<textId>/<n>` (needs `splitLetters` or `reveal` on the text; n counts non-space characters from 0);
|
|
80
|
+
- property: `position`, `position.x`, `rotation.y` (degrees), `scale`, `visible`, `material.opacity` / `color` / `emissiveIntensity` / `roughness`…, `material.uniforms.<name>`; lights `intensity`, `color`; camera `position`, `target`, `fov`, `focus`; `environment.fog.density`, `environment.exposure`; `postfx.<type>.<param>` (an effect written in `postfx` or brought by a `look` preset, e.g. `postfx.bloom.strength` with `{ "type": "look", "preset": "product" }`); models `morph.<name>`, `animation.<clip>.weight`.
|
|
81
|
+
- **Keys** are `[time, value]` or `[time, value, ease]` (the ease shapes the segment ending at that key) sorted by time. Values: numbers, `[x, y, z]`, colours, booleans, or relative strings `"+=0.5"`, `"-=1"`, `"*=1.2"` (from the rest value). The track `ease` (default `linear`) is `step`, `in` / `out` / `inOut` + `Quad`, `Cubic`, `Quart`, `Quint`, `Sine`, `Expo`, `Circ`, `Back`, `Elastic`, `Bounce`, or `"cubicBezier(0.16, 1, 0.3, 1)"`, `"spring(170, 12)"`, `"steps(4)"`. Multi-target selectors take `stagger` (seconds between targets) and `staggerFrom` (`start`, `end`, `center`, `edges`, `random`). Colour keys blend in OKLCh (saturated midpoints); `"colorSpace": "rgb"|"oklab"|"hsl"` on the track changes it.
|
|
82
|
+
```bash
|
|
83
|
+
npx -y @fleox/agent3d@0.2.0 timeline set --duration 10 --loop true --trigger visible --project my-banner --json
|
|
84
|
+
npx -y @fleox/agent3d@0.2.0 timeline add-track --target logo.rotation.y --keys "[[0,0],[10,360]]" --project my-banner --json
|
|
85
|
+
npx -y @fleox/agent3d@0.2.0 timeline add-track --target gem.position.y --keys '[[0,"+=0"],[1,"+=0.6","outBack"],[2,"+=0","inOutSine"]]' --project my-banner --json
|
|
86
|
+
npx -y @fleox/agent3d@0.2.0 timeline remove-track --target logo.rotation.y --yes --project my-banner --json
|
|
87
|
+
```
|
|
88
|
+
- Loops: the last key equals the first. Triggers: `load`, `visible` (default), `hover`, `click`, `scroll` (time = scroll progress; tune with `timeline.scroll`), `manual` (only interactions move it).
|
|
89
|
+
- **Markers and segments** name moments and ranges (`markers: { "lifted": 2.6 }`, `segments: { "hover-in": [2, "lifted"] }`); `autoplay: "intro"` plays only that segment on the trigger. **Interactions** (`scene.interactions`) wire hover / click / scroll / key / marker events to actions: play or toggle a segment, tween a property (`set`), `openUrl` (click / key only), emit an event, play a model clip. Agents on MCP or `tools call` can use the `interactions_set` tool (`{ "add": [...] }` or `{ "interactions": [...] }`, `dryRun`).
|
|
90
|
+
- **Camera shots** (`camera.shots`: pushIn, pullOut, dolly, truck, pedestal, crane, orbit, zoom, move, path, lookAt, focus) are cinematic moves on the timeline clock; `camera.shake` adds handheld noise.
|
|
91
|
+
- Re-timing everything: change `duration`, then the key times of each track (a patch `set` on `timeline.tracks[i].keys`). Patches for all of the above: [references/patch-ops.md](references/patch-ops.md).
|
|
92
|
+
- Check a hover or click state: `render --input '[{"t": 1.9, "pointer": [0, -0.3]}]' --frames 2,3` (coordinates -1..1, y up; `"click": [x, y]` clicks).
|
|
93
|
+
|
|
94
|
+
## 4. Rebrand
|
|
95
|
+
|
|
96
|
+
1. Text: `updateObject` with the new `text` (check the length: banner titles wider than ~11 units collide with the props; lower `size` or move the props). `ariaLabel` and `title` too.
|
|
97
|
+
2. Colours: the background (`environment.background`), materials of the main objects (`set` the material), the rim light colour, particle `color`, HUD `ui.color` / `ui.accent` in games. Keep the structure of the palette (dark background tones, light subject, one accent).
|
|
98
|
+
3. Logo: an SVG becomes extruded 3D with `{ "kind": "svg", "src": "assets/svg/logo.svg", "size": 3, "depth": 0.2 }` (add the file with `assets add ./logo.svg --license proprietary`). Each path keeps its SVG colour unless a `material` is set (`keepColors: true` keeps both), strokes become solid outlines (line icons work; `strokes: false` ignores them), `fit: "height"` sizes by height. `<text>` is not supported: outline the text in the design tool.
|
|
99
|
+
4. Fonts: 13 bundled fonts (`catalog fonts`: `sans-bold` default, `inter-black`, `montserrat-extrabold`, `space-grotesk-bold`, `bebas-neue`, `anton`, `serif-bold`, `serif`, `mono`, `display`, `pacifico`, `lobster`…; no web fonts). Kerning is on by default; `letterSpacing`, `maxWidth` (wraps), `outline`, `reveal` (letter-by-letter entrance).
|
|
100
|
+
5. Render, compare with the previous sheet, and show both to the user if they asked for options.
|
|
101
|
+
|
|
102
|
+
## 5. Check on phones
|
|
103
|
+
|
|
104
|
+
The embed keeps the scene's aspect ratio at every width. A 4:1 banner is only ~98 px tall on a 390 px phone:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
npx -y @fleox/agent3d@0.2.0 render --project my-banner --size 390x98 --scale 2 --frames 2 --json
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
If the title becomes unreadable: shorter text, bigger `size`, fewer props, or a separate mobile version (a copy of the project with `target.aspect` "4:3" or `target.height`, exported under another `--name`, switched with CSS media queries on the page).
|
|
111
|
+
|
|
112
|
+
## 6. Finish
|
|
113
|
+
|
|
114
|
+
`npx -y @fleox/agent3d@0.2.0 check --project my-banner --render --json` until no errors and no warnings, then re-export (`export --yes` overwrites the previous export folder; tell the user to re-upload `<name>/` and, after an Agent3D update, `agent3d-runtime/`). Skill `agent3d-publish` covers the site side.
|
|
115
|
+
|
|
116
|
+
## Rules
|
|
117
|
+
|
|
118
|
+
- Summarise and render before editing; render after every meaningful change and look at it.
|
|
119
|
+
- Prefer patches over rewriting `scene.json`; never edit `assets/manifest.json` by hand (`assets add|remove`).
|
|
120
|
+
- Plans with `needsConfirmation: true` wrote nothing: show the user what will be removed or replaced and get their agreement before re-running with `--yes`.
|
|
121
|
+
- Don't rename ids casually: timelines, behaviours, cameras (`follow.target`), HUD elements and scripts refer to them.
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# Patch ops cookbook
|
|
2
|
+
|
|
3
|
+
Apply with `npx -y @fleox/agent3d@0.2.0 scene patch --project <dir> --file ops.json --json` (add `--dry-run` to preview, `--yes` when the plan removes something or replaces a whole collection such as `lights`, `postfx`, `objects`, `timeline.tracks` or `ui.elements`: `plan.replaces` lists them). Ops run in order on a copy; the result is validated; on any error nothing is written and the error names the failing op (`details.opIndex`).
|
|
4
|
+
|
|
5
|
+
## Paths
|
|
6
|
+
|
|
7
|
+
| Path | Points at |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `camera`, `camera.position`, `camera.fov` | The camera |
|
|
10
|
+
| `environment.background`, `environment.lighting`, `environment.fog`, `environment.rig`, `environment.contactShadows` | Environment |
|
|
11
|
+
| `lights[0]`, `lights#key`, `lights#key.intensity` | A light by index or by id |
|
|
12
|
+
| `objects#title`, `objects#title.material.color` | An object by id, searched in the whole tree (children too) |
|
|
13
|
+
| `objects#torus.position[1]` | One element of an array |
|
|
14
|
+
| `objects#title.behaviours[0].speed` | A behaviour parameter |
|
|
15
|
+
| `timeline.duration`, `timeline.tracks[0].keys`, `timeline.markers`, `timeline.segments`, `timeline.scroll` | Timeline |
|
|
16
|
+
| `camera.shots`, `camera.shots[1].duration` | Cinematic camera moves |
|
|
17
|
+
| `interactions`, `interactions[0].do` | Hover / click / scroll / key triggers |
|
|
18
|
+
| `ui.elements#retry.text`, `ui.elements#score.visible` | A HUD element by id (`#id` works in any array of objects with ids: `lights#key`, `ui.elements#…`) |
|
|
19
|
+
| `postfx[0].strength`, `target.posterTime`, `ui.elements[2].text`, `data.speed` | Anything else in the scene |
|
|
20
|
+
|
|
21
|
+
An unknown id fails with `invalid` and the hint lists how to find ids (`object list`).
|
|
22
|
+
|
|
23
|
+
## Objects
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
[
|
|
27
|
+
{ "op": "addObject", "object": { "id": "props", "kind": "group", "position": [0, 0, -1] } },
|
|
28
|
+
{ "op": "addObject", "parent": "props", "object": { "id": "crystal", "kind": "mesh", "geometry": { "type": "icosahedron", "radius": 0.6 }, "material": { "preset": "glass" }, "position": [7.5, 0, 0] } },
|
|
29
|
+
{ "op": "updateObject", "id": "title", "set": { "text": "Spring sale", "size": 0.9 } },
|
|
30
|
+
{ "op": "moveObject", "id": "torus", "parent": "props", "index": 0 },
|
|
31
|
+
{ "op": "moveObject", "id": "torus", "parent": null }
|
|
32
|
+
]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Object kinds: `mesh` (geometry + material), `text`, `model` (`src` = `assets/…` or `library:<id>`, `fit`, `animation`), `group`, `generator` (`generator` + `params` + `seed`), `particles` (`preset` + overrides), `instances` (one geometry many times: `layout` grid / scatter / circle / list), `svg` (inline markup or a project path, extruded). Common fields: `position`, `rotation` (degrees), `scale` (number or [x, y, z]), `visible`, `castShadow`, `receiveShadow`, `behaviours`, `children`, `tags`, `body` (physics), `href` (click opens a URL, pointer cursor), `userData`, `attach: "camera"` (top-level objects: rides with the camera; `position` / `rotation` are then in camera space, x right, y up, -z forward — `[0, -1.2, -6]` = 6 units in front of the lens — for captions and chapter labels that stay on screen during shots and scroll stories).
|
|
36
|
+
|
|
37
|
+
Duplicating a prop: `object get <id>`, change its `id` and `position`, `addObject`. Many copies: one `instances` object instead (cheaper):
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{ "op": "addObject", "object": { "id": "coins", "kind": "instances", "geometry": { "type": "cylinder", "radiusTop": 0.3, "radiusBottom": 0.3, "height": 0.08 }, "material": { "preset": "gold" }, "layout": { "type": "circle", "count": 12, "radius": 4 } } }
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Text and letters
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
[
|
|
47
|
+
{ "op": "updateObject", "id": "title", "set": { "font": "inter-black", "splitLetters": true, "outline": { "width": 0.05, "color": "#1a1033" } } },
|
|
48
|
+
{ "op": "addTrack", "track": { "target": "title/0.rotation.z", "keys": [[0, 0], [1, 12, "outBack"], [2, 0, "inOutSine"]] } },
|
|
49
|
+
{ "op": "addTrack", "track": { "target": "children:title.position.y", "keys": [[0, "-=1"], [0.8, "+=0", "outCubic"]], "stagger": 0.05, "staggerFrom": "center" } },
|
|
50
|
+
{ "op": "addTrack", "track": { "target": "title/2.material.color", "keys": [[0, "#ffffff"], [1, "#ffd166"]] } }
|
|
51
|
+
]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`splitLetters` makes each glyph a child `<id>/<n>` (n = 0, 1, … counting non-space characters, line after line) with its own pivot and material. `children:<id>` targets every letter. A simpler per-letter entrance without tracks: `"reveal": { "effect": "rise", "stagger": 0.05, "duration": 0.7, "delay": 0.2, "order": "forward" }` (effects rise, fade, scale, spin, drop; it implies `splitLetters`). Other text fields: `font` (`catalog fonts`), `size`, `depth` (0 = flat), `bevel` (a number: bevel size in scene units, 0 = sharp), `letterSpacing` (scene units, scale it with `size`), `lineHeight`, `maxWidth` (wraps on spaces), `kerning` (on by default), `align`. Validation rejects a `<id>/<n>` target on a text that is not split, but not a letter index past the end: count the letters yourself. The block is centred vertically on `position` and placed by `align` (`center` default, `left` = lines start at x, `right` = lines end at x); extra lines grow it up and down. Split letters × `outline` = two meshes per letter (draw calls add up fast).
|
|
55
|
+
|
|
56
|
+
## Materials
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
[
|
|
60
|
+
{ "op": "set", "path": "objects#title.material", "value": { "preset": "gold" } },
|
|
61
|
+
{ "op": "updateObject", "id": "title", "set": { "material": { "roughness": 0.25 } } },
|
|
62
|
+
{ "op": "set", "path": "objects#logo.material", "value": { "preset": "neon", "color": "#3ee8ff", "emissive": "#3ee8ff", "emissiveIntensity": 2.5 } },
|
|
63
|
+
{ "op": "set", "path": "objects#backdrop.material", "value": { "type": "shader", "shader": "gradientFlow", "uniforms": { "colors": ["#ff7eb3", "#7afcff", "#feffb7"], "speed": 0.3 } } },
|
|
64
|
+
{ "op": "set", "path": "objects#floor.material", "value": { "preset": "matte", "map": "library:textures/wood-planks-color.jpg", "normalMap": "library:textures/wood-planks-normal.jpg", "roughnessMap": "library:textures/wood-planks-roughness.jpg", "repeat": [4, 4] } }
|
|
65
|
+
]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
[
|
|
70
|
+
{ "op": "addObject", "object": { "id": "plinth", "kind": "mesh", "geometry": { "type": "cylinder", "radiusTop": 1.6, "radiusBottom": 1.6, "height": 0.4 }, "position": [0, -2.2, -1.5],
|
|
71
|
+
"material": { "type": "physical", "color": "#ffffff", "roughness": 0.35, "map": { "procedural": "wood", "rings": 14 }, "bumpMap": { "procedural": "wood", "rings": 14 }, "bumpScale": 0.3, "clearcoat": 0.6 } } },
|
|
72
|
+
{ "op": "updateObject", "id": "plinth", "set": { "material": { "triplanar": 0.5 } } },
|
|
73
|
+
{ "op": "set", "path": "objects#plinth.material.roughnessMap", "value": { "procedural": "noise" } },
|
|
74
|
+
{ "op": "set", "path": "objects#blob.material", "value": { "preset": "carPaint", "color": "#c2183c" } }
|
|
75
|
+
]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`set` replaces (use it to change the look), `updateObject` merges (use it for one property). Models accept a `material` override too (it recolours every mesh of the model).
|
|
79
|
+
|
|
80
|
+
- Presets: `catalog materialPresets` (the photoreal set: carPaint, ceramic, marble, terrazzo, wood, carbonFiber, leather, satin, silk, brushedAluminium, ice, water, diamond, gem, jelly, chromeGradient, soapBubble, mattePastel, emissiveGradient).
|
|
81
|
+
- Texture slots (`map`, `normalMap`, `roughnessMap`, `metalnessMap`, `aoMap`, `emissiveMap`, `bumpMap`, `displacementMap`, `alphaMap`) take a path, a `library:` id or a procedural texture `{ "procedural": "<id>", …params }` (`catalog textures`: marble, wood, terrazzo, carbon, noise, voronoi, flakes, brushed, grid, checker, stripes, dots; zero bytes, seamless). `triplanar` (true or repeats per unit) projects them without UVs (generators, stretched shapes).
|
|
82
|
+
- `"type": "physical"` unlocks `transmission`, `thickness`, `ior`, `clearcoat`, `iridescence`, `sheen`, `anisotropy`, `attenuationColor`, `dispersion`… (full list in `docs/scene-format.md`).
|
|
83
|
+
|
|
84
|
+
## Lights and environment
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
[
|
|
88
|
+
{ "op": "set", "path": "lights#key.intensity", "value": 2.4 },
|
|
89
|
+
{ "op": "set", "path": "lights#rim.color", "value": "#ffb366" },
|
|
90
|
+
{ "op": "set", "path": "environment.lighting", "value": "sunset" },
|
|
91
|
+
{ "op": "set", "path": "environment.lightingIntensity", "value": 0.6 },
|
|
92
|
+
{ "op": "set", "path": "environment.background", "value": { "radial": ["#2b2d6e", "#0d0e24"] } },
|
|
93
|
+
{ "op": "set", "path": "environment.fog", "value": { "color": "#ffd8a8", "near": 30, "far": 90 } },
|
|
94
|
+
{ "op": "set", "path": "environment.ground", "value": { "y": 0, "size": 20, "shadowOnly": true } },
|
|
95
|
+
{ "op": "addBehaviour", "id": "key", "behaviour": { "type": "flicker", "amount": 0.2, "speed": 6 } }
|
|
96
|
+
]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
A product studio in five ops (a light rig replaces the hand-placed lights; contact shadows ground the subject):
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
[
|
|
103
|
+
{ "op": "set", "path": "environment.background", "value": { "radial": ["#f6efe8", "#d8cbbf"], "center": [0.5, 0.62] } },
|
|
104
|
+
{ "op": "set", "path": "environment.lighting", "value": { "hdri": "library:hdri/softbox.hdr", "intensity": 1 } },
|
|
105
|
+
{ "op": "set", "path": "environment.rig", "value": { "preset": "softbox", "intensity": 1.1 } },
|
|
106
|
+
{ "op": "set", "path": "environment.contactShadows", "value": { "opacity": 0.6, "blur": 2.5 } },
|
|
107
|
+
{ "op": "set", "path": "lights", "value": [] }
|
|
108
|
+
]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Outdoors and abstract backgrounds (each `set` replaces the previous background; `remove` asks for `--yes`):
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
[
|
|
115
|
+
{ "op": "set", "path": "environment.background", "value": { "sky": { "preset": "golden-hour", "sun": { "azimuth": 125 } } } },
|
|
116
|
+
{ "op": "remove", "path": "environment.lighting" },
|
|
117
|
+
{ "op": "set", "path": "environment.fog", "value": { "density": 0.025, "height": 1, "falloff": 0.25 } },
|
|
118
|
+
{ "op": "set", "path": "environment.background", "value": { "meshGradient": ["#ff9a8b", "#ff6a88", "#7b5cff", "#2ad4ff"], "speed": 0.15 } },
|
|
119
|
+
{ "op": "set", "path": "environment.background", "value": { "hdri": "library:hdri/forest.jpg", "rotation": 120, "groundProjection": { "height": 2, "radius": 60 } } },
|
|
120
|
+
{ "op": "set", "path": "environment.shadows", "value": { "type": "vsm", "softness": 4 } }
|
|
121
|
+
]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
- Backgrounds: a colour, `"transparent"` (also set `target.transparent: true`), `{ "gradient": [c1, c2, c3], "angle": 0, "grain": 0.03 }`, `{ "radial": [centre, edge], "center": [x, y] }`, `{ "meshGradient": [2-6 colours], "speed", "scale", "seed" }`, a gradient sky `{ "sky": { "top", "horizon", "bottom", "sun", "stars" } }`, a **physical sky** `{ "sky": { "preset": "sunrise" | "morning" | "noon" | "afternoon" | "golden-hour" | "sunset" | "dusk", "sun": { "elevation", "azimuth" }, "clouds", "turbidity" } }` (it adds a matching sun light and lights the scene: drop `environment.lighting`), `{ "hdri": "library:hdri/sunset.jpg", "blur": 0.3, "rotation": deg, "groundProjection": true }`.
|
|
125
|
+
- `lighting`: `studio`, `soft`, `sunset`, `night`, `neutral`, `sky`, `none` (procedural, zero bytes) or `{ "hdri": path, "intensity", "rotation" }`. Library HDRIs: `assets library --kind hdri`.
|
|
126
|
+
- `fog`: linear `{ color, near, far }`, exponential `{ color, density }`, height fog `{ density, height, falloff }` (colour defaults to the sky horizon).
|
|
127
|
+
- `rig`: `catalog lightRigs` (studio-3point, softbox, product-top, rim, dramatic, golden-hour, noon, overcast, neon, moonlight), or `{ "preset", "intensity", "rotation", "scale", "castShadow", "color" }`. Its lights add to `lights`: empty or dim those when the rig does the job. Rigs assume a subject about 1-3 units around the origin (`scale` for bigger scenes).
|
|
128
|
+
- `contactShadows`: `true` or `{ "opacity", "blur", "far", "y", "size", "resolution", "color", "frames": 1 }` (soft shadows under objects, no shadow-casting light). `shadows`: `{ "type": "pcf" | "vsm", "softness", "mapSize", "intensity" }` for shadow-casting lights.
|
|
129
|
+
- Lights (`type`): ambient, hemisphere (`skyColor`, `groundColor`), directional, point (`distance`, `decay`), spot (`angle`, `penumbra`, `target`, `volumetric: true` for a visible beam), rect (`width`, `height`, `panel: true` draws the glowing panel).
|
|
130
|
+
|
|
131
|
+
Adding a light: `{ "op": "set", "path": "lights", "value": [ …the whole array… ] }` (read it with `scene get --path lights` first) or `{ "op": "merge", "path": "lights#rim", "value": { "intensity": 20 } }` to tune one.
|
|
132
|
+
|
|
133
|
+
## Camera
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
[
|
|
137
|
+
{ "op": "set", "path": "camera.position", "value": [0, 1.5, 9] },
|
|
138
|
+
{ "op": "set", "path": "camera.target", "value": [0, 1, 0] },
|
|
139
|
+
{ "op": "set", "path": "camera.fov", "value": 35 },
|
|
140
|
+
{ "op": "merge", "path": "camera", "value": { "controls": "orbit", "autoRotate": 10, "orbitZoom": false, "orbitLimits": { "minPolar": 50, "maxPolar": 95 } } }
|
|
141
|
+
]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`orbitLimits` takes `minDistance`, `maxDistance`, `minPolar` / `maxPolar` (degrees from straight above) and `minAzimuth` / `maxAzimuth` (degrees around Y, 0 = camera on +Z: `-45` / `45` keeps a product's back hidden).
|
|
145
|
+
|
|
146
|
+
Cinematic shots and handheld shake (shots run on the timeline clock, scroll-driven with `trigger: "scroll"`; a `focus` shot needs a `dof` effect in `postfx`):
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
[
|
|
150
|
+
{ "op": "merge", "path": "camera", "value": { "controls": "none", "lookAt": "blob", "shake": { "amount": 0.02, "rotation": 0.25, "speed": 0.4 }, "shots": [
|
|
151
|
+
{ "type": "pushIn", "at": 0, "duration": 2, "distance": 2.5 },
|
|
152
|
+
{ "type": "orbit", "at": 2, "duration": 2, "angle": 40, "elevation": 10 },
|
|
153
|
+
{ "type": "focus", "at": 3, "duration": 1, "object": "blob" }
|
|
154
|
+
] } },
|
|
155
|
+
{ "op": "set", "path": "camera.shots[1].duration", "value": 3 },
|
|
156
|
+
{ "op": "set", "path": "postfx", "value": [{ "type": "look", "preset": "cinematic" }, { "type": "dof", "aperture": 0.003 }] }
|
|
157
|
+
]
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Shot types: `dolly`, `pushIn`, `pullOut`, `truck`, `pedestal`, `crane`, `orbit`, `zoom`, `move`, `path` (`points`, `lookAt`), `lookAt`, `focus`; each has `at`, `duration`, `ease` (default `inOutCubic`). `lookAt` on the camera keeps an object centred (replaces `target`).
|
|
161
|
+
|
|
162
|
+
Controls: `none`, `orbit` (drag), `parallax` (drifts with the pointer: `parallax.strength`, `smoothing`), `scroll` (follows `scrollPath` with the page scroll), `follow` (games: `follow.target`, `offset`, `smoothing`). Orthographic: `"type": "orthographic", "zoom": 10` (world units visible vertically; isometric looks).
|
|
163
|
+
|
|
164
|
+
## Timeline
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
[
|
|
168
|
+
{ "op": "addTrack", "track": { "target": "title.rotation.y", "keys": [[0, -5], [4, 5], [8, -5]], "ease": "inOutSine" } },
|
|
169
|
+
{ "op": "addTrack", "track": { "target": "camera.position", "keys": [[0, [0, 0, 12]], [8, [0, 0, 11]]], "ease": "inOutSine" } },
|
|
170
|
+
{ "op": "addTrack", "track": { "target": "key.intensity", "keys": [[0, 2], [4, 3], [8, 2]] } },
|
|
171
|
+
{ "op": "addTrack", "track": { "target": "title.material.color", "keys": [[0, "#ffffff"], [4, "#ffd166"], [8, "#ffffff"]] } },
|
|
172
|
+
{ "op": "addTrack", "track": { "target": "badge.visible", "keys": [[0, false], [1.5, true]], "ease": "step" } },
|
|
173
|
+
{ "op": "merge", "path": "timeline", "value": { "duration": 8, "loop": true, "trigger": "visible" } },
|
|
174
|
+
{ "op": "removeTrack", "target": "title.rotation.y" }
|
|
175
|
+
]
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
`addTrack` replaces an existing track with the same target. Colour keys blend in OKLCh by default (perceptual: orange → teal stays saturated instead of going grey); `"colorSpace": "oklab" | "rgb" | "hsl"` on the track changes it. Values: numbers, [x, y, z], colours, booleans, or relative strings `"+=1"`, `"-=0.5"`, `"*=1.2"` (from the property's rest value). `loop`: true, false or `"pingpong"`. A track on a property that a behaviour also drives (e.g. `position.y` + `float`) fights it: animate a parent group instead. Every key time must be within `duration` (validation warns otherwise).
|
|
179
|
+
|
|
180
|
+
Per-key easing, parametric eases, relative values and staggered multi-target tracks:
|
|
181
|
+
|
|
182
|
+
```json
|
|
183
|
+
[
|
|
184
|
+
{ "op": "updateObject", "id": "torus", "set": { "tags": ["prop"] } },
|
|
185
|
+
{ "op": "updateObject", "id": "gem", "set": { "tags": ["prop"] } },
|
|
186
|
+
{ "op": "updateObject", "id": "pill", "set": { "tags": ["prop"] } },
|
|
187
|
+
{ "op": "addTrack", "track": { "target": "tag:prop.scale", "keys": [[0, 0.001], [0.8, 1, "spring(170, 12)"]], "stagger": 0.1, "staggerFrom": "center" } },
|
|
188
|
+
{ "op": "addTrack", "track": { "target": "torus,gem.rotation.z", "keys": [[0, 0], [4, 20, "inOutQuart"], [8, 0, "inOutQuart"]], "stagger": 0.5 } },
|
|
189
|
+
{ "op": "set", "path": "timeline.tracks[0].keys[1]", "value": [4, 5, "inOutSine"] }
|
|
190
|
+
]
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
- A key's third element is the ease of the segment that ends at it; the track `ease` is the default. Eases: `linear`, `step`, `in` / `out` / `inOut` + `Quad`, `Cubic`, `Quart`, `Quint`, `Sine`, `Expo`, `Circ`, `Back`, `Elastic`, `Bounce`, `"cubicBezier(x1, y1, x2, y2)"`, `"spring(stiffness, damping[, mass])"`, `"steps(n)"`.
|
|
194
|
+
- Selectors: an id, `a,b,c`, `tag:<tag>` (scene order), `children:<id>` (direct children, or the letters of a split text), `<textId>/<n>`, `camera`, `environment`, `postfx`. `stagger` (s) offsets each target; `staggerFrom`: `start`, `end`, `center`, `edges`, `random`.
|
|
195
|
+
- `postfx.<type>.<param>` (e.g. `postfx.vignette.darkness`, `postfx.dof.focus`) only targets effects written in `postfx`: the effects a `look` expands to are not targetable, so add the effect next to the look first.
|
|
196
|
+
|
|
197
|
+
Markers, segments and a hover state (pairs with the interactions below; on a starter, also shorten or remove its 8 s title track, or validation warns that its last key is never reached):
|
|
198
|
+
|
|
199
|
+
```json
|
|
200
|
+
[
|
|
201
|
+
{ "op": "merge", "path": "timeline", "value": { "duration": 4, "loop": false, "autoplay": "intro", "markers": { "lifted": 2.6 }, "segments": { "intro": { "from": 0, "to": 2 }, "hover-in": [2, "lifted"], "hover-out": ["lifted", 2] } } },
|
|
202
|
+
{ "op": "addTrack", "track": { "target": "blob.position.y", "keys": [[2, "+=0"], [2.6, "+=0.5", "outBack"]] } },
|
|
203
|
+
{ "op": "addTrack", "track": { "target": "blob.scale", "keys": [[0, 0.001], [1.2, 1, "spring(170, 12)"]] } }
|
|
204
|
+
]
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
`markers: { name: seconds }` emit an event when crossed; `segments: { name: { from, to, loop?, speed? } | [from, to] }` (seconds or marker names; `to < from` plays backwards); `autoplay`: `true`, `false` or a segment name. `trigger`: `load`, `visible`, `hover`, `click`, `scroll`, `manual` (only interactions move the clock).
|
|
208
|
+
|
|
209
|
+
Scroll-driven (time = scroll progress through the element; `agent3d render --count 8` shows the states, `--scroll 0.5` one position):
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
[
|
|
213
|
+
{ "op": "merge", "path": "timeline", "value": { "trigger": "scroll", "scroll": { "start": "top bottom", "end": "bottom top", "smoothing": 0.8 } } }
|
|
214
|
+
]
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
`scroll.start` / `end`: `"<element edge> <viewport edge>"` with edges `top`, `center`, `bottom`, `N%`, `Npx`.
|
|
218
|
+
|
|
219
|
+
## Interactions
|
|
220
|
+
|
|
221
|
+
These play the segments of the markers block above (a segment must exist before an interaction names it):
|
|
222
|
+
|
|
223
|
+
```json
|
|
224
|
+
[
|
|
225
|
+
{ "op": "set", "path": "interactions", "value": [
|
|
226
|
+
{ "on": "hover", "target": "blob", "do": [{ "play": "hover-in" }] },
|
|
227
|
+
{ "on": "hoverEnd", "target": "blob", "do": [{ "play": "hover-out" }] },
|
|
228
|
+
{ "on": "click", "target": "blob", "do": [{ "openUrl": "https://shop.example.com/nova" }, { "emit": "blob-click" }] },
|
|
229
|
+
{ "on": "event", "event": "lifted", "do": [{ "set": { "path": "title.material.color", "value": "#e8336d" }, "duration": 0.2 }] }
|
|
230
|
+
] }
|
|
231
|
+
]
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
- `on`: `click`, `hover`, `hoverEnd` (on `target`, or the whole canvas), `visible`, `scroll` (`at`: progress crossed downward), `key` (`key`: a `KeyboardEvent.code` such as `Space`), `event` (a marker or emitted name); `once: true` fires once.
|
|
235
|
+
- Actions (`do`, in order): `{ "play": "<segment>" | "timeline", "reverse"? }`, `{ "toggle": "<segment>" }`, `{ "seek": seconds | "<marker>" }`, `{ "set": { "path": "<track target>", "value" }, "duration"?, "ease"? }`, `{ "emit": "<name>" }`, `{ "openUrl": "https://..." | "/path", "newTab"? }` (click / key only; the only way a scene navigates), `{ "playClip": "<clip>", "target": "<modelId>", "crossfade"? }`.
|
|
236
|
+
- Segments named in `play` / `toggle` must exist in `timeline.segments` (validation says so). Targets get a pointer cursor.
|
|
237
|
+
- Without patches (MCP or the CLI tool runner): `interactions_set` appends with `add` or replaces with `interactions`:
|
|
238
|
+
```bash
|
|
239
|
+
npx -y @fleox/agent3d@0.2.0 tools call interactions_set --input '{"add": [{"on": "click", "target": "blob", "do": [{"toggle": "hover-in"}]}], "dryRun": true}' --project my-hero --json
|
|
240
|
+
```
|
|
241
|
+
- Check hover states headless: `render --input '[{"t": 1.9, "pointer": [0, -0.3]}]' --frames 2,3`.
|
|
242
|
+
|
|
243
|
+
## Behaviours
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
[
|
|
247
|
+
{ "op": "addBehaviour", "id": "logo", "behaviour": { "type": "hoverScale", "scale": 1.1 } },
|
|
248
|
+
{ "op": "addBehaviour", "id": "logo", "behaviour": { "type": "spinOnClick", "when": "click" } },
|
|
249
|
+
{ "op": "set", "path": "objects#logo.behaviours", "value": [{ "type": "float", "amplitude": 0.1, "speed": 0.3 }, { "type": "rotate", "speed": 15 }] },
|
|
250
|
+
{ "op": "set", "path": "objects#logo.behaviours[1].speed", "value": 10 }
|
|
251
|
+
]
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Every behaviour and its parameters: `catalog behaviours` (or `catalog behaviours <id>`).
|
|
255
|
+
|
|
256
|
+
## Post effects, target, accessibility
|
|
257
|
+
|
|
258
|
+
```json
|
|
259
|
+
[
|
|
260
|
+
{ "op": "set", "path": "postfx", "value": [{ "type": "look", "preset": "product" }, { "type": "vignette", "darkness": 0.3 }] },
|
|
261
|
+
{ "op": "set", "path": "postfx", "value": [{ "type": "bloom", "strength": 0.5, "threshold": 0.85 }, { "type": "vignette", "darkness": 0.9 }] },
|
|
262
|
+
{ "op": "set", "path": "postfx", "value": [{ "type": "look", "preset": "product" }, { "type": "dof", "focusOn": "blob", "aperture": 0.003 }, { "type": "vignette", "darkness": 0.3 }] },
|
|
263
|
+
{ "op": "merge", "path": "target", "value": { "quality": "auto" } },
|
|
264
|
+
{ "op": "merge", "path": "target", "value": { "posterTime": 2, "reducedMotion": "static", "maxDpr": 1.5 } },
|
|
265
|
+
{ "op": "set", "path": "ariaLabel", "value": "Golden Crust Bakery: a warm 3D title with floating pastries" },
|
|
266
|
+
{ "op": "remove", "path": "postfx" }
|
|
267
|
+
]
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
- `{ "type": "look", "preset": "cinematic" | "product" | "dreamy" | "neon" | "retro" | "clean", "intensity": 0..1 }` expands into a tuned stack (`catalog postfx look` lists each expansion); an effect next to it overrides the matching expanded effect param by param. Effects and their GPU cost: `catalog postfx`. `check` reports `budget.gpu` and a `postfx-cost` issue when the stack is heavy (or `ao` / `dof` on a game).
|
|
271
|
+
- `target.quality`: `auto` (default: adapts to the device and frame rate), `low`, `medium`, `high`, `ultra`. Leave `auto` unless the user asks.
|
|
272
|
+
|
|
273
|
+
## Validation messages you will meet
|
|
274
|
+
|
|
275
|
+
- `unknown-param` (warning): a parameter the catalog doesn't know is ignored. The hint suggests the right name (e.g. `cylinder` takes `radiusTop` / `radiusBottom`, not `radius`).
|
|
276
|
+
- `unknown id` / "did you mean" (error): a geometry, preset, behaviour, generator… that doesn't exist.
|
|
277
|
+
- Range / type errors: the message gives the allowed range from the catalog.
|
|
278
|
+
- `invalid` from an op (no such id, bad path): fix the op; nothing was written.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent3d-game
|
|
3
|
+
description: Build a mini game or an interactive 3D experience for a web page with Agent3D scripts - a sandboxed ScriptApi (objects, input with keyboard, pointer and touch swipes, rigid-body physics with real shapes, joints, a character controller and collision events, spawning and cloning, HUD with placeholders, synth sounds, best-score storage, events), game patterns (ready / play / over state machine, difficulty ramp, attract mode so screenshots show action), and testing through deterministic headless renders. Use when the user wants a playable game, a quiz-like interaction, a clickable 3D configurator or anything that needs logic beyond behaviours and timelines.
|
|
4
|
+
license: PolyForm-Noncommercial-1.0.0
|
|
5
|
+
compatibility: Requires Node.js 22+ and Google Chrome (or Chromium/Edge) for renders.
|
|
6
|
+
metadata:
|
|
7
|
+
version: "0.2.0"
|
|
8
|
+
repository: "https://github.com/fleox/agent3d"
|
|
9
|
+
allowed-tools: Bash Read Write
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Mini games with Agent3D
|
|
13
|
+
|
|
14
|
+
A game is an ordinary scene (`target.kind: "game"`) plus **scripts**: ES modules listed in `scene.scripts`, each exporting a factory that gets the sandboxed `api` and returns lifecycle hooks. Everything else (objects, HUD, sounds, physics bodies, data) stays declarative in `scene.json`.
|
|
15
|
+
|
|
16
|
+
**Language:** talk to the user in their language; keep commands, ids, code and files in English.
|
|
17
|
+
|
|
18
|
+
Every command is `npx -y @fleox/agent3d@0.2.0 <command> --json` with `--project <dir>`. Read `error.hint` when `ok` is false.
|
|
19
|
+
|
|
20
|
+
## Start
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx -y @fleox/agent3d@0.2.0 new dodge --target game --title "Dodge" --json
|
|
24
|
+
npx -y @fleox/agent3d@0.2.0 scene summary --project dodge --json
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The game starter has a `kinematic` player moved by position, coins with a `coin` tag, a follow camera, a score HUD, a coin sound and `scripts/game.js` (move with arrows / WASD, collect coins). Game templates to start from (`templates list --json`): `game-coin-collector`, `game-runner`, `game-maze`, `game-tap-targets`, `game-physics-playground` (rigid bodies, impulses, impact sounds) — `new my-game --template game-physics-playground --json`. A complete validated example (lane runner: lanes, spawning by cloning, difficulty ramp, best score, attract mode) is in skill `agent3d-create` → `references/recipes.md` ("Lane runner game"; "Physics toss game" for rigid bodies); patterns in [references/game-patterns.md](references/game-patterns.md); the full API in [references/script-api.md](references/script-api.md).
|
|
28
|
+
|
|
29
|
+
## The script contract
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
// scripts/game.js — no imports: everything comes from `api`.
|
|
33
|
+
export default function (api) {
|
|
34
|
+
const player = api.get("player");
|
|
35
|
+
return {
|
|
36
|
+
start() { api.state.phase = "ready"; api.state.score = 0; },
|
|
37
|
+
update(dt, t) { /* every fixed step (default 1/60 s) */ },
|
|
38
|
+
onEvent(name, payload) { /* HUD button actions and api.emit() */ },
|
|
39
|
+
dispose() {},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- `update(dt, t)` runs at a fixed step (`scene.physics.step`, default 1/60): the game is a pure function of time and input, so headless renders are reproducible.
|
|
45
|
+
- `api.state` is shared with the HUD: `"text": "Score {score}"` interpolates it, `"visible": "phase == 'over'"` evaluates a small safe expression (comparisons, `&&`, `||`, `!`, strings, numbers).
|
|
46
|
+
- `api.data` is `scene.data` (tuning, level layouts): keep numbers there so they can be patched without touching code.
|
|
47
|
+
- Randomness: `api.random()` / `api.randomRange(a, b)` (seeded by `scene.seed`), never `Math.random()` (renders would differ every time).
|
|
48
|
+
|
|
49
|
+
## Sandbox rules (`check` enforces them)
|
|
50
|
+
|
|
51
|
+
Scripts only get `api`. `check` fails (`forbidden-script`) on `fetch`, `XMLHttpRequest`, `WebSocket`, `EventSource`, `eval`, `Function`, `import` / `import()` / `import.meta`, `document`, `window`, `globalThis`, `self`, `localStorage` / `sessionStorage` / `indexedDB` / cookies, `parent`, `top`, `opener`, `postMessage`, `importScripts`, `navigator`, `location`, `Worker`. Use `api.storage` for the best score, `api.ui` for the HUD, `api.input` for keys and touch, `api.audio` for sounds. Words in strings and comments are not flagged; property names like `obj.parent` are fine.
|
|
52
|
+
|
|
53
|
+
## Workflow
|
|
54
|
+
|
|
55
|
+
1. Design the loop with the user in one paragraph: goal, controls (keyboard + touch), how you lose, what the score counts, how long a round lasts (30–90 s for a web page).
|
|
56
|
+
2. Declare the scene: player and obstacle templates (hidden, with `tags` and a `body`), camera, HUD elements per phase, sounds (`catalog sounds`), `data` for tuning.
|
|
57
|
+
3. Write the script (patterns below). Keep it under ~200 lines; one file is fine.
|
|
58
|
+
4. Validate and lint: `npx -y @fleox/agent3d@0.2.0 check --project dodge --json` (sandbox errors carry the line: `scripts/game.js:12`).
|
|
59
|
+
5. Render several moments and LOOK:
|
|
60
|
+
```bash
|
|
61
|
+
npx -y @fleox/agent3d@0.2.0 render --project dodge --sheet --frames 0,2,4,6 --json
|
|
62
|
+
```
|
|
63
|
+
Plain renders have no player input, so the game must show something on its own: an **attract mode** (an autopilot plays during the `ready` phase, behind the title and Play button). The HUD is captured because the scene has a `ui` (`--capture page` forces it); posters (`export --format poster`, the embed's `poster.webp`) and videos show the canvas only, without the HUD. Check `data.issues` and `data.consoleErrors` for `script-error`. `data.state` is the script's `api.state` after the last frame (e.g. `{ "score": 0, "phase": "ready" }`); frame and sheet paths are relative to the project folder `data.dir`.
|
|
64
|
+
6. **Play it headlessly** with `--input`: a JSON script of simulated keys / clicks applied while seeking (frames are rendered in time order), then check `data.state` and the frames:
|
|
65
|
+
```bash
|
|
66
|
+
npx -y @fleox/agent3d@0.2.0 render --project dodge --sheet --frames 0,1,2,3 --input '[{"t": 0.2, "click": [0, -0.3]}, {"t": 0.5, "key": "ArrowLeft", "hold": 0.6}, {"t": 1.5, "key": "Space", "down": true}, {"t": 1.6, "key": "Space", "down": false}]' --json
|
|
67
|
+
```
|
|
68
|
+
Events: `{ "t", "key", "down" }` (`key` is a `KeyboardEvent.code`: `ArrowLeft`, `KeyA`, `Space`…; `down: false` releases), `{ "t", "key", "hold": seconds }` (press and release), `{ "t", "click": [x, y] }`, `{ "t", "pointer": [x, y] }` (add `"down": true` / `false` to press / release there), `{ "t", "pointerDown": [x, y] }` and `{ "t", "pointerUp": [x, y] }` (hold the pointer: `api.input.pointer.down`), `{ "t", "drag": { "from": [x, y], "to": [x, y], "duration": 0.4 } }` (press, move, release), `{ "t", "swipe": "left" | "right" | "up" | "down" }` (what `api.input.swipe()` returns next step), `{ "t", "scroll": 0.5 }` (page scroll progress, scroll-driven scenes), `{ "t", "ui": "retryBtn" }` (click that HUD button by id — a warning in `inputWarnings` when it is hidden at that time), `{ "t", "emit": "retry" }` (emit the event / button action directly), `{ "t", "segment": "intro" }` (play a timeline segment) — canvas coordinates −1..1, y up (a canvas `click` never presses a HUD button: use `ui`). Unknown fields are rejected (exit 2, the hint lists the valid shapes). Test the touch controls too, e.g. `--input '[{"t": 0.5, "swipe": "left"}, {"t": 1.2, "drag": {"from": [0, -0.5], "to": [0, 0.3], "duration": 0.3}}]'`. Use `@inputs.json` for longer scripts. MCP: `render_preview` takes the same events as `input`.
|
|
69
|
+
7. To test a state that is hard to reach with input (game over screen, high score), temporarily set the starting phase in `api.data` (e.g. `"startPhase": "over"`), render, then restore it.
|
|
70
|
+
8. `check`, then `export` (skill `agent3d-publish`). Games export like any scene; the embed gets keyboard focus on click (`tabindex`, `role="application"`).
|
|
71
|
+
|
|
72
|
+
## Game patterns in one screen
|
|
73
|
+
|
|
74
|
+
- **Phases**: `ready` (title, Play button, attract mode) → `play` → `over` (score, Retry button). HUD elements use `visible` expressions on `phase`; buttons emit their `action` to `onEvent`.
|
|
75
|
+
- **Input**: `api.input.pressed("ArrowLeft")` (went down this step) for discrete moves, `isDown` for continuous movement, `api.input.swipe()` for touch ("left" / "right" / "up" / "down"), `api.input.pointer` (normalised −1..1, `down`, `justPressed`), `api.input.pointerWorld()` for aiming on the ground plane. Always support both keyboard and touch.
|
|
76
|
+
- **Spawning**: hide a template object (`"visible": false`), then `api.clone("block", { id, position })` (synchronous, cheap) and set `visible = true`; `obj.remove()` when it leaves the screen. Keep your own array of live clones.
|
|
77
|
+
- **Physics** (real rigid bodies, cannon-es, deterministic fixed step): give objects a `body` — `type` `static` (floor, walls), `dynamic` (simulated: it falls, **rotates**, tumbles, stacks, sleeps), `kinematic` (you set its position, it pushes dynamic bodies), `trigger` (overlap detection only); `shape` `box` (default, from the object's own bounds — child objects never enlarge it; `compound` without `shapes` merges them), `sphere`, `cylinder`, `capsule`, `convex`, `trimesh`, `heightfield`, `compound` or `auto`. Pick the body by role:
|
|
78
|
+
|
|
79
|
+
| Role | Body | Drive it with |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| Player moved by position (top-down, lanes, the starter) | `kinematic` | `obj.position.x += …` |
|
|
82
|
+
| Platformer hero (gravity, jumps) | `dynamic`, `capsule`, `"character": true` | `api.physics.moveCharacter` + `jump`, `grounded` |
|
|
83
|
+
| Player driven by velocity / impulses (roller, ship) | `dynamic` + `"fixedRotation": true` | `setVelocity`, `applyImpulse`, `applyForce` |
|
|
84
|
+
| Props that should tumble (crates, balls, pins) | `dynamic` (`sphere` for balls, `ccd` for fast ones) | impulses, collisions |
|
|
85
|
+
| Pickups, goals, kill zones | `trigger` | `onTriggerEnter`, `overlaps` |
|
|
86
|
+
| Moving platforms | `kinematic` | position every update (pushes props, carries characters standing on it — never move the hero with it yourself) |
|
|
87
|
+
|
|
88
|
+
A dynamic player without `character` / `fixedRotation` tips over as soon as friction acts on it. Events: `onCollision((a, b, info) => …)` (`info.impulse` gates impact sounds), `onTriggerEnter` / `Exit`, `contacts`, `raycast` on the real shapes. Joints (`physics.joints`: hinge, point, distance, lock, spring) build doors, pendulums, chains, wheels. `"physics": { "debug": true }` + a render shows the colliders. Recipes: `references/game-patterns.md` → Physics recipes; complete example: template `game-physics-playground`.
|
|
89
|
+
- **Motion from scripts**: timeline markers (`timeline.markers`) reach scripts as events — `api.on("peak", fn)` or `onEvent("peak", { marker, time })` — so a timeline can cue gameplay. Segments are played by `scene.interactions` (`on: click | hover | key | scroll | event`, `do: [{ "play": "<segment>" }]`) and by the page (`element.trigger`, `player.playSegment`); a script plays one by emitting an event: `api.emit("win")` (and HUD button `action`s) fire `{ "on": "event", "event": "win", "do": [{ "play": "celebrate" }] }`. Per-frame gameplay feedback stays in `update` (scale, position, `setColor`). `api.camera.shake(intensity, duration)` for hits; `camera.shake` / `camera.shots` in the scene are for cinematic (non-game) motion.
|
|
90
|
+
- **Links**: scripts cannot navigate. A "Shop now" / "Play the full game" object gets an `href` or a click interaction `{ "openUrl": "https://…" }` (user gesture only; renders emit an `openUrl` event instead).
|
|
91
|
+
- **Page ↔ game**: every `api.emit(name, payload)` (and HUD button action) reaches the page as an `agent3d:event` DOM event on `<agent3d-scene>`, and `element.trigger(name, payload)` from the page calls `api.on(name)` / `onEvent` (e.g. report the score, start a level from an HTML button). Details: skill `agent3d-publish`.
|
|
92
|
+
- **Difficulty ramp**: speed and spawn rate grow with time, clamped (`speed = Math.min(max, speed + dt * 0.4)`).
|
|
93
|
+
- **Best score**: `api.storage.get("best")` / `api.storage.set("best", n)` (namespaced, never throws).
|
|
94
|
+
- **Feedback**: `api.audio.play("hit")`, `api.camera.shake(0.3, 0.4)`, `api.ui.toast("+10", 1)`, `obj.setColor(...)`.
|
|
95
|
+
- **Restart**: reset your own state in a function called from `onEvent("retry")`, or `api.restart()` to rebuild the scene from its definition.
|
|
96
|
+
- **HUD look**: `ui.color` (text), `ui.accent` (buttons, pills' accent), `ui.buttonText` (button labels; default: white or near-black, whichever contrasts with the accent), and per element `color` / `background` (a pill, panel, button or bar track: one highlighted pill, a red danger button). `style: "panel"` is a backdrop card for game-over / pause screens (`\n` breaks lines, the first line is the heading); `pill` stays on one line. Patch one element by id: `{ "op": "set", "path": "ui.elements#retry.text", "value": "Try again" }`.
|
|
97
|
+
|
|
98
|
+
## Performance (games need a steady 60 fps)
|
|
99
|
+
|
|
100
|
+
- Post effects: no `ao` or `dof` (and no `look` preset `cinematic` / `product`, which contain `ao`): `check` warns (`postfx-cost`). Avoid `godrays`, `lensflare`, `outline`, `smaa` unless they are the point. Cheap: `bloom`, `grading`, `vignette`, `film`, `chromatic`, `fxaa` (merged or single passes). `taa` costs nothing while playing (it only supersamples stills). Read `data.budget.gpu` of `check`.
|
|
101
|
+
- Leave `target.quality` at `auto` (drops heavy effects and the pixel ratio on weak devices and adapts while playing); `low` for very busy scenes.
|
|
102
|
+
- One shadow-casting light; static level geometry as primitives or `trimesh`; clone templates instead of `spawn` in loops; `remove()` what leaves the screen; keep `physics.substeps` at 1 unless tall stacks jitter.
|
|
103
|
+
|
|
104
|
+
## Rules
|
|
105
|
+
|
|
106
|
+
- No external code, no network, no DOM: only `api`. Tell the user when a request needs something the sandbox forbids (online leaderboards, analytics) and offer a local alternative (best score in storage).
|
|
107
|
+
- Games must be playable on phones: touch swipes / taps for every control, big HUD buttons, no hover-only interactions. The HUD scales with the embed and anchors in one row never overlap (3 × 3 grid; side columns get ~80 px on a 360 px phone): keep side texts short, put sentences in `top` / `center` / `bottom`.
|
|
108
|
+
- Phone sizes: the embed keeps `target.aspect` at any width, so a 16:9 game is 390 × 219 on a 390 px phone — render exactly that (`render --size 390x219`) and check the HUD leaves room for the action. `--size 390x700` shows a taller box, which only happens when `target.height` or the page's CSS sets a height (the camera then widens its vertical view to keep the horizontal framing). For a mobile-first game, use a portrait `target.aspect` (`"9:16"` or `"3:4"`), raise the fov (65–75) or pull the camera back until every lane / target fits, and render at `--width 390`.
|
|
109
|
+
- Audio starts only after a user gesture (browser rule); the HUD shows a mute toggle. Keep sounds short and not too loud (`volume` 0.4–0.6).
|
|
110
|
+
- Reduced motion: games default to `target.reducedMotion: "ignore"` (the player drives the motion); other kinds default to `static`. Don't set `static` on a game: it would freeze it.
|
|
111
|
+
- Keep the first frame meaningful (attract mode) and `target.posterTime` on a frame with action: it is the poster and the reduced-motion still.
|