zhuda-laya-engine 0.0.0-stage → 2.1.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/AGENTS.md +236 -0
- package/CHANGELOG.md +431 -0
- package/LICENSE +41 -0
- package/README.md +247 -2
- package/assets/branding/layaair-tribute-mark.svg +5 -0
- package/assets/branding/zhuda-layaair-mark.svg +34 -0
- package/assets/prefabs/CoinFountainVfx.lh +197 -0
- package/assets/prefabs/ConfirmActionButton.lh +87 -0
- package/assets/prefabs/LevelUpAuraVfx.lh +136 -0
- package/assets/prefabs/MineExplosionParticle.lh +352 -0
- package/assets/prefabs/NineSliceDialogFrame.lh +171 -0
- package/assets/prefabs/SwordSlashTrailVfx.lh +117 -0
- package/assets/prefabs/TacticalHudBar.lh +134 -0
- package/assets/prefabs/TelemetryDashboard.lh +87 -0
- package/assets/prefabs/UnityCrystalGuardian.lh +144 -0
- package/assets/prefabs/ZhudaSpine42Mascot.lh +183 -0
- package/assets/scenes/MinesweeperStage.ls +1180 -0
- package/dist/asset-calibration-report.json +969 -0
- package/dist/build-manifest.json +254 -0
- package/dist/sdk/zhuda-laya-csg.cjs +710 -0
- package/dist/sdk/zhuda-laya-csg.esm.js +683 -0
- package/dist/sdk/zhuda-laya-csg.min.cjs +7 -0
- package/dist/sdk/zhuda-laya-csg.min.esm.js +7 -0
- package/dist/sdk/zhuda-laya-demo.cjs +5990 -0
- package/dist/sdk/zhuda-laya-demo.esm.js +5956 -0
- package/dist/sdk/zhuda-laya-demo.min.cjs +12 -0
- package/dist/sdk/zhuda-laya-demo.min.esm.js +12 -0
- package/dist/sdk/zhuda-laya-engine.cjs +52628 -0
- package/dist/sdk/zhuda-laya-engine.esm.js +51848 -0
- package/dist/sdk/zhuda-laya-engine.min.cjs +2710 -0
- package/dist/sdk/zhuda-laya-engine.min.esm.js +2710 -0
- package/docs/3d-acceptance.md +47 -0
- package/docs/3d-integration.md +190 -0
- package/docs/README.md +112 -0
- package/docs/SUPPORT.md +21 -0
- package/docs/agent-development.md +219 -0
- package/docs/animation-control.md +213 -0
- package/docs/asset-loading.md +97 -0
- package/docs/assets/reference-games.jpg +0 -0
- package/docs/assets/solana-qr.png +0 -0
- package/docs/assets/sponsor-pass.svg +32 -0
- package/docs/audio.md +319 -0
- package/docs/backend-delivery.md +218 -0
- package/docs/basis-textures.md +94 -0
- package/docs/browser-sdk-releases.json +204 -0
- package/docs/browser-sdk.md +187 -0
- package/docs/cinematics.md +267 -0
- package/docs/cloth.md +280 -0
- package/docs/combat-runtime.md +82 -0
- package/docs/consumer-route.md +169 -0
- package/docs/consumer-tooling.md +518 -0
- package/docs/crowd-runtime.md +195 -0
- package/docs/developer-tooling.md +191 -0
- package/docs/film-scenes.md +1504 -0
- package/docs/filmic-rendering.md +743 -0
- package/docs/flythrough.md +89 -0
- package/docs/gpu-depth.md +207 -0
- package/docs/grass.md +127 -0
- package/docs/hdr-environment.md +76 -0
- package/docs/instanced-meshes.md +137 -0
- package/docs/layout-and-media.md +37 -0
- package/docs/layout-wireframe.md +80 -0
- package/docs/lighting-depth.md +185 -0
- package/docs/minigame-packaging.md +79 -0
- package/docs/model-editor.md +66 -0
- package/docs/model-lod.md +122 -0
- package/docs/model-pipeline.md +74 -0
- package/docs/model-showcase.md +365 -0
- package/docs/overview.md +183 -0
- package/docs/plans/README.md +133 -0
- package/docs/plans/TASK-TEMPLATE.md +64 -0
- package/docs/plans/TASK-spine38-isolated-topology-20261106.md +89 -0
- package/docs/plans/TEMPLATE.md +44 -0
- package/docs/plans/VERIFICATION-TEMPLATE.md +45 -0
- package/docs/plans/asset-packaging.md +140 -0
- package/docs/plans/cinematic-production/task.md +97 -0
- package/docs/plans/cinematic-production/verification.md +49 -0
- package/docs/plans/consumer-delivery-followups.md +129 -0
- package/docs/plans/desktop-and-agent-gates/hardening-task.md +85 -0
- package/docs/plans/desktop-and-agent-gates/hardening-verification.md +109 -0
- package/docs/plans/desktop-and-agent-gates/task.md +94 -0
- package/docs/plans/desktop-and-agent-gates/verification.md +60 -0
- package/docs/plans/prefab-toolchain.md +73 -0
- package/docs/plans/preview-runtime-hardening.md +68 -0
- package/docs/platform-adapters.md +113 -0
- package/docs/post-quality.md +242 -0
- package/docs/prefab-editor.md +194 -0
- package/docs/prefab-library.md +94 -0
- package/docs/prefab-workflow.md +75 -0
- package/docs/procedural-assets.md +463 -0
- package/docs/procedural-prefabs.md +133 -0
- package/docs/quality-route.md +386 -0
- package/docs/release-policy.md +79 -0
- package/docs/routes/README.md +180 -0
- package/docs/routes/TEMPLATE.md +54 -0
- package/docs/routes/action-adventure-3d-minigame.md +238 -0
- package/docs/routes/apocalypse-survival-3d.md +219 -0
- package/docs/routes/aqua-freeze-2d-minigame.md +183 -0
- package/docs/routes/astral-minimal-film-look.md +141 -0
- package/docs/routes/cascade-slot.md +93 -0
- package/docs/routes/clip-free-garments.md +229 -0
- package/docs/routes/drop-merge-2d-minigame.md +200 -0
- package/docs/routes/dungeon-line-slot.md +87 -0
- package/docs/routes/film-as-data.md +131 -0
- package/docs/routes/film-fight-that-lands.md +198 -0
- package/docs/routes/film-ink-lines.md +120 -0
- package/docs/routes/floating-island.md +229 -0
- package/docs/routes/game-2d.md +168 -0
- package/docs/routes/game-rules-first.md +89 -0
- package/docs/routes/game-to-prefabs.md +249 -0
- package/docs/routes/go-game-server.md +95 -0
- package/docs/routes/good-looking-3d-scene.md +99 -0
- package/docs/routes/high-quality-character.md +263 -0
- package/docs/routes/humanoid-from-shapes.md +97 -0
- package/docs/routes/hunting-action-3d.md +76 -0
- package/docs/routes/idle-gacha-2d.md +67 -0
- package/docs/routes/interactive-film-viewer.md +141 -0
- package/docs/routes/isometric-mystery-2d.md +217 -0
- package/docs/routes/key-art-to-animated-title.md +132 -0
- package/docs/routes/laya-ide-project-cli-web.md +125 -0
- package/docs/routes/layered-cloth-on-body.md +240 -0
- package/docs/routes/low-poly-character-from-shapes.md +475 -0
- package/docs/routes/match-three-2d.md +64 -0
- package/docs/routes/merge-2d.md +59 -0
- package/docs/routes/mini-game-build.md +80 -0
- package/docs/routes/mobile-always-landscape.md +149 -0
- package/docs/routes/mobile-web-fullscreen.md +255 -0
- package/docs/routes/model-from-dcc.md +106 -0
- package/docs/routes/new-game-project.md +100 -0
- package/docs/routes/onboarding-tutorial-2d.md +54 -0
- package/docs/routes/online-lockstep-match.md +473 -0
- package/docs/routes/outdoor-landscape.md +134 -0
- package/docs/routes/outfit-swap-3d.md +144 -0
- package/docs/routes/papercraft-diorama.md +186 -0
- package/docs/routes/platform-fighter-2d.md +235 -0
- package/docs/routes/platformer-2d.md +69 -0
- package/docs/routes/pole-rescue-arcade-3d.md +198 -0
- package/docs/routes/pose-atlas-motion.md +188 -0
- package/docs/routes/prototype-to-center.md +162 -0
- package/docs/routes/raft-brawl-3d-minigame.md +205 -0
- package/docs/routes/rhythm-2d.md +82 -0
- package/docs/routes/rigged-phone-character.md +120 -0
- package/docs/routes/screen-fit-game-box.md +127 -0
- package/docs/routes/shared-islands.md +195 -0
- package/docs/routes/side-view-duel.md +266 -0
- package/docs/routes/single-html-page.md +83 -0
- package/docs/routes/smooth-character-motion.md +162 -0
- package/docs/routes/spine-character.md +175 -0
- package/docs/routes/story-counting-2d.md +219 -0
- package/docs/routes/survivors-2d.md +60 -0
- package/docs/routes/third-person-town-3d.md +240 -0
- package/docs/routes/tower-defence-3d.md +67 -0
- package/docs/routes/ui-test-by-probe.md +219 -0
- package/docs/routes/underwater.md +138 -0
- package/docs/routes/visual-content-prefab.md +101 -0
- package/docs/runtime-hardening.md +108 -0
- package/docs/shader-warm-up.md +125 -0
- package/docs/spring-bones.md +79 -0
- package/docs/stylized-shading.md +171 -0
- package/docs/terrain-shader.md +130 -0
- package/docs/vrm.md +128 -0
- package/docs/walking.md +97 -0
- package/docs/webgpu.md +225 -0
- package/docs/white-label-themes.md +212 -0
- package/docs/zh-CN/README.md +130 -0
- package/examples/browser-sdk/2d-webgpu.html +46 -0
- package/examples/browser-sdk/2d.html +46 -0
- package/examples/browser-sdk/3d-gltf-webgpu.html +50 -0
- package/examples/browser-sdk/3d-gltf.html +50 -0
- package/examples/browser-sdk/3d-webgpu.html +46 -0
- package/examples/browser-sdk/3d.html +46 -0
- package/examples/cinematic-capture/Main.ts +294 -0
- package/examples/cinematic-capture/README.md +27 -0
- package/examples/model-inspector/README.md +15 -0
- package/examples/model-inspector/asset.gltf +158 -0
- package/examples/windows-webgpu/README.md +57 -0
- package/examples/windows-webgpu/bundle.mjs +122 -0
- package/examples/windows-webgpu/main.mjs +302 -0
- package/examples/windows-webgpu/package-lock.json +2353 -0
- package/examples/windows-webgpu/package.json +40 -0
- package/examples/windows-webgpu/squirrel.mjs +66 -0
- package/package.json +259 -4
- package/packages/ci-gate/export-film.mjs +347 -0
- package/packages/ci-gate/verify-sequence.mjs +285 -0
- package/packages/compiler/agent-contract.mjs +545 -0
- package/packages/compiler/ast-scanner.mjs +254 -0
- package/packages/compiler/backend-loader.mjs +62 -0
- package/packages/compiler/branding-assets.mjs +32 -0
- package/packages/compiler/branding.mjs +324 -0
- package/packages/compiler/browser-auto-example.mjs +31 -0
- package/packages/compiler/browser-model-example.mjs +53 -0
- package/packages/compiler/browser-process.mjs +344 -0
- package/packages/compiler/browser-sdk-example.mjs +50 -0
- package/packages/compiler/browser-sdk.mjs +342 -0
- package/packages/compiler/chrome-host.mjs +196 -0
- package/packages/compiler/cli.mjs +22 -0
- package/packages/compiler/compiler-runtime.mjs +41 -0
- package/packages/compiler/consumer-accept.mjs +89 -0
- package/packages/compiler/consumer-build.mjs +641 -0
- package/packages/compiler/consumer-guards.mjs +422 -0
- package/packages/compiler/consumer-publication.mjs +56 -0
- package/packages/compiler/consumer-scripts.mjs +134 -0
- package/packages/compiler/consumer-starter-2d.mjs +54 -0
- package/packages/compiler/consumer-starter-minigame.mjs +30 -0
- package/packages/compiler/editor-http.mjs +210 -0
- package/packages/compiler/editor-request.ts +12 -0
- package/packages/compiler/film-host-client.ts +249 -0
- package/packages/compiler/flythrough-file.mjs +144 -0
- package/packages/compiler/json-locate.mjs +85 -0
- package/packages/compiler/layout-contract.mjs +472 -0
- package/packages/compiler/minigame-bootstrap.mjs +24 -0
- package/packages/compiler/minigame-bridge.mjs +66 -0
- package/packages/compiler/minigame-guards.mjs +107 -0
- package/packages/compiler/minigame-toolchain.mjs +241 -0
- package/packages/compiler/model-crown.mjs +173 -0
- package/packages/compiler/model-editor-client.ts +809 -0
- package/packages/compiler/model-editor.mjs +242 -0
- package/packages/compiler/model-lod.mjs +547 -0
- package/packages/compiler/prefab-check.mjs +288 -0
- package/packages/compiler/prefab-checks.mjs +74 -0
- package/packages/compiler/prefab-dependencies.mjs +102 -0
- package/packages/compiler/prefab-editor-client.ts +950 -0
- package/packages/compiler/prefab-editor-preview.ts +89 -0
- package/packages/compiler/prefab-editor-server.mjs +585 -0
- package/packages/compiler/prefab-editor.mjs +43 -0
- package/packages/compiler/prefab-environment.mjs +107 -0
- package/packages/compiler/prefab-lifecycle.mjs +60 -0
- package/packages/compiler/prefab-preview.mjs +159 -0
- package/packages/compiler/prefab-watch.mjs +459 -0
- package/packages/compiler/runtime3d-types.mjs +91 -0
- package/packages/compiler/stage-probe.mjs +557 -0
- package/packages/compiler/visual-asset-audit.mjs +609 -0
- package/packages/compiler/visual-contract-audit.mjs +173 -0
- package/packages/compiler/webgpu-loader.mjs +153 -0
- package/packages/compiler/zhuda-build.mjs +714 -0
- package/packages/compiler/zhuda-doctor.mjs +186 -0
- package/packages/compiler/zhuda-init.mjs +353 -0
- package/packages/compiler/zhuda-layout.mjs +163 -0
- package/packages/compiler/zhuda-minigame.mjs +636 -0
- package/packages/core/BenchmarkEngine.ts +2 -0
- package/packages/core/BitmapFontContract.ts +159 -0
- package/packages/core/DeclarativeSDK.ts +686 -0
- package/packages/core/IframeSoundAdapter.ts +1824 -0
- package/packages/core/NoSleepAdapter.ts +302 -0
- package/packages/core/PixelCalibrationEngine.ts +602 -0
- package/packages/core/Prefab.ts +314 -0
- package/packages/core/RealmGuards.ts +111 -0
- package/packages/core/ResponsiveLayout.ts +149 -0
- package/packages/core/RuntimeGuards.ts +261 -0
- package/packages/core/SpineCharacter.ts +243 -0
- package/packages/core/SpineVisualContract.ts +238 -0
- package/packages/core/SplashSignal.ts +72 -0
- package/packages/core/StaticAssetPipeline.ts +3 -0
- package/packages/core/TopologyGraph.ts +693 -0
- package/packages/core/UnityBridgePipeline.ts +2 -0
- package/packages/core/VideoSurface.ts +75 -0
- package/packages/core/ViewportMatrixEngine.ts +237 -0
- package/packages/core/VisualFocusContract.ts +76 -0
- package/packages/core/VisualMigrationPipeline.ts +245 -0
- package/packages/core/WebViewSurface.ts +116 -0
- package/packages/core/audio/OfflineMix.ts +186 -0
- package/packages/core/audio/Spatial.ts +312 -0
- package/packages/core/audio/StreamVoice.ts +161 -0
- package/packages/core/csg/Bsp.ts +310 -0
- package/packages/core/csg/index.ts +589 -0
- package/packages/core/effects/Effect2D.ts +286 -0
- package/packages/core/effects/Effect3D.ts +213 -0
- package/packages/core/effects/EffectBudget.ts +695 -0
- package/packages/core/effects/EffectDirector.ts +254 -0
- package/packages/core/effects/EffectPresets.ts +843 -0
- package/packages/core/effects/EffectPresets2D.ts +1011 -0
- package/packages/core/effects/EffectSprites.ts +143 -0
- package/packages/core/effects/ParticleEventLink.ts +53 -0
- package/packages/core/effects/README.md +108 -0
- package/packages/core/effects/VfxMaterial.ts +253 -0
- package/packages/core/film/BakeKey.ts +21 -0
- package/packages/core/film/ColorValues.ts +44 -0
- package/packages/core/film/FilmLint.ts +353 -0
- package/packages/core/film/FilmPrefab.ts +82 -0
- package/packages/core/film/FilmReview.ts +84 -0
- package/packages/core/film/FilmScene.ts +3442 -0
- package/packages/core/film/FilmStage.ts +2148 -0
- package/packages/core/film/Flythrough.ts +169 -0
- package/packages/core/film/FlythroughReport.ts +326 -0
- package/packages/core/film/FrameMetrics.ts +167 -0
- package/packages/core/film/LiveLook.ts +242 -0
- package/packages/core/film/LookQuality.ts +94 -0
- package/packages/core/film/Projection.ts +74 -0
- package/packages/core/film/SceneLook.ts +363 -0
- package/packages/core/film/index.ts +12 -0
- package/packages/core/index.ts +48 -0
- package/packages/core/particles/EffectEnvelope.ts +52 -0
- package/packages/core/particles/LayaParticleRenderer.ts +182 -0
- package/packages/core/particles/LayaParticleRenderer3D.ts +218 -0
- package/packages/core/particles/ParticleExtras.ts +163 -0
- package/packages/core/particles/ParticleMesh3D.ts +156 -0
- package/packages/core/particles/ParticleSystem.ts +324 -0
- package/packages/core/particles/ParticleSystem3D.ts +411 -0
- package/packages/core/particles/ParticleTypes.ts +230 -0
- package/packages/core/particles/ParticleTypes3D.ts +115 -0
- package/packages/core/particles/README.md +181 -0
- package/packages/core/particles/RibbonPath3D.ts +234 -0
- package/packages/core/particles/RibbonTrail.ts +145 -0
- package/packages/core/particles/RibbonTrail3D.ts +166 -0
- package/packages/core/particles/index.ts +12 -0
- package/packages/core/prefabs/PrefabLibrary.ts +692 -0
- package/packages/core/prefabs/PrefabTree3D.ts +291 -0
- package/packages/core/prefabs/index.ts +10 -0
- package/packages/core/procedural/Geometry.ts +1871 -0
- package/packages/core/procedural/Hand.ts +1510 -0
- package/packages/core/procedural/Isosurface.ts +1035 -0
- package/packages/core/procedural/ModuleHarness.ts +180 -0
- package/packages/core/procedural/Noise.ts +123 -0
- package/packages/core/procedural/PhotoMaterial.ts +283 -0
- package/packages/core/procedural/ProceduralAssetProvider.ts +105 -0
- package/packages/core/procedural/ProceduralMaterial.ts +184 -0
- package/packages/core/procedural/PropFactory.ts +307 -0
- package/packages/core/procedural/Random.ts +70 -0
- package/packages/core/procedural/SynthAudio.ts +221 -0
- package/packages/core/procedural/TerrainMesh.ts +207 -0
- package/packages/core/procedural/TextureRecipe.ts +464 -0
- package/packages/core/procedural/TriplanarMaterial.ts +169 -0
- package/packages/core/procedural/Variation.ts +94 -0
- package/packages/core/procedural/index.ts +15 -0
- package/packages/core/runtime3d/ActionFrames.ts +245 -0
- package/packages/core/runtime3d/AnimationBlend.ts +282 -0
- package/packages/core/runtime3d/AnimationBlendMath.ts +98 -0
- package/packages/core/runtime3d/AssetProvider.ts +775 -0
- package/packages/core/runtime3d/AssetShowcase.ts +190 -0
- package/packages/core/runtime3d/Assets.ts +801 -0
- package/packages/core/runtime3d/AsyncDeadline.ts +53 -0
- package/packages/core/runtime3d/AsyncOperation.ts +39 -0
- package/packages/core/runtime3d/BackendChoice.ts +359 -0
- package/packages/core/runtime3d/BakedCrowd.ts +575 -0
- package/packages/core/runtime3d/BasisTexture.ts +657 -0
- package/packages/core/runtime3d/CameraCollision.ts +69 -0
- package/packages/core/runtime3d/CameraEffects.ts +752 -0
- package/packages/core/runtime3d/CameraRig.ts +70 -0
- package/packages/core/runtime3d/CharacterController.ts +272 -0
- package/packages/core/runtime3d/CinematicCapture.ts +457 -0
- package/packages/core/runtime3d/Clocks.ts +724 -0
- package/packages/core/runtime3d/Cloth.ts +183 -0
- package/packages/core/runtime3d/Clouds.ts +462 -0
- package/packages/core/runtime3d/ColorLut.ts +351 -0
- package/packages/core/runtime3d/CombatQueries.ts +240 -0
- package/packages/core/runtime3d/ComputePass.ts +582 -0
- package/packages/core/runtime3d/CrowdPresentation.ts +368 -0
- package/packages/core/runtime3d/DebugDraw.ts +567 -0
- package/packages/core/runtime3d/DebugStats.ts +35 -0
- package/packages/core/runtime3d/Decals.ts +309 -0
- package/packages/core/runtime3d/DensityVolume.ts +238 -0
- package/packages/core/runtime3d/DistanceBricks.ts +349 -0
- package/packages/core/runtime3d/Dither.ts +199 -0
- package/packages/core/runtime3d/DrawWarmUp.ts +217 -0
- package/packages/core/runtime3d/EdgeSmoothing.ts +108 -0
- package/packages/core/runtime3d/EnvironmentProbe.ts +656 -0
- package/packages/core/runtime3d/Filmic.ts +973 -0
- package/packages/core/runtime3d/Foliage.ts +367 -0
- package/packages/core/runtime3d/GltfIntake.ts +914 -0
- package/packages/core/runtime3d/GltfSecondUv.ts +153 -0
- package/packages/core/runtime3d/GraphicsGuard.ts +171 -0
- package/packages/core/runtime3d/Grass.ts +1080 -0
- package/packages/core/runtime3d/GroundTruthAO.ts +360 -0
- package/packages/core/runtime3d/HalfFloat.ts +44 -0
- package/packages/core/runtime3d/HdrEnvironment.ts +588 -0
- package/packages/core/runtime3d/Ik.ts +392 -0
- package/packages/core/runtime3d/InputBuffer.ts +165 -0
- package/packages/core/runtime3d/InstancedMesh.ts +460 -0
- package/packages/core/runtime3d/Laya342Adapters.ts +1095 -0
- package/packages/core/runtime3d/Laya342GltfAdapter.ts +751 -0
- package/packages/core/runtime3d/LensFinish.ts +153 -0
- package/packages/core/runtime3d/LensFlare.ts +490 -0
- package/packages/core/runtime3d/LightFog.ts +1008 -0
- package/packages/core/runtime3d/LightingDepth.ts +544 -0
- package/packages/core/runtime3d/Lightmap.ts +238 -0
- package/packages/core/runtime3d/Math3D.ts +84 -0
- package/packages/core/runtime3d/MeshQuery.ts +547 -0
- package/packages/core/runtime3d/MeshoptModelDecoder.ts +354 -0
- package/packages/core/runtime3d/MiniGameSplash.ts +70 -0
- package/packages/core/runtime3d/ModelAnimationSampler.ts +97 -0
- package/packages/core/runtime3d/ModelCompatibility.ts +890 -0
- package/packages/core/runtime3d/ModelDecoder.ts +294 -0
- package/packages/core/runtime3d/ModelInspector.ts +226 -0
- package/packages/core/runtime3d/ModelLod.ts +163 -0
- package/packages/core/runtime3d/ModelPlacements.ts +426 -0
- package/packages/core/runtime3d/ObjectMotion.ts +217 -0
- package/packages/core/runtime3d/PhysicalCamera.ts +190 -0
- package/packages/core/runtime3d/PointShadow.ts +500 -0
- package/packages/core/runtime3d/PointShadowSchedule.ts +201 -0
- package/packages/core/runtime3d/Pool.ts +120 -0
- package/packages/core/runtime3d/ProbeVolume.ts +695 -0
- package/packages/core/runtime3d/QualityGovernor.ts +385 -0
- package/packages/core/runtime3d/QualityMemory.ts +200 -0
- package/packages/core/runtime3d/RenderScale.ts +356 -0
- package/packages/core/runtime3d/RenderSpaces.ts +105 -0
- package/packages/core/runtime3d/Renderer.ts +377 -0
- package/packages/core/runtime3d/ResultPlayback.ts +239 -0
- package/packages/core/runtime3d/Runtime.ts +507 -0
- package/packages/core/runtime3d/RuntimeDriver.ts +127 -0
- package/packages/core/runtime3d/SceneLifecycle.ts +211 -0
- package/packages/core/runtime3d/SceneMutation.ts +107 -0
- package/packages/core/runtime3d/SceneQueries.ts +191 -0
- package/packages/core/runtime3d/ScreenReflections.ts +595 -0
- package/packages/core/runtime3d/SelectionOutline.ts +389 -0
- package/packages/core/runtime3d/ShaderErrors.ts +104 -0
- package/packages/core/runtime3d/ShaderRegistry.ts +34 -0
- package/packages/core/runtime3d/ShaderWarmUp.ts +473 -0
- package/packages/core/runtime3d/ShadowUpdates.ts +287 -0
- package/packages/core/runtime3d/SkinBinding.ts +235 -0
- package/packages/core/runtime3d/Smaa.ts +386 -0
- package/packages/core/runtime3d/SmaaTables.ts +244 -0
- package/packages/core/runtime3d/SpringBones.ts +184 -0
- package/packages/core/runtime3d/SurfaceBuffer.ts +76 -0
- package/packages/core/runtime3d/Surfaces.ts +1105 -0
- package/packages/core/runtime3d/Themes.ts +344 -0
- package/packages/core/runtime3d/Timeline.ts +362 -0
- package/packages/core/runtime3d/ToneCurves.ts +292 -0
- package/packages/core/runtime3d/TransformGizmo.ts +539 -0
- package/packages/core/runtime3d/TriangleMask.ts +250 -0
- package/packages/core/runtime3d/Underwater.ts +778 -0
- package/packages/core/runtime3d/Utf8.ts +87 -0
- package/packages/core/runtime3d/Vrm.ts +773 -0
- package/packages/core/runtime3d/VrmDocument.ts +1830 -0
- package/packages/core/runtime3d/WalkGrid.ts +471 -0
- package/packages/core/runtime3d/WebGPU342Adapters.ts +280 -0
- package/packages/core/runtime3d/index.ts +147 -0
- package/packages/core/shaders/Laya342ShaderTemplates.ts +6 -0
- package/packages/core/shaders/LitSurfaceMaterial.ts +1076 -0
- package/packages/core/shaders/LitSurfaceTemplates.ts +13 -0
- package/packages/core/shaders/ReflectiveSurface.ts +285 -0
- package/packages/core/shaders/ShaderMaterials.ts +387 -0
- package/packages/core/shaders/ToonMaterial.ts +559 -0
- package/packages/core/shaders/WaterRipples.ts +170 -0
- package/packages/core/shaders/WaterSurface.ts +480 -0
- package/packages/core/shaders/ZhudaCommon.ts +109 -0
- package/packages/core/shaders/index.ts +6 -0
- package/packages/core/simulation/Cloth.ts +1541 -0
- package/packages/core/simulation/ParticleCore.ts +498 -0
- package/packages/core/simulation/SpringBones.ts +553 -0
- package/packages/core/simulation/index.ts +3 -0
- package/packages/core/terrain/Heightfield.ts +385 -0
- package/packages/core/terrain/Terrain2D.ts +324 -0
- package/packages/core/terrain/Terrain3D.ts +452 -0
- package/packages/core/terrain/TerrainShell.ts +94 -0
- package/packages/core/terrain/index.ts +3 -0
- package/packages/demo/BenchmarkEngine.ts +184 -0
- package/packages/demo/PixelCalibrationEngine.ts +36 -0
- package/packages/demo/ProceduralStarter.ts +312 -0
- package/packages/demo/StaticAssetPipeline.ts +1631 -0
- package/packages/demo/UnityBridgePipeline.ts +485 -0
- package/packages/demo/index.ts +6 -0
- package/packages/mcp-server/arguments.mjs +81 -0
- package/packages/mcp-server/corpus.mjs +627 -0
- package/packages/mcp-server/film-host.mjs +627 -0
- package/packages/mcp-server/film-session.mjs +95 -0
- package/packages/mcp-server/film-tools.mjs +460 -0
- package/packages/mcp-server/index.mjs +931 -0
- package/packages/mcp-server/quality-route.mjs +332 -0
- package/packages/mcp-server/roots.mjs +72 -0
- package/packages/mcp-server/runtime.mjs +81 -0
- package/packages/types/BitmapFontContract.d.ts +19 -0
- package/packages/types/DeclarativeSDK.d.ts +137 -0
- package/packages/types/IframeSoundAdapter.d.ts +173 -0
- package/packages/types/NoSleepAdapter.d.ts +50 -0
- package/packages/types/PixelCalibrationEngine.d.ts +83 -0
- package/packages/types/Prefab.d.ts +11 -0
- package/packages/types/RealmGuards.d.ts +26 -0
- package/packages/types/ResponsiveLayout.d.ts +10 -0
- package/packages/types/RuntimeGuards.d.ts +55 -0
- package/packages/types/SpineCharacter.d.ts +94 -0
- package/packages/types/SpineVisualContract.d.ts +50 -0
- package/packages/types/SplashSignal.d.ts +27 -0
- package/packages/types/TopologyGraph.d.ts +76 -0
- package/packages/types/VideoSurface.d.ts +21 -0
- package/packages/types/ViewportMatrixEngine.d.ts +27 -0
- package/packages/types/VisualFocusContract.d.ts +32 -0
- package/packages/types/VisualMigrationPipeline.d.ts +53 -0
- package/packages/types/WebViewSurface.d.ts +26 -0
- package/packages/types/audio/OfflineMix.d.ts +10 -0
- package/packages/types/audio/Spatial.d.ts +63 -0
- package/packages/types/audio/StreamVoice.d.ts +31 -0
- package/packages/types/browser.d.ts +44 -0
- package/packages/types/csg/Bsp.d.ts +85 -0
- package/packages/types/csg/index.d.ts +81 -0
- package/packages/types/demo/BenchmarkEngine.d.ts +61 -0
- package/packages/types/demo/PixelCalibrationEngine.d.ts +13 -0
- package/packages/types/demo/ProceduralStarter.d.ts +11 -0
- package/packages/types/demo/StaticAssetPipeline.d.ts +87 -0
- package/packages/types/demo/UnityBridgePipeline.d.ts +49 -0
- package/packages/types/demo/index.d.ts +7 -0
- package/packages/types/editor-preview.d.ts +27 -0
- package/packages/types/effects/Effect2D.d.ts +65 -0
- package/packages/types/effects/Effect3D.d.ts +42 -0
- package/packages/types/effects/EffectBudget.d.ts +179 -0
- package/packages/types/effects/EffectDirector.d.ts +68 -0
- package/packages/types/effects/EffectPresets.d.ts +27 -0
- package/packages/types/effects/EffectPresets2D.d.ts +32 -0
- package/packages/types/effects/EffectSprites.d.ts +23 -0
- package/packages/types/effects/ParticleEventLink.d.ts +16 -0
- package/packages/types/effects/VfxMaterial.d.ts +52 -0
- package/packages/types/film/BakeKey.d.ts +9 -0
- package/packages/types/film/ColorValues.d.ts +25 -0
- package/packages/types/film/FilmLint.d.ts +40 -0
- package/packages/types/film/FilmPrefab.d.ts +22 -0
- package/packages/types/film/FilmReview.d.ts +27 -0
- package/packages/types/film/FilmScene.d.ts +1214 -0
- package/packages/types/film/FilmStage.d.ts +237 -0
- package/packages/types/film/Flythrough.d.ts +44 -0
- package/packages/types/film/FlythroughReport.d.ts +132 -0
- package/packages/types/film/FrameMetrics.d.ts +49 -0
- package/packages/types/film/LiveLook.d.ts +60 -0
- package/packages/types/film/LookQuality.d.ts +24 -0
- package/packages/types/film/Projection.d.ts +20 -0
- package/packages/types/film/SceneLook.d.ts +122 -0
- package/packages/types/film/index.d.ts +13 -0
- package/packages/types/index.d.ts +49 -0
- package/packages/types/particles/EffectEnvelope.d.ts +18 -0
- package/packages/types/particles/LayaParticleRenderer.d.ts +30 -0
- package/packages/types/particles/LayaParticleRenderer3D.d.ts +29 -0
- package/packages/types/particles/ParticleExtras.d.ts +50 -0
- package/packages/types/particles/ParticleMesh3D.d.ts +24 -0
- package/packages/types/particles/ParticleSystem.d.ts +52 -0
- package/packages/types/particles/ParticleSystem3D.d.ts +69 -0
- package/packages/types/particles/ParticleTypes.d.ts +89 -0
- package/packages/types/particles/ParticleTypes3D.d.ts +56 -0
- package/packages/types/particles/RibbonPath3D.d.ts +32 -0
- package/packages/types/particles/RibbonTrail.d.ts +38 -0
- package/packages/types/particles/RibbonTrail3D.d.ts +22 -0
- package/packages/types/particles/index.d.ts +13 -0
- package/packages/types/prefabs/PrefabLibrary.d.ts +176 -0
- package/packages/types/prefabs/PrefabTree3D.d.ts +59 -0
- package/packages/types/prefabs/index.d.ts +4 -0
- package/packages/types/procedural/Geometry.d.ts +252 -0
- package/packages/types/procedural/Hand.d.ts +150 -0
- package/packages/types/procedural/Isosurface.d.ts +181 -0
- package/packages/types/procedural/ModuleHarness.d.ts +90 -0
- package/packages/types/procedural/Noise.d.ts +15 -0
- package/packages/types/procedural/PhotoMaterial.d.ts +49 -0
- package/packages/types/procedural/ProceduralAssetProvider.d.ts +31 -0
- package/packages/types/procedural/ProceduralMaterial.d.ts +63 -0
- package/packages/types/procedural/PropFactory.d.ts +94 -0
- package/packages/types/procedural/Random.d.ts +26 -0
- package/packages/types/procedural/SynthAudio.d.ts +49 -0
- package/packages/types/procedural/TerrainMesh.d.ts +55 -0
- package/packages/types/procedural/TextureRecipe.d.ts +125 -0
- package/packages/types/procedural/TriplanarMaterial.d.ts +27 -0
- package/packages/types/procedural/Variation.d.ts +23 -0
- package/packages/types/procedural/index.d.ts +16 -0
- package/packages/types/runtime3d/ActionFrames.d.ts +62 -0
- package/packages/types/runtime3d/AnimationBlend.d.ts +57 -0
- package/packages/types/runtime3d/AnimationBlendMath.d.ts +27 -0
- package/packages/types/runtime3d/AssetProvider.d.ts +167 -0
- package/packages/types/runtime3d/AssetShowcase.d.ts +44 -0
- package/packages/types/runtime3d/Assets.d.ts +166 -0
- package/packages/types/runtime3d/AsyncDeadline.d.ts +6 -0
- package/packages/types/runtime3d/AsyncOperation.d.ts +3 -0
- package/packages/types/runtime3d/BackendChoice.d.ts +130 -0
- package/packages/types/runtime3d/BakedCrowd.d.ts +156 -0
- package/packages/types/runtime3d/BasisTexture.d.ts +169 -0
- package/packages/types/runtime3d/CameraCollision.d.ts +20 -0
- package/packages/types/runtime3d/CameraEffects.d.ts +134 -0
- package/packages/types/runtime3d/CameraRig.d.ts +27 -0
- package/packages/types/runtime3d/CharacterController.d.ts +71 -0
- package/packages/types/runtime3d/CinematicCapture.d.ts +103 -0
- package/packages/types/runtime3d/Clocks.d.ts +200 -0
- package/packages/types/runtime3d/Cloth.d.ts +57 -0
- package/packages/types/runtime3d/Clouds.d.ts +69 -0
- package/packages/types/runtime3d/ColorLut.d.ts +73 -0
- package/packages/types/runtime3d/CombatQueries.d.ts +50 -0
- package/packages/types/runtime3d/ComputePass.d.ts +134 -0
- package/packages/types/runtime3d/CrowdPresentation.d.ts +104 -0
- package/packages/types/runtime3d/DebugDraw.d.ts +161 -0
- package/packages/types/runtime3d/DebugStats.d.ts +24 -0
- package/packages/types/runtime3d/Decals.d.ts +65 -0
- package/packages/types/runtime3d/DensityVolume.d.ts +39 -0
- package/packages/types/runtime3d/DistanceBricks.d.ts +97 -0
- package/packages/types/runtime3d/Dither.d.ts +78 -0
- package/packages/types/runtime3d/DrawWarmUp.d.ts +93 -0
- package/packages/types/runtime3d/EdgeSmoothing.d.ts +10 -0
- package/packages/types/runtime3d/EnvironmentProbe.d.ts +139 -0
- package/packages/types/runtime3d/Filmic.d.ts +243 -0
- package/packages/types/runtime3d/Foliage.d.ts +95 -0
- package/packages/types/runtime3d/GltfIntake.d.ts +236 -0
- package/packages/types/runtime3d/GltfSecondUv.d.ts +54 -0
- package/packages/types/runtime3d/GraphicsGuard.d.ts +18 -0
- package/packages/types/runtime3d/Grass.d.ts +226 -0
- package/packages/types/runtime3d/GroundTruthAO.d.ts +64 -0
- package/packages/types/runtime3d/HalfFloat.d.ts +13 -0
- package/packages/types/runtime3d/HdrEnvironment.d.ts +144 -0
- package/packages/types/runtime3d/Ik.d.ts +123 -0
- package/packages/types/runtime3d/InputBuffer.d.ts +49 -0
- package/packages/types/runtime3d/InstancedMesh.d.ts +116 -0
- package/packages/types/runtime3d/Laya342Adapters.d.ts +306 -0
- package/packages/types/runtime3d/Laya342GltfAdapter.d.ts +105 -0
- package/packages/types/runtime3d/LensFinish.d.ts +38 -0
- package/packages/types/runtime3d/LensFlare.d.ts +114 -0
- package/packages/types/runtime3d/LightFog.d.ts +190 -0
- package/packages/types/runtime3d/LightingDepth.d.ts +128 -0
- package/packages/types/runtime3d/Lightmap.d.ts +55 -0
- package/packages/types/runtime3d/Math3D.d.ts +19 -0
- package/packages/types/runtime3d/MeshQuery.d.ts +107 -0
- package/packages/types/runtime3d/MeshoptModelDecoder.d.ts +34 -0
- package/packages/types/runtime3d/MiniGameSplash.d.ts +4 -0
- package/packages/types/runtime3d/ModelAnimationSampler.d.ts +26 -0
- package/packages/types/runtime3d/ModelCompatibility.d.ts +169 -0
- package/packages/types/runtime3d/ModelDecoder.d.ts +66 -0
- package/packages/types/runtime3d/ModelInspector.d.ts +77 -0
- package/packages/types/runtime3d/ModelLod.d.ts +61 -0
- package/packages/types/runtime3d/ModelPlacements.d.ts +77 -0
- package/packages/types/runtime3d/ObjectMotion.d.ts +43 -0
- package/packages/types/runtime3d/PhysicalCamera.d.ts +51 -0
- package/packages/types/runtime3d/PointShadow.d.ts +71 -0
- package/packages/types/runtime3d/PointShadowSchedule.d.ts +74 -0
- package/packages/types/runtime3d/Pool.d.ts +33 -0
- package/packages/types/runtime3d/ProbeVolume.d.ts +123 -0
- package/packages/types/runtime3d/QualityGovernor.d.ts +201 -0
- package/packages/types/runtime3d/QualityMemory.d.ts +83 -0
- package/packages/types/runtime3d/RenderScale.d.ts +69 -0
- package/packages/types/runtime3d/RenderSpaces.d.ts +44 -0
- package/packages/types/runtime3d/Renderer.d.ts +62 -0
- package/packages/types/runtime3d/ResultPlayback.d.ts +70 -0
- package/packages/types/runtime3d/Runtime.d.ts +136 -0
- package/packages/types/runtime3d/RuntimeDriver.d.ts +42 -0
- package/packages/types/runtime3d/SceneLifecycle.d.ts +84 -0
- package/packages/types/runtime3d/SceneMutation.d.ts +34 -0
- package/packages/types/runtime3d/SceneQueries.d.ts +71 -0
- package/packages/types/runtime3d/ScreenReflections.d.ts +78 -0
- package/packages/types/runtime3d/SelectionOutline.d.ts +68 -0
- package/packages/types/runtime3d/ShaderErrors.d.ts +27 -0
- package/packages/types/runtime3d/ShaderRegistry.d.ts +10 -0
- package/packages/types/runtime3d/ShaderWarmUp.d.ts +162 -0
- package/packages/types/runtime3d/ShadowUpdates.d.ts +125 -0
- package/packages/types/runtime3d/SkinBinding.d.ts +53 -0
- package/packages/types/runtime3d/Smaa.d.ts +60 -0
- package/packages/types/runtime3d/SmaaTables.d.ts +12 -0
- package/packages/types/runtime3d/SpringBones.d.ts +69 -0
- package/packages/types/runtime3d/SurfaceBuffer.d.ts +28 -0
- package/packages/types/runtime3d/Surfaces.d.ts +326 -0
- package/packages/types/runtime3d/Themes.d.ts +70 -0
- package/packages/types/runtime3d/Timeline.d.ts +88 -0
- package/packages/types/runtime3d/ToneCurves.d.ts +59 -0
- package/packages/types/runtime3d/TransformGizmo.d.ts +139 -0
- package/packages/types/runtime3d/TriangleMask.d.ts +84 -0
- package/packages/types/runtime3d/Underwater.d.ts +120 -0
- package/packages/types/runtime3d/Utf8.d.ts +12 -0
- package/packages/types/runtime3d/Vrm.d.ts +120 -0
- package/packages/types/runtime3d/VrmDocument.d.ts +381 -0
- package/packages/types/runtime3d/WalkGrid.d.ts +94 -0
- package/packages/types/runtime3d/WebGPU342Adapters.d.ts +27 -0
- package/packages/types/runtime3d/index.d.ts +102 -0
- package/packages/types/shaders/Laya342ShaderTemplates.d.ts +3 -0
- package/packages/types/shaders/LitSurfaceMaterial.d.ts +257 -0
- package/packages/types/shaders/LitSurfaceTemplates.d.ts +7 -0
- package/packages/types/shaders/ReflectiveSurface.d.ts +58 -0
- package/packages/types/shaders/ShaderMaterials.d.ts +60 -0
- package/packages/types/shaders/ToonMaterial.d.ts +176 -0
- package/packages/types/shaders/WaterRipples.d.ts +48 -0
- package/packages/types/shaders/WaterSurface.d.ts +110 -0
- package/packages/types/shaders/ZhudaCommon.d.ts +31 -0
- package/packages/types/shaders/index.d.ts +7 -0
- package/packages/types/simulation/Cloth.d.ts +381 -0
- package/packages/types/simulation/ParticleCore.d.ts +125 -0
- package/packages/types/simulation/SpringBones.d.ts +107 -0
- package/packages/types/simulation/index.d.ts +4 -0
- package/packages/types/terrain/Heightfield.d.ts +67 -0
- package/packages/types/terrain/Terrain2D.d.ts +81 -0
- package/packages/types/terrain/Terrain3D.d.ts +80 -0
- package/packages/types/terrain/TerrainShell.d.ts +8 -0
- package/packages/types/terrain/index.d.ts +4 -0
- package/packages/types/vendor/LayaAir.runtime.d.ts +97440 -0
- package/packages/types/vendor/REPAIRS.md +30 -0
- package/packages/types/vendor/restored-3.4.2.json +142 -0
- package/packages/types/vendor/spine.runtime.d.ts +1507 -0
- package/packages/types/vendor/wechat-media.d.ts +877 -0
- package/packages/types/zhuda-2d-ui.d.ts +244 -0
- package/packages/types/zhuda-3d-physics.d.ts +34 -0
- package/packages/types/zhuda-audio.d.ts +128 -0
- package/packages/types/zhuda-bootstrap.d.ts +100 -0
- package/packages/types/zhuda-branding.d.ts +6 -0
- package/packages/types/zhuda-core.d.ts +46 -0
- package/packages/types/zhuda-declarative.d.ts +81 -0
- package/packages/types/zhuda-effects.d.ts +302 -0
- package/packages/types/zhuda-layout.d.ts +96 -0
- package/packages/types/zhuda-particles.d.ts +477 -0
- package/packages/types/zhuda-spine42.d.ts +23 -0
- package/packages/types/zhuda-static-assets.d.ts +389 -0
- package/packages/types/zhuda-video.d.ts +24 -0
- package/packages/types/zhuda-visual-contract.d.ts +52 -0
- package/packages/types/zhuda-webview.d.ts +43 -0
- package/vendor/basis/LICENSE.txt +55 -0
- package/vendor/basis/README.md +25 -0
- package/vendor/basis/basis_transcoder.js +19 -0
- package/vendor/basis/basis_transcoder.wasm +0 -0
- package/vendor/laya-3.4.2/WEBGPU-LICENSES.txt +1259 -0
- package/vendor/laya-3.4.2/libs/laya.ani.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.box2D.js +1209 -0
- package/vendor/laya-3.4.2/libs/laya.bridge.js +2273 -0
- package/vendor/laya-3.4.2/libs/laya.bullet.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.core.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.d3.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.device.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.gltf.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.ik.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.light2D.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.line2D.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.native-spine42.js +7672 -0
- package/vendor/laya-3.4.2/libs/laya.navMesh2d.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.navMesh3d.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.navMeshCommon.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.particle.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.particle3D.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.particleCommon.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.physics2D.js +3774 -0
- package/vendor/laya-3.4.2/libs/laya.physics3D.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.postProcess.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.spine.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.spine3D.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.tilemap.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.trail2D.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.trail3D.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.trailCommon.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.ui.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.ui2.js +9904 -0
- package/vendor/laya-3.4.2/libs/laya.vfx.js +6754 -0
- package/vendor/laya-3.4.2/libs/laya.webgl_2D.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.webgl_3D.js +1 -0
- package/vendor/laya-3.4.2/libs/laya.webgpu_2D.js +18576 -0
- package/vendor/laya-3.4.2/libs/laya.webgpu_3D.js +6729 -0
- package/vendor/laya-3.4.2/libs/nagabind.js +395 -0
- package/vendor/laya-3.4.2/libs/nagabind_bg.wasm +0 -0
- package/vendor/laya-3.4.2/libs/shader_compiler_web.js +22 -0
- package/vendor/laya-3.4.2/libs/shader_compiler_web.wasm +0 -0
- package/vendor/laya-3.4.2/libs/spine-core-3.8.js +1 -0
- package/vendor/laya-3.4.2/libs/spine-core-4.2.js +10216 -0
- package/vendor/laya-3.4.2/webgpu-provenance.json +41 -0
- package/vendor/meshoptimizer/LICENSE.txt +21 -0
- package/vendor/meshoptimizer/README.md +13 -0
- package/vendor/threejs-post/LICENSE.txt +53 -0
- package/vendor/threejs-post/README.md +54 -0
- package/zhuda.config.json +22 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# Route: Continuous motion from a generated pose atlas (joint pins, baked in-betweens, masks)
|
|
2
|
+
|
|
3
|
+
Turns one AI-generated atlas of "eight full-body poses of the same character" into motion in a
|
|
4
|
+
game that is continuous and does not jump: measure ten joint pins, write move timetables, bake the
|
|
5
|
+
in-between cels between two poses offline with optical flow (poses that overlap, such as an arm
|
|
6
|
+
crossing the helmet, get layered masks as well), and at run time change picture along the baked
|
|
7
|
+
in-betweens while a mesh deforms with the joints. The knight (69 in-between cels) and the warden
|
|
8
|
+
(61) of Ashfall Duel (灰燼之庭) were made this way; the run-time part is `zhuda-engine-prefabs/2d/cel-motion`.
|
|
9
|
+
Checked on desktop only.
|
|
10
|
+
|
|
11
|
+
- **Id:** `pose-atlas-motion`
|
|
12
|
+
- **Kind:** workflow
|
|
13
|
+
- **For:** You have (or will generate) a key-pose atlas of a realistic 2D character and want it
|
|
14
|
+
continuous in a game while it walks, attacks, is hit and is interrupted, without a skeleton or
|
|
15
|
+
Spine
|
|
16
|
+
- **Checked on:** desktop WebGL (Apple M4, headless Chrome 158 on macOS); the bake was run on a Mac
|
|
17
|
+
(Python 3.9, OpenCV 5.0.0, NumPy 2.0.2, Pillow 11.3.0), but its result differs from what the
|
|
18
|
+
original author made on Windows; no phone
|
|
19
|
+
- **Status:** 2026-11-25: the run-time part (`2d/cel-motion`) is pixel for pixel the same in
|
|
20
|
+
Ashfall Duel as in the original game, and 3 + 15 tests pass; the bake script runs to the end on
|
|
21
|
+
the Mac in about 5 seconds, and its output differs from the shipped in-betweens (see
|
|
22
|
+
**Pitfalls**)
|
|
23
|
+
- **Reference consumer:** this repository, `zhuda-engine-prefabs/2d/cel-motion/` (`cel-motion.ts`,
|
|
24
|
+
`cel-sprite.ts`, `preview/pins.jpg`, `preview/strip-3-4.jpg`),
|
|
25
|
+
`zhuda-engine-prefabs/2d/ashfall-duel/source/tools/bake-transitions.py`, `zhuda-engine-prefabs/2d/ashfall-duel/motion.ts`
|
|
26
|
+
(the two characters' joint tables and move timetables),
|
|
27
|
+
`zhuda-engine-prefabs/2d/ashfall-duel/source/ART.md` (the image prompts)
|
|
28
|
+
- **Engine version:** zhuda-laya-engine 1.18.0, `def94aae9e7ebf5f9f35b915b54dbb4c3e5fe43c`
|
|
29
|
+
|
|
30
|
+
## When to take this route
|
|
31
|
+
|
|
32
|
+
- It fits: a side-view character facing one way, realistic or painterly, whose motion is "changing
|
|
33
|
+
among a few poses" (stand, walk, raise, swing, be hit, fall); pictures that are generated and
|
|
34
|
+
not cut into parts.
|
|
35
|
+
- It does not fit:
|
|
36
|
+
- Parts pulled by the hand, cloth with physics: take [spine-character](spine-character.md)
|
|
37
|
+
(zhuda-spine2D).
|
|
38
|
+
- Turning round, several directions, or a great many poses: every further direction is a whole
|
|
39
|
+
atlas and bake of its own.
|
|
40
|
+
- Cartoon or flat characters that can simply be drawn frame by frame: a sequence of frames is
|
|
41
|
+
quicker.
|
|
42
|
+
- When the character is made and is to go into a duel: [side-view-duel](side-view-duel.md).
|
|
43
|
+
|
|
44
|
+
## Tools
|
|
45
|
+
|
|
46
|
+
- Pictures: the image command of the owner's `zhuda-windows` agent skill (not in this repository),
|
|
47
|
+
with gpt-image-2.6 (generating single pictures on the Mac itself has been retired). The original
|
|
48
|
+
author used ImageGen; the prompts are in full in `zhuda-engine-prefabs/2d/ashfall-duel/source/ART.md`.
|
|
49
|
+
- The bake: `zhuda-engine-prefabs/2d/ashfall-duel/source/tools/bake-transitions.py`. It needs Python 3 with
|
|
50
|
+
Pillow, NumPy and OpenCV (`cv2.DISOpticalFlow`, `inpaint`, `distanceTransform`), and Node 24
|
|
51
|
+
(to read the joint tables in `motion.ts`).
|
|
52
|
+
- Run time: `2d/cel-motion` (`node zhuda-engine-prefabs/scripts/sync.mjs <game dir> 2d/cel-motion` from a
|
|
53
|
+
checkout of this repository, or from the game
|
|
54
|
+
`node node_modules/zhuda-engine-prefabs/scripts/sync.mjs . 2d/cel-motion`), the engine's
|
|
55
|
+
prefabs (`ZhudaPrefabLibrary`, `.lh` scenes) and `zhuda-laya-accept`.
|
|
56
|
+
- Looking: any image tool that can lay points over a picture; `zhuda-engine-prefabs/2d/cel-motion/preview/pins.jpg`
|
|
57
|
+
and `strip-3-4.jpg` were overlaid with PIL.
|
|
58
|
+
|
|
59
|
+
## Steps
|
|
60
|
+
|
|
61
|
+
1. **Generate the atlas.** One truly transparent RGBA picture, 4 columns × 2 rows, eight full-body
|
|
62
|
+
poses of the same character: the same design, the same proportions, the same light, feet on one
|
|
63
|
+
baseline, space left between the cells, no grid lines and no text. One fixed facing (the knight
|
|
64
|
+
faces right, the warden left). **Do not paint a weapon that must deform into the picture**: in
|
|
65
|
+
every pose the knight holds only the grip and the guard, and the game draws the long sword
|
|
66
|
+
separately (only then can it bend). Key 0 is the ready stance and key 1 a stride (`Footwork`
|
|
67
|
+
swings between 0 and 1); the rest follow the moves (the knight: ready, advance, wound up at the
|
|
68
|
+
shoulder, raised high, start of the swing, full extension, recovery, off balance; the warden:
|
|
69
|
+
guard, stride, wind-up, gauntlet lunge, braced for a blow, under pressure, leaning back,
|
|
70
|
+
kneeling). Two reference pictures: one for pose and silhouette, one for materials. Save as WebP
|
|
71
|
+
at the original size (the knight 1536×1024, the warden 1774×887).
|
|
72
|
+
2. **Measure the key poses.** One `frame(box, origin, ...pins)` for each: the atlas box (pixel
|
|
73
|
+
edges), **its own** sole origin (a shared origin makes the figure jump when the pose changes),
|
|
74
|
+
and ten pins in a fixed order: helmet, breastplate, weapon hand, front boot, rear boot, belt,
|
|
75
|
+
front knee, rear knee, elbow, hem of the cloak (`PIN`). Look at them laid over the picture (as
|
|
76
|
+
`preview/pins.jpg` does).
|
|
77
|
+
3. **Write the move timetables.** `[time 0..1, key pose][]`, for example the light slash
|
|
78
|
+
`[0,0],[0.13,0],[0.35,4],[0.52,5],[0.61,5],[0.78,6],[1,0]`; the same key pose twice in a row is
|
|
79
|
+
a hold. `poseAt()` keeps its speed through a key pose in the middle (the tangent is the
|
|
80
|
+
harmonic mean of the slopes on the two sides) and stops where the direction reverses.
|
|
81
|
+
4. **Decide which pairs to bake.** Every pair a timetable passes through, and every pair an
|
|
82
|
+
interruption will walk, needs in-betweens. `PoseTrack` walks only baked pairs; poses that are
|
|
83
|
+
not joined directly are reached by way of others (shortest path, a pair's length = its cel
|
|
84
|
+
count + 1), and if the target pair is not baked it throws `缺少動作影格 a-b` ("motion cels a-b
|
|
85
|
+
are missing"). Ashfall Duel: the knight has 10 pairs and 69 cels (0-1, 0-2, 2-3, 3-4, 0-4, 4-5,
|
|
86
|
+
5-6, 0-6, 4-6, 0-7), the warden 9 pairs and 61 cels. Each pair has 5–13 divisions (the third
|
|
87
|
+
number in `CLIPS` is the number of divisions; the cels are one fewer).
|
|
88
|
+
5. **Give the bake its guide points.** Measured by hand in the script for each character: the
|
|
89
|
+
shoulder in every key pose (`SHOULDERS`), and the far hand and far elbow (`FAR_ARM`). For poses
|
|
90
|
+
in which the arm crosses the helmet (the knight's 0, 2, 3 and 4, used in 0→2 and 3→4), draw
|
|
91
|
+
three polygons as well (`ARM_LAYERS`: upper arm, forearm, torso): the arm layers turn rigidly
|
|
92
|
+
(scale limited to 0.92–1.08, the upper arm's angle to ±0.65 rad), the part of the torso under
|
|
93
|
+
the arm is filled in with Telea inpainting (radius 6), and the armour's detail changes over
|
|
94
|
+
only between t 0.34 and 0.66.
|
|
95
|
+
6. **Bake.** What the script does (the values are all its own): each key pose is first scaled to
|
|
96
|
+
0.78 and put on a 380×352 canvas with the soles at (178, 335); the joint guide points drive a
|
|
97
|
+
moving-least-squares similarity transform on a 3 px grid (weights `(9 + d²)^−1.65`) that aligns
|
|
98
|
+
both pictures to the shape between the two; DIS optical flow (MEDIUM, finest level) in both
|
|
99
|
+
directions, clamped to ±15 px; each in-between cel samples colour only once; the silhouette is
|
|
100
|
+
blended by signed distance (±13 px); the largest connected piece is cut out (alpha > 0.13,
|
|
101
|
+
dilated 7 px); the cels are packed by shelves into pages 2048 wide, 2 px apart; they are saved
|
|
102
|
+
as WebP (quality 88, method 5, alpha quality 95) and the index
|
|
103
|
+
`{ scale, <character>: { pages, edges } }` is written. Run it inside the module:
|
|
104
|
+
`python3 2d/<module>/source/tools/bake-transitions.py` (it writes `motion-cels.ts` and
|
|
105
|
+
`assets/art/*-motion-*.webp`).
|
|
106
|
+
7. **Into the prefab.** A character is one Sprite node with, under it, `Art` (the key-pose atlas)
|
|
107
|
+
and one hidden `Motion0`, `Motion1`… for each page; the prefab's `textures` lists them all.
|
|
108
|
+
`CelSprite` only reads these textures (an example: `zhuda-engine-prefabs/2d/ashfall-duel/assets/courtyard.lh`).
|
|
109
|
+
8. **The order at run time.** The target pose (from a timetable or `Footwork.walkPose()`) →
|
|
110
|
+
`Footwork.shape()` (planting the feet, rise and fall, breathing) → the move's own adjustments
|
|
111
|
+
(for example the wrist lifted while the sword is raised) →
|
|
112
|
+
`PoseTrack.sample(move name, pose, dt)` (when the move name changes, the hand-over takes
|
|
113
|
+
0.105 s, walking along the in-betweens at 36–140 cels a second) → `CelSprite.draw()`: it takes
|
|
114
|
+
cel `round(t × (count − 1))` of that pair (the two ends are the key poses); an in-between cel's
|
|
115
|
+
pins are the joints interpolated at the bake scale, placed on its anchor; the mesh is 16×20,
|
|
116
|
+
its weights `1 / (90 + d²)^1.65` normalised, and screen scale / bake scale = the mesh's scale.
|
|
117
|
+
9. **Check.** Tests: every pair is interrupted once in each direction, only registered pairs are
|
|
118
|
+
walked, and the target is reached (the last test of `tests/ashfall-duel.test.mjs`, and
|
|
119
|
+
`tests/cel-motion.test.mjs`); look at each strip of in-betweens laid out in a row; compare each
|
|
120
|
+
character alone as a prefab (Ashfall Duel: the knight 0, the warden 0 and loaded and unloaded
|
|
121
|
+
30 times in a row); interrupt every move in the game and watch for a jump.
|
|
122
|
+
|
|
123
|
+
## Pitfalls
|
|
124
|
+
|
|
125
|
+
- **Running the bake again does not give the same set of in-betweens.** Run again on 2026-11-25 on
|
|
126
|
+
the Mac (OpenCV 5.0.0), 113 of the 130 cels had a different crop box and the knight's first page
|
|
127
|
+
went from 1776 high to 2048 high; the pictures are close but not the same set. There are at
|
|
128
|
+
least two causes: a different OpenCV version; and the `knight.webp` and `warden.webp` that are
|
|
129
|
+
kept (in the module and in the git bundle) are lossy WebP (`VP8 ` + `ALPH`), while the script's
|
|
130
|
+
comment says the end frames come from the original lossless transparent pictures, which were not
|
|
131
|
+
kept. → The in-between pages and the index are always replaced together and shipped together;
|
|
132
|
+
after a new bake, look at every strip again and shoot the prefab references and the previews
|
|
133
|
+
again. **If you have the lossless originals, keep them with the atlas.**
|
|
134
|
+
- **A double image where the arm crosses the helmet.** Optical flow draws half of each picture's
|
|
135
|
+
arm. → Those pairs use the layered masks (step 5). The first few cels of the knight's 3→4 still
|
|
136
|
+
show the shadow of two sets of arms (cels 1–5 of `preview/strip-3-4.jpg`); in the game each
|
|
137
|
+
stays for about one frame.
|
|
138
|
+
- **The whole character jumps when the pose changes.** The key poses shared one origin. → Measure
|
|
139
|
+
each key pose's own sole origin.
|
|
140
|
+
- **What must bend cannot bend once it is painted into the picture.** → Draw the weapon separately
|
|
141
|
+
(Ashfall Duel's sword is a strip of triangles in 24 segments) and leave only the grip in the
|
|
142
|
+
picture.
|
|
143
|
+
- **An interrupted move jumps straight to the new pose.** A cross-fade shows two half-transparent
|
|
144
|
+
figures. → `PoseTrack` walks there along the baked in-betweens, and the joints hand over in
|
|
145
|
+
0.105 s.
|
|
146
|
+
|
|
147
|
+
## Engine gaps and their workarounds
|
|
148
|
+
|
|
149
|
+
| Gap | Workaround |
|
|
150
|
+
| --- | --- |
|
|
151
|
+
| The engine's 2D characters are Spine only; there is no "atlas of key poses plus in-betweens" | `zhuda-engine-prefabs/2d/cel-motion` (`PoseTrack`, `Footwork`, `CelSprite`) |
|
|
152
|
+
| No tool that bakes in-betweens offline | `zhuda-engine-prefabs/2d/ashfall-duel/source/tools/bake-transitions.py` (the characters' data is written into the script; another character means changing it) |
|
|
153
|
+
| No component that deforms a picture by a mesh | `CelSprite` draws a mesh of 17×21 vertices every frame with Laya's `graphics.drawTriangles` |
|
|
154
|
+
|
|
155
|
+
## Checks
|
|
156
|
+
|
|
157
|
+
The commands are written for this repository's `zhuda-engine-prefabs/`; the results are those of 2026-11-25,
|
|
158
|
+
from before the library moved into this repository.
|
|
159
|
+
|
|
160
|
+
```sh
|
|
161
|
+
cd prefabs && node --test tests/cel-motion.test.mjs tests/ashfall-duel.test.mjs
|
|
162
|
+
# The bake (try it in a copy: it overwrites motion-cels.ts and assets/art/*-motion-*.webp):
|
|
163
|
+
python3 2d/ashfall-duel/source/tools/bake-transitions.py
|
|
164
|
+
# One character alone: add node: "<character node>" to the prefab's prefabChecks, then npx zhuda-laya-accept
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
2026-11-25: the 18 tests passed; the knight and the warden, each compared alone as a prefab,
|
|
168
|
+
differed by 0 pixels; the bake runs to the end on the Mac with a different result (above).
|
|
169
|
+
|
|
170
|
+
## Not checked
|
|
171
|
+
|
|
172
|
+
- No third character has been made by this route: the two characters of Ashfall Duel were made by
|
|
173
|
+
the original author, and this route was put together from that author's code, scripts and
|
|
174
|
+
records.
|
|
175
|
+
- The bake cannot reproduce the shipped in-betweens on that Mac; the original author's Python and
|
|
176
|
+
OpenCV versions were not recorded.
|
|
177
|
+
- The quality of the in-betweens was judged by eye only (`preview/strip-3-4.jpg`), not measured.
|
|
178
|
+
- No phone; the memory and load time on a phone of the in-between pages (two pages 2048 wide for
|
|
179
|
+
each character) were not measured.
|
|
180
|
+
|
|
181
|
+
## Boundaries
|
|
182
|
+
|
|
183
|
+
- The game: the character's atlas, joint tables, move timetables, the bake's guide points and
|
|
184
|
+
masks, the in-between pages and index, the lossless originals.
|
|
185
|
+
- The prefab library (`zhuda-engine-prefabs/`): `2d/cel-motion` (motion and drawing at run time) and the bake
|
|
186
|
+
script (for now in `2d/ashfall-duel/source/tools/`, with the characters' data written into it).
|
|
187
|
+
- The engine: prefab loading and comparison, Laya's drawing. To build this into the engine (for
|
|
188
|
+
example a general atlas-character component), move it from `2d/cel-motion`.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Route: an outside prototype moved into the game centre, through the prefab gates first
|
|
2
|
+
|
|
3
|
+
A 2D prototype made in a folder outside the workspace (carrying its own copy of the engine, a
|
|
4
|
+
vendor folder and old evidence) becomes ZhudaGameCenter `games/<game>/client` and `server/`
|
|
5
|
+
(outside this repository). It depends only on the public engine package; every picture is first
|
|
6
|
+
registered with its hash and made a prefab that is compared alone in a browser, and only then
|
|
7
|
+
does the scene mount the same definition; the prototype is deleted only when every gate has
|
|
8
|
+
passed. Dungeon Spin (迷宮一閃; the workspace's `games/dungeon-spin`, the original game, removed
|
|
9
|
+
after it was taken apart) was moved this way on 2026-11-06, and on 2026-11-25, when it was taken
|
|
10
|
+
apart into shared modules, its gates were run again on the newer engine. Checked only in
|
|
11
|
+
headless Chrome on a desktop.
|
|
12
|
+
|
|
13
|
+
- **Id:** `prototype-to-center`
|
|
14
|
+
- **Kind:** workflow
|
|
15
|
+
- **For:** A prototype from outside the workspace (or any 2D project that is not in the game centre) is to become a game in the workspace's `games/`, pinned to an engine commit, whose picture has passed the prefab gates.
|
|
16
|
+
- **Checked on:** desktop WebGL (Apple M4, headless Chrome 158); no phone
|
|
17
|
+
- **Status:** 2026-11-25: Dungeon Spin's gates run again on engine `def94aa`. After a new
|
|
18
|
+
acceptance the build, the types, the Doctor and the tests all pass; three prefabs at 0 pixels
|
|
19
|
+
from the original reference pictures, 30 cycles each; the module taken out of it passed once
|
|
20
|
+
more in a minimal game.
|
|
21
|
+
- **Reference consumer:** `zhuda-engine-prefabs/2d/dungeon-spin/source/prefab-check/` (the smallest game that
|
|
22
|
+
passes the gates), `zhuda-engine-prefabs/2d/dungeon-spin/prefabs.ts`, `zhuda-engine-prefabs/tests/dungeon-spin.test.mjs`
|
|
23
|
+
(the boundary test and the asset-manifest test).
|
|
24
|
+
- **Engine version:** zhuda-laya-engine 1.18.0, `def94aae9e7ebf5f9f35b915b54dbb4c3e5fe43c` (the
|
|
25
|
+
original move was at `dd9b5fd`)
|
|
26
|
+
|
|
27
|
+
Everything on this page was done and checked on or before 2026-11-25, when the prefab library
|
|
28
|
+
was still in the ZhudaGameCenter workspace, beside the engine. The paths are written as they are
|
|
29
|
+
in this repository; nothing was run again from them.
|
|
30
|
+
|
|
31
|
+
## When to take this route
|
|
32
|
+
|
|
33
|
+
- Fits: a project outside the workspace (a loose folder, someone else's repository, a
|
|
34
|
+
single-file prototype) that is to move into the workspace's `games/` and claim to be "made
|
|
35
|
+
with the engine"; its picture is images, atlases and `.lh` nodes.
|
|
36
|
+
- Does not fit:
|
|
37
|
+
- A new game: [new-game-project](new-game-project.md), [game-2d](game-2d.md).
|
|
38
|
+
- A game already in the workspace that is only to be retired:
|
|
39
|
+
[game-to-prefabs](game-to-prefabs.md).
|
|
40
|
+
- Prefabs of 3D models: [visual-content-prefab](visual-content-prefab.md),
|
|
41
|
+
[model-from-dcc](model-from-dcc.md).
|
|
42
|
+
- This route does not repeat the five gates of
|
|
43
|
+
[visual-content-prefab](visual-content-prefab.md); it gives only what a move really takes, and
|
|
44
|
+
what was measured.
|
|
45
|
+
|
|
46
|
+
## Tools
|
|
47
|
+
|
|
48
|
+
- The engine, pinned in `package.json` (`github:<owner>/zhuda-laya-engine#<commit>`):
|
|
49
|
+
`zhuda-laya-build` (`--candidate`), `zhuda-laya-accept` (`-- --capture` only makes the
|
|
50
|
+
reference pictures), `zhuda-laya-doctor`.
|
|
51
|
+
- `node --test`: the boundary test and the asset-manifest test (example:
|
|
52
|
+
`zhuda-engine-prefabs/tests/dungeon-spin.test.mjs`).
|
|
53
|
+
- Go (when there is a server): `go test ./...`, `go vet ./...`.
|
|
54
|
+
|
|
55
|
+
## Steps
|
|
56
|
+
|
|
57
|
+
1. **Bring only what is the game's own.** Not the engine's `packages/`, `vendor/laya-*`,
|
|
58
|
+
`dist/`, the old `legacy/` runtime or archives of old evidence (Dungeon Spin left one of
|
|
59
|
+
227 MB behind). Keep: the game's code, its pictures, its data tables and its prefab
|
|
60
|
+
definitions.
|
|
61
|
+
2. **The project's shape.** The workspace's `games/<game>/client` (`package.json` pinned to a
|
|
62
|
+
commit, `zhuda.config.json`, `src/Main.ts`, `public/index.html` with
|
|
63
|
+
`<meta charset="utf-8">`, `<!-- ZHUDA_LIBS -->` and `<!-- ZHUDA_ENTRY -->`) and the
|
|
64
|
+
workspace's `games/<game>/server`. Confirm with `tsc --strict` and `zhuda-laya-doctor`:
|
|
65
|
+
imports from the root of `zhuda-laya-engine` only, no `packages/core`, `packages/types` or
|
|
66
|
+
`vendor/`, and no `declare const Laya: any` (written as a test: the boundary case in
|
|
67
|
+
`zhuda-engine-prefabs/tests/dungeon-spin.test.mjs`).
|
|
68
|
+
3. **Register every file.** `assetManifest`: `{ id, kind: 'image' | 'scene', bytes, sha256 }`,
|
|
69
|
+
given to
|
|
70
|
+
`new DirectoryAssetProvider({ baseUrl, manifest, timeoutMs: 15_000, maxBytes: 20_000_000 })`;
|
|
71
|
+
a test works out each file's size and SHA-256 again, and confirms that every picture that
|
|
72
|
+
ships is in the manifest and that the manifest lists nothing more.
|
|
73
|
+
4. **One prefab for each picture.** The `.lh`: a Sprite root with one `Image` child (its name is
|
|
74
|
+
the `node` of the check, its `skin` is the picture's id). The definition:
|
|
75
|
+
`{ id: 'visual/…', asset: 'zhuda-engine-prefabs/….lh', textures: ['….png'], states: { idle: { <node>: { visible: true } } } }`.
|
|
76
|
+
5. **The preview module.** `prefabPreview` in `zhuda.config.json` points to a module that
|
|
77
|
+
exports `definitions` and `createAssetProvider()`. The engine's preview page calls
|
|
78
|
+
`createAssetProvider()` **with no arguments**, so its default `baseUrl` must be a place the
|
|
79
|
+
preview page can see (`./assets/`, or `./common/…/assets/` for what came by sync).
|
|
80
|
+
6. **Write the checks.** Each entry of `prefabChecks`: `id`, `state`, `node`, `width`, `height`
|
|
81
|
+
(the size that picture has in the game), `dpr: 1`, `cycles: 30`, `baseline`, `output`.
|
|
82
|
+
7. **Pass the gates.** `npm run build:candidate`; then, the first time,
|
|
83
|
+
`npm run accept:prefabs -- --capture` (it only makes `references/*.png`, which a person must
|
|
84
|
+
look at); then `npm run accept:prefabs` (it publishes only when all three pass, and writes
|
|
85
|
+
`evidence/prefab-*.json` in schema 2); then `npm run build` (the release build accepts only
|
|
86
|
+
passing evidence that matches this build).
|
|
87
|
+
8. **The scene mounts the same one.** The scene uses the same `definitions` and the same
|
|
88
|
+
`createAssetProvider()`; the pictures a moving picture needs are taken from the mounted
|
|
89
|
+
prefab instance (`mountAtlasPrefab` of `zhuda-engine-prefabs/2d/prefab-atlas`), with no other URL and no
|
|
90
|
+
`Laya.loader`. A test checks that every id is `instantiate`d in the scene's source.
|
|
91
|
+
9. **The server is verified apart.** `go test ./...`, `go vet ./...`, a health check; recorded
|
|
92
|
+
apart from the client's results.
|
|
93
|
+
10. **Evidence is recorded apart, and deleting the prototype comes last.** One record each for
|
|
94
|
+
the prefabs, the scene, the server and the devices (each written only up to the level it
|
|
95
|
+
claims); delete the prototype only when all have passed, and write in the report what was
|
|
96
|
+
deleted and how to restore it.
|
|
97
|
+
|
|
98
|
+
## Pitfalls
|
|
99
|
+
|
|
100
|
+
- **Evidence goes stale with any change of code.** The release build reports
|
|
101
|
+
`missing, failed or stale prefab evidence`. Adding one comment line to the entry file does it;
|
|
102
|
+
putting one more unrelated file under `public/` does not (measured on 2026-11-25). After every
|
|
103
|
+
change of code: `build:candidate`, then `accept:prefabs`, then `build`. This is why the shared
|
|
104
|
+
viewer carries no `prefabChecks`, and a module is checked in a minimal game of its own.
|
|
105
|
+
- **A changed engine pin makes it stale in the same way.** Dungeon Spin went from `dd9b5fd` to
|
|
106
|
+
`def94aa`: with not one line of code changed, acceptance was run again, the three prefabs were
|
|
107
|
+
at 0 pixels from the original reference pictures over 30 cycles, and the build passed. Try
|
|
108
|
+
this first, before suspecting the code.
|
|
109
|
+
- **Written in the spec is not the same as done.** Dungeon Spin's spec said "sound goes through
|
|
110
|
+
the engine's `IframeSoundAdapter`; there is no second mixer", and the code in fact opened its
|
|
111
|
+
own `AudioContext`; `zhuda.config.json` said `dprCap: 1.5`, boot never passed it, and the
|
|
112
|
+
canvas stayed 572×1024 scaled by CSS; a 3D stone corridor that was built besides was wholly
|
|
113
|
+
covered by an opaque background (taking it out gave 0 pixels of difference). The gates look
|
|
114
|
+
after prefabs only and stopped none of these. When moving, go through the spec against the
|
|
115
|
+
code item by item, and measure whatever can be measured (take one layer out and compare
|
|
116
|
+
pixels).
|
|
117
|
+
- **Top-level `await` fails the build.** The build target is ES2020: use
|
|
118
|
+
`async function main()`.
|
|
119
|
+
- **Giving `container` at boot changes show-all.** A fixed portrait design either gives no
|
|
120
|
+
`container` (Laya scales by itself) or gives `designSize`; the two draw differently (920,000
|
|
121
|
+
pixels of difference at 1280×720). Do whichever the prototype did.
|
|
122
|
+
|
|
123
|
+
## Engine gaps and their workarounds
|
|
124
|
+
|
|
125
|
+
| Gap | Workaround |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| Prefab evidence is bound to the built code, so several projects cannot share one set of it | Every module that is to be shared carries a minimal game made of it alone (`zhuda-engine-prefabs/2d/dungeon-spin/source/prefab-check/`), where its checks run and its evidence is kept |
|
|
128
|
+
| The gates do not check the other promises of a spec (a single sound output, the DPR cap, whether a layer can be seen) | Compare by hand when moving; write what can be measured as a test or a comparison |
|
|
129
|
+
|
|
130
|
+
## Checks
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
cd <workspace>/games/<game>/client # the game is in the workspace, outside this repository
|
|
134
|
+
npm run build:candidate && npm run accept:prefabs # every prefabChecks entry: passed, differentPixels 0, lifecycle 30
|
|
135
|
+
npm run build && npm run typecheck && npm run doctor && npm test
|
|
136
|
+
cd ../server && go test ./... && go vet ./...
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
2026-11-25 (a copy of Dungeon Spin with only the pin changed, to `def94aa`): all three accepted,
|
|
140
|
+
0 pixels, 30 cycles; the build, the types, the Doctor (HEALTHY, 0 violations), 6 tests, the Go
|
|
141
|
+
tests and vet all pass. The module taken out of it was run once more with
|
|
142
|
+
`zhuda-engine-prefabs/2d/dungeon-spin/source/prefab-check/`: the same three at 0 pixels and 30 cycles, with
|
|
143
|
+
definition hashes and source SHA-256 equal to those of the original evidence.
|
|
144
|
+
|
|
145
|
+
## Not checked
|
|
146
|
+
|
|
147
|
+
- The prototype itself (`DungeonSpin-zhuda-laya-engine`, a folder outside the workspace) was
|
|
148
|
+
deleted on 2026-11-06; the two steps "what to leave behind" and "delete the prototype" rest
|
|
149
|
+
only on the report of that time and were not done again on 2026-11-25.
|
|
150
|
+
- No phone, no packaging; the prefab checks ran at DPR 1 only.
|
|
151
|
+
- `accept:prefabs -- --capture` was not used on 2026-11-25 (the original reference pictures were
|
|
152
|
+
kept).
|
|
153
|
+
|
|
154
|
+
## Boundaries
|
|
155
|
+
|
|
156
|
+
- The game: its pictures, `.lh` files, definitions, reference pictures and evidence, its rules,
|
|
157
|
+
its server and its device records.
|
|
158
|
+
- The prefab library (`zhuda-engine-prefabs/`): reusable pictures and systems (taken out by
|
|
159
|
+
[game-to-prefabs](game-to-prefabs.md)).
|
|
160
|
+
- The engine: the prefab runtime library, `AssetProvider`, the preview page, the acceptance and
|
|
161
|
+
build commands. Do not change the engine or import from deep inside it in order to pass a
|
|
162
|
+
gate.
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Route: Four pigs fighting on a raft, a landscape 3D mini game for WeChat
|
|
2
|
+
|
|
3
|
+
A landscape 3D WeChat mini game (重生之我在海上当猪大): the player and three computer pigs stand on
|
|
4
|
+
a raft of 25 tiles at sea. Every blow raises a pig's damage and throws it further, a shark takes
|
|
5
|
+
edge tiles, whoever falls in is out and the last one standing wins. A thumb stick on the left, a
|
|
6
|
+
camera drag on the right, two buttons. The rules are pure, seeded and tested in Node, the
|
|
7
|
+
fighting comes from a shared prefab module. The game's records show eight rule tests passing and
|
|
8
|
+
the title screen on an iPhone in WeChat; no match on the phone, no picture of the brawl. Nothing
|
|
9
|
+
was run again to write this page.
|
|
10
|
+
|
|
11
|
+
- **Id:** `raft-brawl-3d-minigame`
|
|
12
|
+
- **Kind:** workflow
|
|
13
|
+
- **For:** a landscape 3D mini game for WeChat where several characters knock each other off a shrinking raft of tiles: seeded pure rules with bots, combat from a shared prefab module, one slimmed skinned model in a subpackage, a 4 MB main package
|
|
14
|
+
- **Checked on:** Node (rule tests); an iPhone in WeChat (mini-game host, WebGL; iPhone 14 in the game's earlier entries): subpackage load and title screen only; no browser run of the brawl recorded
|
|
15
|
+
- **Status:** recorded in the game's HANDOFF on 2026-11-19: 8 rule tests pass, 40 bot matches were
|
|
16
|
+
run for balance, the model subpackage loaded on the iPhone and the title ran at 41–54 fps. Not
|
|
17
|
+
recorded: a match played on the phone (remote taps did not land in landscape), the frame rate
|
|
18
|
+
in a match after the performance changes (22 fps before them), any scripted browser run or
|
|
19
|
+
screenshot of the brawl. Nothing is committed (draft)
|
|
20
|
+
- **Reference consumer:** ZhudaGameCenter `games/zhuda-raft-survival` (outside this repository; the workspace is not under version control)
|
|
21
|
+
- **Engine version:** zhuda-laya-engine 1.18.0 pinned at `a5dfc6b12595e2668af63255bd96c45f8f9caa33`. Moved to 2.0.0 (`91d21f79`) on 2026-11-26: `npm run verify` 8 of 8 with Doctor HEALTHY; main package 3,199,416 to 3,283,566 bytes, the subpackage unchanged; a match played in headless Chrome with 0 errors; no run in a host
|
|
22
|
+
|
|
23
|
+
## When to take this route
|
|
24
|
+
|
|
25
|
+
A small arena fight in 3D for a mini-game host: a few skinned characters, an arena of tiles that
|
|
26
|
+
can be taken away, a ring-out instead of a health bar, computer opponents, a 4 MB main package.
|
|
27
|
+
Take [new-game-project](new-game-project.md), [mini-game-build](mini-game-build.md) and
|
|
28
|
+
[game-rules-first](game-rules-first.md) first; a larger game on the same host files and helper
|
|
29
|
+
is [action-adventure-3d-minigame](action-adventure-3d-minigame.md).
|
|
30
|
+
|
|
31
|
+
Not this route: a 2D fight ([platform-fighter-2d](platform-fighter-2d.md),
|
|
32
|
+
[side-view-duel](side-view-duel.md)); one large monster ([hunting-action-3d](hunting-action-3d.md));
|
|
33
|
+
play between phones ([online-lockstep-match](online-lockstep-match.md)); landscape in a phone
|
|
34
|
+
browser ([mobile-always-landscape](mobile-always-landscape.md)).
|
|
35
|
+
|
|
36
|
+
The folder first held a portrait survival game (2026-11-18: a hook, building, hunger and thirst,
|
|
37
|
+
seven days). What survives of it in the code: the mini-game setup, the asset provider, the
|
|
38
|
+
polyfills, the host bridge, the look and water settings, the particles, and its debris, shark
|
|
39
|
+
and island as scenery. Its rules, tests and play script were removed without a commit (commit
|
|
40
|
+
before changing genre) and cannot be followed; every screenshot in `evidence/` is of that game.
|
|
41
|
+
|
|
42
|
+
## Tools
|
|
43
|
+
|
|
44
|
+
- Engine pin above; Node 24 or later (exact version not recorded); TypeScript 5.9.3; the LayaAir
|
|
45
|
+
3.4.2 command line behind the build ([mini-game packaging](../minigame-packaging.md)).
|
|
46
|
+
- `zhuda-engine-prefabs/systems/pig-combat` (library 0.4.0 in `common-prefabs.lock.json`). It and the model
|
|
47
|
+
come from the game of [third-person-town-3d](third-person-town-3d.md); how the model was made
|
|
48
|
+
and its licence are not recorded here.
|
|
49
|
+
- `@gltf-transform/core`, `extensions`, `functions` ^4.1.1, `meshoptimizer` ^0.22.0, `sharp`
|
|
50
|
+
^0.34.4 for `tools/slim-model.mjs`; the engine's Chrome fixture for `tools/shot.mjs`.
|
|
51
|
+
- The WeChat developer tools (version not recorded), a WeChat mini-game account for the app id,
|
|
52
|
+
and the owner's `wxgame` helper (a workstation skill outside this repository): `lower`,
|
|
53
|
+
`subpack`, `check-pkg`, `preview`.
|
|
54
|
+
|
|
55
|
+
## Steps
|
|
56
|
+
|
|
57
|
+
1. **Template, config, boot.** `zhuda-laya-init <dir> --template minigame`. `zhuda.config.json`:
|
|
58
|
+
`renderer: "webgl"`, `features` `core, 3d, gltf, postProcess`, `branding.mode: "none"`,
|
|
59
|
+
`viewport` 1334×750 `fixedheight`, the app id under `minigame.targets.wxgame`.
|
|
60
|
+
`ZhudaEngine.boot` takes the same size with `dprCap: 2`. `tsconfig.json` sets
|
|
61
|
+
`allowImportingTsExtensions`: the rules import the shared module as `.ts`, so Node runs them.
|
|
62
|
+
2. **Host files before anything else.** First line of `src/Main.ts` is `import './polyfills'`
|
|
63
|
+
(`TextDecoder`, `structuredClone`). `src/assets.ts` (34 lines) is the `AssetProvider`
|
|
64
|
+
([asset loading](../asset-loading.md)): `wx.getFileSystemManager().readFile` in WeChat,
|
|
65
|
+
`fetch` in a browser; it goes to `new ZhudaModelLibrary({ provider, timeoutMs: 60_000 })`.
|
|
66
|
+
3. **Take the fighting from the prefab library.**
|
|
67
|
+
`node node_modules/zhuda-engine-prefabs/scripts/sync.mjs . systems/pig-combat` copies
|
|
68
|
+
`jobs.ts` and `targets.ts` to `src/common/systems/pig-combat/`. Used here: `JOBS` (three
|
|
69
|
+
callings, each a round of five attacks and a skill), `newCombat`, `pressAttack`, `pressSkill`,
|
|
70
|
+
`stepCombat`, `current`; `REACH`, `struck`, `aimAt`, `aimRange`, `landAhead`, `SHATTER`.
|
|
71
|
+
4. **The match as data: `src/brawl.ts`** (449 lines, no engine import). `createBrawl(job, seed)`:
|
|
72
|
+
a 5×5 grid of 1.2 m tiles, four pigs 1.8 m from the middle facing it, the three bots one of
|
|
73
|
+
each calling in an order shuffled by `rand(state)`. `setIntent(state, id, intent)` (move,
|
|
74
|
+
attack, skill) is the only input. `stepBrawl(state, dt)` clamps `dt` to 0.1 s and returns
|
|
75
|
+
events (`attack`, `land`, `hit`, `refused`, `fall`, `out`, `warn`, `tileLost`, `won`). In a
|
|
76
|
+
step: a 3 s countdown; per pig, bot thinking, presses (turning to the nearest foe with
|
|
77
|
+
`aimAt`, arc 220°), `stepCombat`, feet, pushes; pigs pushed apart (radius 0.35 m); delayed
|
|
78
|
+
strikes; the shark; who is off the raft falls for 0.9 s and is out; one left wins.
|
|
79
|
+
5. **Feet never leave the raft, pushes do.** `walkOn` tries the move, then each axis alone, with
|
|
80
|
+
a 0.1 m margin; walking is 3 m/s (0.45 of it during an attack). A strike adds
|
|
81
|
+
`force × FORCE_SCALE[effect] × 1.4 × (1 + damage / 120)` m/s (×1.3 when frozen), which decays
|
|
82
|
+
at 3.5 per second. Damage is 0.35 of the prefab's number, a freeze half its length. The
|
|
83
|
+
long reaches are scaled down (`crescent` 0.55, `chop` 0.7), single charms up (1.3 to 1.6).
|
|
84
|
+
6. **The shark shrinks the arena.** First 21 s after the countdown, then every
|
|
85
|
+
`max(4, 11 − time / 20)` s plus up to 3 s. It picks a random edge tile (one missing a
|
|
86
|
+
neighbour, never the middle), the tile flashes for 2.4 s (`warn`), then goes (`tileLost`).
|
|
87
|
+
7. **Bots** (`think`, every 0.2–0.45 s): leave a doomed tile or the edge for the raft's middle;
|
|
88
|
+
keep a target unless another is 2 m nearer; use the skill in range (ninja 7 m, Taoist 5 m,
|
|
89
|
+
boxer 2.4 m) with chance 0.7 or 0.45; in reach, strike with chance 0.4, else sidestep; else
|
|
90
|
+
close in. One bot starts on the player, two on each other. Recorded over 40 bot matches:
|
|
91
|
+
median about 35 s; wins boxer 20, ninja 15, Taoist 5.
|
|
92
|
+
8. **Tests: `tests/brawl.test.ts`**, 8, under `node --test`: same seed same match
|
|
93
|
+
(`assert.deepEqual`); one of each calling; four bots end with places 1 to 4 (three seeds);
|
|
94
|
+
walking never leaves the raft; more damage throws further; the shark warns, takes a tile and
|
|
95
|
+
the pig on it places last; revive; nobody moves in the countdown.
|
|
96
|
+
9. **One slimmed model, four times.** `tools/slim-model.mjs <in> <out>` with `--keep <clips>`,
|
|
97
|
+
`--drop-materials <names>` and `RATIO=0.2 ERROR=0.008`: `weld`, `simplify` (meshoptimizer),
|
|
98
|
+
`resample`, `dedup`, `prune`, textures to 512 JPEG, no normal map or tangents. Recorded:
|
|
99
|
+
0.93 MB and 12k triangles out (the source is 3.97 MB), lantern and pole removed. Each pig is
|
|
100
|
+
`models.instantiate('models/zhuda-fighter.glb', { independentMaterials: true })`, so a frozen
|
|
101
|
+
one is tinted alone. `src/animated.ts` plays the 17 clips through `ZhudaAnimationBlend`
|
|
102
|
+
([animation control](../animation-control.md)); an attack's clip is sped to last the
|
|
103
|
+
`seconds` its `attack` event gives.
|
|
104
|
+
10. **Sea, light, camera** ([quality route](../quality-route.md), water in
|
|
105
|
+
[film scenes](../film-scenes.md)). `ZhudaSceneLook`: preset `day`, sun azimuth 150° elevation
|
|
106
|
+
42°, shadows 22 m at 1024 with one cascade, exposure 1.0, bloom 0.25, ao 0.4, start quality 1.
|
|
107
|
+
`ZhudaWaterSurface`: 260 m square, flow `[0, 0.12]`, color `[0.02, 0.36, 0.5]`, clarity 0.6,
|
|
108
|
+
`waveMeters` 1.8, waves 0.2, reflection 0.7, glow 1.1, `foamDepth` 0.16, resolution 512. Each
|
|
109
|
+
frame `setRipples` (raft: radius 3.4, strength 0.4; shark: 0.5, and 0.8 or 1.4), `update`,
|
|
110
|
+
`setTime`, and `render()` every frame at quality 2, every second at 1, every third at 0.
|
|
111
|
+
`ZhudaQualityGovernor({ budgetMs: 1000 / 50 })` feeds `look.setQuality`. No `lightFog`.
|
|
112
|
+
`ZhudaCameraRig` ([3D integration](../3d-integration.md)): `orbit`, fov 52, pitch 0.36,
|
|
113
|
+
distance 6.4, target eased to 1 m above the player's pig.
|
|
114
|
+
11. **Everything else from primitives: `src/view3d.ts`.** A tile is a plank box on two logs and
|
|
115
|
+
swaps to a red material when doomed; a ring in each pig's colour, headgear per calling on
|
|
116
|
+
the `head` bone, shark, island, drifting junk. `syncTiles` and `syncPigs` in `src/Main.ts`
|
|
117
|
+
copy state to nodes: removed tiles sink for 1.4 s, a falling pig splashes once. `src/fx.ts`
|
|
118
|
+
holds 11 emitters on `ZhudaParticleSystem3D`, sprites painted in code; `onEvents` maps each
|
|
119
|
+
event to a burst, a sound, a shake or a vibration.
|
|
120
|
+
12. **Touch.** `ZhudaPointerInput` is refused in a mini game: `Laya.stage` `MOUSE_DOWN`, `MOVE`,
|
|
121
|
+
`UP` with `e.stageX`, `e.stageY`, `e.touchId`; `hud.tap` first. A press on the left 45%
|
|
122
|
+
(below y 130) is the stick: full tilt at 80 px, dead zone 0.15, the base follows past 110 px.
|
|
123
|
+
Any other press drags the camera (`rig.rotate(dx, dy × 0.7)`). `steer` turns the stick by
|
|
124
|
+
the rig's yaw before `setIntent`. Keys (WASD, J, K) serve the desktop.
|
|
125
|
+
13. **HUD: `src/hud.ts`**, Laya sprites at design height 750. `safeArea` in `src/platform.ts`
|
|
126
|
+
converts `wx.getSystemInfoSync().safeArea` and the capsule button's rectangle to design
|
|
127
|
+
pixels; cards (calling, damage %) sit between notch and capsule and are redrawn only when
|
|
128
|
+
their text changes. 攻击 (radius 92) and 技能 (66) bottom right. Names over heads come from
|
|
129
|
+
`camera.worldToViewportPoint` (`screenOf`). Title: pick a calling; the health advice text.
|
|
130
|
+
14. **Host bridge: `src/platform.ts`.** Best place and calling in `wx` storage or
|
|
131
|
+
`localStorage`; share menu; vibration; a rewarded video for `revivePlayer` (once, button
|
|
132
|
+
only when an ad has loaded, reward only when watched to the end); an interstitial at most
|
|
133
|
+
every third round and 60 s. Sound: `Laya.SoundManager` in `src/sound.ts` ([audio](../audio.md)).
|
|
134
|
+
15. **Package.** `npm run build:minigame -- --platform wxgame`, then on
|
|
135
|
+
`dist/minigames/wxgame/game`: `wxgame lower <dir> --appid <appid> --name <name>` with
|
|
136
|
+
`--orientation landscape` (ES2017), `wxgame subpack <dir> assets/models --name models`, the
|
|
137
|
+
helper's `check-pkg`. `loadSubpackage('models')` runs before `instantiate`. Recorded: main
|
|
138
|
+
3.05 MB, subpackage 0.93 MB. The engine gate is 8 MB (`maxMainPackageBytes`).
|
|
139
|
+
16. **Hooks for a script.** `window.__RAFT__` has `ready`, `error`, `phase` and an `api`: `start`,
|
|
140
|
+
`state`, `fast(seconds)`, `move`, `look`, `attack`, `skill`, `tap`. `?quality=0..2` pins the look.
|
|
141
|
+
|
|
142
|
+
## Pitfalls
|
|
143
|
+
|
|
144
|
+
- **22 fps in a match on the iPhone**, against 41–54 on the title. Changed since, not measured:
|
|
145
|
+
the 12k-triangle model, HUD text drawn only on change, the water mirror every third frame.
|
|
146
|
+
- **No model, then a blank screen, on the iPhone only.** WeChat on iOS has no `TextDecoder`
|
|
147
|
+
(the GLB JSON chunk) and no `structuredClone` (the engine copies look and water options with
|
|
148
|
+
it). `src/polyfills.ts` installs both when missing.
|
|
149
|
+
- **The main package ran out.** The landscape build was 3.74 MB with a 0.54 MB pig; the 0.93 MB
|
|
150
|
+
fighter went to a subpackage. The engine's gate sees the whole output, so it was raised to
|
|
151
|
+
8 MB and the real 4 MB check became the helper's.
|
|
152
|
+
- **Numbers tuned for a town were too strong on a raft 6 m wide.** Hence `FORCE_SCALE`,
|
|
153
|
+
`DAMAGE_SCALE` and `FREEZE_SCALE` in `src/brawl.ts`; a full freeze was a free knock-out.
|
|
154
|
+
- **Short taps missed, as if a long press were needed.** `stage.mouseX` can hold the previous
|
|
155
|
+
position during a short tap. Use the event's `stageX`, `stageY`.
|
|
156
|
+
- **The whole sea grey at quality 1 and 2** with `lightFog` and a camera above water
|
|
157
|
+
(`evidence/q-compare.png`, from the earlier game). Leave `lightFog` off.
|
|
158
|
+
- **Remote taps did not land in landscape**, so nobody has played a match on a phone.
|
|
159
|
+
- **Left in:** `SHOW_FPS`, boot `log` lines, startup error text, the old title in `index.html`.
|
|
160
|
+
|
|
161
|
+
## Engine gaps and their workarounds
|
|
162
|
+
|
|
163
|
+
As met at the pinned commit; no engine plan item is known unless one is named.
|
|
164
|
+
|
|
165
|
+
- No asset provider for a mini-game host (`DirectoryAssetProvider` is refused): `src/assets.ts`.
|
|
166
|
+
- No `TextDecoder` or `structuredClone` fallback for WeChat on iOS: `src/polyfills.ts`.
|
|
167
|
+
- `zhuda-laya-minigame` has no subpackage cut, orientation or ES2017 lowering, and one size
|
|
168
|
+
number for the whole output: the owner's `wxgame` helper; gate at 8 MB.
|
|
169
|
+
- `lightFog` greys water seen from above at quality 1 and 2; cause not found: left off.
|
|
170
|
+
- No host bridge (storage, safe area, ads, share, vibration): `src/platform.ts`.
|
|
171
|
+
- The Chrome fixture had no public entry: closed in 2.0.0 as
|
|
172
|
+
`zhuda-laya-engine/compiler/chrome-host` ([consumer tooling](../consumer-tooling.md)); the
|
|
173
|
+
game's `tools/shot.mjs` still imports it by path until it is upgraded.
|
|
174
|
+
|
|
175
|
+
## Checks
|
|
176
|
+
|
|
177
|
+
All from the game's HANDOFF of 2026-11-19 unless dated otherwise; none repeated here.
|
|
178
|
+
|
|
179
|
+
- `node --test`: `tests/brawl.test.ts`, 8 tests pass. `npm run verify` (build, `tsc --noEmit`,
|
|
180
|
+
Doctor, tests) is not recorded as run.
|
|
181
|
+
- 40 bot matches: median about 35 s; wins 20, 15, 5 (the script is not in the folder).
|
|
182
|
+
Package: main 3.05 MB, subpackage 0.93 MB.
|
|
183
|
+
- iPhone in WeChat: the subpackage loads; title 41–54 fps. Just before the brawl, the landscape
|
|
184
|
+
scene with one pig: capsule and notch clear, 40–57 fps at quality 0.
|
|
185
|
+
- `evidence/` (all 2026-11-18, the earlier portrait game): `q-compare.png` shows the look's
|
|
186
|
+
levels and the fog fault, `play-3/` the engine water and shadows. No file shows the brawl.
|
|
187
|
+
|
|
188
|
+
## Not checked
|
|
189
|
+
|
|
190
|
+
- Anything at engine 2.0.0; anything by the writer of this page.
|
|
191
|
+
- A match on a phone: stick, camera drag, buttons, revive video, interstitial, share, sound.
|
|
192
|
+
- Frame rate in a match after the changes; Android; any other host; the developer tools' version.
|
|
193
|
+
- Any browser run of the brawl: no play script exists, and `tools/shot.mjs` is not recorded
|
|
194
|
+
against it. Whether `npm run verify` and the Doctor pass today (`node_modules` is absent).
|
|
195
|
+
- Balance by a person: the Taoist won 5 of 40 bot matches and nothing was retuned.
|
|
196
|
+
- Release: no upload or review is recorded, and the name change in the WeChat backend waits on
|
|
197
|
+
the owner; see the owner's portals (`PORTALS.md` in the workspace). Online play.
|
|
198
|
+
|
|
199
|
+
## Boundaries
|
|
200
|
+
|
|
201
|
+
The game owns `src/brawl.ts` and its numbers, the bots, the HUD and its text, the props from
|
|
202
|
+
code, the slimmed model, app id, ad units and advice text. The prefab library owns
|
|
203
|
+
`zhuda-engine-prefabs/systems/pig-combat`: change it there and sync, never in `src/common/`. The engine owns
|
|
204
|
+
the look, the water, the governor, the camera rig, the model library, clip blending, particles
|
|
205
|
+
and the mini-game build; the files named under Engine gaps are game code until it takes them.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Route: A lane rhythm game
|
|
2
|
+
|
|
3
|
+
Notes fall down lanes to a line and are tapped in time with a song. The song is one sample mixed in the page from engine synth recipes; the chart comes from the same data as the song; time is one clock.
|
|
4
|
+
|
|
5
|
+
- **Id:** `rhythm-2d`
|
|
6
|
+
- **Kind:** workflow
|
|
7
|
+
- **For:** building anything that must be judged against music: a rhythm game, or a timed prompt over a track
|
|
8
|
+
- **Checked on:** desktop WebGL (headless Chromium 153 on SwiftShader, Linux container); no phone, no GPU, no human player
|
|
9
|
+
- **Status:** two songs, two difficulties built on 2026-11-25; real key presses at published times judged 54/54 perfect (mean −5 ms) while following the engine's audio clock; pause and resume recorded; nobody has heard it (draft)
|
|
10
|
+
- **Reference consumer:** this repository, `games/zhuda-beat`
|
|
11
|
+
- **Engine version:** zhuda-laya-engine 1.18.0; built at `def94aae9e7ebf5f9f35b915b54dbb4c3e5fe43c`, `npm run verify:games` re-run against this repository's engine
|
|
12
|
+
|
|
13
|
+
Read `game-rules-first` first: this file only adds what is particular to the genre.
|
|
14
|
+
|
|
15
|
+
## When to take this route
|
|
16
|
+
|
|
17
|
+
Input judged in tens of milliseconds against audio. Read it also before syncing a cut or a line of
|
|
18
|
+
dialogue to a track: the clock part is the same.
|
|
19
|
+
|
|
20
|
+
## Tools
|
|
21
|
+
|
|
22
|
+
- `IframeSoundAdapter`, `ProceduralAssetProvider`, `renderZhudaSynth`, `encodeZhudaWav`,
|
|
23
|
+
`validateZhudaSynthRecipe`; engine 2D for the lanes.
|
|
24
|
+
|
|
25
|
+
## Steps
|
|
26
|
+
|
|
27
|
+
1. **One zero.** Describe the song as data (tempo, bars, melody, bass, drums). Derive both the
|
|
28
|
+
audio and the chart from it. Never type chart times by hand beside a finished audio file.
|
|
29
|
+
2. **Mix it yourself.** A synth recipe is at most 10 s and 16 layers, so render each distinct tone
|
|
30
|
+
once (`renderZhudaSynth`), add it into one `Float32Array` where it sounds, level it, wrap with
|
|
31
|
+
`encodeZhudaWav`, register under a `ProceduralAssetProvider` id, `loadSample`. A 37 s song at
|
|
32
|
+
22050 Hz mono took about 0.1 s.
|
|
33
|
+
3. **One clock.** `songTime = performance.now()/1000 − origin`. Set `origin` a count-in ahead.
|
|
34
|
+
When `songTime` first passes zero, `playSample({ offsetSec: songTime, replace: true })`: the
|
|
35
|
+
sample starts where the clock says, so a late frame does not shift it. While it sounds, each
|
|
36
|
+
frame ease `origin` a tenth of the way onto `now − getSamplePositionSec(id)` (the audio clock
|
|
37
|
+
moves in steps of a few milliseconds) and jump when they part by more than 50 ms: the song's
|
|
38
|
+
time is then the audio clock's, and the page clock only carries it between frames.
|
|
39
|
+
4. **Stamp taps with `event.timeStamp`**, listen on the DOM (`keydown`, `pointerdown`), map the
|
|
40
|
+
pointer to a lane yourself. Do not take the frame's time.
|
|
41
|
+
5. Judge in pure code: windows ±50 / ±100 / ±140 ms; a tap takes the earliest open note of its
|
|
42
|
+
lane within reach; notes past reach are misses on `advance(time)`.
|
|
43
|
+
6. **Calibration**: subtract a player-set offset from every tap's time; after a song, show the
|
|
44
|
+
mean signed offset of the hits and say which way to move the setting.
|
|
45
|
+
7. **Leaving the page pauses the game**: on `blur` and `visibilitychange`, store `songTime`, stop
|
|
46
|
+
the sample. On resume, set `origin` so the song is a little before where it stopped and start
|
|
47
|
+
the sample again at its offset.
|
|
48
|
+
8. Publish the remaining notes as `[lane, performance.now() ms]` in the report: a script can then
|
|
49
|
+
press real keys on time, and that run is the check of clock → judgement.
|
|
50
|
+
|
|
51
|
+
## Pitfalls
|
|
52
|
+
|
|
53
|
+
- The adapter suspends audio on blur by itself while `performance.now()` runs on. Without step 7
|
|
54
|
+
the song and the notes part ways.
|
|
55
|
+
- Muted, `playSample` returns false and plays nothing: never use "is the song playing" as the clock.
|
|
56
|
+
- A chart with the same lane twice within 0.2 s is unplayable on a phone: test for it.
|
|
57
|
+
|
|
58
|
+
## Engine gaps and their workarounds
|
|
59
|
+
|
|
60
|
+
- `getSamplePositionSec(id)` is null until a gesture unlocks audio, while muted and after `stop`:
|
|
61
|
+
the page clock of step 3 is the fallback, not something to remove (`docs/audio.md`, "Keeping
|
|
62
|
+
time with a sample").
|
|
63
|
+
- No "start at" on `playSample`: start at an offset instead (step 3).
|
|
64
|
+
- Synth limits (10 s, 16 layers): step 2.
|
|
65
|
+
|
|
66
|
+
## Checks
|
|
67
|
+
|
|
68
|
+
- Exact taps rank S with a full combo; 70 ms late is all "good" and the lean reads 70 ms (tests).
|
|
69
|
+
- The first beat has sound at time zero in the mix (test).
|
|
70
|
+
- Real keys at published times: all within the perfect window; Esc holds `songTime` still (recorded).
|
|
71
|
+
- In headless Chromium's audio context the engine's audio clock was read 1,315 times over one song
|
|
72
|
+
and never stood more than 10.2 ms from the page clock; the host reported 32 ms of output latency.
|
|
73
|
+
|
|
74
|
+
## Not checked
|
|
75
|
+
|
|
76
|
+
- **Whether the ear and the eye agree.** Headless has no speaker: only clock → judgement was checked.
|
|
77
|
+
- Whether the songs sound good. Drift between page clock and audio clock over minutes.
|
|
78
|
+
- Touch on a device; Bluetooth latency.
|
|
79
|
+
|
|
80
|
+
## Boundaries
|
|
81
|
+
|
|
82
|
+
Taps only: no holds, no slides, no imported audio files, no editor.
|