@woosh/meep-engine 3.11.3 → 3.12.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/README.md +14 -18
- package/editor/SelectionVisualizer.js +127 -127
- package/editor/entity_world_bounds.js +27 -27
- package/editor/particles/rebuildParticleEmitter.js +31 -31
- package/editor/process/SymbolicDisplayProcess.js +1 -1
- package/editor/process/symbolic/CameraSymbolicDisplay.js +146 -146
- package/editor/process/symbolic/LightSymbolicDisplay.js +172 -172
- package/editor/prototypeEditorShell.js +156 -156
- package/editor/selection/editor_pick.js +130 -130
- package/editor/selection/screen_rect_frustum.js +119 -119
- package/editor/tools/v2/TransformControls.js +971 -971
- package/package.json +1 -1
- package/src/engine/Engine.d.ts +3 -3
- package/src/engine/Engine.d.ts.map +1 -1
- package/src/engine/Engine.js +726 -726
- package/src/engine/EngineHarness.d.ts +1 -1
- package/src/engine/EngineHarness.js +590 -590
- package/src/engine/ecs/HIERARCHY_REVIEW.md +717 -717
- package/src/engine/ecs/terrain/ecs/BuildLightTexture.d.ts +1 -1
- package/src/engine/ecs/terrain/ecs/BuildLightTexture.js +27 -27
- package/src/engine/ecs/terrain/ecs/Terrain.d.ts +1 -5
- package/src/engine/ecs/terrain/ecs/Terrain.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/Terrain.js +790 -790
- package/src/engine/ecs/terrain/util/loadVisibleTerrainTiles.js +129 -129
- package/src/engine/graphics/ecs/camera/camera_find_active.d.ts +1 -1
- package/src/engine/graphics/ecs/camera/camera_find_active.js +28 -28
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +1 -1
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +428 -428
- package/src/engine/graphics/ecs/water/Water.d.ts +1 -1
- package/src/engine/graphics/ecs/water/Water.js +104 -104
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +1 -1
- package/src/engine/graphics3/AnimationGraphSystem.d.ts +65 -0
- package/src/engine/graphics3/AnimationGraphSystem.d.ts.map +1 -0
- package/src/engine/graphics3/AnimationGraphSystem.js +329 -0
- package/src/engine/graphics3/AnimationGraphSystem3.d.ts +6 -61
- package/src/engine/graphics3/AnimationGraphSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/AnimationGraphSystem3.js +6 -325
- package/src/engine/graphics3/AnimationSystem.d.ts +76 -0
- package/src/engine/graphics3/AnimationSystem.d.ts.map +1 -0
- package/src/engine/graphics3/AnimationSystem.js +352 -0
- package/src/engine/graphics3/AnimationSystem3.d.ts +6 -72
- package/src/engine/graphics3/AnimationSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/AnimationSystem3.js +6 -348
- package/src/engine/graphics3/CameraSystem.d.ts +49 -0
- package/src/engine/graphics3/CameraSystem.d.ts.map +1 -0
- package/src/engine/graphics3/CameraSystem.js +170 -0
- package/src/engine/graphics3/CameraSystem3.d.ts +6 -45
- package/src/engine/graphics3/CameraSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/CameraSystem3.js +6 -166
- package/src/engine/graphics3/DebugDrawSystem.d.ts +72 -0
- package/src/engine/graphics3/DebugDrawSystem.d.ts.map +1 -0
- package/src/engine/graphics3/DebugDrawSystem.js +205 -0
- package/src/engine/graphics3/DebugDrawSystem3.d.ts +6 -68
- package/src/engine/graphics3/DebugDrawSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/DebugDrawSystem3.js +6 -201
- package/src/engine/graphics3/DecalSystem.d.ts +81 -0
- package/src/engine/graphics3/DecalSystem.d.ts.map +1 -0
- package/src/engine/graphics3/DecalSystem.js +441 -0
- package/src/engine/graphics3/DecalSystem3.d.ts +6 -77
- package/src/engine/graphics3/DecalSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/DecalSystem3.js +6 -437
- package/src/engine/graphics3/FogOfWarSystem.d.ts +74 -0
- package/src/engine/graphics3/FogOfWarSystem.d.ts.map +1 -0
- package/src/engine/graphics3/FogOfWarSystem.js +265 -0
- package/src/engine/graphics3/FogOfWarSystem3.d.ts +6 -70
- package/src/engine/graphics3/FogOfWarSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/FogOfWarSystem3.js +6 -261
- package/src/engine/graphics3/GraphicsEngine.d.ts +340 -0
- package/src/engine/graphics3/GraphicsEngine.d.ts.map +1 -0
- package/src/engine/graphics3/GraphicsEngine.js +790 -0
- package/src/engine/graphics3/GraphicsEngine3.d.ts +6 -336
- package/src/engine/graphics3/GraphicsEngine3.d.ts.map +1 -1
- package/src/engine/graphics3/GraphicsEngine3.js +6 -786
- package/src/engine/graphics3/HighlightSystem.d.ts +82 -0
- package/src/engine/graphics3/HighlightSystem.d.ts.map +1 -0
- package/src/engine/graphics3/HighlightSystem.js +241 -0
- package/src/engine/graphics3/HighlightSystem3.d.ts +6 -78
- package/src/engine/graphics3/HighlightSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/HighlightSystem3.js +6 -237
- package/src/engine/graphics3/LightSystem.d.ts +40 -0
- package/src/engine/graphics3/LightSystem.d.ts.map +1 -0
- package/src/engine/graphics3/LightSystem.js +211 -0
- package/src/engine/graphics3/LightSystem3.d.ts +6 -36
- package/src/engine/graphics3/LightSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/LightSystem3.js +6 -207
- package/src/engine/graphics3/MeshSystem.d.ts +106 -0
- package/src/engine/graphics3/MeshSystem.d.ts.map +1 -0
- package/src/engine/graphics3/MeshSystem.js +647 -0
- package/src/engine/graphics3/MeshSystem3.d.ts +6 -102
- package/src/engine/graphics3/MeshSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/MeshSystem3.js +6 -642
- package/src/engine/graphics3/ParticipatingMedia.d.ts +2 -2
- package/src/engine/graphics3/ParticipatingMedia.js +203 -203
- package/src/engine/graphics3/ParticipatingMediaSystem.d.ts +87 -0
- package/src/engine/graphics3/ParticipatingMediaSystem.d.ts.map +1 -0
- package/src/engine/graphics3/ParticipatingMediaSystem.js +184 -0
- package/src/engine/graphics3/ParticipatingMediaSystem3.d.ts +6 -83
- package/src/engine/graphics3/ParticipatingMediaSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/ParticipatingMediaSystem3.js +6 -180
- package/src/engine/graphics3/ParticleEmitterSystem.d.ts +76 -0
- package/src/engine/graphics3/ParticleEmitterSystem.d.ts.map +1 -0
- package/src/engine/graphics3/ParticleEmitterSystem.js +289 -0
- package/src/engine/graphics3/ParticleEmitterSystem3.d.ts +6 -72
- package/src/engine/graphics3/ParticleEmitterSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/ParticleEmitterSystem3.js +6 -285
- package/src/engine/graphics3/PathDisplaySystem.d.ts +70 -0
- package/src/engine/graphics3/PathDisplaySystem.d.ts.map +1 -0
- package/src/engine/graphics3/PathDisplaySystem.js +309 -0
- package/src/engine/graphics3/PathDisplaySystem3.d.ts +6 -66
- package/src/engine/graphics3/PathDisplaySystem3.d.ts.map +1 -1
- package/src/engine/graphics3/PathDisplaySystem3.js +6 -305
- package/src/engine/graphics3/Pickable.d.ts +1 -1
- package/src/engine/graphics3/Pickable.js +65 -65
- package/src/engine/graphics3/PickingQuery.d.ts +1 -1
- package/src/engine/graphics3/PickingQuery.js +48 -48
- package/src/engine/graphics3/PickingSystem.d.ts +67 -0
- package/src/engine/graphics3/PickingSystem.d.ts.map +1 -0
- package/src/engine/graphics3/PickingSystem.js +273 -0
- package/src/engine/graphics3/PickingSystem3.d.ts +6 -63
- package/src/engine/graphics3/PickingSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/PickingSystem3.js +6 -269
- package/src/engine/graphics3/ShadedGeometrySystem.d.ts +47 -0
- package/src/engine/graphics3/ShadedGeometrySystem.d.ts.map +1 -0
- package/src/engine/graphics3/ShadedGeometrySystem.js +169 -0
- package/src/engine/graphics3/ShadedGeometrySystem3.d.ts +6 -43
- package/src/engine/graphics3/ShadedGeometrySystem3.d.ts.map +1 -1
- package/src/engine/graphics3/ShadedGeometrySystem3.js +6 -165
- package/src/engine/graphics3/TerrainSystem.d.ts +80 -0
- package/src/engine/graphics3/TerrainSystem.d.ts.map +1 -0
- package/src/engine/graphics3/TerrainSystem.js +566 -0
- package/src/engine/graphics3/TerrainSystem3.d.ts +6 -76
- package/src/engine/graphics3/TerrainSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/TerrainSystem3.js +6 -562
- package/src/engine/graphics3/TooltipComponentSystem.d.ts +65 -0
- package/src/engine/graphics3/TooltipComponentSystem.d.ts.map +1 -0
- package/src/engine/graphics3/TooltipComponentSystem.js +328 -0
- package/src/engine/graphics3/TooltipComponentSystem3.d.ts +6 -61
- package/src/engine/graphics3/TooltipComponentSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/TooltipComponentSystem3.js +6 -324
- package/src/engine/graphics3/Trail3DSystem.d.ts +73 -0
- package/src/engine/graphics3/Trail3DSystem.d.ts.map +1 -0
- package/src/engine/graphics3/Trail3DSystem.js +221 -0
- package/src/engine/graphics3/Trail3DSystem3.d.ts +6 -69
- package/src/engine/graphics3/Trail3DSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/Trail3DSystem3.js +6 -217
- package/src/engine/graphics3/VolumetricLightMap.d.ts +2 -2
- package/src/engine/graphics3/VolumetricLightMap.js +2 -2
- package/src/engine/graphics3/VolumetricLightMapSystem.d.ts +98 -0
- package/src/engine/graphics3/VolumetricLightMapSystem.d.ts.map +1 -0
- package/src/engine/graphics3/VolumetricLightMapSystem.js +261 -0
- package/src/engine/graphics3/VolumetricLightMapSystem3.d.ts +6 -94
- package/src/engine/graphics3/VolumetricLightMapSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/VolumetricLightMapSystem3.js +10 -261
- package/src/engine/graphics3/WaterSystem.d.ts +59 -0
- package/src/engine/graphics3/WaterSystem.d.ts.map +1 -0
- package/src/engine/graphics3/WaterSystem.js +293 -0
- package/src/engine/graphics3/WaterSystem3.d.ts +6 -55
- package/src/engine/graphics3/WaterSystem3.d.ts.map +1 -1
- package/src/engine/graphics3/WaterSystem3.js +6 -289
- package/src/engine/graphics3/animation/AnimationGraphController.d.ts +1 -1
- package/src/engine/graphics3/animation/AnimationGraphController.js +518 -518
- package/src/engine/graphics3/animation/ClipListPlayer.d.ts +1 -1
- package/src/engine/graphics3/animation/ClipListPlayer.js +263 -263
- package/src/engine/graphics3/animation/ClipPlayback.d.ts +2 -2
- package/src/engine/graphics3/animation/ClipPlayback.js +84 -84
- package/src/engine/graphics3/decal/graph_build_decal_clusters.d.ts.map +1 -1
- package/src/engine/graphics3/decal/graph_build_decal_clusters.js +6 -8
- package/src/engine/graphics3/decal/shader_cluster_assign_decals.d.ts +0 -7
- package/src/engine/graphics3/decal/shader_cluster_assign_decals.d.ts.map +1 -1
- package/src/engine/graphics3/decal/shader_cluster_assign_decals.js +1 -1
- package/src/engine/graphics3/decal/shader_cull_decals_frustum.d.ts +0 -4
- package/src/engine/graphics3/decal/shader_cull_decals_frustum.d.ts.map +1 -1
- package/src/engine/graphics3/decal/shader_cull_decals_frustum.js +1 -1
- package/src/engine/graphics3/highlight/pack_highlight_table.d.ts +2 -2
- package/src/engine/graphics3/highlight/pack_highlight_table.d.ts.map +1 -1
- package/src/engine/graphics3/highlight/pack_highlight_table.js +74 -74
- package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts +1 -1
- package/src/engine/graphics3/pose/query_entity_node_world_pose.js +101 -101
- package/src/engine/graphics3/preview/make_model_thumbnail.d.ts +3 -3
- package/src/engine/graphics3/preview/make_model_thumbnail.d.ts.map +1 -1
- package/src/engine/graphics3/preview/make_model_thumbnail.js +48 -48
- package/src/engine/graphics3/shade_camera_projection_ray.d.ts +1 -1
- package/src/engine/graphics3/shade_camera_projection_ray.js +77 -77
- package/src/engine/graphics3/shade_node_to_entity_composition.d.ts +1 -1
- package/src/engine/graphics3/shade_node_to_entity_composition.js +84 -84
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.js +0 -1
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_points.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_points.js +0 -1
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.js +133 -134
- package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.js +202 -202
- package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.js +249 -249
- package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.js +1 -1
- package/src/shade/renderer/animation/pose/PosePlayback.d.ts +2 -1
- package/src/shade/renderer/animation/pose/PosePlayback.d.ts.map +1 -1
- package/src/shade/renderer/animation/pose/PosePlayback.js +2 -1
- package/src/shade/renderer/animation/shader_animation_apply.d.ts.map +1 -1
- package/src/shade/renderer/animation/shader_animation_apply.js +128 -129
- package/src/shade/renderer/animation/shader_animation_pose_resolve.d.ts.map +1 -1
- package/src/shade/renderer/animation/shader_animation_pose_resolve.js +176 -177
- package/src/shade/renderer/animation/shader_animation_tick.d.ts.map +1 -1
- package/src/shade/renderer/animation/shader_animation_tick.js +125 -126
- package/src/shade/renderer/animation/skinning/bounds_refresh/shader_geometry_sphere_derive.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/bounds_refresh/shader_geometry_sphere_derive.js +98 -99
- package/src/shade/renderer/animation/skinning/bounds_refresh/shader_meshlet_bounds_reduce.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/bounds_refresh/shader_meshlet_bounds_reduce.js +212 -213
- package/src/shade/renderer/animation/skinning/bounds_refresh/shader_meshlet_bounds_scatter.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/bounds_refresh/shader_meshlet_bounds_scatter.js +120 -121
- package/src/shade/renderer/animation/skinning/bounds_refresh/shader_skinned_mesh_bounds_refresh.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/bounds_refresh/shader_skinned_mesh_bounds_refresh.js +75 -76
- package/src/shade/renderer/animation/skinning/shader_meshlet_apply_skinning.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/shader_meshlet_apply_skinning.js +371 -372
- package/src/shade/renderer/animation/skinning/shader_skin_matrix_prep.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/shader_skin_matrix_prep.js +104 -105
- package/src/shade/renderer/atmosphere/shader_multiscatter_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/shader_multiscatter_lut.js +0 -1
- package/src/shade/renderer/buffer/graph_inspect_gpu_buffer.js +136 -136
- package/src/shade/renderer/buffer/table/GPUDatabase.d.ts.map +1 -1
- package/src/shade/renderer/buffer/table/GPUDatabase.js +2 -3
- package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.js +319 -319
- package/src/shade/renderer/buffer/util/shader_buffer_copy_storage_to_storage.d.ts.map +1 -1
- package/src/shade/renderer/buffer/util/shader_buffer_copy_storage_to_storage.js +41 -42
- package/src/shade/renderer/buffer/util/shader_buffer_intra_copy_regions.d.ts.map +1 -1
- package/src/shade/renderer/buffer/util/shader_buffer_intra_copy_regions.js +83 -84
- package/src/shade/renderer/dynamic/shader_dynamic_mesh.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/shader_dynamic_mesh.js +177 -170
- package/src/shade/renderer/extension/RENDER_EXTENSION_DESIGN.md +918 -918
- package/src/shade/renderer/geometry/bvh/record_blas_refit.js +4 -4
- package/src/shade/renderer/geometry/bvh/shader_blas_refit_leaf_bounds.d.ts.map +1 -1
- package/src/shade/renderer/geometry/bvh/shader_blas_refit_leaf_bounds.js +121 -122
- package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.js +774 -774
- package/src/shade/renderer/geometry/meshlet/shader_meshlet_metadata_address_patch.d.ts +1 -1
- package/src/shade/renderer/geometry/meshlet/shader_meshlet_metadata_address_patch.d.ts.map +1 -1
- package/src/shade/renderer/geometry/meshlet/shader_meshlet_metadata_address_patch.js +69 -70
- package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.js +367 -367
- package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_lvp_atlas_to_sh.js +184 -184
- package/src/shade/renderer/gpu_primitive/bvh/GPU_BVH_BUILD_PLAN.md +1115 -1115
- package/src/shade/renderer/gpu_primitive/bvh/graph_bvh_build_lbvh.js +217 -217
- package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_emit_hierarchy.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_emit_hierarchy.js +142 -143
- package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_morton.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_morton.js +0 -1
- package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_refit.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_refit.js +140 -141
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.js +0 -1
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.js +0 -1
- package/src/shade/renderer/light/cluster/cull/graph_cull_lights.d.ts.map +1 -1
- package/src/shade/renderer/light/cluster/cull/graph_cull_lights.js +191 -198
- package/src/shade/renderer/light/cluster/cull/shader_cull_lights_frustum.d.ts +0 -6
- package/src/shade/renderer/light/cluster/cull/shader_cull_lights_frustum.d.ts.map +1 -1
- package/src/shade/renderer/light/cluster/cull/shader_cull_lights_frustum.js +120 -120
- package/src/shade/renderer/light/cluster/cull/shader_cull_lights_hzb.d.ts +0 -4
- package/src/shade/renderer/light/cluster/cull/shader_cull_lights_hzb.d.ts.map +1 -1
- package/src/shade/renderer/light/cluster/cull/shader_cull_lights_hzb.js +112 -112
- package/src/shade/renderer/light/cluster/graph_assign_clsuters.d.ts.map +1 -1
- package/src/shade/renderer/light/cluster/graph_assign_clsuters.js +4 -7
- package/src/shade/renderer/light/cluster/shader_cluster_assign_lights.d.ts +0 -6
- package/src/shade/renderer/light/cluster/shader_cluster_assign_lights.d.ts.map +1 -1
- package/src/shade/renderer/light/cluster/shader_cluster_assign_lights.js +1 -1
- package/src/shade/renderer/lightmap/bake/raster/shader_lightmap_to_viz_buffer.js +222 -222
- package/src/shade/renderer/lightmap/bake/tile/shader_lightmap_tile_composit.js +81 -81
- package/src/shade/renderer/material/GPUMaterialContext.js +380 -380
- package/src/shade/renderer/material/standard/fragment_gbuffer_vt.js +169 -169
- package/src/shade/renderer/object_property/shader_object_property_process.d.ts.map +1 -1
- package/src/shade/renderer/object_property/shader_object_property_process.js +83 -84
- package/src/shade/renderer/object_property/shader_refresh_all_mesh_bounds.d.ts.map +1 -1
- package/src/shade/renderer/object_property/shader_refresh_all_mesh_bounds.js +57 -58
- package/src/shade/renderer/particles/prototypeParticleSystem.js +2 -3
- package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_emit.js +117 -118
- package/src/shade/renderer/particles/shaders/shader_particle_finalize.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_finalize.js +77 -79
- package/src/shade/renderer/particles/shaders/shader_particle_render.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_render.js +190 -183
- package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_simulate.js +99 -100
- package/src/shade/renderer/particles/sort/shader_particle_sort.d.ts.map +1 -1
- package/src/shade/renderer/particles/sort/shader_particle_sort.js +158 -161
- package/src/shade/renderer/path_tracer/graph_path_trace_scene.js +184 -184
- package/src/shade/renderer/postprocess/denoise/graph_atorus_denoise_luma.js +119 -119
- package/src/shade/renderer/postprocess/dof/raymarch/graph_postprocess_dof.js +3 -4
- package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch_compute.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch_compute.js +266 -267
- package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_slice_compute.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_slice_compute.js +270 -271
- package/src/shade/renderer/postprocess/nss/shader_nss_concat.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/nss/shader_nss_concat.js +68 -69
- package/src/shade/renderer/postprocess/nss/shader_nss_conv_layer.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/nss/shader_nss_conv_layer.js +225 -226
- package/src/shade/renderer/postprocess/nss/shader_nss_extract_feedback.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/nss/shader_nss_extract_feedback.js +49 -50
- package/src/shade/renderer/postprocess/nss/shader_nss_postprocess.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/nss/shader_nss_postprocess.js +291 -292
- package/src/shade/renderer/postprocess/nss/shader_nss_preprocess.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/nss/shader_nss_preprocess.js +230 -231
- package/src/shade/renderer/postprocess/ssr/reproject/shader_ffx_denoiser_reflections_reproject.d.ts +16 -2
- package/src/shade/renderer/postprocess/ssr/reproject/shader_ffx_denoiser_reflections_reproject.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/reproject/shader_ffx_denoiser_reflections_reproject.js +12 -12
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +2 -2
- package/src/shade/renderer/rasterize/bucket/shader_count_meshlets_by_material.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/bucket/shader_count_meshlets_by_material.js +68 -69
- package/src/shade/renderer/rasterize/bucket/shader_make_meshlet_indirect_draw_commands_by_material.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/bucket/shader_make_meshlet_indirect_draw_commands_by_material.js +59 -60
- package/src/shade/renderer/rasterize/bucket/shader_read_out_bucket.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/bucket/shader_read_out_bucket.js +0 -1
- package/src/shade/renderer/rasterize/bucket/shader_sort_meshlets_by_material.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/bucket/shader_sort_meshlets_by_material.js +64 -65
- package/src/shade/renderer/rasterize/compute/graph_mesh_frustum_cull.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/compute/graph_mesh_frustum_cull.js +168 -169
- package/src/shade/renderer/rasterize/compute/graph_mesh_sphere_cull.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/compute/graph_mesh_sphere_cull.js +160 -161
- package/src/shade/renderer/rasterize/cull/hzb/shader_hzb_mesh_filter_2way.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/cull/hzb/shader_hzb_mesh_filter_2way.js +109 -110
- package/src/shade/renderer/rasterize/cull/hzb/shader_hzb_meshlet_filter_1way_full.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/cull/hzb/shader_hzb_meshlet_filter_1way_full.js +115 -116
- package/src/shade/renderer/rasterize/expand/bucket/mesh/shader_instances_classify_bucket.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/bucket/mesh/shader_instances_classify_bucket.js +139 -140
- package/src/shade/renderer/rasterize/expand/bucket/mesh/shader_instances_count_by_rasterization_bucket.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/bucket/mesh/shader_instances_count_by_rasterization_bucket.js +91 -92
- package/src/shade/renderer/rasterize/expand/bucket/mesh/shader_instances_rasterization_bucket_sort.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/bucket/mesh/shader_instances_rasterization_bucket_sort.js +88 -89
- package/src/shade/renderer/rasterize/expand/bucket/meshlet/shader_meshlets_count_by_rasterization_bucket.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/bucket/meshlet/shader_meshlets_count_by_rasterization_bucket.js +90 -91
- package/src/shade/renderer/rasterize/expand/bucket/meshlet/shader_meshlets_extract_bucket.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/bucket/meshlet/shader_meshlets_extract_bucket.js +65 -66
- package/src/shade/renderer/rasterize/expand/bucket/meshlet/shader_meshlets_rasterization_bucket_sort.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/bucket/meshlet/shader_meshlets_rasterization_bucket_sort.js +89 -90
- package/src/shade/renderer/rasterize/expand/graph_mesh_filter_one_way.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/graph_mesh_filter_one_way.js +169 -170
- package/src/shade/renderer/rasterize/expand/mesh/shader_mesh_expand_to_meshlets_prefix.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/mesh/shader_mesh_expand_to_meshlets_prefix.js +89 -90
- package/src/shade/renderer/rasterize/expand/mesh/shader_meshes_to_meshlet_counts.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/mesh/shader_meshes_to_meshlet_counts.js +61 -62
- package/src/shade/renderer/rasterize/expand/pass1/filter_meshlets.2-way.compute.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/pass1/filter_meshlets.2-way.compute.js +153 -154
- package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.js +144 -144
- package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_pass_descriptor.js +88 -88
- package/src/shade/renderer/rasterize/native/oit/shader_oit_generate_moments.js +217 -217
- package/src/shade/renderer/rasterize/native/oit/shader_oit_resolve_moments.js +179 -179
- package/src/shade/renderer/rasterize/native/oit/shader_oit_resolve_moments_ibl.js +178 -178
- package/src/shade/renderer/rasterize/native/viz/viz_rasterization_alpha_tested_pass_descriptor.js +194 -194
- package/src/shade/renderer/rasterize/native/viz/viz_rasterization_opaque_pass_descriptor.js +76 -76
- package/src/shade/renderer/restir/di/shader_restir_di_denoise.d.ts.map +1 -1
- package/src/shade/renderer/restir/di/shader_restir_di_denoise.js +136 -137
- package/src/shade/renderer/restir/di/shader_restir_di_resample.d.ts.map +1 -1
- package/src/shade/renderer/restir/di/shader_restir_di_resample.js +129 -130
- package/src/shade/renderer/restir/di/shader_restir_di_resolve.d.ts.map +1 -1
- package/src/shade/renderer/restir/di/shader_restir_di_resolve.js +99 -100
- package/src/shade/renderer/restir/di/shader_restir_di_spatial.d.ts.map +1 -1
- package/src/shade/renderer/restir/di/shader_restir_di_spatial.js +116 -117
- package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.js +383 -383
- package/src/shade/renderer/scene/hierarchy/graph_scene_update_transform_hierarchy_naive.js +123 -123
- package/src/shade/renderer/scene/hierarchy/shader_nodes_record_input_positions.d.ts.map +1 -1
- package/src/shade/renderer/scene/hierarchy/shader_nodes_record_input_positions.js +64 -65
- package/src/shade/renderer/scene/hierarchy/shader_nodes_update_transform_hierarchy.d.ts.map +1 -1
- package/src/shade/renderer/scene/hierarchy/shader_nodes_update_transform_hierarchy.js +372 -373
- package/src/shade/renderer/scene/hierarchy/shader_nodes_update_transform_hierarchy_naive.d.ts.map +1 -1
- package/src/shade/renderer/scene/hierarchy/shader_nodes_update_transform_hierarchy_naive.js +111 -112
- package/src/shade/renderer/scene/shader_bvh_extract_instance_leaves.d.ts.map +1 -1
- package/src/shade/renderer/scene/shader_bvh_extract_instance_leaves.js +0 -1
- package/src/shade/renderer/shader/ComputeShader.d.ts +24 -3
- package/src/shade/renderer/shader/ComputeShader.d.ts.map +1 -1
- package/src/shade/renderer/shader/ComputeShader.js +350 -296
- package/src/shade/renderer/shader/ImageShader.js +217 -217
- package/src/shade/renderer/shader/ShaderDescriptor.d.ts +5 -0
- package/src/shade/renderer/shader/ShaderDescriptor.d.ts.map +1 -1
- package/src/shade/renderer/shader/ShaderDescriptor.js +20 -0
- package/src/shade/renderer/shader/util/compute_infer_workgroup_size_from_source.d.ts +47 -0
- package/src/shade/renderer/shader/util/compute_infer_workgroup_size_from_source.d.ts.map +1 -0
- package/src/shade/renderer/shader/util/compute_infer_workgroup_size_from_source.js +448 -0
- package/src/shade/renderer/shadow/map/csm/graph_csm_setup_cascades.js +3 -3
- package/src/shade/renderer/shadow/ray/staged/gen/graph_gen_rays.js +3 -3
- package/src/shade/renderer/shadow/ray/staged/trace/graph_trace_rays.js +2 -2
- package/src/shade/renderer/shadow/sdf/cascade/CascadedSceneSDF.js +4 -4
- package/src/shade/renderer/texture/virtual/build_shader_vt_feedback.d.ts.map +1 -1
- package/src/shade/renderer/texture/virtual/build_shader_vt_feedback.js +231 -232
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +1 -1
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +12 -15
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts +3 -2
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +3 -2
- package/src/shade/renderer/volumetrics/taa/shader_volumetrics_taa.d.ts +0 -2
- package/src/shade/renderer/volumetrics/taa/shader_volumetrics_taa.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/taa/shader_volumetrics_taa.js +17 -6
- package/src/shade/renderer/water/shader_water.js +246 -246
- package/src/shade/vitest.setup.mjs +1 -1
- package/src/shade/wgsl/emulator/ComputeShaderEmulator.js +291 -291
- package/src/view/minimap/Minimap.d.ts +2 -2
- package/src/view/minimap/Minimap.d.ts.map +1 -1
- package/src/view/minimap/Minimap.js +225 -225
- package/src/view/minimap/dom/MinimapCameraView.d.ts +3 -3
- package/src/view/minimap/dom/MinimapCameraView.d.ts.map +1 -1
- package/src/view/minimap/dom/MinimapCameraView.js +206 -206
- package/src/shade/renderer/shadow/map/csm/shader/shader_setup_cascades.d.ts +0 -3
- package/src/shade/renderer/shadow/map/csm/shader/shader_setup_cascades.d.ts.map +0 -1
- package/src/shade/renderer/shadow/map/csm/shader/shader_setup_cascades.js +0 -20
|
@@ -1,717 +1,717 @@
|
|
|
1
|
-
# Hierarchy in meep's ECS — a review against Unreal 6 / Scene Graph
|
|
2
|
-
|
|
3
|
-
**Date:** 2026-08-23
|
|
4
|
-
**Subject:** `ParentEntity`, `TransformAttachment`, `EntityNode`, and the systems behind them
|
|
5
|
-
**Comparator:** Epic's Scene Graph — the entity/component framework that UE6 is being built on
|
|
6
|
-
|
|
7
|
-
**Status, 2026-08-24.** §6.1 landed: both systems now keep a parent → children index
|
|
8
|
-
(`ecs/hierarchy/EntityChildIndex.js`), which closed **D5**, **D7**, **D8** and **D11**, and made **D3** small enough
|
|
9
|
-
to fix in the same pass. **D4** was addressed the day before. Still open: **D1**, **D2**, **D6**, **D9**, **D10**, and
|
|
10
|
-
the question in §8. Sections below are written in the tense of what is true now; the reasoning that led there is
|
|
11
|
-
unchanged.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## 0. Verdict up front
|
|
16
|
-
|
|
17
|
-
The **core split is right, and it is a better decomposition than Unreal's.** meep separates *lifetime* parenting
|
|
18
|
-
(`ParentEntity`) from *spatial* parenting (`TransformAttachment`) into two independent components. Scene Graph has one
|
|
19
|
-
hierarchy that means lifetime, and bolts a spatial override onto it (`transform_component.Origin`). meep's version is
|
|
20
|
-
the more honest model: two relations that are genuinely independent are stored as two relations, rather than one
|
|
21
|
-
relation plus an escape hatch.
|
|
22
|
-
|
|
23
|
-
The **propagation is also better than I expected.** I assumed the signal cascade would re-do work exponentially in
|
|
24
|
-
depth. It does not — measured, each descendant is recomputed **exactly once** per root change, at any depth. That is
|
|
25
|
-
optimal, and it is achieved without a sort, a level index, or a dirty-flag pass.
|
|
26
|
-
|
|
27
|
-
What is weak is everything *around* that core:
|
|
28
|
-
|
|
29
|
-
- `EntityNode`, described as "syntactic sugar", is not sugar. It holds live state (the local transform, the
|
|
30
|
-
subscriptions) that the ECS does not have, and animation binds to it. It is a **shadow object graph** — the exact
|
|
31
|
-
thing an ECS hierarchy exists to remove.
|
|
32
|
-
- **Live reparenting does not work.** One path silently strips the spatial link (verified, repro below); the other
|
|
33
|
-
asserts. Scene Graph treats reparenting as an ordinary operation.
|
|
34
|
-
- ~~**Children are not stored anywhere.** Every "give me the subtree" operation is a full scan of the dataset, so
|
|
35
|
-
subtree work is O(nodes × entities-in-world).~~ **Fixed** — each system now owns the back-links (§6.1).
|
|
36
|
-
- Three parallel attachment mechanisms exist (`TransformAttachment`, `Attachment`, plus ad-hoc `transform.subscribe`
|
|
37
|
-
closures in `
|
|
38
|
-
|
|
39
|
-
Severity-ordered defect list is in §5. Six of the eleven are correctness, and two of those I reproduced.
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## 1. Scope and method
|
|
44
|
-
|
|
45
|
-
**Read in full:** `ecs/parent/*` (`ParentEntity`, `ParentEntitySystem`, `ChildEntities` (since deleted), `EntityNode`,
|
|
46
|
-
`EntityNodeFlags`, `entity_node_compute_bounding_box`), `ecs/transform-attachment/*` (`TransformAttachment`,
|
|
47
|
-
`TransformAttachmentSystem`, `transform_attachment_parent_of`, `transform_attachment_find_descendant_by_name`),
|
|
48
|
-
`ecs/attachment/*` (`Attachment`, `AttachmentSystem`, `AttachmentBinding`, `TransformAttachmentBinding`,
|
|
49
|
-
`BoneAttachmentBinding`), plus `Entity`, `Transform`, and the relevant parts of `EntityComponentDataset`,
|
|
50
|
-
`EntityManager` and `BinaryBufferSerializer`.
|
|
51
|
-
|
|
52
|
-
**Consumers surveyed:** `shade_node_to_entity_composition`, `three_object_to_entity_composition`, `
|
|
53
|
-
`SGMeshSystem`, `ColliderObserverSystem`, `HierarchicalEntityListView`, `bind_property_writer`,
|
|
54
|
-
`sg_hierarchy_compute_bounding_box_via_parent_entity`.
|
|
55
|
-
|
|
56
|
-
**Measured, not assumed.** Four throwaway specs were run against the real systems (no mocks) and then deleted. Every
|
|
57
|
-
number in §2.3, §5 D1, D2 and D10 is output from those runs, quoted verbatim. Where I state something I only read and
|
|
58
|
-
did not execute, it says so.
|
|
59
|
-
|
|
60
|
-
**On the Unreal side — read this before trusting §3.** Epic announced at State of Unreal (June 2026) that UE6 unifies
|
|
61
|
-
UE and UEFN, and that Actors and Blueprints will eventually be deprecated in favour of Verse plus Scene Graph, with
|
|
62
|
-
conversion tools and a multi-year transition. Scene Graph itself shipped first in UEFN and is documented there as
|
|
63
|
-
experimental/beta. **The public documentation is the UEFN surface**, so the API names below are the Verse ones. Epic
|
|
64
|
-
has not published Scene Graph's internal storage, so anything about *how* it stores hierarchy is unknown, and I make
|
|
65
|
-
no claims about it.
|
|
66
|
-
|
|
67
|
-
One terminology correction worth making, because it changes what "compare against Unreal's ECS" means: **Scene Graph
|
|
68
|
-
is not Unreal's ECS.** Unreal's data-oriented ECS is **Mass** (archetype-based; components are "fragments", systems
|
|
69
|
-
are "processors"), built for crowds and traffic. Scene Graph is an *entity/component gameplay framework* — the Actor
|
|
70
|
-
replacement. It is Scene Graph, not Mass, that is the right comparator for meep's hierarchy, and that is what this
|
|
71
|
-
document uses. Mass has no user-facing hierarchy to compare against.
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
## 2. What meep has today
|
|
76
|
-
|
|
77
|
-
### 2.1 Four mechanisms, not one
|
|
78
|
-
|
|
79
|
-
| Mechanism | Means | Propagated by | Status |
|
|
80
|
-
|---|---|---|---|
|
|
81
|
-
| `ParentEntity { entity }` | **Lifetime.** Parent dies → child dies. | `ParentEntitySystem` listens for `EntityRemoved` on the parent, removes the child. | Live |
|
|
82
|
-
| `TransformAttachment { transform, parent, flags }` | **Space.** Child world = parent world × local. | `TransformAttachmentSystem`, via `Transform` change signals. | Live |
|
|
83
|
-
| `Attachment { parent, socket, transform }` | **Space, via a named socket / bone.** | `AttachmentSystem`, via `AttachmentBinding`s, polled every frame. | Live |
|
|
84
|
-
| ad-hoc `transform.subscribe(follow)` | **Space, hand-rolled.** | A closure in `
|
|
85
|
-
| ~~`ChildEntities { entities[] }`~~ | — | — | **Deleted** (D5). Was dead, and the wrong shape — see §4.2. |
|
|
86
|
-
|
|
87
|
-
`EntityNode` sits on top of the first two as an authoring façade.
|
|
88
|
-
|
|
89
|
-
The overlap between rows 2–4 is the first thing to notice. `TransformAttachmentBinding` (row 3's transform case) does
|
|
90
|
-
what `UpdateContext` (row 2) does, with a socket offset spliced in, using matrices instead of `Transform` composition —
|
|
91
|
-
and it carries a `TODO` saying so. Row 4 is row 2 with the local transform hard-coded to identity.
|
|
92
|
-
|
|
93
|
-
### 2.2 The two relations are genuinely independent — and that is the good part
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
ParentEntity.entity → "when that entity dies, I die"
|
|
97
|
-
TransformAttachment.parent → "my transform is relative to that entity"
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Nothing requires them to name the same entity. That is a real capability: a UI marker can be spatially attached to a
|
|
101
|
-
unit's head while being owned by the HUD; a compound rigid body's colliders are `ParentEntity`-owned by the body
|
|
102
|
-
(which is exactly how `ColliderObserverSystem` finds them) without necessarily composing transforms through it.
|
|
103
|
-
|
|
104
|
-
Scene Graph cannot express this as two facts. It has one hierarchy — which means lifetime — and then
|
|
105
|
-
`transform_component.Origin` to say "actually, compose me against *that* entity instead". Same expressive power,
|
|
106
|
-
reached by exception rather than by construction.
|
|
107
|
-
|
|
108
|
-
### 2.3 How the transform composition actually behaves (measured)
|
|
109
|
-
|
|
110
|
-
`TransformAttachmentSystem` builds an `UpdateContext` per attached entity holding `{attachment, transform, entity,
|
|
111
|
-
parent_transform}` and subscribes it to *both* the parent's world `Transform` and the attachment's local `Transform`.
|
|
112
|
-
Any change to either fires `ctx.update()`, which is one `m4_multiply` plus a decompose back into the child's world
|
|
113
|
-
`Transform` — whose own position/rotation/scale setters fire, waking the grandchild's context. Propagation is a
|
|
114
|
-
synchronous, re-entrant, depth-first cascade with no flush point.
|
|
115
|
-
|
|
116
|
-
Measured on a straight chain, counting writes to each descendant's TRS channels for **one** root change:
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
depth=4 translate: pos-writes=3 rot-writes=0 scale-writes=0 across 3 descendants
|
|
120
|
-
depth=4 rotate: pos-writes=3 rot-writes=3 scale-writes=3 across 3 descendants
|
|
121
|
-
depth=8 translate: pos-writes=7 rot-writes=0 scale-writes=0 across 7 descendants
|
|
122
|
-
depth=8 rotate: pos-writes=7 rot-writes=7 scale-writes=7 across 7 descendants
|
|
123
|
-
depth=16 translate: pos-writes=15 rot-writes=0 scale-writes=0 across 15 descendants
|
|
124
|
-
depth=16 rotate: pos-writes=15 rot-writes=15 scale-writes=15 across 15 descendants
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
**One recompute per descendant, every time.** No redundancy at any depth. The `Vector3.set`/`Quaternion.set` equality
|
|
128
|
-
guards are doing real work here: a pure translation never wakes a rotation listener. This is a good design and it
|
|
129
|
-
should be said plainly, because the rest of this document is mostly criticism.
|
|
130
|
-
|
|
131
|
-
Two costs come with it, both real:
|
|
132
|
-
|
|
133
|
-
**It is observable mid-cascade.** An observer of a descendant's `Transform` is called *during* propagation, when the
|
|
134
|
-
transform is only partly updated. Measured on a depth-3 chain under one 90° root yaw, an observer of the leaf sees:
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
[0] pos(0.000,-2.000) rotY(0.000) ← position already final, rotation still stale
|
|
138
|
-
[1] pos(0.000,-2.000) rotY(0.707) ← settled
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
State `[0]` is a pose that never existed. Anything that *accumulates* from a transform callback — a motion trail, a
|
|
142
|
-
velocity estimate, a moved-event, a physics impulse — integrates a torn pose. Renderers get away with it because the
|
|
143
|
-
last write before the frame ends is correct.
|
|
144
|
-
|
|
145
|
-
**Every level does a decompose/recompose round-trip**, and it is lossy. Measured on a chain with **no scaling
|
|
146
|
-
anywhere**, all-rotation locals:
|
|
147
|
-
|
|
148
|
-
```
|
|
149
|
-
depth=8: leaf world scale = (1.00000009045938, 1, 1.00000009045938)
|
|
150
|
-
depth=32: leaf world scale = (1.0000006507070245, 1, 1.0000006507070245)
|
|
151
|
-
depth=64: leaf world scale = (1.0000014229381489, 1, 1.0000014229381489)
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
The exact answer is `(1,1,1)` at every depth. The drift grows with depth, and — because it is a genuine change — it
|
|
155
|
-
also fires a spurious `scale.onChanged` at every level on every rotation, which is where the `scale-writes=N` column
|
|
156
|
-
above comes from. Anything subscribed to scale is woken by pure rotation.
|
|
157
|
-
|
|
158
|
-
The same round-trip discards shear outright. Root scaled `(4,1,1)`, child yawed 45°:
|
|
159
|
-
|
|
160
|
-
```
|
|
161
|
-
mid world scale stored as (2.9155, 1.0000, 2.9155)
|
|
162
|
-
leaf world matrix row0 = 2.8284, 0.0000, -0.7071
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
The true composed basis is non-orthogonal; TRS cannot hold it, so it is silently best-fitted. A mesh under a
|
|
166
|
-
non-uniformly-scaled rotated parent draws wrong. **Scene Graph shares this limitation** — its transform is TRS too —
|
|
167
|
-
but Unreal documents the non-uniform-scale caveat and meep does not.
|
|
168
|
-
|
|
169
|
-
### 2.4 `EntityNode` is not syntactic sugar
|
|
170
|
-
|
|
171
|
-
Its own docstring says "syntactic sugar on top of `TransformAttachment` and `ParentEntity`". It is not, on three
|
|
172
|
-
counts:
|
|
173
|
-
|
|
174
|
-
1. **It owns a third copy of the local transform.** `EntityNode.__transform` is the local transform; the component's
|
|
175
|
-
`attachment.transform` is *also* the local transform. They are synced one-way, node → component, by
|
|
176
|
-
`__transform_sync_down` on change. Write the component directly and the node is stale, with no way to notice.
|
|
177
|
-
2. **It is required at runtime, not just at authoring time.** `bind_property_writer` binds animation curves to
|
|
178
|
-
`node.transform.position` / `.rotation` / `.scale` — the *node's* transform, not the component's. Every animated
|
|
179
|
-
model therefore has to retain its `EntityNode` tree for as long as it animates. The object graph an ECS hierarchy
|
|
180
|
-
is supposed to replace is still there, alive, next to the dataset.
|
|
181
|
-
3. **It carries behaviour the components do not have** — `build`/`destroy` ordering, `on.built`/`on.destroyed`,
|
|
182
|
-
listener attach/detach, `root`, `traverse`. None of that is reachable from an entity id. Anything holding only an
|
|
183
|
-
entity id cannot participate.
|
|
184
|
-
|
|
185
|
-
So there are two ways to express a hierarchy in meep, and they are not interchangeable: components are the storage,
|
|
186
|
-
`EntityNode` is the API, and the API is only available to whoever constructed the tree.
|
|
187
|
-
|
|
188
|
-
---
|
|
189
|
-
|
|
190
|
-
## 3. What Scene Graph does
|
|
191
|
-
|
|
192
|
-
From Epic's UEFN documentation (see §8 for links):
|
|
193
|
-
|
|
194
|
-
**Entities are containers; components supply data and behaviour.** One component instance per type per entity — need
|
|
195
|
-
two, make two entities. Components are constructed with a pointer to their owning entity and **cannot be moved between
|
|
196
|
-
parents**.
|
|
197
|
-
|
|
198
|
-
**One hierarchy, and it means lifetime.** "Parenting represents object lifetime: if the parent is removed from the
|
|
199
|
-
scene, so are the sub-objects." One simulation entity is the root; every map entity is a descendant of it.
|
|
200
|
-
|
|
201
|
-
**Children are stored and enumerable.** `GetEntities()` returns the direct children; `GetParent()` walks up;
|
|
202
|
-
`AddEntities(...)` adds children **and reparents them if they already have a parent**; `RemoveFromParent()` detaches,
|
|
203
|
-
and the entity can be re-added later.
|
|
204
|
-
|
|
205
|
-
**Space is layered on top, by exception.** `transform_component` holds `LocalTransform` plus an optional `Origin`. If
|
|
206
|
-
`Origin` is unset, the entity composes against its parent. If set, it composes against whatever entity `Origin` names
|
|
207
|
-
— "a child can orbit around a sibling rather than its parent". API is `Get/SetLocalTransform`, `Get/SetGlobalTransform`
|
|
208
|
-
(both of which implicitly create the component), and `SetOrigin` / `GetOrigin[]` / `ResetOrigin`.
|
|
209
|
-
|
|
210
|
-
**Lifecycle is a phase machine, not a boolean.** Components get `OnAddedToScene` → `OnBeginSimulation` →
|
|
211
|
-
`OnSimulate` (suspending/async) → `OnEndSimulation` → `OnRemovingFromScene`. Adding a child to an in-scene parent
|
|
212
|
-
"advances the child through lifetime phases to match parent state". Component queries only become valid after
|
|
213
|
-
`OnAddedToScene`.
|
|
214
|
-
|
|
215
|
-
**The hierarchy is an event bus.** `SendUp(event)` / `SendDown(event)`, with consumption halting propagation.
|
|
216
|
-
|
|
217
|
-
**Entities carry tags** — `AddTag`, `ContainsAnyTag`, `RemoveAllTagsExcept`, etc.
|
|
218
|
-
|
|
219
|
-
**Access is scoped.** `GetEntities()` and `GetComponents()` return what is "accessible from the calling context" —
|
|
220
|
-
visibility is part of the model, not just a convention.
|
|
221
|
-
|
|
222
|
-
**Their own performance guidance** is: don't re-scan the tree during gameplay; find what you need once in
|
|
223
|
-
`OnBeginSimulation`, cache the references or subscribe to events, and react to events rather than searching again.
|
|
224
|
-
Don't broadcast events across large portions of the graph.
|
|
225
|
-
|
|
226
|
-
---
|
|
227
|
-
|
|
228
|
-
## 4. Head-to-head
|
|
229
|
-
|
|
230
|
-
| | meep | Scene Graph |
|
|
231
|
-
|---|---|---|
|
|
232
|
-
| Lifetime relation | `ParentEntity.entity` | the hierarchy itself |
|
|
233
|
-
| Spatial relation | `TransformAttachment.parent` — **independent** | `transform_component.Origin`, defaulting to the parent |
|
|
234
|
-
| Local transform | `TransformAttachment.transform` (+ a shadow copy on `EntityNode`) | `transform_component.LocalTransform` |
|
|
235
|
-
| World transform | stored, as a decomposed `Transform` component | queried via `GetGlobalTransform()` |
|
|
236
|
-
| Children stored? | Yes — a system-owned index, not a component (§4.2) | Yes — `GetEntities()` |
|
|
237
|
-
| Reparenting | **Broken / unsupported** (§5 D1, D2) | `AddEntities` reparents as a normal operation |
|
|
238
|
-
| Lifecycle | `isBuilt` boolean; `link`/`unlink` on systems | five explicit phases, propagated to children |
|
|
239
|
-
| Events on the tree | none | `SendUp` / `SendDown` with consumption |
|
|
240
|
-
| Tags | none (`Name` only) | first-class |
|
|
241
|
-
| Cycle safety | detected on read, throws | not documented |
|
|
242
|
-
| Serialization | asymmetric — spatial survives, lifetime does not (§5 D6) | prefab-based |
|
|
243
|
-
| Shear under non-uniform scale | lost silently | lost (documented) |
|
|
244
|
-
|
|
245
|
-
### 4.1 The relation split — meep wins, and should not follow Unreal here
|
|
246
|
-
|
|
247
|
-
Worth stating explicitly because it is tempting to read Unreal's design as the newer one and therefore the better one.
|
|
248
|
-
It is not, on this axis. `Origin`-defaults-to-parent is a **"unset means auto" sentinel**: one field with two meanings,
|
|
249
|
-
where the common case is invisible and the uncommon case is an override. meep's two independent fields say the same
|
|
250
|
-
thing with uniform control flow — the common case (`TransformAttachment.parent === ParentEntity.entity`) is written
|
|
251
|
-
out rather than implied.
|
|
252
|
-
|
|
253
|
-
This also happens to be the shape the codebase already prefers. Adopting `Origin` would be adopting a sentinel.
|
|
254
|
-
|
|
255
|
-
The cost meep pays is that **the coupling is real but undocumented**: `TransformAttachment` alone is not safe when the
|
|
256
|
-
parent can die (§5 D3). `ParentEntity` is what makes it safe. Nothing says so, and `transform_attachment_parent_of`'s
|
|
257
|
-
docstring — which is otherwise the best documentation in this area — describes the spatial hierarchy as if it stood
|
|
258
|
-
alone.
|
|
259
|
-
|
|
260
|
-
### 4.2 Children were not stored — the biggest structural gap, now closed
|
|
261
|
-
|
|
262
|
-
**Was:** `ParentEntitySystem.findChildrenOf` scanned **every** `ParentEntity` component in the dataset to find one
|
|
263
|
-
entity's children, and `traverse` called it once per node. So computing a subtree bounding box (which
|
|
264
|
-
`sg_hierarchy_compute_bounding_box_via_parent_entity` does exactly this way) was **O(subtree × all-parented-entities)**.
|
|
265
|
-
|
|
266
|
-
Scene Graph stores children and Epic's own guidance is *still* "don't scan the tree during gameplay, cache in
|
|
267
|
-
`OnBeginSimulation`". meep was scanning a structure that was a full dataset sweep rather than a stored list.
|
|
268
|
-
|
|
269
|
-
**Now:** both systems own a parent → children index (`ecs/hierarchy/EntityChildIndex.js`), so `findChildrenOf` is a
|
|
270
|
-
lookup and `traverse` is linear in the subtree. The shape and the reasoning are below; what actually landed is in §6.1.
|
|
271
|
-
|
|
272
|
-
Two things this did **not** change, deliberately:
|
|
273
|
-
|
|
274
|
-
- `transform_attachment_find_descendant_by_name` still scans every `Name` and walks up from each candidate — that is
|
|
275
|
-
the bone-lookup path, and it searches by *name* first, which no parent → children index answers. Rewriting it as a
|
|
276
|
-
downward walk over the spatial index is now possible and is the obvious follow-up, but it is a different search.
|
|
277
|
-
- The editor's `HierarchicalEntityListView` still builds its own `Map<parent, children[]>`. It looked like the missing
|
|
278
|
-
index implemented privately, and it is not quite: the view excludes editor-owned entities from the tree entirely, so
|
|
279
|
-
its map is a *filtered* one, and it needs a full entity sweep regardless to find the roots — entities with no
|
|
280
|
-
`ParentEntity` at all, which no children index knows about. Swapping in the real index would mean filtering on every
|
|
281
|
-
read and taking a dependency on a running system, for no sweep saved. Left alone.
|
|
282
|
-
|
|
283
|
-
#### Where the index belongs — *not* in a component
|
|
284
|
-
|
|
285
|
-
The obvious move, and the one most engines make, is a `ChildEntities` component. meep had one already
|
|
286
|
-
(`parent/ChildEntities.js`, dead). **That was the wrong shape, and it was deleted rather than revived.**
|
|
287
|
-
|
|
288
|
-
A child list stored as a component is *derived data promoted to authored data*. The consequences are all bad and all
|
|
289
|
-
structural:
|
|
290
|
-
|
|
291
|
-
- **It is a two-place invariant.** `ParentEntity` lives on the child and `ChildEntities` lives on the parent — two
|
|
292
|
-
entities, two components, one fact. Nothing in the type system or the dataset keeps them agreeing. They can drift,
|
|
293
|
-
and the drift is silent.
|
|
294
|
-
- **It is user-writable.** Being a component makes it authorable, mutable, and reachable from any system. Every one of
|
|
295
|
-
those is an opportunity to corrupt an index that has one correct value.
|
|
296
|
-
- **It is a burden at the layer least able to carry it.** Whoever builds a hierarchy now has to maintain both ends of
|
|
297
|
-
every edge, for information the engine can derive.
|
|
298
|
-
- **It doubles the state footprint** of every parent, and it has to be excluded from serialization by hand — one more
|
|
299
|
-
thing to get wrong alongside D6.
|
|
300
|
-
|
|
301
|
-
The alternative, and what was built, is to hold the back-links **at the system level**: `ParentEntitySystem` already
|
|
302
|
-
observes every entity that gains or loses a `ParentEntity`, so it maintains a private parent → children index with no
|
|
303
|
-
component, no authored state, and nothing for a user to desynchronise. One writer, one source of truth, rebuilt from
|
|
304
|
-
scratch on load.
|
|
305
|
-
|
|
306
|
-
The usual objection is ergonomics — a consumer now has to reach for the system instead of just calling `getComponent`.
|
|
307
|
-
That objection does not survive contact with the actual call pattern: **`ChildEntities` would not have avoided it.** A
|
|
308
|
-
component gives you one level of children as entity ids; to go a level deeper you need `getComponent(child,
|
|
309
|
-
ChildEntities)`, so you are already reaching for the dataset. Component and system are equally indirect, and the system
|
|
310
|
-
version is the one that cannot be wrong. `EntityManager.getSystem(SystemClass)` is typed on the class, so this stays
|
|
311
|
-
inside the codebase's preference for typed lookup over string-keyed registries.
|
|
312
|
-
|
|
313
|
-
The migration cost was also much smaller than it looked — see §6.1.
|
|
314
|
-
|
|
315
|
-
### 4.3 Reparenting
|
|
316
|
-
|
|
317
|
-
Scene Graph: `AddEntities` reparents, and advances the child through lifecycle phases to match the new parent.
|
|
318
|
-
|
|
319
|
-
meep: **neither path works.** Direct `.parent =` assignment strips the spatial link (D1, reproduced). `addChild` of an
|
|
320
|
-
already-built node throws (D2, reproduced). There is no supported way to move a live subtree.
|
|
321
|
-
|
|
322
|
-
This is the single largest functional gap, and it is not exotic — "pick this up", "get in the vehicle", "re-dock this
|
|
323
|
-
panel" are all reparenting a live subtree.
|
|
324
|
-
|
|
325
|
-
### 4.4 Lifecycle phases
|
|
326
|
-
|
|
327
|
-
meep has one bit (`isBuilt`) plus system `link`/`unlink`. The consequence is `TransformAttachmentSystem`'s retry
|
|
328
|
-
queue: a child whose parent has not appeared yet cannot be linked, so it is parked and retried at 32 entries per
|
|
329
|
-
frame, forever, with no diagnostic if the parent never arrives. `AttachmentSystem` has its own separate `waiting`
|
|
330
|
-
array doing the same thing.
|
|
331
|
-
|
|
332
|
-
That queue is *compensating for the absence of ordering guarantees*. Scene Graph's answer is that a child added to an
|
|
333
|
-
in-scene parent is advanced to match the parent's phase — the "parent isn't ready yet" state is structurally
|
|
334
|
-
impossible rather than polled for.
|
|
335
|
-
|
|
336
|
-
Not a defect. But two hand-rolled retry queues is what the missing phase model costs.
|
|
337
|
-
|
|
338
|
-
### 4.5 Events, tags, scoping
|
|
339
|
-
|
|
340
|
-
meep has none of `SendUp`/`SendDown`, tags, or context-scoped access. Of the three:
|
|
341
|
-
|
|
342
|
-
- **`SendUp`/`SendDown` is worth having** and is cheap once children are stored. The idiom it enables — a hit on a
|
|
343
|
-
limb bubbling to the creature, a "prefab" root broadcasting down — is currently done by walking to
|
|
344
|
-
`ParentEntitySystem.findRoot` and dispatching manually.
|
|
345
|
-
- **Tags** duplicate what a component already does in meep. Skip; a zero-field component is the same thing and stays
|
|
346
|
-
typed, which is what this codebase prefers over string keys.
|
|
347
|
-
- **Scoped access** is a Verse-language concern. Not applicable.
|
|
348
|
-
|
|
349
|
-
---
|
|
350
|
-
|
|
351
|
-
## 5. Defects
|
|
352
|
-
|
|
353
|
-
Ordered by severity. **[repro]** = I reproduced it against the real systems. **[read]** = from reading only.
|
|
354
|
-
Entries marked **FIXED** were closed on 2026-08-24 by the work in §6.1 and §6.3; the original finding is kept so the
|
|
355
|
-
reasoning stays readable, with what changed appended.
|
|
356
|
-
|
|
357
|
-
---
|
|
358
|
-
|
|
359
|
-
**D1 — `EntityNode.parent` setter destroys the spatial link. [repro]** — *correctness, high*
|
|
360
|
-
|
|
361
|
-
`EntityNode.js:240-270`. The setter removes both components up front:
|
|
362
|
-
|
|
363
|
-
```js
|
|
364
|
-
let parent_entity = this_entity.removeComponent(ParentEntity);
|
|
365
|
-
let attachment = this_entity.removeComponent(TransformAttachment); // returns the instance
|
|
366
|
-
|
|
367
|
-
if (node !== null) {
|
|
368
|
-
...
|
|
369
|
-
this_entity.add(parent_entity); // ParentEntity IS re-added
|
|
370
|
-
|
|
371
|
-
if (attachment === null) { // ...but it is NOT null,
|
|
372
|
-
attachment = this.__safe_get_attachment(); // so this never runs
|
|
373
|
-
}
|
|
374
|
-
attachment.parent = parent_entity_id; // mutates a DETACHED component
|
|
375
|
-
}
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
`Entity.removeComponent` returns the removed instance (`Entity.js:286`), so the `=== null` branch is dead whenever the
|
|
379
|
-
node was already parented. The re-add only happens through `__safe_get_attachment()`, which is skipped.
|
|
380
|
-
|
|
381
|
-
Reproduced — build `a → b`, then assign `b.parent = c` directly:
|
|
382
|
-
|
|
383
|
-
```
|
|
384
|
-
after build, b has TransformAttachment: true
|
|
385
|
-
after reparent, b TransformAttachment: null
|
|
386
|
-
after reparent, b ParentEntity: 2 (c.id: 2) ← lifetime link correct
|
|
387
|
-
dataset has TransformAttachment on b: undefined ← spatial link gone
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
The child keeps its new owner and silently stops following it in space; its world `Transform` freezes at its last
|
|
391
|
-
value. `addChild()` happens to escape this because `removeChild()` runs first and clears the component via the
|
|
392
|
-
`node === null` path — so the bug is confined to the public setter, which is the documented way to reparent.
|
|
393
|
-
|
|
394
|
-
Fix is one line: drop the `if (attachment === null)` guard and always call `__safe_get_attachment()`.
|
|
395
|
-
|
|
396
|
-
---
|
|
397
|
-
|
|
398
|
-
**D2 — live reparenting asserts in dev, silently no-ops in prod. [repro]** — *correctness, high*
|
|
399
|
-
|
|
400
|
-
`EntityNode.addChild` calls `node.build(dataset)` when the receiving parent is built; `build` opens with
|
|
401
|
-
`assert.notOk(this.__entity.isBuilt, 'Already built')`. Reproduced: `addChild` of a built node into a built parent
|
|
402
|
-
throws `"Already built"`.
|
|
403
|
-
|
|
404
|
-
Asserts are compiled out of production builds. In production the assert vanishes and `Entity.build` early-returns
|
|
405
|
-
(`Entity.js:442-449`), so it degrades to a partial no-op rather than corruption — but combined with D1 the node can
|
|
406
|
-
end up owned-but-not-attached with no error anywhere. **Dev throws, prod silently misbehaves**, which is the worse of
|
|
407
|
-
the two orderings.
|
|
408
|
-
|
|
409
|
-
---
|
|
410
|
-
|
|
411
|
-
**D3 — a child was not detached when its spatial parent died. [read]** — *correctness, high* — **FIXED 2026-08-24.**
|
|
412
|
-
|
|
413
|
-
`UpdateContext` captured `parent_transform` at link time and subscribed to it. Nothing observed the *parent's*
|
|
414
|
-
removal. When the parent entity was destroyed:
|
|
415
|
-
|
|
416
|
-
- the child still had `TransformAttachment` + `Transform`, so the system's `unlink` was never called;
|
|
417
|
-
- `this.__contexts[entity]` kept holding the context, which kept holding the dead parent's `Transform` alive;
|
|
418
|
-
- the child composed against a transform nothing would ever update again — it froze, silently.
|
|
419
|
-
|
|
420
|
-
`ParentEntity` masked this whenever both components named the same entity, because the child got destroyed too. It was
|
|
421
|
-
exposed exactly when the two are used independently — i.e. the capability §4.1 credits as meep's advantage.
|
|
422
|
-
|
|
423
|
-
**The fix**, mirroring what `ParentEntitySystem`'s `Context` already did: `UpdateContext` subscribes to its parent's
|
|
424
|
-
`EntityRemoved` in `link()` and unsubscribes in `unlink()`, and on removal it takes `TransformAttachment` off the
|
|
425
|
-
child. The child survives with the world transform it had, as a root, and its own subtree keeps composing against it.
|
|
426
|
-
Dropping the component rather than quietly tearing the context down is what makes the detach observable, and it routes
|
|
427
|
-
the teardown through the system's ordinary `unlink` path.
|
|
428
|
-
|
|
429
|
-
Two details worth keeping:
|
|
430
|
-
|
|
431
|
-
- **It is registered per child, not per parent, so the §6.1 index is not what makes it work.** The index would have
|
|
432
|
-
needed a separate count of *bound* children to know when to add and drop a single per-parent listener — queued
|
|
433
|
-
children are in the index but must not register — which is more state than one listener per context. The index is
|
|
434
|
-
still what makes "which children point at me" answerable; this particular fix just did not need to ask.
|
|
435
|
-
- **A stale dispatch is real and is guarded.** Entity event dispatch copies its listener list before invoking it, so
|
|
436
|
-
when an entity carries *both* relations and the lifetime one destroys it first, the spatial detach still arrives —
|
|
437
|
-
for an entity that no longer exists. `UpdateContext` tracks whether it is linked and ignores the late call. This is
|
|
438
|
-
ordering-dependent (whichever system linked first is called first) and is covered both ways round in the spec.
|
|
439
|
-
|
|
440
|
-
**Still not covered:** a child that is still *queued* when its parent dies. It never bound, so it never subscribed, and
|
|
441
|
-
it goes on retrying against an id that may be recycled. That is the pre-existing gap §4.4 describes — the retry queue
|
|
442
|
-
has no diagnostic for a parent that never arrives, and now also none for one that leaves.
|
|
443
|
-
|
|
444
|
-
---
|
|
445
|
-
|
|
446
|
-
**D4 — mutating `TransformAttachment.parent` is silently ignored. [read]** — *correctness, medium* — **ADDRESSED
|
|
447
|
-
2026-08-24**, documented on the field to match `ParentEntity`'s existing constraint.
|
|
448
|
-
|
|
449
|
-
`UpdateContext.update()` reads `this.parent_transform`, resolved once at link. Writing `attachment.parent = other`
|
|
450
|
-
afterwards changes nothing; the entity keeps composing against the old parent. `ParentEntity` documents this
|
|
451
|
-
constraint ("Must not be mutated while the component is attached to a dataset"); `TransformAttachment` did not, and
|
|
452
|
-
its field is plain and public.
|
|
453
|
-
|
|
454
|
-
Worth noting that this contract is **load-bearing for §6.1, not just hygiene.** A system-owned child index is correct
|
|
455
|
-
precisely because `link`/`unlink` are the only transitions a parent reference can undergo. If either component's
|
|
456
|
-
`parent` field could be rewritten in place, the index would need change detection to stay honest, and the argument for
|
|
457
|
-
keeping it out of a component would weaken. Documenting the immutability is what makes the cheap index sound.
|
|
458
|
-
|
|
459
|
-
---
|
|
460
|
-
|
|
461
|
-
**D5 — `ChildEntities` was dead code, and the wrong shape. [repro — zero references]** — *hygiene, medium* —
|
|
462
|
-
**FIXED 2026-08-24.**
|
|
463
|
-
|
|
464
|
-
Defined in `parent/ChildEntities.js`, referenced nowhere outside its own file.
|
|
465
|
-
|
|
466
|
-
**Deleted.** Per §4.2 it was not a stub to finish — a component is the wrong home for a derived back-link, and leaving
|
|
467
|
-
the file present implied both that a child index existed and that a component was where one should go. Neither was
|
|
468
|
-
true. The index belongs to `ParentEntitySystem` (§6.1), and now lives there.
|
|
469
|
-
|
|
470
|
-
---
|
|
471
|
-
|
|
472
|
-
**D6 — serialization is asymmetric between the two hierarchies. [read]** — *correctness, medium*
|
|
473
|
-
|
|
474
|
-
`ParentEntity.serializable = false`, commented "Entity IDs are transient, serialization is not applicable".
|
|
475
|
-
`TransformAttachment` sets no such flag, and `isComponentClassSerializable` defaults to serializable
|
|
476
|
-
(`BinaryBufferSerializer.js:15`) — so its `parent` field, **also a raw entity id**, is written and read back.
|
|
477
|
-
|
|
478
|
-
Entity ids do survive a round-trip (`BinaryBufferDeSerializer` calls `createEntitySpecific`), so this is not
|
|
479
|
-
straightforwardly broken. But the two components make opposite decisions about the same kind of data, and the result
|
|
480
|
-
is that a saved scene reloads with its **spatial** hierarchy intact and its **lifetime** hierarchy gone. Given D3,
|
|
481
|
-
that reload also lands in exactly the configuration where an attachment is unsafe.
|
|
482
|
-
|
|
483
|
-
Whichever way it is resolved, the two should agree.
|
|
484
|
-
|
|
485
|
-
§6.1 sharpened this rather than changing it: the child index is rebuilt from the child-side components on load, so a
|
|
486
|
-
scene that reloads without its `ParentEntity` components reloads with an empty lifetime index too. The index does not
|
|
487
|
-
cause the omission, it just stops it being invisible.
|
|
488
|
-
|
|
489
|
-
---
|
|
490
|
-
|
|
491
|
-
**D7 — subtree operations were O(subtree × world). [read]** — *performance, medium* — **FIXED 2026-08-24.**
|
|
492
|
-
|
|
493
|
-
`ParentEntitySystem.findChildrenOf` swept every `ParentEntity` in the dataset per node; `traverse` called it per node.
|
|
494
|
-
`sg_hierarchy_compute_bounding_box_via_parent_entity` and `transform_attachment_find_descendant_by_name` (the bone
|
|
495
|
-
lookup) both paid it.
|
|
496
|
-
|
|
497
|
-
The index in §6.1 fixed the first: `findChildrenOf` is a lookup and `traverse` is linear in the subtree. The bone
|
|
498
|
-
lookup is untouched — it searches by name, which this index does not answer (§4.2).
|
|
499
|
-
|
|
500
|
-
Also in `traverse`: `path.concat(entity)` allocated a new array per node per level, making cycle detection O(depth²) in
|
|
501
|
-
allocations for a deep tree. The rewritten walk pushes and pops one shared path array instead, and cycle detection is
|
|
502
|
-
now O(depth) comparisons per node against no allocation at all.
|
|
503
|
-
|
|
504
|
-
---
|
|
505
|
-
|
|
506
|
-
**D8 — the cycle checker was a shared fixed buffer. [read]** — *correctness, low* — **FIXED 2026-08-24.**
|
|
507
|
-
|
|
508
|
-
`ParentEntitySystem` used a module-level `Uint32Array(1024)` for `findRoot` and `isAncestorOf`, with no bounds check
|
|
509
|
-
on `loop_checker_array[count++]`. Two consequences: writes past 1024 were silently dropped by JS typed arrays, so a
|
|
510
|
-
hierarchy deeper than 1024 stopped detecting cycles and could spin forever; and because the buffer was shared and
|
|
511
|
-
un-reentrant, a `findRoot` called from inside a `traverse` callback clobbered the outer walk's state.
|
|
512
|
-
|
|
513
|
-
Depth > 1024 is not realistic. Re-entrancy was — `traverse` takes a user callback.
|
|
514
|
-
|
|
515
|
-
Both walks now keep their own path array, which is per call and grows, so neither failure mode exists. It fell out of
|
|
516
|
-
moving these two off the static-plus-`ecd` shape onto the system; the module global, `check_loop` and `genLoopString`
|
|
517
|
-
went with it. A 2048-deep chain is in the spec.
|
|
518
|
-
|
|
519
|
-
---
|
|
520
|
-
|
|
521
|
-
**D9 — transform sockets update twice per frame. [read]** — *performance, low*
|
|
522
|
-
|
|
523
|
-
`TransformAttachmentBinding.link()` subscribes to the parent's and the attachment's transform changes, *and*
|
|
524
|
-
`AttachmentSystem.__updateAll()` calls `binding.update()` for every binding every frame unconditionally. Either the
|
|
525
|
-
subscription or the sweep is redundant. (`BoneAttachmentBinding` genuinely needs the per-frame sweep — its pose is a
|
|
526
|
-
query with no change signal — so the sweep is the one to keep, and the `TransformAttachmentBinding` subscriptions are
|
|
527
|
-
the removable half.)
|
|
528
|
-
|
|
529
|
-
---
|
|
530
|
-
|
|
531
|
-
**D10 — decompose round-trip drifts and drops shear. [repro]** — *correctness, low-to-medium*
|
|
532
|
-
|
|
533
|
-
Numbers in §2.3. Scale drifts to ~1.4e-6 over 64 rotation-only levels and fires spurious `scale.onChanged` at every
|
|
534
|
-
level; shear from a non-uniformly-scaled rotated parent is silently best-fitted away.
|
|
535
|
-
|
|
536
|
-
Not cheaply fixable — it is inherent to storing the world transform as a decomposed `Transform` — and Unreal has the
|
|
537
|
-
same limitation.
|
|
538
|
-
|
|
539
|
-
The documentation half is **done**: `TransformAttachment` now carries the non-uniform-scale caveat and the drift
|
|
540
|
-
figure. The behaviour is unchanged and the defect stays open on that basis. Still worth considering: whether
|
|
541
|
-
`UpdateContext.update()` should compose into the child's `matrix` and skip the decompose for consumers that only read
|
|
542
|
-
the matrix.
|
|
543
|
-
|
|
544
|
-
---
|
|
545
|
-
|
|
546
|
-
**D11 — neither system had a spec. [repro — no such files]** — *test coverage, medium* — **FIXED 2026-08-24.**
|
|
547
|
-
|
|
548
|
-
There was no `TransformAttachmentSystem.spec.js` and no `ParentEntitySystem.spec.js`. `TransformAttachment.spec.js` and
|
|
549
|
-
`EntityNode.spec.js` between them test `setFlag`/`clearFlag`/`getFlag`/`writeFlag` — twice, once each, in identical
|
|
550
|
-
form — plus JSON round-trip and `addChild`/`removeChild` bookkeeping on *unbuilt* nodes.
|
|
551
|
-
|
|
552
|
-
**The composition contract itself was untested.** Nothing asserted that a child's world transform equals parent ×
|
|
553
|
-
local, that a change propagates, that a chain composes, or that a queued attachment links when its parent arrives.
|
|
554
|
-
Nine other specs register both systems, but as fixture scaffolding — `
|
|
555
|
-
can expand, not to check them.
|
|
556
|
-
|
|
557
|
-
Both specs now exist, on real `EntityManager`/`EntityComponentDataset` objects, and cover the composition contract,
|
|
558
|
-
the index (empty/one/many, ordering, child removal, parent removal, id recycling, snapshot semantics), the queue path,
|
|
559
|
-
subtree traversal against the full-scan implementation it replaced, cycles, and the D3 detach in both dispatch orders.
|
|
560
|
-
`EntityChildIndex` has its own spec for what the systems cannot reach through their own API. The flag tests remain the
|
|
561
|
-
vacuous-smoke-test shape and were left alone; they are not what this defect was about.
|
|
562
|
-
|
|
563
|
-
Note that D1 and D2 are both immediately visible from a five-line test, which is why they are still here.
|
|
564
|
-
|
|
565
|
-
---
|
|
566
|
-
|
|
567
|
-
## 6. What is worth taking from Scene Graph
|
|
568
|
-
|
|
569
|
-
In order of value per unit of change. Note that the first item takes Scene Graph's *capability* while explicitly
|
|
570
|
-
rejecting its *storage* — the useful comparison here is not "copy what Unreal did".
|
|
571
|
-
|
|
572
|
-
### 6.1 Store children — as a system-owned index, not a component — **LANDED 2026-08-24**
|
|
573
|
-
|
|
574
|
-
Take Scene Graph's *capability* (children are enumerable in O(children)) and reject its *storage*, because meep's
|
|
575
|
-
system layer can derive the same thing without asking the user to maintain anything. Reasoning in §4.2; this is what
|
|
576
|
-
was built.
|
|
577
|
-
|
|
578
|
-
`ecs/hierarchy/EntityChildIndex.js` holds the structure — a sparse array of parent id → ascending child ids — and both
|
|
579
|
-
systems own one, as `__children`. It has its own spec for the ordering and copy-out contracts.
|
|
580
|
-
|
|
581
|
-
**The choke points already existed and were already overridden.** `ParentEntitySystem` extends `AbstractContextSystem`,
|
|
582
|
-
whose `link()`/`unlink()` fire exactly once per entity gaining or losing a `ParentEntity`. `ParentEntitySystem`'s own
|
|
583
|
-
`Context` already overrode both, and already read `this.components[0].entity` to subscribe to the parent's removal.
|
|
584
|
-
Maintaining the index is one insert in `Context.link()` and one remove in `Context.unlink()`, beside code that was
|
|
585
|
-
already there for exactly the same edge.
|
|
586
|
-
|
|
587
|
-
Design notes that mattered, and how each was settled:
|
|
588
|
-
|
|
589
|
-
- **Store entity ids, never contexts.** `AbstractContextSystem` pools its contexts through `ObjectPoolFactory` and
|
|
590
|
-
reuses them after `unlink`. An index holding context references would alias recycled objects. The index stores ids.
|
|
591
|
-
- **Define child order explicitly.** Insertion order is link order, which is deterministic only as far as entity
|
|
592
|
-
creation order is. **Sorted ascending by entity id on insert**, via a binary-search insert — chosen over documenting
|
|
593
|
-
link order because it makes iteration order independent of the thing that is hard to reason about, and child fan-out
|
|
594
|
-
is small enough that the splice is not worth defending against.
|
|
595
|
-
- **Hand out a snapshot, not the live array.** `handleParentEntityRemoval` destroys children from inside the cascade,
|
|
596
|
-
so a consumer iterating a live array mutates under itself. `findChildrenOf` kept its `(result, result_offset, ...)
|
|
597
|
-
-> count` shape — the `ecd` argument dropped, since the system knows its own dataset — which preserves the house
|
|
598
|
-
convention from the bvh3 query API. `countChildrenOf` was added beside it, to size a buffer without filling one.
|
|
599
|
-
- **The index does not serialize, and that is the point.** It is rebuilt from `ParentEntity` on load, so there is no
|
|
600
|
-
format, no version, and no stale-id migration. **This does sharpen D6:** `ParentEntity.serializable === false` means
|
|
601
|
-
a loaded scene has no `ParentEntity` components to rebuild *from*, so the lifetime hierarchy comes back empty. The
|
|
602
|
-
index makes that omission visible rather than causing it.
|
|
603
|
-
- **Entity ids are recycled**, so a parent whose last child leaves has its entry deleted outright rather than left
|
|
604
|
-
empty. An id that comes back has to come back childless; both specs pin it.
|
|
605
|
-
|
|
606
|
-
**Static-with-`ecd` versus instance.** `traverse` and `findChildrenOf` need the index, so they had to move onto the
|
|
607
|
-
system. `findRoot`, `isAncestorOf` and `findParentEntity` walk child → parent and did not, but leaving them static
|
|
608
|
-
would have meant two ways to ask the same system the same kind of question. All five are instance methods now and the
|
|
609
|
-
`ecd` parameter is gone from all of them. Per library semantics the unreferenced ones were carried across rather than
|
|
610
|
-
deleted.
|
|
611
|
-
|
|
612
|
-
**Migration cost, measured before and confirmed after:** `ParentEntitySystem.traverse` had **exactly one caller** in
|
|
613
|
-
the whole tree (`sg_hierarchy_compute_bounding_box_via_parent_entity.js:30`), which now takes the system in place of
|
|
614
|
-
the `ecd`. `findChildrenOf`, `findRoot` and `isAncestorOf` had **zero** external callers. So the "you have to reach
|
|
615
|
-
for the system" awkwardness cost one production signature change, plus standing up an `EntityManager` in
|
|
616
|
-
`sg_hierarchy_compute_bounding_box_via_parent_entity.spec.js`, which had been running on a bare ECD.
|
|
617
|
-
|
|
618
|
-
Payoff: killed D7 and D8, made D3 small enough to fix in the same pass (§6.3), and unblocks `SendUp`/`SendDown`. It did
|
|
619
|
-
**not** let `HierarchicalEntityListView` drop its private `Map<parent, children[]>` — see §4.2 for why that map is not
|
|
620
|
-
this index.
|
|
621
|
-
|
|
622
|
-
**The same index shape applies to the spatial hierarchy**, and landed there too. `TransformAttachmentSystem` already
|
|
623
|
-
keyed `__contexts` by child; the parent → children direction goes in at `link()` and out at `unlink()`. Inserting at
|
|
624
|
-
`link()` rather than `__finalize_link()` means **a queued child is in the index before it binds** — the question the
|
|
625
|
-
index answers is "which children point at me", and that is true of a child still waiting for its parent to gain a
|
|
626
|
-
`Transform`. The consequence, documented on the system: a non-zero child count does not imply those children are
|
|
627
|
-
composing yet.
|
|
628
|
-
|
|
629
|
-
### 6.2 Make reparenting a real, single operation
|
|
630
|
-
|
|
631
|
-
**Not done — still the largest open item.** One function — `hierarchy_reparent(ecd, entity, new_parent)` — that
|
|
632
|
-
updates both components together and is the only supported path. Fix D1 inside it and let `EntityNode.parent` delegate
|
|
633
|
-
to it. This is Scene Graph's `AddEntities` semantics, minus the phase machine. D4's documented immutability means
|
|
634
|
-
reparenting is a remove/re-add of the components, not a field write — which is the contract this function should
|
|
635
|
-
encode rather than leave to callers, and which §6.1 turned from a convention into something the child indices depend
|
|
636
|
-
on.
|
|
637
|
-
|
|
638
|
-
### 6.3 Detach on parent death — **LANDED 2026-08-24**
|
|
639
|
-
|
|
640
|
-
`TransformAttachmentSystem` now listens for `EntityRemoved` on the parent (as `ParentEntitySystem`'s `Context` already
|
|
641
|
-
did) and drops the child's `TransformAttachment`. This fixes D3, and makes the independent use of the two relations
|
|
642
|
-
actually safe.
|
|
643
|
-
|
|
644
|
-
One prediction here did not hold up. The expectation was that the 6.1 index would turn "which children do I unlink"
|
|
645
|
-
into a lookup; in practice the listener is registered **per child context**, exactly as `ParentEntitySystem` does it,
|
|
646
|
-
because a single per-parent listener would have needed its own count of *bound* children to know when to register and
|
|
647
|
-
unregister — the index deliberately includes queued children, which must not register one. Per-child is less state
|
|
648
|
-
and mirrors the sibling system. The index is still what makes the direction answerable at all; this fix just did not
|
|
649
|
-
need to ask. Details, including the stale-dispatch guard, are in D3.
|
|
650
|
-
|
|
651
|
-
### 6.4 `SendUp` / `SendDown`
|
|
652
|
-
|
|
653
|
-
Now cheap — 6.1 exists, so `SendDown` is a traversal that already terminates and `SendUp` is
|
|
654
|
-
`ParentEntitySystem.findRoot`'s walk with a visitor. Replaces the manual `findRoot`-and-dispatch idiom. Not built;
|
|
655
|
-
nothing in the tree asks for it yet.
|
|
656
|
-
|
|
657
|
-
### 6.5 Document the couplings — **DONE 2026-08-24**
|
|
658
|
-
|
|
659
|
-
`TransformAttachment` needed what `ParentEntity` already had. All three halves are now on the component: the
|
|
660
|
-
`parent`-immutability note (D4), the non-uniform-scale and drift caveat (D10), and the statement that without a
|
|
661
|
-
lifetime relation an attachment does not survive its parent — which, since D3, means the component is removed and the
|
|
662
|
-
entity becomes a world-space root rather than freezing.
|
|
663
|
-
|
|
664
|
-
Both `parent` fields also now say *why* they must not be mutated in place: each system resolves the parent once at
|
|
665
|
-
link and indexes the edge at the same moment, so an in-place write desynchronises both.
|
|
666
|
-
|
|
667
|
-
## 7. What is not worth taking
|
|
668
|
-
|
|
669
|
-
- **`Origin`-defaults-to-parent.** §4.1 — meep's two-field split is better and matches the codebase's stated
|
|
670
|
-
preference for uniform control flow over sentinels.
|
|
671
|
-
- **A child list as stored, authored state.** §4.2 — take the enumerability, not the component. Scene Graph can afford
|
|
672
|
-
a stored child list because its hierarchy *is* the entity and there is only one writer; in an ECS the same list
|
|
673
|
-
becomes a second, user-writable copy of an edge that already exists on the child, with no mechanism keeping the two
|
|
674
|
-
ends honest. Derive it in the system instead. This is the one place where the conventional engine answer and
|
|
675
|
-
`ChildEntities` agree with each other and are both wrong.
|
|
676
|
-
- **Tags.** A zero-field component already is a tag, and stays typed.
|
|
677
|
-
- **The five-phase lifecycle, wholesale.** The valuable half is the ordering guarantee that removes the retry queues;
|
|
678
|
-
adopting five named phases across every system is a much larger change than the problem warrants. If anything here
|
|
679
|
-
is worth doing it is the *guarantee*, not the vocabulary.
|
|
680
|
-
- **Scoped access.** A Verse language feature with no analogue here.
|
|
681
|
-
|
|
682
|
-
## 8. The one thing this review would change first
|
|
683
|
-
|
|
684
|
-
Not any single defect — **`EntityNode`'s status.**
|
|
685
|
-
|
|
686
|
-
It is documented as sugar and treated as sugar, but it holds the local transform that animation writes to, so it is
|
|
687
|
-
load-bearing runtime state. Every gap in this document traces back to that: reparenting is broken because the fix
|
|
688
|
-
belongs on the components but the API lives on the node; the transform has two homes because the node keeps its own;
|
|
689
|
-
subtree queries scanned because the node had `children` and nothing at the dataset level did.
|
|
690
|
-
|
|
691
|
-
That last clause is no longer true, which sharpens the question rather than answering it: since §6.1 there **is** a
|
|
692
|
-
child enumeration below the node, owned by the systems. `EntityNode.children` is now a second answer to a question the
|
|
693
|
-
dataset can already answer — a list of nodes, only available to whoever built the tree, next to a list of entity ids
|
|
694
|
-
available to anything holding an entity id.
|
|
695
|
-
|
|
696
|
-
Decide which one is the hierarchy. If it is the components, `EntityNode` must become genuinely stateless — its
|
|
697
|
-
`transform` accessor forwarding to `attachment.transform`, its `children` reading through `ParentEntitySystem` — and
|
|
698
|
-
animation binds to components. If it is `EntityNode`, then say so, and stop describing it as sugar.
|
|
699
|
-
|
|
700
|
-
Scene Graph made this choice: the entity is the hierarchy, `transform_component.LocalTransform` is the one local
|
|
701
|
-
transform, and there is no second object graph. That is the part of the design worth copying — not the API surface.
|
|
702
|
-
|
|
703
|
-
---
|
|
704
|
-
|
|
705
|
-
## Sources
|
|
706
|
-
|
|
707
|
-
Unreal / Scene Graph — Epic documentation and reporting:
|
|
708
|
-
|
|
709
|
-
- [Getting Started in Scene Graph in Fortnite](https://dev.epicgames.com/documentation/fortnite/getting-started-in-scene-graph-in-fortnite)
|
|
710
|
-
- [entity class — Verse API reference](https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/versedotorg/scenegraph/entity)
|
|
711
|
-
- [component class — Verse API reference](https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/versedotorg/scenegraph/component)
|
|
712
|
-
- [Transforms in Scene Graph](https://dev.epicgames.com/documentation/en-us/fortnite/transforms-in-scene-graph-in-unreal-editor-for-fortnite)
|
|
713
|
-
- [Scene Graph Best Practices](https://dev.epicgames.com/documentation/fortnite/scene-graph-best-practices-in-fortnite?lang=en-US)
|
|
714
|
-
- [Scene Graph is Now Available as an Experimental Feature in UEFN](https://www.fortnite.com/news/scene-graph-is-now-available-as-an-experimental-feature-in-uefn)
|
|
715
|
-
- [Unreal Engine 6 Will Combine UEFN and UE Into a "Unified Engine"](https://80.lv/articles/upd-unreal-engine-6-will-combine-uefn-and-ue-into-a-unified-engine)
|
|
716
|
-
- [10 things CG artists need to know about Unreal Engine 6](https://www.cgchannel.com/2026/06/10-things-cg-artists-need-to-know-about-unreal-engine-6/)
|
|
717
|
-
- [Mass Framework overview](https://vrealmatic.com/unreal-engine/mass) — for the Scene Graph ≠ Mass distinction
|
|
1
|
+
# Hierarchy in meep's ECS — a review against Unreal 6 / Scene Graph
|
|
2
|
+
|
|
3
|
+
**Date:** 2026-08-23
|
|
4
|
+
**Subject:** `ParentEntity`, `TransformAttachment`, `EntityNode`, and the systems behind them
|
|
5
|
+
**Comparator:** Epic's Scene Graph — the entity/component framework that UE6 is being built on
|
|
6
|
+
|
|
7
|
+
**Status, 2026-08-24.** §6.1 landed: both systems now keep a parent → children index
|
|
8
|
+
(`ecs/hierarchy/EntityChildIndex.js`), which closed **D5**, **D7**, **D8** and **D11**, and made **D3** small enough
|
|
9
|
+
to fix in the same pass. **D4** was addressed the day before. Still open: **D1**, **D2**, **D6**, **D9**, **D10**, and
|
|
10
|
+
the question in §8. Sections below are written in the tense of what is true now; the reasoning that led there is
|
|
11
|
+
unchanged.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 0. Verdict up front
|
|
16
|
+
|
|
17
|
+
The **core split is right, and it is a better decomposition than Unreal's.** meep separates *lifetime* parenting
|
|
18
|
+
(`ParentEntity`) from *spatial* parenting (`TransformAttachment`) into two independent components. Scene Graph has one
|
|
19
|
+
hierarchy that means lifetime, and bolts a spatial override onto it (`transform_component.Origin`). meep's version is
|
|
20
|
+
the more honest model: two relations that are genuinely independent are stored as two relations, rather than one
|
|
21
|
+
relation plus an escape hatch.
|
|
22
|
+
|
|
23
|
+
The **propagation is also better than I expected.** I assumed the signal cascade would re-do work exponentially in
|
|
24
|
+
depth. It does not — measured, each descendant is recomputed **exactly once** per root change, at any depth. That is
|
|
25
|
+
optimal, and it is achieved without a sort, a level index, or a dirty-flag pass.
|
|
26
|
+
|
|
27
|
+
What is weak is everything *around* that core:
|
|
28
|
+
|
|
29
|
+
- `EntityNode`, described as "syntactic sugar", is not sugar. It holds live state (the local transform, the
|
|
30
|
+
subscriptions) that the ECS does not have, and animation binds to it. It is a **shadow object graph** — the exact
|
|
31
|
+
thing an ECS hierarchy exists to remove.
|
|
32
|
+
- **Live reparenting does not work.** One path silently strips the spatial link (verified, repro below); the other
|
|
33
|
+
asserts. Scene Graph treats reparenting as an ordinary operation.
|
|
34
|
+
- ~~**Children are not stored anywhere.** Every "give me the subtree" operation is a full scan of the dataset, so
|
|
35
|
+
subtree work is O(nodes × entities-in-world).~~ **Fixed** — each system now owns the back-links (§6.1).
|
|
36
|
+
- Three parallel attachment mechanisms exist (`TransformAttachment`, `Attachment`, plus ad-hoc `transform.subscribe`
|
|
37
|
+
closures in `MeshSystem`). A fourth component, `ChildEntities`, was dead code and has been deleted.
|
|
38
|
+
|
|
39
|
+
Severity-ordered defect list is in §5. Six of the eleven are correctness, and two of those I reproduced.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 1. Scope and method
|
|
44
|
+
|
|
45
|
+
**Read in full:** `ecs/parent/*` (`ParentEntity`, `ParentEntitySystem`, `ChildEntities` (since deleted), `EntityNode`,
|
|
46
|
+
`EntityNodeFlags`, `entity_node_compute_bounding_box`), `ecs/transform-attachment/*` (`TransformAttachment`,
|
|
47
|
+
`TransformAttachmentSystem`, `transform_attachment_parent_of`, `transform_attachment_find_descendant_by_name`),
|
|
48
|
+
`ecs/attachment/*` (`Attachment`, `AttachmentSystem`, `AttachmentBinding`, `TransformAttachmentBinding`,
|
|
49
|
+
`BoneAttachmentBinding`), plus `Entity`, `Transform`, and the relevant parts of `EntityComponentDataset`,
|
|
50
|
+
`EntityManager` and `BinaryBufferSerializer`.
|
|
51
|
+
|
|
52
|
+
**Consumers surveyed:** `shade_node_to_entity_composition`, `three_object_to_entity_composition`, `MeshSystem`,
|
|
53
|
+
`SGMeshSystem`, `ColliderObserverSystem`, `HierarchicalEntityListView`, `bind_property_writer`,
|
|
54
|
+
`sg_hierarchy_compute_bounding_box_via_parent_entity`.
|
|
55
|
+
|
|
56
|
+
**Measured, not assumed.** Four throwaway specs were run against the real systems (no mocks) and then deleted. Every
|
|
57
|
+
number in §2.3, §5 D1, D2 and D10 is output from those runs, quoted verbatim. Where I state something I only read and
|
|
58
|
+
did not execute, it says so.
|
|
59
|
+
|
|
60
|
+
**On the Unreal side — read this before trusting §3.** Epic announced at State of Unreal (June 2026) that UE6 unifies
|
|
61
|
+
UE and UEFN, and that Actors and Blueprints will eventually be deprecated in favour of Verse plus Scene Graph, with
|
|
62
|
+
conversion tools and a multi-year transition. Scene Graph itself shipped first in UEFN and is documented there as
|
|
63
|
+
experimental/beta. **The public documentation is the UEFN surface**, so the API names below are the Verse ones. Epic
|
|
64
|
+
has not published Scene Graph's internal storage, so anything about *how* it stores hierarchy is unknown, and I make
|
|
65
|
+
no claims about it.
|
|
66
|
+
|
|
67
|
+
One terminology correction worth making, because it changes what "compare against Unreal's ECS" means: **Scene Graph
|
|
68
|
+
is not Unreal's ECS.** Unreal's data-oriented ECS is **Mass** (archetype-based; components are "fragments", systems
|
|
69
|
+
are "processors"), built for crowds and traffic. Scene Graph is an *entity/component gameplay framework* — the Actor
|
|
70
|
+
replacement. It is Scene Graph, not Mass, that is the right comparator for meep's hierarchy, and that is what this
|
|
71
|
+
document uses. Mass has no user-facing hierarchy to compare against.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 2. What meep has today
|
|
76
|
+
|
|
77
|
+
### 2.1 Four mechanisms, not one
|
|
78
|
+
|
|
79
|
+
| Mechanism | Means | Propagated by | Status |
|
|
80
|
+
|---|---|---|---|
|
|
81
|
+
| `ParentEntity { entity }` | **Lifetime.** Parent dies → child dies. | `ParentEntitySystem` listens for `EntityRemoved` on the parent, removes the child. | Live |
|
|
82
|
+
| `TransformAttachment { transform, parent, flags }` | **Space.** Child world = parent world × local. | `TransformAttachmentSystem`, via `Transform` change signals. | Live |
|
|
83
|
+
| `Attachment { parent, socket, transform }` | **Space, via a named socket / bone.** | `AttachmentSystem`, via `AttachmentBinding`s, polled every frame. | Live |
|
|
84
|
+
| ad-hoc `transform.subscribe(follow)` | **Space, hand-rolled.** | A closure in `MeshSystem` (line ~558) copying one transform to another. | Live |
|
|
85
|
+
| ~~`ChildEntities { entities[] }`~~ | — | — | **Deleted** (D5). Was dead, and the wrong shape — see §4.2. |
|
|
86
|
+
|
|
87
|
+
`EntityNode` sits on top of the first two as an authoring façade.
|
|
88
|
+
|
|
89
|
+
The overlap between rows 2–4 is the first thing to notice. `TransformAttachmentBinding` (row 3's transform case) does
|
|
90
|
+
what `UpdateContext` (row 2) does, with a socket offset spliced in, using matrices instead of `Transform` composition —
|
|
91
|
+
and it carries a `TODO` saying so. Row 4 is row 2 with the local transform hard-coded to identity.
|
|
92
|
+
|
|
93
|
+
### 2.2 The two relations are genuinely independent — and that is the good part
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
ParentEntity.entity → "when that entity dies, I die"
|
|
97
|
+
TransformAttachment.parent → "my transform is relative to that entity"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Nothing requires them to name the same entity. That is a real capability: a UI marker can be spatially attached to a
|
|
101
|
+
unit's head while being owned by the HUD; a compound rigid body's colliders are `ParentEntity`-owned by the body
|
|
102
|
+
(which is exactly how `ColliderObserverSystem` finds them) without necessarily composing transforms through it.
|
|
103
|
+
|
|
104
|
+
Scene Graph cannot express this as two facts. It has one hierarchy — which means lifetime — and then
|
|
105
|
+
`transform_component.Origin` to say "actually, compose me against *that* entity instead". Same expressive power,
|
|
106
|
+
reached by exception rather than by construction.
|
|
107
|
+
|
|
108
|
+
### 2.3 How the transform composition actually behaves (measured)
|
|
109
|
+
|
|
110
|
+
`TransformAttachmentSystem` builds an `UpdateContext` per attached entity holding `{attachment, transform, entity,
|
|
111
|
+
parent_transform}` and subscribes it to *both* the parent's world `Transform` and the attachment's local `Transform`.
|
|
112
|
+
Any change to either fires `ctx.update()`, which is one `m4_multiply` plus a decompose back into the child's world
|
|
113
|
+
`Transform` — whose own position/rotation/scale setters fire, waking the grandchild's context. Propagation is a
|
|
114
|
+
synchronous, re-entrant, depth-first cascade with no flush point.
|
|
115
|
+
|
|
116
|
+
Measured on a straight chain, counting writes to each descendant's TRS channels for **one** root change:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
depth=4 translate: pos-writes=3 rot-writes=0 scale-writes=0 across 3 descendants
|
|
120
|
+
depth=4 rotate: pos-writes=3 rot-writes=3 scale-writes=3 across 3 descendants
|
|
121
|
+
depth=8 translate: pos-writes=7 rot-writes=0 scale-writes=0 across 7 descendants
|
|
122
|
+
depth=8 rotate: pos-writes=7 rot-writes=7 scale-writes=7 across 7 descendants
|
|
123
|
+
depth=16 translate: pos-writes=15 rot-writes=0 scale-writes=0 across 15 descendants
|
|
124
|
+
depth=16 rotate: pos-writes=15 rot-writes=15 scale-writes=15 across 15 descendants
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**One recompute per descendant, every time.** No redundancy at any depth. The `Vector3.set`/`Quaternion.set` equality
|
|
128
|
+
guards are doing real work here: a pure translation never wakes a rotation listener. This is a good design and it
|
|
129
|
+
should be said plainly, because the rest of this document is mostly criticism.
|
|
130
|
+
|
|
131
|
+
Two costs come with it, both real:
|
|
132
|
+
|
|
133
|
+
**It is observable mid-cascade.** An observer of a descendant's `Transform` is called *during* propagation, when the
|
|
134
|
+
transform is only partly updated. Measured on a depth-3 chain under one 90° root yaw, an observer of the leaf sees:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
[0] pos(0.000,-2.000) rotY(0.000) ← position already final, rotation still stale
|
|
138
|
+
[1] pos(0.000,-2.000) rotY(0.707) ← settled
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
State `[0]` is a pose that never existed. Anything that *accumulates* from a transform callback — a motion trail, a
|
|
142
|
+
velocity estimate, a moved-event, a physics impulse — integrates a torn pose. Renderers get away with it because the
|
|
143
|
+
last write before the frame ends is correct.
|
|
144
|
+
|
|
145
|
+
**Every level does a decompose/recompose round-trip**, and it is lossy. Measured on a chain with **no scaling
|
|
146
|
+
anywhere**, all-rotation locals:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
depth=8: leaf world scale = (1.00000009045938, 1, 1.00000009045938)
|
|
150
|
+
depth=32: leaf world scale = (1.0000006507070245, 1, 1.0000006507070245)
|
|
151
|
+
depth=64: leaf world scale = (1.0000014229381489, 1, 1.0000014229381489)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The exact answer is `(1,1,1)` at every depth. The drift grows with depth, and — because it is a genuine change — it
|
|
155
|
+
also fires a spurious `scale.onChanged` at every level on every rotation, which is where the `scale-writes=N` column
|
|
156
|
+
above comes from. Anything subscribed to scale is woken by pure rotation.
|
|
157
|
+
|
|
158
|
+
The same round-trip discards shear outright. Root scaled `(4,1,1)`, child yawed 45°:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
mid world scale stored as (2.9155, 1.0000, 2.9155)
|
|
162
|
+
leaf world matrix row0 = 2.8284, 0.0000, -0.7071
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The true composed basis is non-orthogonal; TRS cannot hold it, so it is silently best-fitted. A mesh under a
|
|
166
|
+
non-uniformly-scaled rotated parent draws wrong. **Scene Graph shares this limitation** — its transform is TRS too —
|
|
167
|
+
but Unreal documents the non-uniform-scale caveat and meep does not.
|
|
168
|
+
|
|
169
|
+
### 2.4 `EntityNode` is not syntactic sugar
|
|
170
|
+
|
|
171
|
+
Its own docstring says "syntactic sugar on top of `TransformAttachment` and `ParentEntity`". It is not, on three
|
|
172
|
+
counts:
|
|
173
|
+
|
|
174
|
+
1. **It owns a third copy of the local transform.** `EntityNode.__transform` is the local transform; the component's
|
|
175
|
+
`attachment.transform` is *also* the local transform. They are synced one-way, node → component, by
|
|
176
|
+
`__transform_sync_down` on change. Write the component directly and the node is stale, with no way to notice.
|
|
177
|
+
2. **It is required at runtime, not just at authoring time.** `bind_property_writer` binds animation curves to
|
|
178
|
+
`node.transform.position` / `.rotation` / `.scale` — the *node's* transform, not the component's. Every animated
|
|
179
|
+
model therefore has to retain its `EntityNode` tree for as long as it animates. The object graph an ECS hierarchy
|
|
180
|
+
is supposed to replace is still there, alive, next to the dataset.
|
|
181
|
+
3. **It carries behaviour the components do not have** — `build`/`destroy` ordering, `on.built`/`on.destroyed`,
|
|
182
|
+
listener attach/detach, `root`, `traverse`. None of that is reachable from an entity id. Anything holding only an
|
|
183
|
+
entity id cannot participate.
|
|
184
|
+
|
|
185
|
+
So there are two ways to express a hierarchy in meep, and they are not interchangeable: components are the storage,
|
|
186
|
+
`EntityNode` is the API, and the API is only available to whoever constructed the tree.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 3. What Scene Graph does
|
|
191
|
+
|
|
192
|
+
From Epic's UEFN documentation (see §8 for links):
|
|
193
|
+
|
|
194
|
+
**Entities are containers; components supply data and behaviour.** One component instance per type per entity — need
|
|
195
|
+
two, make two entities. Components are constructed with a pointer to their owning entity and **cannot be moved between
|
|
196
|
+
parents**.
|
|
197
|
+
|
|
198
|
+
**One hierarchy, and it means lifetime.** "Parenting represents object lifetime: if the parent is removed from the
|
|
199
|
+
scene, so are the sub-objects." One simulation entity is the root; every map entity is a descendant of it.
|
|
200
|
+
|
|
201
|
+
**Children are stored and enumerable.** `GetEntities()` returns the direct children; `GetParent()` walks up;
|
|
202
|
+
`AddEntities(...)` adds children **and reparents them if they already have a parent**; `RemoveFromParent()` detaches,
|
|
203
|
+
and the entity can be re-added later.
|
|
204
|
+
|
|
205
|
+
**Space is layered on top, by exception.** `transform_component` holds `LocalTransform` plus an optional `Origin`. If
|
|
206
|
+
`Origin` is unset, the entity composes against its parent. If set, it composes against whatever entity `Origin` names
|
|
207
|
+
— "a child can orbit around a sibling rather than its parent". API is `Get/SetLocalTransform`, `Get/SetGlobalTransform`
|
|
208
|
+
(both of which implicitly create the component), and `SetOrigin` / `GetOrigin[]` / `ResetOrigin`.
|
|
209
|
+
|
|
210
|
+
**Lifecycle is a phase machine, not a boolean.** Components get `OnAddedToScene` → `OnBeginSimulation` →
|
|
211
|
+
`OnSimulate` (suspending/async) → `OnEndSimulation` → `OnRemovingFromScene`. Adding a child to an in-scene parent
|
|
212
|
+
"advances the child through lifetime phases to match parent state". Component queries only become valid after
|
|
213
|
+
`OnAddedToScene`.
|
|
214
|
+
|
|
215
|
+
**The hierarchy is an event bus.** `SendUp(event)` / `SendDown(event)`, with consumption halting propagation.
|
|
216
|
+
|
|
217
|
+
**Entities carry tags** — `AddTag`, `ContainsAnyTag`, `RemoveAllTagsExcept`, etc.
|
|
218
|
+
|
|
219
|
+
**Access is scoped.** `GetEntities()` and `GetComponents()` return what is "accessible from the calling context" —
|
|
220
|
+
visibility is part of the model, not just a convention.
|
|
221
|
+
|
|
222
|
+
**Their own performance guidance** is: don't re-scan the tree during gameplay; find what you need once in
|
|
223
|
+
`OnBeginSimulation`, cache the references or subscribe to events, and react to events rather than searching again.
|
|
224
|
+
Don't broadcast events across large portions of the graph.
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## 4. Head-to-head
|
|
229
|
+
|
|
230
|
+
| | meep | Scene Graph |
|
|
231
|
+
|---|---|---|
|
|
232
|
+
| Lifetime relation | `ParentEntity.entity` | the hierarchy itself |
|
|
233
|
+
| Spatial relation | `TransformAttachment.parent` — **independent** | `transform_component.Origin`, defaulting to the parent |
|
|
234
|
+
| Local transform | `TransformAttachment.transform` (+ a shadow copy on `EntityNode`) | `transform_component.LocalTransform` |
|
|
235
|
+
| World transform | stored, as a decomposed `Transform` component | queried via `GetGlobalTransform()` |
|
|
236
|
+
| Children stored? | Yes — a system-owned index, not a component (§4.2) | Yes — `GetEntities()` |
|
|
237
|
+
| Reparenting | **Broken / unsupported** (§5 D1, D2) | `AddEntities` reparents as a normal operation |
|
|
238
|
+
| Lifecycle | `isBuilt` boolean; `link`/`unlink` on systems | five explicit phases, propagated to children |
|
|
239
|
+
| Events on the tree | none | `SendUp` / `SendDown` with consumption |
|
|
240
|
+
| Tags | none (`Name` only) | first-class |
|
|
241
|
+
| Cycle safety | detected on read, throws | not documented |
|
|
242
|
+
| Serialization | asymmetric — spatial survives, lifetime does not (§5 D6) | prefab-based |
|
|
243
|
+
| Shear under non-uniform scale | lost silently | lost (documented) |
|
|
244
|
+
|
|
245
|
+
### 4.1 The relation split — meep wins, and should not follow Unreal here
|
|
246
|
+
|
|
247
|
+
Worth stating explicitly because it is tempting to read Unreal's design as the newer one and therefore the better one.
|
|
248
|
+
It is not, on this axis. `Origin`-defaults-to-parent is a **"unset means auto" sentinel**: one field with two meanings,
|
|
249
|
+
where the common case is invisible and the uncommon case is an override. meep's two independent fields say the same
|
|
250
|
+
thing with uniform control flow — the common case (`TransformAttachment.parent === ParentEntity.entity`) is written
|
|
251
|
+
out rather than implied.
|
|
252
|
+
|
|
253
|
+
This also happens to be the shape the codebase already prefers. Adopting `Origin` would be adopting a sentinel.
|
|
254
|
+
|
|
255
|
+
The cost meep pays is that **the coupling is real but undocumented**: `TransformAttachment` alone is not safe when the
|
|
256
|
+
parent can die (§5 D3). `ParentEntity` is what makes it safe. Nothing says so, and `transform_attachment_parent_of`'s
|
|
257
|
+
docstring — which is otherwise the best documentation in this area — describes the spatial hierarchy as if it stood
|
|
258
|
+
alone.
|
|
259
|
+
|
|
260
|
+
### 4.2 Children were not stored — the biggest structural gap, now closed
|
|
261
|
+
|
|
262
|
+
**Was:** `ParentEntitySystem.findChildrenOf` scanned **every** `ParentEntity` component in the dataset to find one
|
|
263
|
+
entity's children, and `traverse` called it once per node. So computing a subtree bounding box (which
|
|
264
|
+
`sg_hierarchy_compute_bounding_box_via_parent_entity` does exactly this way) was **O(subtree × all-parented-entities)**.
|
|
265
|
+
|
|
266
|
+
Scene Graph stores children and Epic's own guidance is *still* "don't scan the tree during gameplay, cache in
|
|
267
|
+
`OnBeginSimulation`". meep was scanning a structure that was a full dataset sweep rather than a stored list.
|
|
268
|
+
|
|
269
|
+
**Now:** both systems own a parent → children index (`ecs/hierarchy/EntityChildIndex.js`), so `findChildrenOf` is a
|
|
270
|
+
lookup and `traverse` is linear in the subtree. The shape and the reasoning are below; what actually landed is in §6.1.
|
|
271
|
+
|
|
272
|
+
Two things this did **not** change, deliberately:
|
|
273
|
+
|
|
274
|
+
- `transform_attachment_find_descendant_by_name` still scans every `Name` and walks up from each candidate — that is
|
|
275
|
+
the bone-lookup path, and it searches by *name* first, which no parent → children index answers. Rewriting it as a
|
|
276
|
+
downward walk over the spatial index is now possible and is the obvious follow-up, but it is a different search.
|
|
277
|
+
- The editor's `HierarchicalEntityListView` still builds its own `Map<parent, children[]>`. It looked like the missing
|
|
278
|
+
index implemented privately, and it is not quite: the view excludes editor-owned entities from the tree entirely, so
|
|
279
|
+
its map is a *filtered* one, and it needs a full entity sweep regardless to find the roots — entities with no
|
|
280
|
+
`ParentEntity` at all, which no children index knows about. Swapping in the real index would mean filtering on every
|
|
281
|
+
read and taking a dependency on a running system, for no sweep saved. Left alone.
|
|
282
|
+
|
|
283
|
+
#### Where the index belongs — *not* in a component
|
|
284
|
+
|
|
285
|
+
The obvious move, and the one most engines make, is a `ChildEntities` component. meep had one already
|
|
286
|
+
(`parent/ChildEntities.js`, dead). **That was the wrong shape, and it was deleted rather than revived.**
|
|
287
|
+
|
|
288
|
+
A child list stored as a component is *derived data promoted to authored data*. The consequences are all bad and all
|
|
289
|
+
structural:
|
|
290
|
+
|
|
291
|
+
- **It is a two-place invariant.** `ParentEntity` lives on the child and `ChildEntities` lives on the parent — two
|
|
292
|
+
entities, two components, one fact. Nothing in the type system or the dataset keeps them agreeing. They can drift,
|
|
293
|
+
and the drift is silent.
|
|
294
|
+
- **It is user-writable.** Being a component makes it authorable, mutable, and reachable from any system. Every one of
|
|
295
|
+
those is an opportunity to corrupt an index that has one correct value.
|
|
296
|
+
- **It is a burden at the layer least able to carry it.** Whoever builds a hierarchy now has to maintain both ends of
|
|
297
|
+
every edge, for information the engine can derive.
|
|
298
|
+
- **It doubles the state footprint** of every parent, and it has to be excluded from serialization by hand — one more
|
|
299
|
+
thing to get wrong alongside D6.
|
|
300
|
+
|
|
301
|
+
The alternative, and what was built, is to hold the back-links **at the system level**: `ParentEntitySystem` already
|
|
302
|
+
observes every entity that gains or loses a `ParentEntity`, so it maintains a private parent → children index with no
|
|
303
|
+
component, no authored state, and nothing for a user to desynchronise. One writer, one source of truth, rebuilt from
|
|
304
|
+
scratch on load.
|
|
305
|
+
|
|
306
|
+
The usual objection is ergonomics — a consumer now has to reach for the system instead of just calling `getComponent`.
|
|
307
|
+
That objection does not survive contact with the actual call pattern: **`ChildEntities` would not have avoided it.** A
|
|
308
|
+
component gives you one level of children as entity ids; to go a level deeper you need `getComponent(child,
|
|
309
|
+
ChildEntities)`, so you are already reaching for the dataset. Component and system are equally indirect, and the system
|
|
310
|
+
version is the one that cannot be wrong. `EntityManager.getSystem(SystemClass)` is typed on the class, so this stays
|
|
311
|
+
inside the codebase's preference for typed lookup over string-keyed registries.
|
|
312
|
+
|
|
313
|
+
The migration cost was also much smaller than it looked — see §6.1.
|
|
314
|
+
|
|
315
|
+
### 4.3 Reparenting
|
|
316
|
+
|
|
317
|
+
Scene Graph: `AddEntities` reparents, and advances the child through lifecycle phases to match the new parent.
|
|
318
|
+
|
|
319
|
+
meep: **neither path works.** Direct `.parent =` assignment strips the spatial link (D1, reproduced). `addChild` of an
|
|
320
|
+
already-built node throws (D2, reproduced). There is no supported way to move a live subtree.
|
|
321
|
+
|
|
322
|
+
This is the single largest functional gap, and it is not exotic — "pick this up", "get in the vehicle", "re-dock this
|
|
323
|
+
panel" are all reparenting a live subtree.
|
|
324
|
+
|
|
325
|
+
### 4.4 Lifecycle phases
|
|
326
|
+
|
|
327
|
+
meep has one bit (`isBuilt`) plus system `link`/`unlink`. The consequence is `TransformAttachmentSystem`'s retry
|
|
328
|
+
queue: a child whose parent has not appeared yet cannot be linked, so it is parked and retried at 32 entries per
|
|
329
|
+
frame, forever, with no diagnostic if the parent never arrives. `AttachmentSystem` has its own separate `waiting`
|
|
330
|
+
array doing the same thing.
|
|
331
|
+
|
|
332
|
+
That queue is *compensating for the absence of ordering guarantees*. Scene Graph's answer is that a child added to an
|
|
333
|
+
in-scene parent is advanced to match the parent's phase — the "parent isn't ready yet" state is structurally
|
|
334
|
+
impossible rather than polled for.
|
|
335
|
+
|
|
336
|
+
Not a defect. But two hand-rolled retry queues is what the missing phase model costs.
|
|
337
|
+
|
|
338
|
+
### 4.5 Events, tags, scoping
|
|
339
|
+
|
|
340
|
+
meep has none of `SendUp`/`SendDown`, tags, or context-scoped access. Of the three:
|
|
341
|
+
|
|
342
|
+
- **`SendUp`/`SendDown` is worth having** and is cheap once children are stored. The idiom it enables — a hit on a
|
|
343
|
+
limb bubbling to the creature, a "prefab" root broadcasting down — is currently done by walking to
|
|
344
|
+
`ParentEntitySystem.findRoot` and dispatching manually.
|
|
345
|
+
- **Tags** duplicate what a component already does in meep. Skip; a zero-field component is the same thing and stays
|
|
346
|
+
typed, which is what this codebase prefers over string keys.
|
|
347
|
+
- **Scoped access** is a Verse-language concern. Not applicable.
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## 5. Defects
|
|
352
|
+
|
|
353
|
+
Ordered by severity. **[repro]** = I reproduced it against the real systems. **[read]** = from reading only.
|
|
354
|
+
Entries marked **FIXED** were closed on 2026-08-24 by the work in §6.1 and §6.3; the original finding is kept so the
|
|
355
|
+
reasoning stays readable, with what changed appended.
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
**D1 — `EntityNode.parent` setter destroys the spatial link. [repro]** — *correctness, high*
|
|
360
|
+
|
|
361
|
+
`EntityNode.js:240-270`. The setter removes both components up front:
|
|
362
|
+
|
|
363
|
+
```js
|
|
364
|
+
let parent_entity = this_entity.removeComponent(ParentEntity);
|
|
365
|
+
let attachment = this_entity.removeComponent(TransformAttachment); // returns the instance
|
|
366
|
+
|
|
367
|
+
if (node !== null) {
|
|
368
|
+
...
|
|
369
|
+
this_entity.add(parent_entity); // ParentEntity IS re-added
|
|
370
|
+
|
|
371
|
+
if (attachment === null) { // ...but it is NOT null,
|
|
372
|
+
attachment = this.__safe_get_attachment(); // so this never runs
|
|
373
|
+
}
|
|
374
|
+
attachment.parent = parent_entity_id; // mutates a DETACHED component
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
`Entity.removeComponent` returns the removed instance (`Entity.js:286`), so the `=== null` branch is dead whenever the
|
|
379
|
+
node was already parented. The re-add only happens through `__safe_get_attachment()`, which is skipped.
|
|
380
|
+
|
|
381
|
+
Reproduced — build `a → b`, then assign `b.parent = c` directly:
|
|
382
|
+
|
|
383
|
+
```
|
|
384
|
+
after build, b has TransformAttachment: true
|
|
385
|
+
after reparent, b TransformAttachment: null
|
|
386
|
+
after reparent, b ParentEntity: 2 (c.id: 2) ← lifetime link correct
|
|
387
|
+
dataset has TransformAttachment on b: undefined ← spatial link gone
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
The child keeps its new owner and silently stops following it in space; its world `Transform` freezes at its last
|
|
391
|
+
value. `addChild()` happens to escape this because `removeChild()` runs first and clears the component via the
|
|
392
|
+
`node === null` path — so the bug is confined to the public setter, which is the documented way to reparent.
|
|
393
|
+
|
|
394
|
+
Fix is one line: drop the `if (attachment === null)` guard and always call `__safe_get_attachment()`.
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
**D2 — live reparenting asserts in dev, silently no-ops in prod. [repro]** — *correctness, high*
|
|
399
|
+
|
|
400
|
+
`EntityNode.addChild` calls `node.build(dataset)` when the receiving parent is built; `build` opens with
|
|
401
|
+
`assert.notOk(this.__entity.isBuilt, 'Already built')`. Reproduced: `addChild` of a built node into a built parent
|
|
402
|
+
throws `"Already built"`.
|
|
403
|
+
|
|
404
|
+
Asserts are compiled out of production builds. In production the assert vanishes and `Entity.build` early-returns
|
|
405
|
+
(`Entity.js:442-449`), so it degrades to a partial no-op rather than corruption — but combined with D1 the node can
|
|
406
|
+
end up owned-but-not-attached with no error anywhere. **Dev throws, prod silently misbehaves**, which is the worse of
|
|
407
|
+
the two orderings.
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
**D3 — a child was not detached when its spatial parent died. [read]** — *correctness, high* — **FIXED 2026-08-24.**
|
|
412
|
+
|
|
413
|
+
`UpdateContext` captured `parent_transform` at link time and subscribed to it. Nothing observed the *parent's*
|
|
414
|
+
removal. When the parent entity was destroyed:
|
|
415
|
+
|
|
416
|
+
- the child still had `TransformAttachment` + `Transform`, so the system's `unlink` was never called;
|
|
417
|
+
- `this.__contexts[entity]` kept holding the context, which kept holding the dead parent's `Transform` alive;
|
|
418
|
+
- the child composed against a transform nothing would ever update again — it froze, silently.
|
|
419
|
+
|
|
420
|
+
`ParentEntity` masked this whenever both components named the same entity, because the child got destroyed too. It was
|
|
421
|
+
exposed exactly when the two are used independently — i.e. the capability §4.1 credits as meep's advantage.
|
|
422
|
+
|
|
423
|
+
**The fix**, mirroring what `ParentEntitySystem`'s `Context` already did: `UpdateContext` subscribes to its parent's
|
|
424
|
+
`EntityRemoved` in `link()` and unsubscribes in `unlink()`, and on removal it takes `TransformAttachment` off the
|
|
425
|
+
child. The child survives with the world transform it had, as a root, and its own subtree keeps composing against it.
|
|
426
|
+
Dropping the component rather than quietly tearing the context down is what makes the detach observable, and it routes
|
|
427
|
+
the teardown through the system's ordinary `unlink` path.
|
|
428
|
+
|
|
429
|
+
Two details worth keeping:
|
|
430
|
+
|
|
431
|
+
- **It is registered per child, not per parent, so the §6.1 index is not what makes it work.** The index would have
|
|
432
|
+
needed a separate count of *bound* children to know when to add and drop a single per-parent listener — queued
|
|
433
|
+
children are in the index but must not register — which is more state than one listener per context. The index is
|
|
434
|
+
still what makes "which children point at me" answerable; this particular fix just did not need to ask.
|
|
435
|
+
- **A stale dispatch is real and is guarded.** Entity event dispatch copies its listener list before invoking it, so
|
|
436
|
+
when an entity carries *both* relations and the lifetime one destroys it first, the spatial detach still arrives —
|
|
437
|
+
for an entity that no longer exists. `UpdateContext` tracks whether it is linked and ignores the late call. This is
|
|
438
|
+
ordering-dependent (whichever system linked first is called first) and is covered both ways round in the spec.
|
|
439
|
+
|
|
440
|
+
**Still not covered:** a child that is still *queued* when its parent dies. It never bound, so it never subscribed, and
|
|
441
|
+
it goes on retrying against an id that may be recycled. That is the pre-existing gap §4.4 describes — the retry queue
|
|
442
|
+
has no diagnostic for a parent that never arrives, and now also none for one that leaves.
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
**D4 — mutating `TransformAttachment.parent` is silently ignored. [read]** — *correctness, medium* — **ADDRESSED
|
|
447
|
+
2026-08-24**, documented on the field to match `ParentEntity`'s existing constraint.
|
|
448
|
+
|
|
449
|
+
`UpdateContext.update()` reads `this.parent_transform`, resolved once at link. Writing `attachment.parent = other`
|
|
450
|
+
afterwards changes nothing; the entity keeps composing against the old parent. `ParentEntity` documents this
|
|
451
|
+
constraint ("Must not be mutated while the component is attached to a dataset"); `TransformAttachment` did not, and
|
|
452
|
+
its field is plain and public.
|
|
453
|
+
|
|
454
|
+
Worth noting that this contract is **load-bearing for §6.1, not just hygiene.** A system-owned child index is correct
|
|
455
|
+
precisely because `link`/`unlink` are the only transitions a parent reference can undergo. If either component's
|
|
456
|
+
`parent` field could be rewritten in place, the index would need change detection to stay honest, and the argument for
|
|
457
|
+
keeping it out of a component would weaken. Documenting the immutability is what makes the cheap index sound.
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
**D5 — `ChildEntities` was dead code, and the wrong shape. [repro — zero references]** — *hygiene, medium* —
|
|
462
|
+
**FIXED 2026-08-24.**
|
|
463
|
+
|
|
464
|
+
Defined in `parent/ChildEntities.js`, referenced nowhere outside its own file.
|
|
465
|
+
|
|
466
|
+
**Deleted.** Per §4.2 it was not a stub to finish — a component is the wrong home for a derived back-link, and leaving
|
|
467
|
+
the file present implied both that a child index existed and that a component was where one should go. Neither was
|
|
468
|
+
true. The index belongs to `ParentEntitySystem` (§6.1), and now lives there.
|
|
469
|
+
|
|
470
|
+
---
|
|
471
|
+
|
|
472
|
+
**D6 — serialization is asymmetric between the two hierarchies. [read]** — *correctness, medium*
|
|
473
|
+
|
|
474
|
+
`ParentEntity.serializable = false`, commented "Entity IDs are transient, serialization is not applicable".
|
|
475
|
+
`TransformAttachment` sets no such flag, and `isComponentClassSerializable` defaults to serializable
|
|
476
|
+
(`BinaryBufferSerializer.js:15`) — so its `parent` field, **also a raw entity id**, is written and read back.
|
|
477
|
+
|
|
478
|
+
Entity ids do survive a round-trip (`BinaryBufferDeSerializer` calls `createEntitySpecific`), so this is not
|
|
479
|
+
straightforwardly broken. But the two components make opposite decisions about the same kind of data, and the result
|
|
480
|
+
is that a saved scene reloads with its **spatial** hierarchy intact and its **lifetime** hierarchy gone. Given D3,
|
|
481
|
+
that reload also lands in exactly the configuration where an attachment is unsafe.
|
|
482
|
+
|
|
483
|
+
Whichever way it is resolved, the two should agree.
|
|
484
|
+
|
|
485
|
+
§6.1 sharpened this rather than changing it: the child index is rebuilt from the child-side components on load, so a
|
|
486
|
+
scene that reloads without its `ParentEntity` components reloads with an empty lifetime index too. The index does not
|
|
487
|
+
cause the omission, it just stops it being invisible.
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
**D7 — subtree operations were O(subtree × world). [read]** — *performance, medium* — **FIXED 2026-08-24.**
|
|
492
|
+
|
|
493
|
+
`ParentEntitySystem.findChildrenOf` swept every `ParentEntity` in the dataset per node; `traverse` called it per node.
|
|
494
|
+
`sg_hierarchy_compute_bounding_box_via_parent_entity` and `transform_attachment_find_descendant_by_name` (the bone
|
|
495
|
+
lookup) both paid it.
|
|
496
|
+
|
|
497
|
+
The index in §6.1 fixed the first: `findChildrenOf` is a lookup and `traverse` is linear in the subtree. The bone
|
|
498
|
+
lookup is untouched — it searches by name, which this index does not answer (§4.2).
|
|
499
|
+
|
|
500
|
+
Also in `traverse`: `path.concat(entity)` allocated a new array per node per level, making cycle detection O(depth²) in
|
|
501
|
+
allocations for a deep tree. The rewritten walk pushes and pops one shared path array instead, and cycle detection is
|
|
502
|
+
now O(depth) comparisons per node against no allocation at all.
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
506
|
+
**D8 — the cycle checker was a shared fixed buffer. [read]** — *correctness, low* — **FIXED 2026-08-24.**
|
|
507
|
+
|
|
508
|
+
`ParentEntitySystem` used a module-level `Uint32Array(1024)` for `findRoot` and `isAncestorOf`, with no bounds check
|
|
509
|
+
on `loop_checker_array[count++]`. Two consequences: writes past 1024 were silently dropped by JS typed arrays, so a
|
|
510
|
+
hierarchy deeper than 1024 stopped detecting cycles and could spin forever; and because the buffer was shared and
|
|
511
|
+
un-reentrant, a `findRoot` called from inside a `traverse` callback clobbered the outer walk's state.
|
|
512
|
+
|
|
513
|
+
Depth > 1024 is not realistic. Re-entrancy was — `traverse` takes a user callback.
|
|
514
|
+
|
|
515
|
+
Both walks now keep their own path array, which is per call and grows, so neither failure mode exists. It fell out of
|
|
516
|
+
moving these two off the static-plus-`ecd` shape onto the system; the module global, `check_loop` and `genLoopString`
|
|
517
|
+
went with it. A 2048-deep chain is in the spec.
|
|
518
|
+
|
|
519
|
+
---
|
|
520
|
+
|
|
521
|
+
**D9 — transform sockets update twice per frame. [read]** — *performance, low*
|
|
522
|
+
|
|
523
|
+
`TransformAttachmentBinding.link()` subscribes to the parent's and the attachment's transform changes, *and*
|
|
524
|
+
`AttachmentSystem.__updateAll()` calls `binding.update()` for every binding every frame unconditionally. Either the
|
|
525
|
+
subscription or the sweep is redundant. (`BoneAttachmentBinding` genuinely needs the per-frame sweep — its pose is a
|
|
526
|
+
query with no change signal — so the sweep is the one to keep, and the `TransformAttachmentBinding` subscriptions are
|
|
527
|
+
the removable half.)
|
|
528
|
+
|
|
529
|
+
---
|
|
530
|
+
|
|
531
|
+
**D10 — decompose round-trip drifts and drops shear. [repro]** — *correctness, low-to-medium*
|
|
532
|
+
|
|
533
|
+
Numbers in §2.3. Scale drifts to ~1.4e-6 over 64 rotation-only levels and fires spurious `scale.onChanged` at every
|
|
534
|
+
level; shear from a non-uniformly-scaled rotated parent is silently best-fitted away.
|
|
535
|
+
|
|
536
|
+
Not cheaply fixable — it is inherent to storing the world transform as a decomposed `Transform` — and Unreal has the
|
|
537
|
+
same limitation.
|
|
538
|
+
|
|
539
|
+
The documentation half is **done**: `TransformAttachment` now carries the non-uniform-scale caveat and the drift
|
|
540
|
+
figure. The behaviour is unchanged and the defect stays open on that basis. Still worth considering: whether
|
|
541
|
+
`UpdateContext.update()` should compose into the child's `matrix` and skip the decompose for consumers that only read
|
|
542
|
+
the matrix.
|
|
543
|
+
|
|
544
|
+
---
|
|
545
|
+
|
|
546
|
+
**D11 — neither system had a spec. [repro — no such files]** — *test coverage, medium* — **FIXED 2026-08-24.**
|
|
547
|
+
|
|
548
|
+
There was no `TransformAttachmentSystem.spec.js` and no `ParentEntitySystem.spec.js`. `TransformAttachment.spec.js` and
|
|
549
|
+
`EntityNode.spec.js` between them test `setFlag`/`clearFlag`/`getFlag`/`writeFlag` — twice, once each, in identical
|
|
550
|
+
form — plus JSON round-trip and `addChild`/`removeChild` bookkeeping on *unbuilt* nodes.
|
|
551
|
+
|
|
552
|
+
**The composition contract itself was untested.** Nothing asserted that a child's world transform equals parent ×
|
|
553
|
+
local, that a change propagates, that a chain composes, or that a queued attachment links when its parent arrives.
|
|
554
|
+
Nine other specs register both systems, but as fixture scaffolding — `MeshSystem.spec.js` registers them so a model
|
|
555
|
+
can expand, not to check them.
|
|
556
|
+
|
|
557
|
+
Both specs now exist, on real `EntityManager`/`EntityComponentDataset` objects, and cover the composition contract,
|
|
558
|
+
the index (empty/one/many, ordering, child removal, parent removal, id recycling, snapshot semantics), the queue path,
|
|
559
|
+
subtree traversal against the full-scan implementation it replaced, cycles, and the D3 detach in both dispatch orders.
|
|
560
|
+
`EntityChildIndex` has its own spec for what the systems cannot reach through their own API. The flag tests remain the
|
|
561
|
+
vacuous-smoke-test shape and were left alone; they are not what this defect was about.
|
|
562
|
+
|
|
563
|
+
Note that D1 and D2 are both immediately visible from a five-line test, which is why they are still here.
|
|
564
|
+
|
|
565
|
+
---
|
|
566
|
+
|
|
567
|
+
## 6. What is worth taking from Scene Graph
|
|
568
|
+
|
|
569
|
+
In order of value per unit of change. Note that the first item takes Scene Graph's *capability* while explicitly
|
|
570
|
+
rejecting its *storage* — the useful comparison here is not "copy what Unreal did".
|
|
571
|
+
|
|
572
|
+
### 6.1 Store children — as a system-owned index, not a component — **LANDED 2026-08-24**
|
|
573
|
+
|
|
574
|
+
Take Scene Graph's *capability* (children are enumerable in O(children)) and reject its *storage*, because meep's
|
|
575
|
+
system layer can derive the same thing without asking the user to maintain anything. Reasoning in §4.2; this is what
|
|
576
|
+
was built.
|
|
577
|
+
|
|
578
|
+
`ecs/hierarchy/EntityChildIndex.js` holds the structure — a sparse array of parent id → ascending child ids — and both
|
|
579
|
+
systems own one, as `__children`. It has its own spec for the ordering and copy-out contracts.
|
|
580
|
+
|
|
581
|
+
**The choke points already existed and were already overridden.** `ParentEntitySystem` extends `AbstractContextSystem`,
|
|
582
|
+
whose `link()`/`unlink()` fire exactly once per entity gaining or losing a `ParentEntity`. `ParentEntitySystem`'s own
|
|
583
|
+
`Context` already overrode both, and already read `this.components[0].entity` to subscribe to the parent's removal.
|
|
584
|
+
Maintaining the index is one insert in `Context.link()` and one remove in `Context.unlink()`, beside code that was
|
|
585
|
+
already there for exactly the same edge.
|
|
586
|
+
|
|
587
|
+
Design notes that mattered, and how each was settled:
|
|
588
|
+
|
|
589
|
+
- **Store entity ids, never contexts.** `AbstractContextSystem` pools its contexts through `ObjectPoolFactory` and
|
|
590
|
+
reuses them after `unlink`. An index holding context references would alias recycled objects. The index stores ids.
|
|
591
|
+
- **Define child order explicitly.** Insertion order is link order, which is deterministic only as far as entity
|
|
592
|
+
creation order is. **Sorted ascending by entity id on insert**, via a binary-search insert — chosen over documenting
|
|
593
|
+
link order because it makes iteration order independent of the thing that is hard to reason about, and child fan-out
|
|
594
|
+
is small enough that the splice is not worth defending against.
|
|
595
|
+
- **Hand out a snapshot, not the live array.** `handleParentEntityRemoval` destroys children from inside the cascade,
|
|
596
|
+
so a consumer iterating a live array mutates under itself. `findChildrenOf` kept its `(result, result_offset, ...)
|
|
597
|
+
-> count` shape — the `ecd` argument dropped, since the system knows its own dataset — which preserves the house
|
|
598
|
+
convention from the bvh3 query API. `countChildrenOf` was added beside it, to size a buffer without filling one.
|
|
599
|
+
- **The index does not serialize, and that is the point.** It is rebuilt from `ParentEntity` on load, so there is no
|
|
600
|
+
format, no version, and no stale-id migration. **This does sharpen D6:** `ParentEntity.serializable === false` means
|
|
601
|
+
a loaded scene has no `ParentEntity` components to rebuild *from*, so the lifetime hierarchy comes back empty. The
|
|
602
|
+
index makes that omission visible rather than causing it.
|
|
603
|
+
- **Entity ids are recycled**, so a parent whose last child leaves has its entry deleted outright rather than left
|
|
604
|
+
empty. An id that comes back has to come back childless; both specs pin it.
|
|
605
|
+
|
|
606
|
+
**Static-with-`ecd` versus instance.** `traverse` and `findChildrenOf` need the index, so they had to move onto the
|
|
607
|
+
system. `findRoot`, `isAncestorOf` and `findParentEntity` walk child → parent and did not, but leaving them static
|
|
608
|
+
would have meant two ways to ask the same system the same kind of question. All five are instance methods now and the
|
|
609
|
+
`ecd` parameter is gone from all of them. Per library semantics the unreferenced ones were carried across rather than
|
|
610
|
+
deleted.
|
|
611
|
+
|
|
612
|
+
**Migration cost, measured before and confirmed after:** `ParentEntitySystem.traverse` had **exactly one caller** in
|
|
613
|
+
the whole tree (`sg_hierarchy_compute_bounding_box_via_parent_entity.js:30`), which now takes the system in place of
|
|
614
|
+
the `ecd`. `findChildrenOf`, `findRoot` and `isAncestorOf` had **zero** external callers. So the "you have to reach
|
|
615
|
+
for the system" awkwardness cost one production signature change, plus standing up an `EntityManager` in
|
|
616
|
+
`sg_hierarchy_compute_bounding_box_via_parent_entity.spec.js`, which had been running on a bare ECD.
|
|
617
|
+
|
|
618
|
+
Payoff: killed D7 and D8, made D3 small enough to fix in the same pass (§6.3), and unblocks `SendUp`/`SendDown`. It did
|
|
619
|
+
**not** let `HierarchicalEntityListView` drop its private `Map<parent, children[]>` — see §4.2 for why that map is not
|
|
620
|
+
this index.
|
|
621
|
+
|
|
622
|
+
**The same index shape applies to the spatial hierarchy**, and landed there too. `TransformAttachmentSystem` already
|
|
623
|
+
keyed `__contexts` by child; the parent → children direction goes in at `link()` and out at `unlink()`. Inserting at
|
|
624
|
+
`link()` rather than `__finalize_link()` means **a queued child is in the index before it binds** — the question the
|
|
625
|
+
index answers is "which children point at me", and that is true of a child still waiting for its parent to gain a
|
|
626
|
+
`Transform`. The consequence, documented on the system: a non-zero child count does not imply those children are
|
|
627
|
+
composing yet.
|
|
628
|
+
|
|
629
|
+
### 6.2 Make reparenting a real, single operation
|
|
630
|
+
|
|
631
|
+
**Not done — still the largest open item.** One function — `hierarchy_reparent(ecd, entity, new_parent)` — that
|
|
632
|
+
updates both components together and is the only supported path. Fix D1 inside it and let `EntityNode.parent` delegate
|
|
633
|
+
to it. This is Scene Graph's `AddEntities` semantics, minus the phase machine. D4's documented immutability means
|
|
634
|
+
reparenting is a remove/re-add of the components, not a field write — which is the contract this function should
|
|
635
|
+
encode rather than leave to callers, and which §6.1 turned from a convention into something the child indices depend
|
|
636
|
+
on.
|
|
637
|
+
|
|
638
|
+
### 6.3 Detach on parent death — **LANDED 2026-08-24**
|
|
639
|
+
|
|
640
|
+
`TransformAttachmentSystem` now listens for `EntityRemoved` on the parent (as `ParentEntitySystem`'s `Context` already
|
|
641
|
+
did) and drops the child's `TransformAttachment`. This fixes D3, and makes the independent use of the two relations
|
|
642
|
+
actually safe.
|
|
643
|
+
|
|
644
|
+
One prediction here did not hold up. The expectation was that the 6.1 index would turn "which children do I unlink"
|
|
645
|
+
into a lookup; in practice the listener is registered **per child context**, exactly as `ParentEntitySystem` does it,
|
|
646
|
+
because a single per-parent listener would have needed its own count of *bound* children to know when to register and
|
|
647
|
+
unregister — the index deliberately includes queued children, which must not register one. Per-child is less state
|
|
648
|
+
and mirrors the sibling system. The index is still what makes the direction answerable at all; this fix just did not
|
|
649
|
+
need to ask. Details, including the stale-dispatch guard, are in D3.
|
|
650
|
+
|
|
651
|
+
### 6.4 `SendUp` / `SendDown`
|
|
652
|
+
|
|
653
|
+
Now cheap — 6.1 exists, so `SendDown` is a traversal that already terminates and `SendUp` is
|
|
654
|
+
`ParentEntitySystem.findRoot`'s walk with a visitor. Replaces the manual `findRoot`-and-dispatch idiom. Not built;
|
|
655
|
+
nothing in the tree asks for it yet.
|
|
656
|
+
|
|
657
|
+
### 6.5 Document the couplings — **DONE 2026-08-24**
|
|
658
|
+
|
|
659
|
+
`TransformAttachment` needed what `ParentEntity` already had. All three halves are now on the component: the
|
|
660
|
+
`parent`-immutability note (D4), the non-uniform-scale and drift caveat (D10), and the statement that without a
|
|
661
|
+
lifetime relation an attachment does not survive its parent — which, since D3, means the component is removed and the
|
|
662
|
+
entity becomes a world-space root rather than freezing.
|
|
663
|
+
|
|
664
|
+
Both `parent` fields also now say *why* they must not be mutated in place: each system resolves the parent once at
|
|
665
|
+
link and indexes the edge at the same moment, so an in-place write desynchronises both.
|
|
666
|
+
|
|
667
|
+
## 7. What is not worth taking
|
|
668
|
+
|
|
669
|
+
- **`Origin`-defaults-to-parent.** §4.1 — meep's two-field split is better and matches the codebase's stated
|
|
670
|
+
preference for uniform control flow over sentinels.
|
|
671
|
+
- **A child list as stored, authored state.** §4.2 — take the enumerability, not the component. Scene Graph can afford
|
|
672
|
+
a stored child list because its hierarchy *is* the entity and there is only one writer; in an ECS the same list
|
|
673
|
+
becomes a second, user-writable copy of an edge that already exists on the child, with no mechanism keeping the two
|
|
674
|
+
ends honest. Derive it in the system instead. This is the one place where the conventional engine answer and
|
|
675
|
+
`ChildEntities` agree with each other and are both wrong.
|
|
676
|
+
- **Tags.** A zero-field component already is a tag, and stays typed.
|
|
677
|
+
- **The five-phase lifecycle, wholesale.** The valuable half is the ordering guarantee that removes the retry queues;
|
|
678
|
+
adopting five named phases across every system is a much larger change than the problem warrants. If anything here
|
|
679
|
+
is worth doing it is the *guarantee*, not the vocabulary.
|
|
680
|
+
- **Scoped access.** A Verse language feature with no analogue here.
|
|
681
|
+
|
|
682
|
+
## 8. The one thing this review would change first
|
|
683
|
+
|
|
684
|
+
Not any single defect — **`EntityNode`'s status.**
|
|
685
|
+
|
|
686
|
+
It is documented as sugar and treated as sugar, but it holds the local transform that animation writes to, so it is
|
|
687
|
+
load-bearing runtime state. Every gap in this document traces back to that: reparenting is broken because the fix
|
|
688
|
+
belongs on the components but the API lives on the node; the transform has two homes because the node keeps its own;
|
|
689
|
+
subtree queries scanned because the node had `children` and nothing at the dataset level did.
|
|
690
|
+
|
|
691
|
+
That last clause is no longer true, which sharpens the question rather than answering it: since §6.1 there **is** a
|
|
692
|
+
child enumeration below the node, owned by the systems. `EntityNode.children` is now a second answer to a question the
|
|
693
|
+
dataset can already answer — a list of nodes, only available to whoever built the tree, next to a list of entity ids
|
|
694
|
+
available to anything holding an entity id.
|
|
695
|
+
|
|
696
|
+
Decide which one is the hierarchy. If it is the components, `EntityNode` must become genuinely stateless — its
|
|
697
|
+
`transform` accessor forwarding to `attachment.transform`, its `children` reading through `ParentEntitySystem` — and
|
|
698
|
+
animation binds to components. If it is `EntityNode`, then say so, and stop describing it as sugar.
|
|
699
|
+
|
|
700
|
+
Scene Graph made this choice: the entity is the hierarchy, `transform_component.LocalTransform` is the one local
|
|
701
|
+
transform, and there is no second object graph. That is the part of the design worth copying — not the API surface.
|
|
702
|
+
|
|
703
|
+
---
|
|
704
|
+
|
|
705
|
+
## Sources
|
|
706
|
+
|
|
707
|
+
Unreal / Scene Graph — Epic documentation and reporting:
|
|
708
|
+
|
|
709
|
+
- [Getting Started in Scene Graph in Fortnite](https://dev.epicgames.com/documentation/fortnite/getting-started-in-scene-graph-in-fortnite)
|
|
710
|
+
- [entity class — Verse API reference](https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/versedotorg/scenegraph/entity)
|
|
711
|
+
- [component class — Verse API reference](https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/versedotorg/scenegraph/component)
|
|
712
|
+
- [Transforms in Scene Graph](https://dev.epicgames.com/documentation/en-us/fortnite/transforms-in-scene-graph-in-unreal-editor-for-fortnite)
|
|
713
|
+
- [Scene Graph Best Practices](https://dev.epicgames.com/documentation/fortnite/scene-graph-best-practices-in-fortnite?lang=en-US)
|
|
714
|
+
- [Scene Graph is Now Available as an Experimental Feature in UEFN](https://www.fortnite.com/news/scene-graph-is-now-available-as-an-experimental-feature-in-uefn)
|
|
715
|
+
- [Unreal Engine 6 Will Combine UEFN and UE Into a "Unified Engine"](https://80.lv/articles/upd-unreal-engine-6-will-combine-uefn-and-ue-into-a-unified-engine)
|
|
716
|
+
- [10 things CG artists need to know about Unreal Engine 6](https://www.cgchannel.com/2026/06/10-things-cg-artists-need-to-know-about-unreal-engine-6/)
|
|
717
|
+
- [Mass Framework overview](https://vrealmatic.com/unreal-engine/mass) — for the Scene Graph ≠ Mass distinction
|