feat: 切换至滚动阻力运行模型并更新资产、编辑器与验证

- 物理规则:现行模型仅保留滚动阻力耗能与恢复系数碰撞,风力、空气阻力、静摩擦、动摩擦不再参与运行;确认三球质量 60/330/约890 kg 及水密度、流阻参数
- 定向加速改为真实顶面接触触发的一次性 +5 m/s 速度事件,模型新增渐进式 U 形导槽出口
- 更新球体、滑槽、水/冰/墙、球洞模型与 storybook 目录、物理、实体配置
- 工坊摆放、编辑器、运行适配与检查脚本同步;删除过时的 baseline 三组检查
- 新增谜题设计参考文档、关卡草稿与本轮实验产物
This commit is contained in:
Yanchen
2026-12-05 10:37:31 +08:00
parent d1141b04c7
commit bf6c355fa6
132 changed files with 13205 additions and 1838 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
| --- | --- | --- |
| [baseline](baseline/README.md) | 早期滑槽、铁球、汇流实验。 | `./scripts/playtest.zsh` |
| [showcase](showcase) | 当前画风固定展示及示例布局。 | `./scripts/showcase.zsh` |
| [materials](materials/README.md) | 三种小球的入洞、同风场与加速对照。 | `./scripts/materials.zsh` |
| [materials](materials/README.md) | 三种小球的入洞与加速对照。 | `./scripts/materials.zsh` |
| [environment](environment/README.md) | 水流 5 m/s、冰块冲击/静置、墙壁与冰面减速对照;长期保留用于三球质量调校。 | `./scripts/environment.zsh` |
| [mass_calibration](mass_calibration/README.md) | Python 浮力/质量计算与 8 秒水流位移候选核验。 | `uv run --offline --no-sync python playtest/mass_calibration/calculate.py` |
| [tutorial](tutorial/README.md) | 等级一五关:直槽/缓坡、转弯、旋转、急缓坡与综合搭建。 | `./scripts/tutorial.zsh` |
File diff suppressed because it is too large Load Diff
@@ -1,6 +1,6 @@
{
"failed": 0,
"passed": 30,
"passed": 28,
"results": [
{
"detail": {
@@ -17,14 +17,14 @@
},
{
"detail": {
"max_speed": 3.55942463874817,
"max_speed": 2.58126783370972,
"position": [
1.98111593723297,
0.624034285545349,
0.00604082643985748
1.9847160577774,
1.17056846618652,
0.0125022642314434
],
"status": "成功入洞 · 2.90 秒",
"time": 2.89999999999999
"status": "成功入洞 · 2.69 秒",
"time": 2.69166666666666
},
"name": "default_course_reaches_hole",
"passed": true
@@ -61,22 +61,12 @@
},
{
"detail": {},
"name": "library_turn_cw",
"name": "library_turn_90",
"passed": true
},
{
"detail": {},
"name": "rotation_cycle_turn_cw",
"passed": true
},
{
"detail": {},
"name": "library_turn_ccw",
"passed": true
},
{
"detail": {},
"name": "rotation_cycle_turn_ccw",
"name": "rotation_cycle_turn_90",
"passed": true
},
{
@@ -0,0 +1,19 @@
{
"assetFamily": "railbound_inspired",
"balls": [],
"entities": [
{
"id": "water",
"kind": "water",
"position": [
0.0,
0.0,
0.0
],
"quarter": 0
}
],
"pieces": [],
"schemaVersion": 2,
"title": "my_level"
}
@@ -0,0 +1,19 @@
{
"assetFamily": "railbound_inspired",
"balls": [],
"entities": [
{
"id": "piece_4309426_3",
"kind": "ice",
"position": [
0.0,
0.0,
0.0
],
"quarter": 1
}
],
"pieces": [],
"schemaVersion": 2,
"title": "my_level"
}
@@ -0,0 +1,19 @@
{
"assetFamily": "railbound_inspired",
"balls": [],
"entities": [
{
"id": "piece_4288175_1",
"kind": "wall",
"position": [
0.0,
0.0,
0.0
],
"quarter": 1
}
],
"pieces": [],
"schemaVersion": 2,
"title": "my_level"
}
@@ -0,0 +1,19 @@
{
"assetFamily": "railbound_inspired",
"balls": [],
"entities": [
{
"id": "piece_4297824_2",
"kind": "water",
"position": [
0.0,
0.0,
0.0
],
"quarter": 1
}
],
"pieces": [],
"schemaVersion": 2,
"title": "my_level"
}
@@ -0,0 +1,24 @@
{
"sourceManifest": {
"files": {
"assets/collections/baseline/source/collection.blend": "2d948b29f8332fa0b8faaa60ce7e92d5bf3b75c05e2dbd17795e63ea35b3d197",
"assets/collections/baseline/catalog.json": "3bbe2a939f3d4542c6c733548ff0e0549db332a30e5c2f09d51fe0aba0faa7a0",
"assets/collections/baseline/physics.json": "b0f2e8fa1637de0ee55c38471be808ccf3e018eaf1c3003e5e16c8b1a8c8de22"
},
"copiedAtUnix": 1794799536.467038,
"readOnlyBaseline": true,
"geometryRevision": "solid_base_v1",
"physicsUpdatedAtUnix": 1794810704.149133
},
"models": [
{
"id": "directional_boost",
"collisionGeometryUnchanged": false,
"vertices": 925,
"separateBlend": "assets/blocks/directional_boost/source/model.blend"
}
],
"radius": 0.3,
"physicalMaterialUnchanged": true,
"outlineGeometry": "visual only"
}
+18 -11
View File
@@ -3,11 +3,12 @@
"files": {
"assets/collections/baseline/source/collection.blend": "2d948b29f8332fa0b8faaa60ce7e92d5bf3b75c05e2dbd17795e63ea35b3d197",
"assets/collections/baseline/catalog.json": "3bbe2a939f3d4542c6c733548ff0e0549db332a30e5c2f09d51fe0aba0faa7a0",
"assets/collections/baseline/physics.json": "b12802f7763c162d037b0795e79272955031162790424831e88c939288f5526e"
"assets/collections/baseline/physics.json": "b0f2e8fa1637de0ee55c38471be808ccf3e018eaf1c3003e5e16c8b1a8c8de22"
},
"copiedAtUnix": 1794799536.467038,
"readOnlyBaseline": true,
"geometryRevision": "solid_base_v1"
"geometryRevision": "solid_base_v1",
"physicsUpdatedAtUnix": 1794810704.149133
},
"models": [
{
@@ -17,16 +18,10 @@
"separateBlend": "assets/chutes/straight/source/model.blend"
},
{
"id": "turn_cw",
"id": "turn_90",
"collisionGeometryUnchanged": true,
"vertices": 1657,
"separateBlend": "assets/chutes/turn_cw/source/model.blend"
},
{
"id": "turn_ccw",
"collisionGeometryUnchanged": true,
"vertices": 1657,
"separateBlend": "assets/chutes/turn_ccw/source/model.blend"
"separateBlend": "assets/chutes/turn_90/source/model.blend"
},
{
"id": "gentle",
@@ -67,8 +62,20 @@
{
"id": "directional_boost",
"collisionGeometryUnchanged": false,
"vertices": 8,
"vertices": 925,
"separateBlend": "assets/blocks/directional_boost/source/model.blend"
},
{
"id": "water",
"collisionGeometryUnchanged": false,
"vertices": 8,
"separateBlend": "assets/blocks/water/source/model.blend"
},
{
"id": "ice",
"collisionGeometryUnchanged": false,
"vertices": 8,
"separateBlend": "assets/blocks/ice/source/model.blend"
}
],
"radius": 0.3,
@@ -0,0 +1,51 @@
{
"assetFamily": "railbound_inspired",
"balls": [
{
"ballTypeId": "wood_ball",
"id": "wood_ball_210846_1",
"launchDirection": [
1.0,
0.0,
0.0
],
"position": [
0.0,
3.5,
0.0
]
},
{
"ballTypeId": "ceramic_ball",
"id": "ceramic_ball_214670_2",
"launchDirection": [
1.0,
0.0,
0.0
],
"position": [
2.0,
3.5,
0.0
]
},
{
"ballTypeId": "iron_ball",
"id": "iron_ball_216944_3",
"launchDirection": [
1.0,
0.0,
0.0
],
"position": [
4.0,
3.5,
0.0
]
}
],
"entities": [],
"pieces": [],
"schemaVersion": 2,
"title": "my_level"
}
@@ -1,6 +1,6 @@
{
"failed": 0,
"passed": 36,
"passed": 68,
"results": [
{
"detail": {
@@ -26,9 +26,9 @@
{
"detail": {
"position": [
0.0999999940395355,
0.0,
3.3199999332428,
0.0999999940395355
0.0
]
},
"name": "mouse_picks_wall_top",
@@ -82,123 +82,178 @@
},
{
"detail": {
"position": [
-0.0499999970197678,
2.0,
0.0
]
"actual": "(0.0, 2.0, 0.0)",
"expected": "(0.0, 2.0, 0.0)"
},
"name": "chute_pick_straight_0",
"name": "chute_midpoint_straight_0_0_0.12",
"passed": true
},
{
"detail": {
"position": [
0.0,
2.0,
-0.0499999970197678
]
"actual": "(0.0, 2.0, 0.0)",
"expected": "(0.0, 2.0, 0.0)"
},
"name": "chute_pick_straight_1",
"name": "chute_midpoint_straight_0_0_0.35",
"passed": true
},
{
"detail": {
"position": [
0.0499999970197678,
2.0,
0.0
]
"actual": "(0.0, 2.0, 0.0)",
"expected": "(0.0, 2.0, 0.0)"
},
"name": "chute_pick_straight_2",
"name": "chute_midpoint_straight_1_0_0.12",
"passed": true
},
{
"detail": {
"position": [
0.0,
2.0,
0.0499999970197678
]
"actual": "(0.0, 2.0, 0.0)",
"expected": "(0.0, 2.0, 0.0)"
},
"name": "chute_pick_straight_3",
"name": "chute_midpoint_straight_1_0_0.35",
"passed": true
},
{
"detail": {
"position": [
-0.179999992251396,
2.0,
0.119999997317791
]
"actual": "(0.0, 2.0, 0.0)",
"expected": "(0.0, 2.0, 0.0)"
},
"name": "chute_pick_turn_90_0",
"name": "chute_midpoint_straight_2_0_0.12",
"passed": true
},
{
"detail": {
"position": [
-0.119999997317791,
2.0,
-0.179999992251396
]
"actual": "(0.0, 2.0, 0.0)",
"expected": "(0.0, 2.0, 0.0)"
},
"name": "chute_pick_turn_90_1",
"name": "chute_midpoint_straight_2_0_0.35",
"passed": true
},
{
"detail": {
"position": [
0.179999992251396,
2.0,
-0.119999997317791
]
"actual": "(0.0, 2.0, 0.0)",
"expected": "(0.0, 2.0, 0.0)"
},
"name": "chute_pick_turn_90_2",
"name": "chute_midpoint_straight_3_0_0.12",
"passed": true
},
{
"detail": {
"position": [
0.119999997317791,
2.0,
0.179999992251396
]
"actual": "(0.0, 2.0, 0.0)",
"expected": "(0.0, 2.0, 0.0)"
},
"name": "chute_pick_turn_90_3",
"name": "chute_midpoint_straight_3_0_0.35",
"passed": true
},
{
"detail": {
"position": [
-0.179999992251396,
1.68999993801117,
0.0
]
"actual": "(-0.15, 2.0, 0.15)",
"expected": "(-0.15, 2.0, 0.15)"
},
"name": "chute_pick_gentle_0",
"name": "chute_midpoint_turn_90_0_0_0.12",
"passed": true
},
{
"detail": {
"position": [
0.0,
1.68999993801117,
-0.179999992251396
]
"actual": "(-0.15, 2.0, 0.15)",
"expected": "(-0.15, 2.0, 0.15)"
},
"name": "chute_pick_gentle_1",
"name": "chute_midpoint_turn_90_0_0_0.35",
"passed": true
},
{
"detail": {
"position": [
0.179999992251396,
1.68999993801117,
0.0
]
"actual": "(-0.15, 2.0, -0.15)",
"expected": "(-0.15, 2.0, -0.15)"
},
"name": "chute_pick_gentle_2",
"name": "chute_midpoint_turn_90_1_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(-0.15, 2.0, -0.15)",
"expected": "(-0.15, 2.0, -0.15)"
},
"name": "chute_midpoint_turn_90_1_0_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.15, 2.0, -0.15)",
"expected": "(0.15, 2.0, -0.15)"
},
"name": "chute_midpoint_turn_90_2_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.15, 2.0, -0.15)",
"expected": "(0.15, 2.0, -0.15)"
},
"name": "chute_midpoint_turn_90_2_0_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.15, 2.0, 0.15)",
"expected": "(0.15, 2.0, 0.15)"
},
"name": "chute_midpoint_turn_90_3_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.15, 2.0, 0.15)",
"expected": "(0.15, 2.0, 0.15)"
},
"name": "chute_midpoint_turn_90_3_0_0.35",
"passed": true
},
{
"detail": {
"actual": "(-0.13, 1.72, 0.0)",
"expected": "(-0.13, 1.72, 0.0)"
},
"name": "chute_midpoint_gentle_0_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(-0.13, 1.72, 0.0)",
"expected": "(-0.13, 1.72, 0.0)"
},
"name": "chute_midpoint_gentle_0_0_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.0, 1.72, -0.13)",
"expected": "(0.0, 1.72, -0.13)"
},
"name": "chute_midpoint_gentle_1_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.0, 1.72, -0.13)",
"expected": "(0.0, 1.72, -0.13)"
},
"name": "chute_midpoint_gentle_1_0_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.13, 1.72, 0.0)",
"expected": "(0.13, 1.72, 0.0)"
},
"name": "chute_midpoint_gentle_2_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.13, 1.72, 0.0)",
"expected": "(0.13, 1.72, 0.0)"
},
"name": "chute_midpoint_gentle_2_0_0.35",
"passed": true
},
{
@@ -213,108 +268,245 @@
},
{
"detail": {
"position": [
0.0,
1.68999993801117,
0.179999992251396
]
"actual": "(0.0, 1.72, 0.13)",
"expected": "(0.0, 1.72, 0.13)"
},
"name": "chute_pick_gentle_3",
"name": "chute_midpoint_gentle_3_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.0, 1.72, 0.13)",
"expected": "(0.0, 1.72, 0.13)"
},
"name": "chute_midpoint_gentle_3_0_0.35",
"passed": true
},
{
"detail": {
"actual": "(-0.21, 1.91, 0.0)",
"expected": "(-0.21, 1.91, 0.0)"
},
"name": "chute_midpoint_steep_0_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(-0.21, 1.91, 0.0)",
"expected": "(-0.21, 1.91, 0.0)"
},
"name": "chute_midpoint_steep_0_0_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.0, 1.91, -0.21)",
"expected": "(0.0, 1.91, -0.21)"
},
"name": "chute_midpoint_steep_1_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.0, 1.91, -0.21)",
"expected": "(0.0, 1.91, -0.21)"
},
"name": "chute_midpoint_steep_1_0_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.21, 1.91, 0.0)",
"expected": "(0.21, 1.91, 0.0)"
},
"name": "chute_midpoint_steep_2_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.21, 1.91, 0.0)",
"expected": "(0.21, 1.91, 0.0)"
},
"name": "chute_midpoint_steep_2_0_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.0, 1.91, 0.21)",
"expected": "(0.0, 1.91, 0.21)"
},
"name": "chute_midpoint_steep_3_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.0, 1.91, 0.21)",
"expected": "(0.0, 1.91, 0.21)"
},
"name": "chute_midpoint_steep_3_0_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.5, 2.0, 1.0)",
"expected": "(0.5, 2.0, 1.0)"
},
"name": "chute_midpoint_y_merge_0_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.5, 2.0, 1.0)",
"expected": "(0.5, 2.0, 1.0)"
},
"name": "chute_midpoint_y_merge_0_0_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.5, 2.0, 0.5)",
"expected": "(0.5, 2.0, 0.5)"
},
"name": "chute_midpoint_y_merge_0_1_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.5, 2.0, 0.5)",
"expected": "(0.5, 2.0, 0.5)"
},
"name": "chute_midpoint_y_merge_0_1_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.0, 2.0, 0.5)",
"expected": "(0.0, 2.0, 0.5)"
},
"name": "chute_midpoint_y_merge_1_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.0, 2.0, 0.5)",
"expected": "(0.0, 2.0, 0.5)"
},
"name": "chute_midpoint_y_merge_1_0_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.5, 2.0, 0.5)",
"expected": "(0.5, 2.0, 0.5)"
},
"name": "chute_midpoint_y_merge_1_1_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.5, 2.0, 0.5)",
"expected": "(0.5, 2.0, 0.5)"
},
"name": "chute_midpoint_y_merge_1_1_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.5, 2.0, 0.0)",
"expected": "(0.5, 2.0, 0.0)"
},
"name": "chute_midpoint_y_merge_2_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.5, 2.0, 0.0)",
"expected": "(0.5, 2.0, 0.0)"
},
"name": "chute_midpoint_y_merge_2_0_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.5, 2.0, 0.5)",
"expected": "(0.5, 2.0, 0.5)"
},
"name": "chute_midpoint_y_merge_2_1_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.5, 2.0, 0.5)",
"expected": "(0.5, 2.0, 0.5)"
},
"name": "chute_midpoint_y_merge_2_1_0.35",
"passed": true
},
{
"detail": {
"actual": "(1.0, 2.0, 0.5)",
"expected": "(1.0, 2.0, 0.5)"
},
"name": "chute_midpoint_y_merge_3_0_0.12",
"passed": true
},
{
"detail": {
"actual": "(1.0, 2.0, 0.5)",
"expected": "(1.0, 2.0, 0.5)"
},
"name": "chute_midpoint_y_merge_3_0_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.5, 2.0, 0.5)",
"expected": "(0.5, 2.0, 0.5)"
},
"name": "chute_midpoint_y_merge_3_1_0.12",
"passed": true
},
{
"detail": {
"actual": "(0.5, 2.0, 0.5)",
"expected": "(0.5, 2.0, 0.5)"
},
"name": "chute_midpoint_y_merge_3_1_0.35",
"passed": true
},
{
"detail": {
"actual": "(0.0, 2.32, 0.0)"
},
"name": "entity_top_center_directional_boost",
"passed": true
},
{
"detail": {
"actual": "(0.0, 2.32, 0.0)"
},
"name": "entity_top_center_water",
"passed": true
},
{
"detail": {
"actual": "(0.0, 2.32, 0.0)"
},
"name": "entity_top_center_ice",
"passed": true
},
{
"detail": {
"actual": "(0.0, 1.32, 0.0)"
},
"name": "entity_top_center_goal_hole",
"passed": true
},
{
"detail": {
"position": [
0.109999999403954,
2.23000001907349,
0.0
]
},
"name": "chute_pick_steep_0",
"passed": true
},
{
"detail": {
"position": [
0.0,
2.23000001907349,
0.109999999403954
]
},
"name": "chute_pick_steep_1",
"passed": true
},
{
"detail": {
"position": [
-0.109999999403954,
2.23000001907349,
0.0
]
},
"name": "chute_pick_steep_2",
"passed": true
},
{
"detail": {
"position": [
0.0,
2.23000001907349,
-0.109999999403954
]
},
"name": "chute_pick_steep_3",
"passed": true
},
{
"detail": {
"position": [
0.399999976158142,
2.0,
1.0
]
},
"name": "chute_pick_y_merge_0",
"passed": true
},
{
"detail": {
"position": [
0.0,
2.0,
0.399999976158142
]
},
"name": "chute_pick_y_merge_1",
"passed": true
},
{
"detail": {
"position": [
0.599999964237213,
2.0,
0.0
]
},
"name": "chute_pick_y_merge_2",
"passed": true
},
{
"detail": {
"position": [
1.0,
2.0,
0.599999964237213
]
},
"name": "chute_pick_y_merge_3",
"passed": true
},
{
"detail": {
"position": [
0.159999996423721,
2.28999996185303,
-0.209999993443489,
1.9099999666214,
0.0
]
},
@@ -0,0 +1,85 @@
{
"engine": "Godot 4.7.2 / Jolt",
"physics_hz": 120,
"gravity_mps2": 9.81,
"ball_type": "iron_ball",
"fixture": "Reconstructed workshop: launcher (-3,2,1), straight (-2,2.32,1), gentle (-1,2.32,1), gentle (0,1.82,1), goal rim (1,2,1), wall under goal. Ball starts at (-3,3.32,1+offset).",
"comparison": {
"gain_5_mps": [
{
"lateral_offset_m": 0.0,
"slope_entry_vx_mps": 3.729923,
"track_exit_vx_mps": 4.223332,
"scored": false
},
{
"lateral_offset_m": -0.05,
"slope_entry_vx_mps": 2.656222,
"track_exit_vx_mps": 3.919585,
"scored": false
},
{
"lateral_offset_m": 0.05,
"slope_entry_vx_mps": 2.645796,
"track_exit_vx_mps": 3.910903,
"scored": false
}
],
"gain_3_mps": [
{
"lateral_offset_m": 0.0,
"slope_entry_vx_mps": 2.042475,
"track_exit_vx_mps": 3.650388,
"scored": false
},
{
"lateral_offset_m": -0.05,
"slope_entry_vx_mps": 1.650456,
"track_exit_vx_mps": 3.509175,
"scored": true
},
{
"lateral_offset_m": 0.05,
"slope_entry_vx_mps": 1.640918,
"track_exit_vx_mps": 3.48999,
"scored": true
}
]
},
"gain_3_mps_repeats": {
"settling_physics_frames": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14
],
"results": [
{
"lateral_offset_m": 0,
"scored": 2,
"runs": 10
},
{
"lateral_offset_m": -0.05,
"scored": 8,
"runs": 10
},
{
"lateral_offset_m": 0.05,
"scored": 8,
"runs": 10
}
]
},
"existing_answers": {
"basic_tutorial": "5/5",
"ice": "5/5",
"water": "3/5 acceptance checks passed. Water 4 scored both balls; wood southward travel was 0.996 m (required >1 m). Water 5 scored only iron; wood touched the third low-bridge tile."
}
}
+12 -7
View File
@@ -1,6 +1,6 @@
{
"failed": 0,
"passed": 67,
"passed": 68,
"results": [
{
"detail": {},
@@ -12,6 +12,11 @@
"name": "editor_has_fixed_gain_label_and_no_speed_input",
"passed": true
},
{
"detail": {},
"name": "standalone_preview_has_guide_and_arrow",
"passed": true
},
{
"detail": {},
"name": "gui_places_boost_without_gain_override",
@@ -19,7 +24,7 @@
},
{
"detail": {},
"name": "boost_retains_solid_wall_bounds",
"name": "boost_includes_permanent_guide_bounds",
"passed": true
},
{
@@ -121,7 +126,7 @@
"detail": {
"after": "(-0.0, -0.08175, 5.0)",
"before": "(0.0, -0.08175, 0.0)",
"blockId": "piece_247642_2",
"blockId": "piece_351506_2",
"tick": 45
},
"name": "authored_start_ball_receives_rotated_boost",
@@ -370,7 +375,7 @@
{
"detail": {
"events": 1,
"position": "(-0.098283, 1.30001, 0.0)"
"position": "(0.189901, 1.300151, 0.00048)"
},
"name": "continuous_contact_does_not_repeat",
"passed": true
@@ -440,10 +445,10 @@
"tick": 796
},
{
"after": "(9.528823, -0.0, 0.0)",
"before": "(4.528823, -0.0, 0.0)",
"after": "(9.440056, 0.072312, 0.0)",
"before": "(4.440056, 0.072312, -0.001111)",
"blockId": "second",
"tick": 813
"tick": 814
}
]
},
@@ -0,0 +1,533 @@
{
"engine": "Godot 4.7.2 Jolt",
"physics_hz": 120,
"gravity_mps2": 9.81,
"boost_gain_mps": 5,
"route": "Workshop reconstruction, launch -> straight -> gentle -> gentle -> supported goal. Positions are model origins in metres.",
"pieces": [
[
-3,
2,
1
],
[
-2,
2.32,
1
],
[
-1,
2.32,
1
],
[
0,
1.82,
1
],
[
1,
2,
1
]
],
"ball": "iron_ball",
"spawn_xyz": [
-3,
3.32,
1
],
"lateral_offsets_m": [
0,
-0.05,
0.05
],
"settle_frames_each": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14
],
"measurements": "Horizontal velocity along +X on the first tick crossing x=-1.5 and x=0.5. One ball released from rest per run.",
"method": "Only chute contact pairs were assigned in memory before each scene entered the tree. All 15 standard layouts were built by simulated player input. The tutorial outcome was checked for up to 3600 physics frames; element series additionally ran their existing mechanic, contrast and repeat checks.",
"conditions": [
{
"name": "current",
"static_friction": 0.52,
"dynamic_friction": 0.4,
"rolling_resistance": 0.035,
"slope": [
{
"offset_m": 0,
"scored": 0,
"trials": 10,
"mean_exit_vx_mps": 4.2858
},
{
"offset_m": -0.05,
"scored": 5,
"trials": 10,
"mean_exit_vx_mps": 3.8811
},
{
"offset_m": 0.05,
"scored": 5,
"trials": 10,
"mean_exit_vx_mps": 3.8846
}
],
"tutorial": [
{
"all_tiles_contacted": true,
"final_position": "(2.991658, 3.314173, -0.007785)",
"final_speed": 2.95547866821289,
"goals": 1,
"number": 1,
"won": true
},
{
"all_tiles_contacted": true,
"final_position": "(-0.011518, 3.322182, 2.984367)",
"final_speed": 2.30634355545044,
"goals": 1,
"number": 2,
"won": true
},
{
"all_tiles_contacted": true,
"final_position": "(1.997693, 3.322639, -1.997168)",
"final_speed": 1.82185578346252,
"goals": 1,
"number": 3,
"won": true
},
{
"all_tiles_contacted": true,
"final_position": "(4.980642, 3.326633, 0.000458)",
"final_speed": 2.23038792610168,
"goals": 1,
"number": 4,
"won": true
},
{
"all_tiles_contacted": true,
"final_position": "(5.008936, 2.824461, 0.017642)",
"final_speed": 1.0439840555191,
"goals": 1,
"number": 5,
"won": true
}
],
"element_levels": [
{
"scene": "res://playtest/water/scenes/01.tscn",
"won": true,
"scored": [
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/water/scenes/02.tscn",
"won": true,
"scored": [
"iron"
],
"validation_errors": []
},
{
"scene": "res://playtest/water/scenes/03.tscn",
"won": true,
"scored": [
"iron",
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/water/scenes/04.tscn",
"won": true,
"scored": [
"iron",
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/water/scenes/05.tscn",
"won": true,
"scored": [
"iron",
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/ice/scenes/01.tscn",
"won": true,
"scored": [
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/ice/scenes/02.tscn",
"won": true,
"scored": [
"iron"
],
"validation_errors": []
},
{
"scene": "res://playtest/ice/scenes/03.tscn",
"won": true,
"scored": [
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/ice/scenes/04.tscn",
"won": true,
"scored": [
"iron",
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/ice/scenes/05.tscn",
"won": true,
"scored": [
"iron",
"wood"
],
"validation_errors": []
}
],
"standard_solutions_won": 15,
"element_acceptance_passed": 10
},
{
"name": "slide",
"static_friction": 1.0,
"dynamic_friction": 1.0,
"rolling_resistance": 0.035,
"slope": [
{
"offset_m": 0,
"scored": 0,
"trials": 10,
"mean_exit_vx_mps": 4.2999
},
{
"offset_m": -0.05,
"scored": 0,
"trials": 10,
"mean_exit_vx_mps": 3.8859
},
{
"offset_m": 0.05,
"scored": 0,
"trials": 10,
"mean_exit_vx_mps": 3.8725
}
],
"tutorial": [
{
"all_tiles_contacted": true,
"final_position": "(3.007763, 3.328145, 0.018029)",
"final_speed": 1.45721960067749,
"goals": 1,
"number": 1,
"won": true
},
{
"all_tiles_contacted": true,
"final_position": "(-0.015006, 3.31916, 2.992017)",
"final_speed": 2.59988713264465,
"goals": 1,
"number": 2,
"won": true
},
{
"all_tiles_contacted": true,
"final_position": "(1.987617, 3.324002, -1.984607)",
"final_speed": 1.47034776210785,
"goals": 1,
"number": 3,
"won": true
},
{
"all_tiles_contacted": true,
"final_position": "(4.995434, 3.321675, 0.011485)",
"final_speed": 2.78647184371948,
"goals": 1,
"number": 4,
"won": true
},
{
"all_tiles_contacted": true,
"final_position": "(4.980324, 2.822735, -0.00203)",
"final_speed": 1.30365455150604,
"goals": 1,
"number": 5,
"won": true
}
],
"element_levels": [
{
"scene": "res://playtest/water/scenes/01.tscn",
"won": true,
"scored": [
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/water/scenes/02.tscn",
"won": true,
"scored": [
"iron"
],
"validation_errors": []
},
{
"scene": "res://playtest/water/scenes/03.tscn",
"won": true,
"scored": [
"iron",
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/water/scenes/04.tscn",
"won": true,
"scored": [
"iron",
"wood"
],
"validation_errors": [
"Upper route should save wood alone and leave iron submerged"
]
},
{
"scene": "res://playtest/water/scenes/05.tscn",
"won": true,
"scored": [
"iron",
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/ice/scenes/01.tscn",
"won": true,
"scored": [
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/ice/scenes/02.tscn",
"won": true,
"scored": [
"iron"
],
"validation_errors": []
},
{
"scene": "res://playtest/ice/scenes/03.tscn",
"won": true,
"scored": [
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/ice/scenes/04.tscn",
"won": true,
"scored": [
"iron",
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/ice/scenes/05.tscn",
"won": true,
"scored": [
"iron",
"wood"
],
"validation_errors": []
}
],
"standard_solutions_won": 15,
"element_acceptance_passed": 9
},
{
"name": "roll",
"static_friction": 0.52,
"dynamic_friction": 0.4,
"rolling_resistance": 1.0,
"slope": [
{
"offset_m": 0,
"scored": 10,
"trials": 10,
"mean_exit_vx_mps": 3.7925
},
{
"offset_m": -0.05,
"scored": 10,
"trials": 10,
"mean_exit_vx_mps": 2.429
},
{
"offset_m": 0.05,
"scored": 10,
"trials": 10,
"mean_exit_vx_mps": 2.4296
}
],
"tutorial": [
{
"all_tiles_contacted": true,
"final_position": "(1.503046, 3.980306, -0.000324)",
"final_speed": 0.000364574079867452,
"goals": 0,
"number": 1,
"won": false
},
{
"all_tiles_contacted": true,
"final_position": "(0.000217, 3.980318, 0.509666)",
"final_speed": 0.000156402209540829,
"goals": 0,
"number": 2,
"won": false
},
{
"all_tiles_contacted": false,
"final_position": "(-0.000292, 3.980304, -0.571028)",
"final_speed": 0.000303185224765912,
"goals": 0,
"number": 3,
"won": false
},
{
"all_tiles_contacted": true,
"final_position": "(3.488595, 3.980289, -0.000611)",
"final_speed": 0.00023356603924185,
"goals": 0,
"number": 4,
"won": false
},
{
"all_tiles_contacted": false,
"final_position": "(0.000326, 4.980325, -0.51075)",
"final_speed": 2.70238833763869e-05,
"goals": 0,
"number": 5,
"won": false
}
],
"element_levels": [
{
"scene": "res://playtest/water/scenes/01.tscn",
"won": true,
"scored": [
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/water/scenes/02.tscn",
"won": true,
"scored": [
"iron"
],
"validation_errors": []
},
{
"scene": "res://playtest/water/scenes/03.tscn",
"won": true,
"scored": [
"iron",
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/water/scenes/04.tscn",
"won": false,
"scored": [],
"validation_errors": [
"Answer did not get every ball into a hole"
]
},
{
"scene": "res://playtest/water/scenes/05.tscn",
"won": false,
"scored": [],
"validation_errors": [
"Answer did not get every ball into a hole"
]
},
{
"scene": "res://playtest/ice/scenes/01.tscn",
"won": true,
"scored": [
"wood"
],
"validation_errors": []
},
{
"scene": "res://playtest/ice/scenes/02.tscn",
"won": false,
"scored": [],
"validation_errors": [
"Answer did not get every ball into a hole",
"Missing iron break or later passage of wood through that gate"
]
},
{
"scene": "res://playtest/ice/scenes/03.tscn",
"won": false,
"scored": [],
"validation_errors": [
"Answer did not get every ball into a hole"
]
},
{
"scene": "res://playtest/ice/scenes/04.tscn",
"won": false,
"scored": [],
"validation_errors": [
"Answer did not get every ball into a hole",
"Missing iron break or later passage of wood through that gate"
]
},
{
"scene": "res://playtest/ice/scenes/05.tscn",
"won": false,
"scored": [],
"validation_errors": [
"Answer did not get every ball into a hole",
"Missing iron break or later passage of wood through that gate"
]
}
],
"standard_solutions_won": 4,
"element_acceptance_passed": 4
}
]
}
@@ -0,0 +1,155 @@
{
"engine": "Godot 4.7.2 Jolt",
"physics_hz": 120,
"gravity_mps2": 9.81,
"boost_gain_mps": 5,
"route": "Workshop reconstruction, launch -> straight -> gentle -> gentle -> supported goal. Positions are model origins in metres.",
"pieces": [
[
-3,
2,
1
],
[
-2,
2.32,
1
],
[
-1,
2.32,
1
],
[
0,
1.82,
1
],
[
1,
2,
1
]
],
"ball": "iron_ball",
"spawn_xyz": [
-3,
3.32,
1
],
"lateral_offsets_m": [
0,
-0.05,
0.05
],
"settle_frames_each": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14
],
"measurements": "Horizontal velocity along +X on the first tick crossing x=-1.5 and x=0.5. One ball released from rest per run.",
"conditions": [
{
"name": "original",
"static_friction": 0.42,
"dynamic_friction": 0.32,
"rolling_resistance": 0.025,
"restitution": 0.08,
"positions": [
{
"offset_m": 0,
"scores": 0,
"runs": 10,
"mean_slope_entry_vx_mps": 3.7292,
"mean_exit_vx_mps": 4.2318
},
{
"offset_m": -0.05,
"scores": 0,
"runs": 10,
"mean_slope_entry_vx_mps": 2.6574,
"mean_exit_vx_mps": 3.9196
},
{
"offset_m": 0.05,
"scores": 0,
"runs": 10,
"mean_slope_entry_vx_mps": 2.6598,
"mean_exit_vx_mps": 3.9196
}
]
},
{
"name": "sliding_friction_only",
"static_friction": 0.52,
"dynamic_friction": 0.4,
"rolling_resistance": 0.025,
"restitution": 0.08,
"positions": [
{
"offset_m": 0,
"scores": 0,
"runs": 10,
"mean_slope_entry_vx_mps": 3.5249,
"mean_exit_vx_mps": 4.3092
},
{
"offset_m": -0.05,
"scores": 0,
"runs": 10,
"mean_slope_entry_vx_mps": 2.6539,
"mean_exit_vx_mps": 3.9193
},
{
"offset_m": 0.05,
"scores": 0,
"runs": 10,
"mean_slope_entry_vx_mps": 2.6624,
"mean_exit_vx_mps": 3.9187
}
]
},
{
"name": "installed",
"static_friction": 0.52,
"dynamic_friction": 0.4,
"rolling_resistance": 0.035,
"restitution": 0.08,
"positions": [
{
"offset_m": 0,
"scores": 0,
"runs": 10,
"mean_slope_entry_vx_mps": 3.5249,
"mean_exit_vx_mps": 4.2868
},
{
"offset_m": -0.05,
"scores": 3,
"runs": 10,
"mean_slope_entry_vx_mps": 2.6403,
"mean_exit_vx_mps": 3.8827
},
{
"offset_m": 0.05,
"scores": 3,
"runs": 10,
"mean_slope_entry_vx_mps": 2.6473,
"mean_exit_vx_mps": 3.8843
}
]
}
],
"installed_checks": {
"tutorial_lessons": 5,
"element_puzzles": "10/10",
"water05_shared_bridge_runs": 20
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 KiB

After

Width:  |  Height:  |  Size: 248 KiB

@@ -0,0 +1,64 @@
{
"assetFamily": "railbound_inspired",
"balls": [
{
"ballTypeId": "wood_ball",
"id": "keep_ball",
"launchDirection": [
1.0,
0.0,
0.0
],
"position": [
4.0,
3.0,
0.0
]
}
],
"entities": [
{
"id": "wall",
"kind": "wall",
"position": [
0.0,
0.0,
0.0
],
"quarter": 0
},
{
"id": "goal",
"kind": "goal_hole",
"position": [
2.0,
1.0,
0.0
],
"quarter": 0
},
{
"id": "water",
"kind": "water",
"position": [
-2.0,
0.0,
0.0
],
"quarter": 0
},
{
"id": "ice",
"kind": "ice",
"position": [
0.0,
0.0,
2.0
],
"quarter": 0
}
],
"pieces": [],
"schemaVersion": 2,
"title": "my_level"
}
@@ -0,0 +1,266 @@
"""Blender-only authoring of a separate Railbound-inspired asset family.
Copies a stable source once; never writes to the baseline assets. To adopt a
later baseline, remove only this family's source_snapshot files explicitly.
"""
import bpy
import bmesh
import hashlib
import json
import math
import shutil
import time
import runpy
from pathlib import Path
from mathutils import Vector
ROOT = Path(__file__).resolve().parents[4]
SOURCE = Path(__file__).resolve().parent
SNAPSHOT = SOURCE / 'snapshot'
SNAPSHOT.mkdir(parents=True, exist_ok=True)
ONLY_ASSET = globals().get('ONLY_ASSET')
REPORTS = ROOT / 'playtest/artifacts/styled'
REPORTS.mkdir(parents=True, exist_ok=True)
OUT = SOURCE.parent
SOURCE.mkdir(parents=True, exist_ok=True)
snapshot = SNAPSHOT / 'source_snapshot.blend'
inputs = [ROOT/'assets/collections/baseline/source/collection.blend',
ROOT/'assets/collections/baseline/catalog.json', ROOT/'assets/collections/baseline/physics.json']
def digest(path):
return hashlib.sha256(path.read_bytes()).hexdigest()
if not snapshot.exists():
before = [digest(p) for p in inputs]
time.sleep(3)
if before != [digest(p) for p in inputs]:
raise RuntimeError('Baseline is changing. Wait for its current build, then retry.')
copies = [snapshot, SNAPSHOT/'source_catalog.json', SNAPSHOT/'source_physics.json']
for src, dst in zip(inputs, copies):
shutil.copy2(src, dst)
if before != [digest(p) for p in inputs] or before != [digest(p) for p in copies]:
for p in copies: p.unlink(missing_ok=True)
raise RuntimeError('Baseline changed during copy. No snapshot was retained.')
(SNAPSHOT/'source_manifest.json').write_text(json.dumps({
'files': {str(p.relative_to(ROOT)): h for p,h in zip(inputs,before)},
'copiedAtUnix': time.time(), 'readOnlyBaseline': True}, indent=2))
bpy.ops.wm.open_mainfile(filepath=str(snapshot))
bpy.context.preferences.filepaths.save_version=0
catalog = json.loads((SNAPSHOT/'source_catalog.json').read_text())
physics = json.loads((SNAPSHOT/'source_physics.json').read_text())
palette = {'body':'B98A56', 'top':'E9C88B', 'groove':'FFF0C5',
'ink':'342E38', 'iron':'788A9E', 'iron_light':'C6DFE5',
'red':'CB6652', 'green':'799361'}
def mat(name, color, metallic=0.0, roughness=.85):
m = bpy.data.materials.new('Storybook / '+name)
rgba = tuple(int(color[i:i+2],16)/255 for i in (0,2,4))+(1,)
# Hex palette is sRGB; Blender's material values are linear.
rgba = tuple(((v+.055)/1.055)**2.4 if v>.04045 else v/12.92 for v in rgba[:3])+(1,)
m.diffuse_color = rgba
m.use_nodes = True
bsdf = m.node_tree.nodes.get('Principled BSDF')
bsdf.inputs['Base Color'].default_value = rgba
bsdf.inputs['Metallic'].default_value = metallic
bsdf.inputs['Roughness'].default_value = roughness
return m
mats={k:mat(k,v) for k,v in palette.items()}
mats['iron']=mat('iron satin','788A9E',.35,.5)
mats['wall']=mat('wall stone','A29E8B')
mats['wall_top']=mat('wall stone top','D8D3B4')
def mesh_object(name,vertices,faces):
mesh=bpy.data.meshes.new(name)
mesh.from_pydata(vertices,[],faces);mesh.update()
bm=bmesh.new();bm.from_mesh(mesh)
bmesh.ops.recalc_face_normals(bm,faces=bm.faces);bm.to_mesh(mesh);bm.free()
obj=bpy.data.objects.new(name,mesh);bpy.context.collection.objects.link(obj)
return obj
def build_funnel():
bpy.data.objects.remove(bpy.data.objects['goal_hole'],do_unlink=True)
# A closed shell with a wide conical entrance and a true narrow outlet.
profile=[(.46,0),(.32,-.35),(.32,-1),(.36,-1),(.50,0)]
sides=96
vertices=[(radius*math.cos(i*math.tau/sides),radius*math.sin(i*math.tau/sides),z)
for radius,z in profile for i in range(sides)]
faces=[]
for ring in range(len(profile)):
next_ring=(ring+1)%len(profile)
for i in range(sides):
j=(i+1)%sides
faces.append((ring*sides+i,ring*sides+j,next_ring*sides+j,next_ring*sides+i))
return mesh_object('goal_hole',vertices,faces)
def build_wall(name='wall'):
vertices=[(x,y,z) for z in (0,1) for y in (-.5,.5) for x in (-.5,.5)]
faces=[(0,2,3,1),(4,5,7,6),(0,1,5,4),(2,6,7,3),(0,4,6,2),(1,3,7,5)]
return mesh_object(name,vertices,faces)
build_funnel();build_wall();build_wall('directional_boost')
catalog['models']['wall']={'role':'solid','category':'nonInteractive','collisionShape':'box',
'cellFootprint':[1,1],'boundsBlender':{'min':[-.5,-.5,0],'max':[.5,.5,1],'size':[1,1,1]},
'declaredSize':[1,1,1],'geometryOrigin':'authored'}
catalog['models']['directional_boost']={'role':'boost','category':'interactive','collisionShape':'box',
'cellFootprint':[1,1],'boundsBlender':{'min':[-.5,-.5,0],'max':[.5,.5,1],'size':[1,1,1]},
'declaredSize':[1,1,1],'geometryOrigin':'authored','arrowDirectionGodot':[1,0,0]}
catalog['models']['goal_hole']={'role':'goal','category':'nonInteractive','openingRadius':.32,
'entranceRadius':.46,'funnelDepth':.35,'depth':1.0,'cellFootprint':[1,1],
'boundsBlender':{'min':[-.5,-.5,-1],'max':[.5,.5,0],'size':[1,1,1]},
'declaredSize':[1,1,1],'geometryOrigin':'authored'}
def export(objects, path):
if globals().get('EXPORT_KINDS') is not None and objects[0].name not in EXPORT_KINDS:
return
bpy.ops.object.select_all(action='DESELECT')
for obj in objects: obj.select_set(True)
bpy.context.view_layer.objects.active=objects[0]
path.parent.mkdir(parents=True,exist_ok=True)
bpy.ops.export_scene.gltf(filepath=str(path),export_format='GLB',
use_selection=True,export_yup=True,export_extras=True,export_apply=True)
def lines(name, segments, radius=.012):
curve=bpy.data.curves.new('ink_'+name,'CURVE')
curve.dimensions='3D'; curve.bevel_depth=radius; curve.bevel_resolution=0
curve.resolution_u=1
for points in segments:
spline=curve.splines.new('POLY'); spline.points.add(len(points)-1)
for point, value in zip(spline.points,points):point.co=(*value,1)
obj=bpy.data.objects.new('ink_'+name,curve)
bpy.context.collection.objects.link(obj); obj.data.materials.append(mats['ink'])
obj['visual_only']=True
return obj
def outline(obj):
bm=bmesh.new();bm.from_mesh(obj.data);bm.normal_update()
segments=[]
for edge in bm.edges:
if len(edge.link_faces)!=2 or edge.calc_face_angle(0)>math.radians(36):
segments.append([tuple(v.co) for v in edge.verts])
bm.free()
return lines(obj.name,segments)
def boost_arrow():
# Flat authored graphic above the top face; excluded from collision like ink outlines.
points=[(-.34,-.12),(.04,-.12),(.04,-.28),(.36,0),(.04,.28),(.04,.12),(-.34,.12)]
result=[]
for suffix,scale,z,color in [('border',1,1.002,'ink'),('fill',.82,1.003,'red')]:
arrow=mesh_object('ink_boost_arrow_'+suffix,[(x*scale,y*scale,z) for x,y in points],[tuple(range(7))])
arrow.data.materials.append(mats[color]);arrow['visual_only']=True
result.append(arrow)
return result
def asset_dir(kind):
category = 'balls' if kind == 'iron_ball' else 'goals' if kind == 'goal_hole' else 'blocks' if kind in ('wall','directional_boost') else 'chutes'
return ROOT / 'assets' / category / kind
snapshot_turn='turn_90' if 'turn_90' in bpy.data.objects else 'turn_cw'
catalog['models']['turn_90']=dict(catalog['models'][snapshot_turn], geometrySource=snapshot_turn)
# Retire duplicate objects only in this working scene; never rewrite the snapshot.
for legacy in ('turn_cw','turn_ccw'):
if legacy!=snapshot_turn and legacy in bpy.data.objects:
bpy.data.objects.remove(bpy.data.objects[legacy],do_unlink=True)
kinds=['straight','turn_90','gentle','steep','y_merge']
groups=[];report=[]
all_kinds=kinds+['iron_ball','goal_hole','wall','directional_boost']
if ONLY_ASSET is not None and ONLY_ASSET not in all_kinds:raise ValueError(ONLY_ASSET)
for kind in ([ONLY_ASSET] if ONLY_ASSET else all_kinds):
obj=bpy.data.objects[snapshot_turn if kind=='turn_90' else kind]
if kind=='turn_90':
obj.name=kind
obj['asset_id']=kind
obj.location=(0,0,0)
obj.data=obj.data.copy()
before_coords=[tuple(v.co) for v in obj.data.vertices]
old_indices=[p.material_index for p in obj.data.polygons]
obj.data.materials.clear()
if kind in kinds:
for key in ['body','groove','top']:obj.data.materials.append(mats[key])
for face,old in zip(obj.data.polygons,old_indices):
face.material_index=1 if old==1 else (2 if face.normal.z>.55 else 0)
group=[obj,outline(obj)]
category='chutes'
elif kind=='iron_ball':
# A continuous satin sphere: the snapshot's orientation stripe and the
# former face-painted highlight read as cracks/patches during rotation.
# Let the scene lighting produce the highlight on smooth normals instead.
obj.data.materials.append(mats['iron'])
for face in obj.data.polygons:
face.material_index=0
face.use_smooth=True
group=[obj]
category='balls'
elif kind=='goal_hole':
obj.data.materials.append(mats['red'])
obj.data.materials.append(mats['top'])
obj.data.materials.append(mats['ink'])
for face in obj.data.polygons:
face.material_index=1 if face.index<96 else (2 if face.index<192 else 0)
face.use_smooth=face.index<192
group=[obj,outline(obj)]
category='environment'
else:
obj.data.materials.append(mats['wall']);obj.data.materials.append(mats['wall_top'])
for face in obj.data.polygons:face.material_index=1 if face.normal.z>.5 else 0
group=[obj,outline(obj)]
if kind=='directional_boost':group+=boost_arrow()
category='entities'
obj['style_family']='railbound_inspired'
obj['collision_source']='authored mesh' if kind in ('wall','goal_hole','directional_boost') else 'unchanged source mesh'
export(group,asset_dir(kind)/'model.glb')
catalog['models'][kind]['path']='res://'+str((asset_dir(kind)/'model.glb').relative_to(ROOT))
catalog['models'][kind]['sourceBlend']=str((asset_dir(kind)/'source/model.blend').relative_to(ROOT))
for member in group:
if member.type=='CURVE':
bpy.ops.object.select_all(action='DESELECT');member.select_set(True)
bpy.context.view_layer.objects.active=member
bpy.ops.object.convert(target='MESH')
source_path=asset_dir(kind)/'source/model.blend'
source_path.parent.mkdir(parents=True,exist_ok=True)
# A separate editable source file contains only one asset family member.
report.append({'id':kind,'collisionGeometryUnchanged':kind not in ('wall','goal_hole','directional_boost') and before_coords==[tuple(v.co) for v in obj.data.vertices],
'vertices':len(obj.data.vertices),'separateBlend':str(source_path.relative_to(ROOT))})
groups.append(group)
if ONLY_ASSET:
existing=json.loads((OUT/'catalog.json').read_text())
for legacy in ('turn_cw','turn_ccw'):existing['models'].pop(legacy,None)
existing['models'][ONLY_ASSET]=catalog['models'][ONLY_ASSET]
catalog=existing
else:
catalog['models']={k:catalog['models'][k] for k in all_kinds}
catalog['styleFamily']='railbound_inspired'
catalog['palette']=palette
(OUT/'catalog.json').write_text(json.dumps(catalog,ensure_ascii=False,indent=2))
if not ONLY_ASSET:
# Geometry rebuilds must not overwrite curated ball types or physics tuning.
if not (OUT/'physics.json').exists():
(OUT/'physics.json').write_text(json.dumps(physics,ensure_ascii=False,indent=2))
(OUT/'entities.json').write_text(json.dumps({'interactive':[{'id':'directional_boost','name':'定向加速','assetId':'directional_boost'}],
'nonInteractive':[{'id':'wall','name':'标准墙壁','assetId':'wall'},
{'id':'goal_hole','name':'锥口球洞','assetId':'goal_hole'}]},ensure_ascii=False,indent=2))
if ONLY_ASSET:
names={member.name for member in groups[0]}
for obj in list(bpy.data.objects):
if obj.name not in names:bpy.data.objects.remove(obj,do_unlink=True)
bpy.ops.wm.save_as_mainfile(filepath=str(ROOT/report[0]['separateBlend']))
else:
for i,group in enumerate(groups):
for member in group:member.location=(i%4*2.6,i//4*3,0)
bpy.ops.wm.save_as_mainfile(filepath=str(SOURCE/'collection.blend'))
group_names=[[member.name for member in group] for group in groups]
for entry, names in zip(report,group_names):
if globals().get('EXPORT_KINDS') is not None and entry['id'] not in EXPORT_KINDS:
continue
bpy.ops.wm.open_mainfile(filepath=str(SOURCE/'collection.blend'))
for obj in list(bpy.data.objects):
if obj.name not in names:bpy.data.objects.remove(obj,do_unlink=True)
else:obj.location=(0,0,0)
bpy.ops.wm.save_as_mainfile(filepath=str(ROOT/entry['separateBlend']))
(REPORTS/(('asset_'+ONLY_ASSET+'.json') if ONLY_ASSET else 'assets.json')).write_text(json.dumps({
'sourceManifest':json.loads((SNAPSHOT/'source_manifest.json').read_text()),
'models':report,'radius':catalog['models']['iron_ball']['radius'],
'physicalMaterialUnchanged':True,'outlineGeometry':'visual only'},indent=2))
print('STYLE_ASSETS_READY')
if not ONLY_ASSET:
runpy.run_path(str(ROOT/'assets/balls/shared/source/build_materials.py'))
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,124 @@
{
"schemaVersion": 1,
"ballTypes": [
{
"ballTypeId": "wood_ball",
"displayName": "原木球",
"assetId": "wood_ball",
"physicsProfileId": "wood_game"
},
{
"ballTypeId": "ceramic_ball",
"displayName": "陶瓷球",
"assetId": "ceramic_ball",
"physicsProfileId": "ceramic_game"
},
{
"ballTypeId": "iron_ball",
"displayName": "铁球",
"assetId": "iron_ball",
"physicsProfileId": "solid_iron_test"
}
],
"physicsProfiles": {
"solid_iron_test": {
"massKg": 890.0760306150601,
"inertiaModel": "solidSphere",
"dragCoefficient": 0.47,
"contactMaterialId": "iron"
},
"wood_game": {
"massKg": 60,
"inertiaModel": "solidSphere",
"dragCoefficient": 0.47,
"contactMaterialId": "wood"
},
"ceramic_game": {
"massKg": 75,
"inertiaModel": "solidSphere",
"dragCoefficient": 0.04,
"contactMaterialId": "ceramic"
}
},
"contactMaterialPairs": [
{
"materialAId": "iron",
"materialBId": "painted_wood",
"staticFriction": 0.42,
"dynamicFriction": 0.32,
"rollingResistance": 0.025,
"restitution": 0.08
},
{
"materialAId": "iron",
"materialBId": "iron",
"staticFriction": 0.35,
"dynamicFriction": 0.25,
"rollingResistance": 0.01,
"restitution": 0.15
},
{
"materialAId": "wood",
"materialBId": "painted_wood",
"staticFriction": 0.42,
"dynamicFriction": 0.32,
"rollingResistance": 0.025,
"restitution": 0.08
},
{
"materialAId": "ceramic",
"materialBId": "painted_wood",
"staticFriction": 0.42,
"dynamicFriction": 0.32,
"rollingResistance": 0.025,
"restitution": 0.08
},
{
"materialAId": "wood",
"materialBId": "wood",
"staticFriction": 0.35,
"dynamicFriction": 0.25,
"rollingResistance": 0.01,
"restitution": 0.15
},
{
"materialAId": "ceramic",
"materialBId": "ceramic",
"staticFriction": 0.35,
"dynamicFriction": 0.25,
"rollingResistance": 0.01,
"restitution": 0.15
},
{
"materialAId": "wood",
"materialBId": "ceramic",
"staticFriction": 0.35,
"dynamicFriction": 0.25,
"rollingResistance": 0.01,
"restitution": 0.15
},
{
"materialAId": "wood",
"materialBId": "iron",
"staticFriction": 0.35,
"dynamicFriction": 0.25,
"rollingResistance": 0.01,
"restitution": 0.15
},
{
"materialAId": "ceramic",
"materialBId": "iron",
"staticFriction": 0.35,
"dynamicFriction": 0.25,
"rollingResistance": 0.01,
"restitution": 0.15
}
],
"notes": [
"Game tuning: all balls have the same authored radius and shape. Wood mass 60 kg; ceramic 75 kg (+25%); iron keeps its original 890.076 kg.",
"Air drag coefficients are gameplay parameters, not measured material constants: wood 0.47, ceramic 0.04, iron 0.47. Iron receives aerodynamic force through the same equation as other balls; its mass and ordinary contact resistance limit motion in the reference wind.",
"No extra fan multiplier or direct wind velocity override. All types use the established contact coefficients to isolate mass and aerodynamic differences.",
"The current native per-body friction/restitution approximation is retained; simultaneous mixed contact-pair solving is not introduced by this asset change."
],
"airDensity": 1.225
}
@@ -0,0 +1,8 @@
{
"assets/goals/goal_hole/model.glb": "10c848ddb488c230fa957fe247c2407ce656bf1ed57d3c7b5b3dfcd982470951",
"assets/goals/goal_hole/source/model.blend": "3fe002311c2f2e3b5bab4308112c66f64b7d074995734bfdd2600a8587358102",
"assets/collections/storybook/source/collection.blend": "4611a0e8c48f282b4d72835579aa15805051de292b34c15be70881c4db9bed3a",
"assets/collections/storybook/source/build.py": "0d02bd42c841c8bedaf7f613ee7321216cd7bde6527a531eeb3a2f9296e9552e",
"assets/collections/storybook/catalog.json": "c302cfcf8d2068d172519bca7f83e210d556716a82ce0f5afe4ba2965091f447",
"assets/collections/storybook/physics.json": "24161d2574282825b3d0611505c855f5a72b100a892f746f0a236a72ce8798d8"
}
@@ -0,0 +1,7 @@
{
"otherMeshesUnchanged": true,
"replaced": [
"goal_hole",
"ink_goal_hole"
]
}
@@ -2,8 +2,43 @@
"checks": [
{
"detail": {
"contactFrames": 1133,
"end": "(0.0, -1.005104, 0.0)"
"centerY": 1.63104367256165,
"events": [
{
"ballId": "iron",
"goalId": "hole",
"position": [
2.01806831359863,
1.63104367256165,
-0.999547719955444
],
"time": 0.741666666666666
}
],
"status": "全部入洞! 0.74 秒"
},
"name": "workshop_scores_inside_supported_goal",
"passed": true
},
{
"detail": {},
"name": "skimming_above_mouth_does_not_score",
"passed": true
},
{
"detail": {},
"name": "grazing_throat_edge_does_not_score",
"passed": true
},
{
"detail": {},
"name": "rising_from_below_does_not_score",
"passed": true
},
{
"detail": {
"contactFrames": 0,
"end": "(0.0, -0.350831, 0.0)"
},
"name": "drop_wood_ball_(0.0, 0.0)",
"passed": true
@@ -11,7 +46,7 @@
{
"detail": {
"contactFrames": 1141,
"end": "(0.004692, -1.027503, -0.004689)"
"end": "(0.006718, -0.367044, 0.000499)"
},
"name": "drop_wood_ball_(0.12, 0.0)",
"passed": true
@@ -19,7 +54,7 @@
{
"detail": {
"contactFrames": 1122,
"end": "(-0.007495, -1.020418, -0.018401)"
"end": "(-0.001257, -0.363957, 0.002227)"
},
"name": "drop_wood_ball_(0.26, 0.0)",
"passed": true
@@ -27,7 +62,7 @@
{
"detail": {
"contactFrames": 1120,
"end": "(0.01457, -1.021921, -0.01245)"
"end": "(-0.00433, -0.373872, 0.004414)"
},
"name": "drop_wood_ball_(0.36, 0.0)",
"passed": true
@@ -35,7 +70,7 @@
{
"detail": {
"contactFrames": 1120,
"end": "(-0.009895, -1.023855, -0.017172)"
"end": "(0.00349, -0.373755, 0.006115)"
},
"name": "drop_wood_ball_(-0.36, 0.0)",
"passed": true
@@ -43,7 +78,7 @@
{
"detail": {
"contactFrames": 1120,
"end": "(0.013517, -1.023277, 0.00926)"
"end": "(-0.005369, -0.373896, -0.004036)"
},
"name": "drop_wood_ball_(0.0, 0.36)",
"passed": true
@@ -51,7 +86,7 @@
{
"detail": {
"contactFrames": 1120,
"end": "(-0.016024, -1.023196, -0.011723)"
"end": "(0.005562, -0.373769, 0.003615)"
},
"name": "drop_wood_ball_(0.0, -0.36)",
"passed": true
@@ -59,7 +94,7 @@
{
"detail": {
"contactFrames": 1127,
"end": "(-0.008337, -1.003462, -0.018005)"
"end": "(0.003099, -0.350407, 0.007578)"
},
"name": "drop_wood_ball_(0.24, 0.24)",
"passed": true
@@ -67,15 +102,15 @@
{
"detail": {
"contactFrames": 1126,
"end": "(0.019785, -1.012402, -0.001412)"
"end": "(-0.006216, -0.35423, -0.001589)"
},
"name": "drop_wood_ball_(-0.24, -0.24)",
"passed": true
},
{
"detail": {
"contactFrames": 1133,
"end": "(0.0, -1.007103, 0.0)"
"contactFrames": 0,
"end": "(0.0, -0.351871, 0.0)"
},
"name": "drop_ceramic_ball_(0.0, 0.0)",
"passed": true
@@ -83,7 +118,7 @@
{
"detail": {
"contactFrames": 1140,
"end": "(0.011337, -1.029251, 0.012666)"
"end": "(0.006113, -0.365548, -0.001206)"
},
"name": "drop_ceramic_ball_(0.12, 0.0)",
"passed": true
@@ -91,7 +126,7 @@
{
"detail": {
"contactFrames": 1122,
"end": "(0.004795, -1.011782, -0.017516)"
"end": "(0.017727, -0.366344, 0.006552)"
},
"name": "drop_ceramic_ball_(0.26, 0.0)",
"passed": true
@@ -99,7 +134,7 @@
{
"detail": {
"contactFrames": 1120,
"end": "(0.012047, -1.025424, -0.01322)"
"end": "(-0.003429, -0.374514, 0.008168)"
},
"name": "drop_ceramic_ball_(0.36, 0.0)",
"passed": true
@@ -107,7 +142,7 @@
{
"detail": {
"contactFrames": 1120,
"end": "(-0.015903, -1.027495, -0.011892)"
"end": "(0.003284, -0.374516, 0.00973)"
},
"name": "drop_ceramic_ball_(-0.36, 0.0)",
"passed": true
@@ -115,7 +150,7 @@
{
"detail": {
"contactFrames": 1120,
"end": "(-0.012943, -1.025432, 0.013735)"
"end": "(0.007751, -0.374488, -0.003466)"
},
"name": "drop_ceramic_ball_(0.0, 0.36)",
"passed": true
@@ -123,7 +158,7 @@
{
"detail": {
"contactFrames": 1120,
"end": "(-0.016815, -1.02467, -0.010521)"
"end": "(0.007233, -0.374468, 0.003517)"
},
"name": "drop_ceramic_ball_(0.0, -0.36)",
"passed": true
@@ -131,7 +166,7 @@
{
"detail": {
"contactFrames": 1127,
"end": "(0.017929, -1.007286, 0.003665)"
"end": "(0.007584, -0.355175, 0.017886)"
},
"name": "drop_ceramic_ball_(0.24, 0.24)",
"passed": true
@@ -139,15 +174,15 @@
{
"detail": {
"contactFrames": 1126,
"end": "(0.014751, -1.005026, 0.011379)"
"end": "(-0.005455, -0.360435, -0.003424)"
},
"name": "drop_ceramic_ball_(-0.24, -0.24)",
"passed": true
},
{
"detail": {
"contactFrames": 1133,
"end": "(0.0, -1.007105, 0.0)"
"contactFrames": 0,
"end": "(0.0, -0.351816, 0.0)"
},
"name": "drop_iron_ball_(0.0, 0.0)",
"passed": true
@@ -155,7 +190,7 @@
{
"detail": {
"contactFrames": 1141,
"end": "(0.013721, -1.032078, 0.005726)"
"end": "(0.006115, -0.365689, -0.00166)"
},
"name": "drop_iron_ball_(0.12, 0.0)",
"passed": true
@@ -163,7 +198,7 @@
{
"detail": {
"contactFrames": 1122,
"end": "(-0.015804, -1.010242, 0.009249)"
"end": "(0.007877, -0.361279, -0.006082)"
},
"name": "drop_iron_ball_(0.26, 0.0)",
"passed": true
@@ -171,7 +206,7 @@
{
"detail": {
"contactFrames": 1120,
"end": "(0.01255, -1.025249, 0.013082)"
"end": "(-0.003445, -0.374441, -0.007895)"
},
"name": "drop_iron_ball_(0.36, 0.0)",
"passed": true
@@ -179,7 +214,7 @@
{
"detail": {
"contactFrames": 1120,
"end": "(-0.012894, -1.02611, -0.015093)"
"end": "(0.003304, -0.37449, 0.007669)"
},
"name": "drop_iron_ball_(-0.36, 0.0)",
"passed": true
@@ -187,7 +222,7 @@
{
"detail": {
"contactFrames": 1120,
"end": "(0.009499, -1.025884, 0.012995)"
"end": "(-0.009605, -0.374456, -0.003244)"
},
"name": "drop_iron_ball_(0.0, 0.36)",
"passed": true
@@ -195,7 +230,7 @@
{
"detail": {
"contactFrames": 1120,
"end": "(0.009933, -1.0254, -0.012974)"
"end": "(-0.008965, -0.374423, 0.003309)"
},
"name": "drop_iron_ball_(0.0, -0.36)",
"passed": true
@@ -203,7 +238,7 @@
{
"detail": {
"contactFrames": 1127,
"end": "(-0.018326, -1.012097, -0.007675)"
"end": "(0.007256, -0.352717, 0.003666)"
},
"name": "drop_iron_ball_(0.24, 0.24)",
"passed": true
@@ -211,7 +246,7 @@
{
"detail": {
"contactFrames": 1126,
"end": "(0.009102, -1.015484, 0.015162)"
"end": "(-0.002968, -0.362735, -0.00636)"
},
"name": "drop_iron_ball_(-0.24, -0.24)",
"passed": true
@@ -255,14 +290,14 @@
"ballId": "student_ball",
"goalId": "goal",
"position": [
2.9973669052124,
0.645162343978882,
0.0196551065891981
2.99644899368286,
3.32077193260193,
0.00355775188654661
],
"time": 2.39999999999999
"time": 2.08333333333333
}
],
"time": 2.39999999999999
"time": 2.08333333333333
},
"name": "tutorial_1_enters_once",
"passed": true
@@ -274,14 +309,14 @@
"ballId": "student_ball",
"goalId": "goal",
"position": [
0.00339265912771225,
0.678770303726196,
3.01822996139526
-0.0113675752654672,
3.32657384872437,
2.98454475402832
],
"time": 3.71666666666666
"time": 2.41666666666666
}
],
"time": 3.71666666666666
"time": 2.41666666666666
},
"name": "tutorial_2_enters_once",
"passed": true
@@ -293,14 +328,14 @@
"ballId": "student_ball",
"goalId": "goal",
"position": [
1.98784899711609,
0.662082076072693,
-2.01570081710815
1.99756240844727,
3.32501268386841,
-1.9871119260788
],
"time": 4.40833333333334
"time": 2.97499999999999
}
],
"time": 4.40833333333334
"time": 2.97499999999999
},
"name": "tutorial_3_enters_once",
"passed": true
@@ -312,14 +347,14 @@
"ballId": "student_ball",
"goalId": "goal",
"position": [
5.01481342315674,
0.65211695432663,
0.0101500349119306
4.99413537979126,
3.31404900550842,
-0.00234287418425083
],
"time": 3.83333333333332
"time": 2.69166666666666
}
],
"time": 3.83333333333332
"time": 2.69166666666666
},
"name": "tutorial_4_enters_once",
"passed": true
@@ -331,19 +366,19 @@
"ballId": "student_ball",
"goalId": "goal",
"position": [
4.9877724647522,
0.159147873520851,
-0.0156376082450151
4.98896408081055,
2.81397747993469,
-0.0158765353262424
],
"time": 7.01666666666681
"time": 5.45000000000006
}
],
"time": 7.01666666666681
"time": 5.45000000000006
},
"name": "tutorial_5_enters_once",
"passed": true
}
],
"failed": 0,
"passed": 36
"passed": 40
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
{
"assets/balls/iron_ball/model.glb": "d56c8a6e99744aa662b1f8e5ff106d1cbed15abf5044eecd4ffc9ae1eaa3c652",
"assets/balls/iron_ball/source/model.blend": "f663fd01a877a29a9e894d1c31494754458fb95b9abf8315e296711e4f6c005a",
"assets/collections/storybook/catalog.json": "c302cfcf8d2068d172519bca7f83e210d556716a82ce0f5afe4ba2965091f447",
"assets/collections/storybook/physics.json": "24161d2574282825b3d0611505c855f5a72b100a892f746f0a236a72ce8798d8",
"assets/collections/storybook/source/collection.blend": "6a6fd9bb5ffc256f7a98670bc63343b0e533dde93689dfd35ebebfe5bad8d8d7"
}
@@ -0,0 +1,28 @@
{
"snapshot": {
"vertices": 1986,
"faces": 2048,
"closedManifold": true,
"minRadius": 0.29999971336984166,
"maxRadius": 0.30000002458691494,
"smoothFaces": 2048,
"materials": {
"Iron - brushed": 1704,
"Iron ball - orientation stripe": 344
}
},
"before": {
"vertices": 1986,
"faces": 2048,
"closedManifold": true,
"minRadius": 0.29999971336984166,
"maxRadius": 0.30000002458691494,
"smoothFaces": 2048,
"materials": {
"Storybook / iron satin": 1552,
"Storybook / ink": 344,
"Storybook / iron_light": 152
}
},
"geometryMatchesSnapshot": true
}
@@ -0,0 +1,23 @@
{
"geometryUnchanged": true,
"closedManifold": true,
"vertices": 1986,
"faces": 2048,
"radius": 0.30000002458691494,
"allFacesSmooth": true,
"singleMaterial": true,
"materials": [
"Storybook / iron satin"
],
"otherCollectionObjectsUnchanged": true,
"collectionIronGeometryUnchanged": true,
"collectionIronPlacementUnchanged": true,
"collectionIronSingleMaterial": true,
"physicsFileUnchanged": true,
"catalogUnchanged": true,
"glbPrimitiveCount": 1,
"glbMaterials": [
"Storybook / iron satin"
],
"passed": true
}
@@ -3,7 +3,7 @@
"balls": [
{
"ballTypeId": "iron_ball",
"id": "iron_ball_207110_2",
"id": "iron_ball_417390_2",
"launchDirection": [
1.0,
0.0,
@@ -17,7 +17,7 @@
},
{
"ballTypeId": "iron_ball",
"id": "iron_ball_213365_3",
"id": "iron_ball_424950_3",
"launchDirection": [
1.0,
0.0,
+13 -15
View File
@@ -240,9 +240,10 @@
0.6000000238418579
],
"materials": [
"Storybook / iron satin"
"Satin iron"
],
"measuredRadius": 0.30000002458691494
"measuredRadius": 0.30000002458691494,
"packedTextureCount": 2
},
{
"id": "goal_hole",
@@ -321,7 +322,7 @@
"dimensions": [
1.0,
1.0,
1.0
1.3200000524520874
],
"materials": [
"Storybook / wall stone",
@@ -330,10 +331,10 @@
"arrowTipBlender": [
0.295199990272522,
0.0,
1.003000020980835
1.0049999952316284
],
"closedManifold": true,
"solidVolume": 0.9999999999999999
"solidVolume": 1.069741313133497
},
{
"id": "wood_ball",
@@ -353,10 +354,10 @@
0.6000000238418579
],
"materials": [
"Raw wood grain"
"Honey wood with painted grain"
],
"measuredRadius": 0.30000002458691494,
"packedTextureCount": 1
"packedTextureCount": 2
},
{
"id": "ceramic_ball",
@@ -376,18 +377,16 @@
0.6000000238418579
],
"materials": [
"Ivory ceramic glaze with cobalt rings"
"Ivory porcelain glaze with cobalt scallops"
],
"measuredRadius": 0.30000002458691494,
"packedTextureCount": 1
"packedTextureCount": 2
},
{
"id": "water",
"passed": true,
"objects": [
"water",
"ink_water_arrow_border",
"ink_water_arrow_fill"
"water"
],
"geometryMatchesSnapshot": null,
"origin": [
@@ -402,7 +401,7 @@
],
"materials": [
"Storybook / water",
"Storybook / water"
"Storybook / water_surface"
],
"closedManifold": true,
"solidVolume": 0.9999999999999999
@@ -412,8 +411,7 @@
"passed": true,
"objects": [
"ice",
"ink_ice",
"ink_ice_cracks"
"ink_ice"
],
"geometryMatchesSnapshot": null,
"origin": [
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 KiB

After

Width:  |  Height:  |  Size: 231 KiB

@@ -1,7 +1,7 @@
{
"engine": "4.7.2-stable (official)",
"failed": 0,
"passed": 42,
"passed": 68,
"results": [
{
"detail": {
@@ -149,6 +149,11 @@
"name": "screenshot_exact_y_182",
"passed": true
},
{
"detail": {},
"name": "placing_launcher_second_joins_same_surface",
"passed": true
},
{
"detail": {},
"name": "top_click_still_stacks",
@@ -174,6 +179,11 @@
"name": "neighbor_order_does_not_change_height",
"passed": true
},
{
"detail": {},
"name": "standalone_launcher_has_rims_and_arrow",
"passed": true
},
{
"detail": {
"cursor": "(0.0, 1.82, 0.0)"
@@ -233,18 +243,9 @@
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"final": "(-1.309487, 2.801187, -0.002228)",
"slope_y": 2.3199999332428,
"tail_y": 1.8199999332428,
"time": 0.533333333333333
"max_step_m": 0.000498771667480469
},
"name": "gentle_q0_real_ball_crosses_both_seams",
"name": "gentle_q0_full_mouth",
"passed": true
},
{
@@ -255,12 +256,13 @@
"slope",
"tail"
],
"final": "(0.002842, 2.800547, -1.321674)",
"entry_speed_mps": 4.50636196136475,
"final": "(-1.321899, 2.803678, 0.010922)",
"slope_y": 2.3199999332428,
"tail_y": 1.8199999332428,
"time": 0.541666666666667
},
"name": "gentle_q1_real_ball_crosses_both_seams",
"name": "gentle_q0_offset_0.00_real_ball",
"passed": true
},
{
@@ -271,12 +273,13 @@
"slope",
"tail"
],
"final": "(1.303655, 2.801161, 0.005427)",
"entry_speed_mps": 3.48604559898376,
"final": "(-1.300645, 2.80192, -0.007589)",
"slope_y": 2.3199999332428,
"tail_y": 1.8199999332428,
"time": 0.533333333333333
"time": 0.683333333333333
},
"name": "gentle_q2_real_ball_crosses_both_seams",
"name": "gentle_q0_offset_-0.05_real_ball",
"passed": true
},
{
@@ -287,12 +290,20 @@
"slope",
"tail"
],
"final": "(0.00585, 2.802268, 1.304691)",
"entry_speed_mps": 3.48651003837585,
"final": "(-1.306496, 2.802862, -0.009553)",
"slope_y": 2.3199999332428,
"tail_y": 1.8199999332428,
"time": 0.533333333333333
"time": 0.691666666666667
},
"name": "gentle_q3_real_ball_crosses_both_seams",
"name": "gentle_q0_offset_0.05_real_ball",
"passed": true
},
{
"detail": {
"max_step_m": 0.000498771667480469
},
"name": "gentle_q1_full_mouth",
"passed": true
},
{
@@ -303,12 +314,13 @@
"slope",
"tail"
],
"final": "(-1.699048, 2.247441, 0.007275)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.6
"entry_speed_mps": 4.50805997848511,
"final": "(0.010496, 2.803505, -1.323291)",
"slope_y": 2.3199999332428,
"tail_y": 1.8199999332428,
"time": 0.541666666666667
},
"name": "steep_q0_real_ball_crosses_both_seams",
"name": "gentle_q1_offset_0.00_real_ball",
"passed": true
},
{
@@ -319,12 +331,13 @@
"slope",
"tail"
],
"final": "(-0.00041, 2.24705, -1.698913)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.6
"entry_speed_mps": 3.48620176315308,
"final": "(0.006929, 2.801669, -1.304565)",
"slope_y": 2.3199999332428,
"tail_y": 1.8199999332428,
"time": 0.683333333333333
},
"name": "steep_q1_real_ball_crosses_both_seams",
"name": "gentle_q1_offset_-0.05_real_ball",
"passed": true
},
{
@@ -335,12 +348,20 @@
"slope",
"tail"
],
"final": "(1.698807, 2.247102, -0.00226)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.6
"entry_speed_mps": 3.48620343208313,
"final": "(-0.006155, 2.801658, -1.313274)",
"slope_y": 2.3199999332428,
"tail_y": 1.8199999332428,
"time": 0.691666666666667
},
"name": "steep_q2_real_ball_crosses_both_seams",
"name": "gentle_q1_offset_0.05_real_ball",
"passed": true
},
{
"detail": {
"max_step_m": 0.000498771667480469
},
"name": "gentle_q2_full_mouth",
"passed": true
},
{
@@ -351,12 +372,337 @@
"slope",
"tail"
],
"final": "(0.007345, 2.247429, 1.699053)",
"entry_speed_mps": 4.50577354431152,
"final": "(1.326657, 2.803352, -0.010376)",
"slope_y": 2.3199999332428,
"tail_y": 1.8199999332428,
"time": 0.541666666666667
},
"name": "gentle_q2_offset_0.00_real_ball",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 3.48649907112122,
"final": "(1.317046, 2.801669, 0.006928)",
"slope_y": 2.3199999332428,
"tail_y": 1.8199999332428,
"time": 0.691666666666667
},
"name": "gentle_q2_offset_-0.05_real_ball",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 3.48633003234863,
"final": "(1.305969, 2.801574, 0.006665)",
"slope_y": 2.3199999332428,
"tail_y": 1.8199999332428,
"time": 0.683333333333333
},
"name": "gentle_q2_offset_0.05_real_ball",
"passed": true
},
{
"detail": {
"max_step_m": 0.000498771667480469
},
"name": "gentle_q3_full_mouth",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 4.50539684295654,
"final": "(0.007971, 2.802351, 1.315242)",
"slope_y": 2.3199999332428,
"tail_y": 1.8199999332428,
"time": 0.541666666666667
},
"name": "gentle_q3_offset_0.00_real_ball",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 3.48614597320557,
"final": "(0.009307, 2.802734, 1.320634)",
"slope_y": 2.3199999332428,
"tail_y": 1.8199999332428,
"time": 0.7
},
"name": "gentle_q3_offset_-0.05_real_ball",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 3.48637318611145,
"final": "(-0.009566, 2.802869, 1.308262)",
"slope_y": 2.3199999332428,
"tail_y": 1.8199999332428,
"time": 0.691666666666667
},
"name": "gentle_q3_offset_0.05_real_ball",
"passed": true
},
{
"detail": {
"max_step_m": 0.00099945068359375
},
"name": "steep_q0_full_mouth",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 4.50545883178711,
"final": "(-1.549844, 2.359623, -0.011575)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.6
"time": 0.566666666666667
},
"name": "steep_q3_real_ball_crosses_both_seams",
"name": "steep_q0_offset_0.00_real_ball",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 3.48655772209167,
"final": "(-1.315089, 2.305791, -0.013575)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.741666666666667
},
"name": "steep_q0_offset_-0.05_real_ball",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 3.48620939254761,
"final": "(-1.310743, 2.300434, 0.001933)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.733333333333333
},
"name": "steep_q0_offset_0.05_real_ball",
"passed": true
},
{
"detail": {
"max_step_m": 0.00099945068359375
},
"name": "steep_q1_full_mouth",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 4.50606155395508,
"final": "(-0.005537, 2.272588, -1.663085)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.591666666666667
},
"name": "steep_q1_offset_0.00_real_ball",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 3.48655772209167,
"final": "(0.012681, 2.304982, -1.310319)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.741666666666667
},
"name": "steep_q1_offset_-0.05_real_ball",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 3.48605728149414,
"final": "(0.004755, 2.301212, -1.30469)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.733333333333333
},
"name": "steep_q1_offset_0.05_real_ball",
"passed": true
},
{
"detail": {
"max_step_m": 0.00099945068359375
},
"name": "steep_q2_full_mouth",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 4.50730752944946,
"final": "(1.663578, 2.271967, 0.001082)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.591666666666667
},
"name": "steep_q2_offset_0.00_real_ball",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 3.48663663864136,
"final": "(1.314951, 2.300605, -0.003228)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.725
},
"name": "steep_q2_offset_-0.05_real_ball",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 3.48620438575745,
"final": "(1.308576, 2.300469, 0.001644)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.733333333333333
},
"name": "steep_q2_offset_0.05_real_ball",
"passed": true
},
{
"detail": {
"max_step_m": 0.00099945068359375
},
"name": "steep_q3_full_mouth",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 4.50668144226074,
"final": "(0.001801, 2.271847, 1.663327)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.591666666666667
},
"name": "steep_q3_offset_0.00_real_ball",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 3.48678493499756,
"final": "(0.00193, 2.300435, 1.309911)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.733333333333333
},
"name": "steep_q3_offset_-0.05_real_ball",
"passed": true
},
{
"detail": {
"boosts": 1,
"contacts": [
"launch",
"slope",
"tail"
],
"entry_speed_mps": 3.48651027679443,
"final": "(0.008731, 2.302601, 1.307388)",
"slope_y": 1.82000017166138,
"tail_y": 1.32000017166138,
"time": 0.733333333333333
},
"name": "steep_q3_offset_0.05_real_ball",
"passed": true
}
]
@@ -0,0 +1,34 @@
{
"assetFamily": "railbound_inspired",
"balls": [
{
"ballTypeId": "iron_ball",
"id": "ball",
"launchDirection": [
1.0,
0.0,
0.0
],
"position": [
1.89999997615814,
2.0,
-2.0
]
}
],
"entities": [],
"pieces": [
{
"id": "bend",
"kind": "turn_90",
"position": [
2.0,
1.0,
-2.0
],
"quarter": 0
}
],
"schemaVersion": 2,
"title": "my_level"
}
@@ -0,0 +1 @@
{"assetFamily":"railbound_inspired","balls":[{"ballTypeId":"iron_ball","id":"ball","position":[1.9,2,-2]}],"entities":[],"pieces":[{"id":"bend","kind":"turn_ccw","position":[2,1,-2],"quarter":3}],"schemaVersion":2}
File diff suppressed because it is too large Load Diff
+7 -23
View File
@@ -33,7 +33,7 @@
- Y 形在同一侧设置两个相邻、等高的入口,中心相距 1 m,各自连接一个单格直槽;公共出口与其中一路对齐,另一路以连续 S 形曲线并入,不要求对称。单件场景同时展示两个输入直槽和一个输出直槽,验证真实接缝。
- 编辑器按 Y 形四格占用进行选择、替换、旋转及重叠检查;数量配额计为一块。只有上方槽面参与路线连接。
目标洞口现由 Blender 制作并导出为 `goal_hole.glb`:入口与喉部净半径均为 0.32 m,深度 0.55 m,壁厚 0.04 m。碰撞使用同一空心网格,避免只缩小视觉开口。入洞检测记录球心向下跨过洞底平面的交点,再按洞口净空校验水平位置。
目标洞口现由 Blender 制作并导出为 `goal_hole.glb`:入口与喉部净半径均为 0.32 m,深度 0.55 m,壁厚 0.04 m。碰撞使用同一空心网格,避免只缩小视觉开口。这款直筒球洞的喉口位于上沿,球心向下跨入上口并满足孔径净空时即算入洞。
独立半径对比实验已完成选择并清理:删除其 Blender 模型、GLB、Godot 场景、脚本和报告,以及旧镜像下层导轨夹具;当前保留连续轨道、单件试跑、自由搭建和双球汇流四个试玩预设。底孔测试预设及独立底孔场景均已删除。
@@ -42,35 +42,19 @@
铁球为 SphereShape3D 刚体,半径读取生成的资产目录;均匀实心球惯量按质量和半径生成。所有轨道为静态三角网格碰撞体,铁球与轨道、铁球与铁球碰撞均开启。固定物理频率为 120 Hz,启用连续碰撞检测。
当前 `physics.json` 中的名义铁密度假设为 7870 kg/m³,半径 0.3 m 对应约 890.08 kg;质量值保存在物理预设中。木材接触试验系数为:静摩擦 0.42、动摩擦 0.32、滚动阻力 0.025、回弹 0.08;空气密度 1.225 kg/m³,铁球阻力系数为 0.47,正常计算风力和静止空气阻力。质量与接触值沿用首轮验证参数,不是实验测得的材质常数。
当前 `physics.json` 中的名义铁密度假设为 7870 kg/m³,半径 0.3 m 对应约 890.08 kg;质量值保存在物理预设中。木槽滚动阻力为 0.025,恢复系数为 0.08。与工坊共用固体滚动阻力模型,空气阻力已停用。
Godot 原生 PhysicsMaterial 只暴露一个摩擦参数;本轮根据接触点滑速切换静/动摩擦系数,再由原生求解器计算接触冲量。这是用于本轮试验的近似,不等价于完整的逐接触双系数材质求解。滚动阻力另施加受限力矩,空气作用使用相对空气速度计算,不额外修改轨道速度。多材质同时接触和铁球之间的独立材质配对尚未完整标定;目前原生回弹合成会使两个铁球各 0.08 的回弹得到约 0.16 的相对恢复表现。[Godot PhysicsMaterial](https://docs.godotengine.org/en/4.7/classes/class_physicsmaterial.html)
接触数据和力矩在刚体积分回调中读取、施加,轨迹记录只用于显示与测量。[Godot PhysicsDirectBodyState3D](https://docs.godotengine.org/en/4.7/classes/class_physicsdirectbodystate3d.html)
## 验证范围
## 验证与历史记录
本次实心底座修改已通过 42 项基础物理检查;另有两套模型的 151 项碰撞/场景检查和 16 项源文件检查,见 [本次验证索引](../README.md)。以下交互流程与双球汇流的完整历史结果未在本轮重复运行。
早期 `baseline-test` 及其物理、交互流程和双球汇流三组自动检查已删除,不再提供这些过时断言的运行入口,也不再保留 `playtest/baseline/checks/`。早期试玩场景仍可通过 `./scripts/playtest.zsh` 和 `./scripts/run.zsh merge` 手动检查。
运行 `./scripts/run.zsh baseline-test` 会刷新 Godot 导入并运行物理、交互流程和双球汇流三组测试。报告记录实际参数、轨迹和结果;退出码非零表示测试失败。
[基础物理报告](../artifacts/baseline/physics_report.json)、[交互报告](../artifacts/baseline/playtest_report.json) 和 [双球汇流报告](../artifacts/baseline/merge_report.json) 仅作为历史产物保留,不代表当前场景或共享物理脚本已经通过同一组检查。历史默认路线约 2.90 秒入洞;窗口关闭或不同操作路径不会被这些数值覆盖,需要按实际试玩继续验证。
物理测试移除底孔通过用例后共 42 项:
- 真空自由落体与球在半圆槽中的静止接触。
- 30° 理想平面上实心球滚动,加速度与解析值比较。
- 水平滚动时关闭/开启滚动阻力的速度差异。
- 两个铁球副本迎面碰撞,检查速度方向与总动量。
- 六种滑槽、四个朝向的顶部槽面通行;Y 形分别测试两个岔口,共 28 项路径测试。
- Y 形连接两个相邻直槽及一个出口直槽后,分别测试两个入口和四个朝向,共 8 项完整连接测试。连接测试初速度为 1.6 m/s,其余既有路径测试继续使用原有的 1.2 m/s 或坡道静止释放条件。
- 无接触条件下,质量相差十倍时的风响应比较;该解析基准直接读取当前铁球的非零阻力配置,仅改变质量,不再单独覆盖阻力系数。
交互流程测试共 30 项:默认重力路线穿过真实洞口、释放、暂停、重试、六种资产选择与四次旋转复位、相邻放置、运行后编辑锁定、删除、拒绝悬空放置、场景配额及鼠标射线选取可见方块;另覆盖 Y 形的合法四格尺寸、超界标记区分、重叠拒绝、四格选择、中心旋转和替换后释放多余格子。
较长的完整连接测试采用 1.6 m/s 初速度,场景中仍可用滑块调整;试验只设置初始速度,未添加持续推力、速度锁定或关闭摩擦。低初速度是否足够到达后续路线,继续由实际行程和摩擦耗能决定。
测试调用真实 Godot 场景和物理引擎。界面按钮通过信号触发、选格通过引擎输入事件路径验证;原生渲染已截图检查。没有声称通过操作系统鼠标自动化完成所有按钮测试。
当前基础物理结果见 [物理报告](../artifacts/baseline/physics_report.json),历史交互结果见 [交互报告](../artifacts/baseline/playtest_report.json)。历史默认路线约 2.90 秒入洞;当前 30° 平面验证仍与约 3.5036 m/s² 的解析值比较。窗口关闭或不同操作路径不会被这些数值覆盖,需要按实际试玩继续验证。
当前自动检查按改动范围使用 `playtest/checks/` 中的专项,入口见 [脚本说明](../../scripts/README.md)。
## 双铁球汇流场景
@@ -82,7 +66,7 @@ Godot 原生 PhysicsMaterial 只暴露一个摩擦参数;本轮根据接触点
入洞按球的唯一编号计数,每球只记录一次。已入洞球隐藏并退出碰撞;部分入洞不成功,任何一球丢失也不能通过减少剩余球数完成通关。重试会重建两球并清空入洞、轨迹及暂停状态。预设演示场景不开放方块编辑,可切回自由搭建场景调整其他布局。
双球专项验证共 16 项,覆盖同高分支、同时释放、球间碰撞开关、两球暂停、分别通过不同入口及共同出口、两球进入同一洞口、部分入洞、事件去重、退出模拟、重试复现、丢球不判胜及切回单球场景。实际完成时间约 5.4 秒,具体轨迹和逐球入洞事件见 [双球汇流报告](../artifacts/baseline/merge_report.json)。
历史双球专项曾有 16 项,覆盖同高分支、同时释放、球间碰撞开关、两球暂停、分别通过不同入口及共同出口、两球进入同一洞口、部分入洞、事件去重、退出模拟、重试复现、丢球不判胜及切回单球场景。当时实际完成时间约 5.4 秒,具体轨迹和逐球入洞事件见保留的 [双球汇流报告](../artifacts/baseline/merge_report.json);该专项现已删除,不再作为当前运行证明。
## 后续需验证
@@ -1,84 +0,0 @@
extends SceneTree
var results: Array=[]
var failures:=0
func _initialize() -> void:call_deferred("run")
func check(name: String, ok: bool, detail: Dictionary={}) -> void:
results.append({"name":name,"passed":ok,"detail":detail.duplicate(true)})
if not ok:failures+=1
print(("PASS " if ok else "FAIL ")+name+" "+JSON.stringify(detail))
func run() -> void:
var app=load("res://playtest/baseline/scenes/main.tscn").instantiate()
root.add_child(app)
app.build_preset(3)
await physics_frame
check("two_iron_balls_ready",app.merge_balls.size()==2 and app.merge_balls.all(func(b):return b.freeze and is_equal_approx(b.radius,.3) and b.linear_velocity.is_zero_approx()))
check("separate_equal_height_branches",is_equal_approx(app.merge_balls[0].position.y,app.merge_balls[1].position.y) and is_equal_approx(absf(app.merge_balls[0].position.z-app.merge_balls[1].position.z),1.0))
check("ball_collision_enabled",app.merge_balls.all(func(b):return (b.collision_layer&2)!=0 and (b.collision_mask&2)!=0))
app.start_button.pressed.emit()
check("simultaneous_release",app.merge_release_ticks.size()==2 and app.merge_release_ticks[0]==app.merge_release_ticks[1] and app.merge_balls.all(func(b):return not b.freeze and b.linear_velocity.is_zero_approx()))
for i in range(35):await physics_frame
app.toggle_run()
var positions: Array=app.merge_balls.map(func(b):return b.position)
var time: float=app.elapsed
for i in range(20):await physics_frame
check("pause_stops_both_balls",app.paused and app.merge_balls[0].position.is_equal_approx(positions[0]) and app.merge_balls[1].position.is_equal_approx(positions[1]) and is_equal_approx(time,app.elapsed))
app.toggle_run()
var partial_seen:=false
var premature_win:=false
for i in range(2400):
await physics_frame
if app.merge_entered.size()==1:
partial_seen=true
premature_win=premature_win or app.status.begins_with("成功")
if app.merge_entered.size()+app.merge_lost.size()==2:break
check("both_balls_enter_common_hole",app.merge_entered.size()==2 and app.merge_lost.is_empty(),{"status":app.status,"time":app.elapsed,"hole_events":app.merge_hole_events,"ball_collision_frames":app.merge_collision_frames,"a_position":[app.merge_balls[0].position.x,app.merge_balls[0].position.y,app.merge_balls[0].position.z],"b_position":[app.merge_balls[1].position.x,app.merge_balls[1].position.y,app.merge_balls[1].position.z]})
check("one_ball_is_not_a_win",partial_seen and not premature_win)
check("two_unique_hole_events",app.merge_hole_events.size()==2 and app.merge_hole_events[0].ballId!=app.merge_hole_events[1].ballId)
var first_run: Array=app.merge_samples.duplicate(true)
var correct_inlets:=true
var common_outlet:=true
for i in range(2):
var key: String="a" if i==0 else "b"
var inlet_seen:=false
var outlet_seen:=false
for sample in first_run:
var p: Array=sample[key]
if p[0]>-.6 and p[0]<-.1 and absf(p[2]-i)<.2 and p[1]>1.8:inlet_seen=true
if p[0]>1.3 and p[0]<1.7 and absf(p[2]-1)<.2 and p[1]>1.5:outlet_seen=true
correct_inlets=correct_inlets and inlet_seen
common_outlet=common_outlet and outlet_seen
check("both_use_distinct_y_inlets",correct_inlets)
check("both_use_common_y_outlet",common_outlet)
for i in range(60):await physics_frame
check("hole_events_not_repeated",app.merge_hole_events.size()==2)
check("entered_balls_exit_simulation",app.merge_balls.all(func(b):return b.freeze and not b.visible and b.collision_mask==0 and b.collision_layer==0))
app.reset_ball()
await physics_frame
check("retry_restores_two_balls",app.merge_balls.size()==2 and app.merge_balls.all(func(b):return b.freeze and b.visible and b.collision_mask==3) and app.merge_entered.is_empty() and app.merge_hole_events.is_empty() and app.elapsed==0)
app.toggle_run()
for i in range(2400):
await physics_frame
if app.merge_entered.size()+app.merge_lost.size()==2:break
check("repeat_run_completes",app.merge_entered.size()==2 and app.merge_lost.is_empty(),{"time":app.elapsed})
app.reset_ball();app.toggle_run()
app.merge_balls[0].position=Vector3(0,-2,0)
for i in range(1800):
await physics_frame
if app.merge_entered.size()+app.merge_lost.size()==2:break
check("lost_ball_does_not_reduce_target",app.merge_lost.size()==1 and app.merge_entered.size()==1 and not app.status.begins_with("成功"))
app.build_preset(0)
await physics_frame
var dynamic_balls:=0
for child in app.get_children():
if child is RigidBody3D:dynamic_balls+=1
check("switch_back_to_single_ball_scene",app.merge_balls.is_empty() and dynamic_balls==1 and is_instance_valid(app.ball))
var path=ProjectSettings.globalize_path("res://playtest/artifacts/baseline/merge_report.json")
var file=FileAccess.open(path,FileAccess.WRITE)
file.store_string(JSON.stringify({"passed":results.size()-failures,"failed":failures,"results":results,"first_run_trace":first_run}," "))
file.close()
app.queue_free()
await process_frame
quit(1 if failures else 0)
@@ -1 +0,0 @@
uid://mumonx8gdgce
@@ -1,178 +0,0 @@
extends SceneTree
const Library = preload("res://playtest/baseline/scripts/asset_library.gd")
var lib = Library.new()
var arena: Node3D
var results: Array = []
var failures := 0
func _initialize() -> void:
call_deferred("run")
func vec(v: Vector3) -> Array:
return [snappedf(v.x,.000001),snappedf(v.y,.000001),snappedf(v.z,.000001)]
func clear_arena() -> void:
if is_instance_valid(arena):
root.remove_child(arena)
arena.queue_free()
arena=Node3D.new()
root.add_child(arena)
await physics_frame
await physics_frame
func record(name: String, passed: bool, detail: Dictionary) -> void:
results.append({"name":name,"passed":passed,"detail":detail})
if not passed:failures+=1
print(("PASS " if passed else "FAIL ")+name+" "+JSON.stringify(detail))
func run_path(kind: String, rotation_step: int, branch: int, connected := false) -> void:
await clear_arena()
var basis:=Basis(Vector3.UP,-rotation_step*PI/2)
arena.add_child(lib.create_piece(kind,Vector3.ZERO,rotation_step))
var sphere=lib.create_ball()
sphere.freeze=true
var descending: bool=kind in ["gentle","steep"]
var t:=.80 if descending else .05
var direction: Vector3=lib.path_tangent(kind,0,branch)
var start: Vector3
var target: Vector3
var exit_direction: Vector3
start=lib.ball_on_surface(kind,t,branch)
target=lib.ball_on_surface(kind,0 if descending else 1,branch)
exit_direction=-lib.path_tangent(kind,0,branch) if descending else lib.path_tangent(kind,1,branch)
if connected:
for local_center in lib.y_connectors():arena.add_child(lib.create_piece("straight",basis*local_center,rotation_step))
start=lib.path_point(kind,0,branch)+Vector3(-.65,-float(lib.catalog[kind].grooveRadius)+sphere.radius+.018,0)
target=lib.path_point(kind,1,branch)+Vector3(.85,-float(lib.catalog[kind].grooveRadius)+sphere.radius,0)
direction=Vector3.RIGHT
arena.add_child(sphere)
sphere.position=basis*start
await physics_frame
sphere.freeze=false
var initial_speed: float=1.6 if connected else 1.2
sphere.linear_velocity=Vector3.ZERO if descending else basis*direction*initial_speed
sphere.angular_velocity=Vector3.UP.cross(sphere.linear_velocity)/sphere.radius
var closest:=100.0
var reached:=false
var contact_frames:=0
var highest_speed:=0.0
var trace: Array=[]
var time_at_exit:=-1.0
for frame in range(720):
await physics_frame
var p: Vector3=basis.inverse()*sphere.position
var delta_to_goal:=p-target
var axial:=delta_to_goal.dot(exit_direction)
var lateral:=(delta_to_goal-exit_direction*axial).length()
closest=minf(closest,delta_to_goal.length())
highest_speed=maxf(highest_speed,sphere.linear_velocity.length())
if sphere.contact_count>0:contact_frames+=1
if frame%12==0:trace.append({"t":frame/120.0,"p":vec(p),"v":vec(basis.inverse()*sphere.linear_velocity)})
if axial>.04 and lateral<.22:
reached=true
time_at_exit=frame/120.0
break
if p.y < -2:break
var path_name:="connected" if connected else "upper"
record("%s_%s_r%d_b%d" % [path_name,kind,rotation_step*90,branch],reached and contact_frames>0,
{"reached_exit":reached,"time":time_at_exit,"initial_speed":0.0 if descending else initial_speed,"closest_m":closest,"contact_frames":contact_frames,"max_speed":highest_speed,"final":vec(basis.inverse()*sphere.position),"trace":trace})
func run() -> void:
Engine.physics_ticks_per_second=120
await clear_arena()
var falling=lib.create_ball()
falling.drag_enabled=false
falling.rolling_enabled=false
arena.add_child(falling)
falling.position=Vector3(0,10,0)
await physics_frame
var start_y: float=falling.position.y
var start_v: float=falling.linear_velocity.y
for i in range(120):await physics_frame
var expected_drop: float=-start_v+4.905
var observed_drop: float=start_y-falling.position.y
record("vacuum_freefall_1s",absf((falling.linear_velocity.y-start_v)+9.81)<.02 and absf(observed_drop-expected_drop)<.05,
{"initial_velocity":start_v,"velocity_delta":falling.linear_velocity.y-start_v,"distance":observed_drop,"analytic_distance":expected_drop,"position_error":absf(observed_drop-expected_drop)})
await clear_arena()
arena.add_child(lib.create_piece("straight"))
var resting=lib.create_ball()
arena.add_child(resting)
resting.position=Vector3(0,1.8,0)
for i in range(300):await physics_frame
record("sphere_groove_rest",absf(resting.position.y-(1.0-float(lib.catalog["straight"].grooveRadius)+resting.radius))<.035 and resting.linear_velocity.length()<.1,
{"position":vec(resting.position),"speed":resting.linear_velocity.length(),"contacts":resting.contact_count})
# An independent analytic benchmark: sphere rolling on a 30 degree plane.
await clear_arena()
var plane=lib.create_box(Vector3(20,.2,4),Vector3(0,-.1,0),Color.GRAY)
plane.rotation.z=-PI/6
arena.add_child(plane)
var ramp_ball=lib.create_ball()
ramp_ball.drag_enabled=false
ramp_ball.rolling_enabled=false
arena.add_child(ramp_ball)
var normal: Vector3=plane.basis*Vector3.UP
var downhill: Vector3=plane.basis*Vector3.RIGHT
ramp_ball.position=plane.transform*Vector3(0,.1,0)+normal*(ramp_ball.radius+.005)
for i in range(30):await physics_frame
var first_velocity: float=ramp_ball.linear_velocity.dot(downhill)
for i in range(60):await physics_frame
var acceleration: float=(ramp_ball.linear_velocity.dot(downhill)-first_velocity)/.5
var slip: float=absf(ramp_ball.linear_velocity.dot(downhill)-ramp_ball.angular_velocity.length()*ramp_ball.radius)
record("solid_sphere_30_degree_plane",absf(acceleration-3.503571)<.09 and slip<.06,{"acceleration":acceleration,"analytic_acceleration":3.503571,"rolling_slip":slip})
var horizontal_speeds: Array=[]
for enabled in [false,true]:
await clear_arena()
arena.add_child(lib.create_box(Vector3(30,.2,4),Vector3(0,-.1,0),Color.GRAY))
var rolling_ball=lib.create_ball()
rolling_ball.drag_enabled=false
rolling_ball.rolling_enabled=enabled
arena.add_child(rolling_ball)
rolling_ball.position=Vector3(0,rolling_ball.radius+.001,0)
rolling_ball.linear_velocity=Vector3(2,0,0)
rolling_ball.angular_velocity=Vector3(0,0,-2/rolling_ball.radius)
for i in range(240):await physics_frame
horizontal_speeds.append(rolling_ball.linear_velocity.length())
record("rolling_resistance_dissipates",absf(horizontal_speeds[0]-2)<.05 and horizontal_speeds[1]<horizontal_speeds[0]-.15,{"disabled_enabled_speeds":horizontal_speeds})
await clear_arena()
var left=lib.create_ball()
var right=lib.create_ball()
for sphere in [left,right]:
sphere.gravity_scale=0
sphere.drag_enabled=false
sphere.rolling_enabled=false
arena.add_child(sphere)
left.position=Vector3(-1,2,0);right.position=Vector3(1,2,0)
left.linear_velocity=Vector3.RIGHT;right.linear_velocity=Vector3.LEFT
for i in range(150):await physics_frame
var momentum_error: float=(left.linear_velocity+right.linear_velocity).length()
record("ball_to_ball_collision_enabled",left.linear_velocity.x<-.02 and right.linear_velocity.x>.02 and momentum_error<.02,{"left_velocity":vec(left.linear_velocity),"right_velocity":vec(right.linear_velocity),"normalized_momentum_error":momentum_error})
for kind in ["straight","turn_90","gentle","steep","y_merge"]:
for q in range(4):
for branch in range(2 if kind=="y_merge" else 1):
await run_path(kind,q,branch)
for q in range(4):
for branch in range(2):await run_path("y_merge",q,branch,true)
# Air response independently of contacts; compare actual simulated velocities.
var air_velocities: Array=[]
for mass_factor in [1.0,10.0]:
await clear_arena()
var sphere=lib.create_ball()
sphere.gravity_scale=0
sphere.mass*=mass_factor
sphere.wind_velocity=Vector3(20,0,0)
arena.add_child(sphere)
sphere.position=Vector3(0,5,0)
for i in range(60):await physics_frame
air_velocities.append(sphere.linear_velocity.x)
var ratio: float=air_velocities[0]/maxf(air_velocities[1],.000001)
record("wind_mass_response",absf(ratio-10)<.15,{"speeds":air_velocities,"ratio":ratio})
var output={"engine":Engine.get_version_info().string,"physics_engine":ProjectSettings.get_setting("physics/3d/physics_engine"),"ticks_per_second":120,"passed":results.size()-failures,"failed":failures,"results":results}
var path: String=ProjectSettings.globalize_path("res://playtest/artifacts/baseline/physics_report.json")
var file:=FileAccess.open(path,FileAccess.WRITE)
file.store_string(JSON.stringify(output," "))
file.close()
print("PHYSICS_REPORT "+path+" failures="+str(failures))
if is_instance_valid(arena):arena.queue_free()
await process_frame
quit(1 if failures else 0)
@@ -1 +0,0 @@
uid://byeccpbcfaoj3
@@ -1,89 +0,0 @@
extends SceneTree
var results: Array=[]
var failed:=0
func _initialize() -> void:
call_deferred("run")
func check(name: String, passed: bool, detail: Dictionary={}) -> void:
results.append({"name":name,"passed":passed,"detail":detail})
if not passed:failed+=1
print(("PASS " if passed else "FAIL ")+name+" "+JSON.stringify(detail))
func run() -> void:
var app=load("res://playtest/baseline/scenes/main.tscn").instantiate()
root.add_child(app)
await physics_frame
check("one_iron_ball_ready",is_instance_valid(app.ball) and app.ball.freeze and is_equal_approx(app.ball.radius,.3),{"mass_kg":app.ball.mass,"radius_m":app.ball.radius})
app.start_button.pressed.emit()
check("release_button",app.started and not app.ball.freeze)
for i in range(1800):
await physics_frame
if app.status.begins_with("成功") or app.status.begins_with("已离开"):break
check("default_course_reaches_hole",app.status.begins_with("成功"),{"status":app.status,"time":app.elapsed,"position":[app.ball.position.x,app.ball.position.y,app.ball.position.z],"max_speed":app.max_speed})
app.reset_ball()
await physics_frame
check("retry_clears_state",not app.started and app.ball.freeze and app.trail_points.is_empty() and app.elapsed==0)
check("scenario_specific_quotas",app.quota("steep")==0 and app.quota("straight")==6)
app.choose_kind("steep")
check("reject_unavailable_type",app.selected_kind!="steep")
var click:=InputEventMouseButton.new()
click.button_index=MOUSE_BUTTON_LEFT
click.pressed=true
click.position=app.camera.unproject_position(Vector3(0,1.3,.5))
app._unhandled_input(click)
check("ray_select_visible_tile",app.selected_index==app.find_cell(Vector2i(0,0)) and is_equal_approx(app.placement_height,.5))
app.build_preset(1)
await physics_frame
for kind in app.IDS:
app.choose_kind(kind)
await physics_frame
check("library_"+kind,app.records.size()==1 and app.records[0].kind==kind and app.pieces.size()==1)
for i in range(4):app.rotate_selected()
check("rotation_cycle_"+kind,app.preview_quarter==0 and app.records[0].quarter==0)
check("y_has_declared_four_cell_footprint",app.lib.footprint("y_merge")==Vector2i(2,2) and app.lib.catalog.y_merge.declaredBoundsFits and app.lib.catalog.y_merge.ports.size()==3)
check("y_not_mislabelled_as_steep_exception",not app.warning_label.text.contains("陡坡"))
app.build_preset(2)
await physics_frame
var previous: int=app.records.size()
app.selected_cell=Vector2i(2,0)
app.placement_height=.5
app.choose_kind("turn_90")
app.place_selected()
check("place_adjacent_tile",app.records.size()==previous+1 and app.find_cell(Vector2i(2,0))>=0)
app.toggle_run()
var locked: int=app.records.size()
app.remove_selected()
check("editing_locked_after_release",app.records.size()==locked)
app.toggle_run()
check("pause_preserves_run_lock",app.paused and app.started and app.ball.freeze)
app.reset_ball()
app.remove_selected()
check("delete_after_retry",app.records.size()==previous)
app.selected_cell=Vector2i(4,4)
app.place_selected()
check("reject_unattached_tile",app.records.size()==previous)
app.selected_cell=Vector2i(0,0)
app.placement_height=.5
app.choose_kind("y_merge")
app.place_selected()
check("reject_y_overlap_with_neighbor",app.records.size()==previous and app.records[app.find_cell(Vector2i(0,0))].kind=="straight" and app.status.contains("重叠"))
app.selected_cell=Vector2i(-1,1)
app.place_selected()
var y_index: int=app.find_cell(Vector2i(-1,1))
var all_cells_match: bool=y_index>=0
for cell in [Vector2i(-1,1),Vector2i(0,1),Vector2i(-1,2),Vector2i(0,2)]:all_cells_match=all_cells_match and app.find_cell(cell)==y_index
check("y_reserves_four_cells",app.records.size()==previous+1 and all_cells_match)
var model_center: Vector3=app.pieces[y_index].position
for i in range(4):app.rotate_selected()
check("y_rotates_about_fixed_center",app.pieces[y_index].position.is_equal_approx(model_center) and app.preview_quarter==0)
app.choose_kind("straight")
app.place_selected()
check("replace_y_releases_extra_cells",app.find_cell(Vector2i(-1,1))==y_index and app.find_cell(Vector2i(0,2))==-1)
var path=ProjectSettings.globalize_path("res://playtest/artifacts/baseline/playtest_report.json")
var out=FileAccess.open(path,FileAccess.WRITE)
out.store_string(JSON.stringify({"passed":results.size()-failed,"failed":failed,"results":results}," "))
out.close()
app.queue_free()
await process_frame
quit(1 if failed else 0)
@@ -1 +0,0 @@
uid://ddf8i08g3bf4k
+6 -8
View File
@@ -34,7 +34,7 @@ func add_colliders(node: Node, kind: String) -> void:
body.collision_mask = 2
body.set_meta("piece_type",kind)
var material := PhysicsMaterial.new()
material.friction = .25 if kind=="goal_hole" else 1.0 # native pair uses min.
material.friction = 0.0
material.bounce = 0.0
body.physics_material_override = material
var collider := CollisionShape3D.new()
@@ -60,16 +60,13 @@ func create_ball() -> RigidBody3D:
body.radius = float(data["radius"])
body.mass = float(profile["massKg"])
body.inertia = Vector3.ONE * (0.4 * body.mass * body.radius * body.radius)
body.drag_coefficient = float(profile["dragCoefficient"])
body.air_density = float(physics["airDensity"])
body.mu_static = float(pair["staticFriction"])
body.mu_dynamic = float(pair["dynamicFriction"])
body.rolling_resistance = float(pair["rollingResistance"])
body.collision_layer = 2
body.collision_mask = 3
var material := PhysicsMaterial.new()
material.friction = body.mu_static
material.friction = 0.0
material.bounce = float(pair["restitution"])
body.base_bounce = material.bounce
body.physics_material_override = material
var shape := SphereShape3D.new()
shape.radius = body.radius
@@ -100,7 +97,7 @@ func create_box(size: Vector3, location: Vector3, color: Color, solid := true) -
root.collision_layer = 1
root.collision_mask = 2
var pm := PhysicsMaterial.new()
pm.friction = 1.0
pm.friction = 0.0
root.physics_material_override = pm
return root
@@ -143,7 +140,8 @@ func create_goal_hole(location: Vector3) -> Node3D:
return create_piece("goal_hole",location)
func crossed_goal(previous: Vector3, current: Vector3, goal: Vector3, radius: float) -> bool:
var height: float=goal.y-float(catalog["goal_hole"].depth)
# This older straight bore has its throat entrance at the rim.
var height: float=goal.y
if previous.y<=height or current.y>height:return false
var ratio: float=(previous.y-height)/maxf(previous.y-current.y,.000001)
var crossing: Vector3=previous.lerp(current,ratio)
+1 -67
View File
@@ -1,67 +1 @@
extends RigidBody3D
var radius: float = 0.3
var drag_coefficient: float = 0.47
var air_density: float = 1.225
var wind_velocity := Vector3.ZERO
var mu_static: float = 0.42
var mu_dynamic: float = 0.32
var rolling_resistance: float = 0.025
var friction_enabled := true
var rolling_enabled := true
var drag_enabled := true
var contact_count := 0
var ball_contact_count := 0
var contact_slip := 0.0
var air_force := Vector3.ZERO
var rolling_torque := Vector3.ZERO
var travelled := 0.0
var previous_position := Vector3.ZERO
var tracking_started := false
func _ready() -> void:
continuous_cd = true
contact_monitor = true
max_contacts_reported = 12
can_sleep = false
linear_damp_mode = RigidBody3D.DAMP_MODE_REPLACE
angular_damp_mode = RigidBody3D.DAMP_MODE_REPLACE
linear_damp = 0.0
angular_damp = 0.0
func _integrate_forces(state: PhysicsDirectBodyState3D) -> void:
if freeze:
return
contact_count = state.get_contact_count()
ball_contact_count = 0
contact_slip = 0.0
var support_normal := Vector3.ZERO
for i in range(contact_count):
if state.get_contact_collider_object(i) is RigidBody3D:ball_contact_count+=1
# Contact positions are global; the sphere's radial direction is unambiguous.
var n := (state.transform.origin - state.get_contact_local_position(i)).normalized()
var relative := state.get_contact_local_velocity_at_position(i) - state.get_contact_collider_velocity_at_position(i)
var slip := relative - n * relative.dot(n)
contact_slip = maxf(contact_slip, slip.length())
if n.dot(Vector3.UP) > 0.15:
support_normal += n
# Godot exposes one native friction coefficient. Select a slip-dependent
# coefficient; native contact solver still owns the friction impulse.
physics_material_override.friction = (mu_static if contact_slip < 0.035 else mu_dynamic) if friction_enabled else 0.0
var relative_air := state.linear_velocity - wind_velocity
air_force = -0.5 * air_density * drag_coefficient * PI * radius * radius * relative_air.length() * relative_air if drag_enabled else Vector3.ZERO
state.apply_central_force(air_force)
rolling_torque = Vector3.ZERO
if rolling_enabled and support_normal.length_squared() > 0.001:
var n := support_normal.normalized()
var roll := state.angular_velocity - n * state.angular_velocity.dot(n)
if roll.length() > 0.0001:
var support := maxf(0.0, -(mass * state.total_gravity + air_force).dot(n))
var moment := 0.4 * mass * radius * radius
var limit := roll.length() * moment / state.step
rolling_torque = -roll.normalized() * minf(rolling_resistance * support * radius, limit)
state.apply_torque(rolling_torque)
if tracking_started:
travelled += state.transform.origin.distance_to(previous_position)
previous_position = state.transform.origin
tracking_started = true
extends "res://assets/balls/shared/physics.gd"
-10
View File
@@ -68,7 +68,6 @@ var start_button: Button
var quota_label: Label
var mode_selector: OptionButton
var speed_slider: HSlider
var wind_slider: HSlider
var type_buttons: Array = []
var ui_font: SystemFont
var capture_frames := -1
@@ -262,12 +261,6 @@ func setup_ui() -> void:
if not started: configure_spawn(); reset_ball()
)
column.add_child(speed_slider)
column.add_child(label_for("横风速度(m/s)",13,MUTED))
wind_slider = HSlider.new()
wind_slider.min_value = 0
wind_slider.max_value = 60
wind_slider.step = 5
column.add_child(wind_slider)
var checks := HBoxContainer.new()
var trail_check := CheckButton.new()
trail_check.text = "轨迹"
@@ -323,7 +316,6 @@ func build_preset(new_mode: int) -> void:
selected_kind="y_merge"
launch_speed=0
speed_slider.set_value_no_signal(0)
wind_slider.set_value_no_signal(0)
elif previous_mode==3:
launch_speed=1.2
speed_slider.set_value_no_signal(launch_speed)
@@ -674,7 +666,6 @@ func _physics_process(delta: float) -> void:
process_merge(delta)
return
if not is_instance_valid(ball):return
ball.wind_velocity=Vector3(0,0,float(wind_slider.value))
if started and not paused and not ball.freeze:
elapsed+=delta
max_speed=maxf(max_speed,ball.linear_velocity.length())
@@ -785,7 +776,6 @@ func process_merge(delta: float) -> void:
for i in range(merge_balls.size()):
if merge_entered.has(i) or merge_lost.has(i):continue
var sphere=merge_balls[i]
sphere.wind_velocity=Vector3(0,0,float(wind_slider.value))
max_speed=maxf(max_speed,sphere.linear_velocity.length())
if sphere.ball_contact_count>0:touching_ball=true
if lib.crossed_goal(merge_previous_positions[i],sphere.position,goal_position,sphere.radius):
@@ -19,12 +19,4 @@ func run() -> void:
app.status="同一球面 · 半径 0.3 m · 原木 / 陶瓷 / 铁";app.refresh_ui()
await capture("ball_materials")
root.remove_child(app);app.queue_free();await process_frame
var demo=load("res://playtest/materials/scenes/materials.tscn").instantiate();root.add_child(demo)
demo.load_mode("wind")
for i in range(3):await physics_frame
demo.toggle_run()
for i in range(600):await physics_frame
demo.toggle_run()
await capture("ball_materials_wind")
root.remove_child(demo);demo.queue_free();await process_frame
quit()
+1 -1
View File
@@ -7,7 +7,7 @@ func run() -> void:
entities.append({"id":"boost_"+str(quarter),"kind":"directional_boost","position":[quarter*2,0,0],"quarter":quarter})
app.apply_data({"schemaVersion":2,"pieces":[],"entities":entities,"balls":[]})
app.select_record("boost_0");app.target=Vector3(3,.5,0);app.camera_size=9;app.pitch=.95;app.update_camera()
app.status="定向加速 · 四种朝向 · 顶面接触后先转向,再固定增加 5 m/s";app.refresh_ui()
app.status="定向加速 · 四种朝向 · 顶面接触后先转向,再固定增加 %.0f m/s" % app.Booster.SPEED_GAIN;app.refresh_ui()
for i in range(15):await process_frame
await RenderingServer.frame_post_draw
root.get_texture().get_image().save_png(ProjectSettings.globalize_path("res://playtest/artifacts/styled/directional_boost.png"))
@@ -10,10 +10,10 @@ func run() -> void:
app.records=[launch,slope,tail]
for y in [0,1]:app.records.append(placement.record_at("wall",Vector3(-1,y,0),0,"wall_%d"%y))
app.spawn_specs=[{"id":"ball","ballTypeId":"iron_ball","position":[-1,3.32,0]}]
app.rebuild();app.reset_simulation();app.select_record("slope")
app.target=Vector3(0,1.5,0);app.camera_size=6.8;app.yaw=.9;app.update_camera()
app.rebuild();app.reset_simulation();app.kind="";app.refresh_selection()
app.target=Vector3(-.4,2.6,0);app.camera_size=5.6;app.yaw=.9;app.update_camera()
app.sidebar_scroll.scroll_vertical=150
app.status="陡坡底面 Y 1.82 · 高端槽底 Y 3.00,与加速方块顶面齐平";app.refresh_ui()
app.status="加速出口接陡坡 · 槽底 Y 3.00 · 两侧槽沿 Y 3.32";app.refresh_ui()
for i in range(12):await process_frame
RenderingServer.force_draw(false);RenderingServer.force_sync()
root.get_texture().get_image().save_png(ProjectSettings.globalize_path("res://playtest/artifacts/styled/surface_alignment.png"))
+12 -68
View File
@@ -5,7 +5,6 @@ var results: Array=[]
var failures:=0
var app
var demo
var wind_measurements: Dictionary={}
func _initialize() -> void: call_deferred("run")
func check(name: String, ok: bool, detail: Dictionary={}) -> void:
@@ -84,7 +83,7 @@ func run() -> void:
var correct:=false
if not event.is_empty():
var before: Vector3=event.before;var after: Vector3=event.after
var expected:=direction*(Vector2(before.x,before.z).length()+5)
var expected: Vector3=direction*(Vector2(before.x,before.z).length()+app.Booster.SPEED_GAIN)
correct=Vector3(after.x,0,after.z).distance_to(expected)<.0001 and is_equal_approx(before.y,after.y)
var pos: Vector3=body.position
await frames(8)
@@ -114,75 +113,20 @@ func run() -> void:
for kind in TYPES:
check("roll_into_hole_%s_run%d"%[kind,attempt+1],demo.events.any(func(event):return event.ballId==kind),{"events":demo.events})
check("roll_three_unique_goal_events_run%d"%(attempt+1),demo.entered.size()==3 and demo.events.size()==3 and demo.lost.is_empty())
for with_wind in [false,true]:
demo.load_mode("wind");await frames(3)
for body in demo.balls:body.wind_velocity=Vector3(20,0,0) if with_wind else Vector3.ZERO
var peaks: Array=[0.0,0.0,0.0]
demo.toggle_run()
for frame in range(600):
await physics_frame
for i in range(3):peaks[i]=maxf(peaks[i],demo.balls[i].air_force.length())
var measurements: Dictionary={}
for i in range(3):
var body=demo.balls[i]
measurements[TYPES[i]]={"dx":body.position.x-demo.spawn_specs[i].position[0],"speed":body.linear_velocity.length(),"peakAirForceN":peaks[i]}
wind_measurements["wind" if with_wind else "calm"]=measurements
var wood_delta: float=wind_measurements.wind.wood_ball.dx-wind_measurements.calm.wood_ball.dx
var ceramic_delta: float=wind_measurements.wind.ceramic_ball.dx-wind_measurements.calm.ceramic_ball.dx
var iron_delta: float=wind_measurements.wind.iron_ball.dx-wind_measurements.calm.iron_ball.dx
check("wind_clearly_moves_wood",wood_delta>1.0,{"windMinusCalmMeters":wood_delta})
check("ceramic_weak_wind_response",ceramic_delta>=-.001 and ceramic_delta<.2 and ceramic_delta<wood_delta*.15,{"windMinusCalmMeters":ceramic_delta})
check("iron_receives_nonzero_wind_force",wind_measurements.wind.iron_ball.peakAirForceN>30 and wind_measurements.wind.iron_ball.peakAirForceN<35,
{"peakAirForceN":wind_measurements.wind.iron_ball.peakAirForceN})
check("heavy_iron_barely_moves_in_reference_wind",absf(iron_delta)<.1 and absf(iron_delta)<wood_delta*.1,
{"windMinusCalmMeters":iron_delta,"maxDisplacementMeters":.1})
# The same physical iron must move when a sufficiently stronger wind acts.
demo.load_mode("wind");await frames(3)
for body in demo.balls:body.wind_velocity=Vector3.ZERO
var iron=demo.balls[2];iron.wind_velocity=Vector3(100,0,0)
var start_x: float=iron.position.x
demo.toggle_run();await frames(360)
check("strong_wind_can_move_iron",iron.position.x-start_x>.5 and iron.air_force.x>0,
{"windSpeedMps":100,"durationSeconds":3,"displacementMeters":iron.position.x-start_x,"airForceN":iron.air_force.x})
root.remove_child(demo);demo.queue_free();await process_frame
# Isolate mass with two otherwise identical iron bodies in free space.
# No drag override: this tests the actual configured iron profile.
var heavy=lib.create_ball("iron_ball")
var light=lib.create_ball("iron_ball")
var calm=lib.create_ball("iron_ball")
light.mass=heavy.mass/10
light.inertia=Vector3.ONE*(.4*light.mass*light.radius*light.radius)
var bodies=[heavy,light,calm]
for i in range(3):
var body=bodies[i]
body.freeze=true;body.gravity_scale=0;root.add_child(body);body.position=Vector3(0,10,i*3)
body.wind_velocity=Vector3(20,0,0) if i<2 else Vector3.ZERO
await frames(3)
check("iron_profile_has_normal_air_drag",heavy.drag_enabled and is_equal_approx(heavy.drag_coefficient,.47) and
is_equal_approx(heavy.drag_coefficient,lib.physics.physicsProfiles.wood_game.dragCoefficient))
for body in bodies:body.freeze=false
calm.linear_velocity=Vector3(2,0,0)
await frames(2)
var forces: Array=[heavy.air_force.x,light.air_force.x]
await frames(118)
var k: float=.5*heavy.air_density*heavy.drag_coefficient*PI*heavy.radius*heavy.radius
var expected_force: float=k*20*20
check("mass_does_not_change_initial_wind_force",forces[0]>0 and absf(forces[0]-expected_force)<.1 and absf(forces[1]-expected_force)<.1,
{"heavyLightForceN":forces,"analyticForceN":expected_force})
# dv/dt = k/m * (u-v)^2, v(0)=0, integrated for one second.
for body in [heavy,light]:
var expected_speed: float=20.0-20.0/(1.0+k/body.mass*20.0)
check("wind_motion_matches_equation_mass_"+str(body.mass),absf(body.linear_velocity.x-expected_speed)<maxf(.0005,expected_speed*.02),
{"massKg":body.mass,"speedMps":body.linear_velocity.x,"analyticSpeedMps":expected_speed})
check("lower_mass_increases_wind_acceleration",heavy.linear_velocity.x>.02 and light.linear_velocity.x>heavy.linear_velocity.x*9,
{"heavyLightSpeedsMps":[heavy.linear_velocity.x,light.linear_velocity.x]})
check("iron_still_air_drag_is_active",calm.air_force.dot(calm.linear_velocity)<0 and calm.linear_velocity.x<1.9999,
{"speedMps":calm.linear_velocity.x,"airForceX":calm.air_force.x})
for body in bodies:root.remove_child(body);body.queue_free()
await process_frame
# All production profiles keep their horizontal speed during free flight.
for kind in TYPES:
var body=lib.create_ball(kind)
root.add_child(body);body.position=Vector3(0,40,0)
body.linear_velocity=Vector3(4,0,0)
await physics_frame
var initial:Vector3=body.linear_velocity
await frames(120)
var delta:Vector3=body.linear_velocity-initial
check("gravity_only_in_air_"+kind,absf(delta.x)<.001 and absf(delta.y+9.81)<.02 and body.rolling_force.is_zero_approx() and body.physics_material_override.friction==0.0,{"velocity_change_1s":delta})
root.remove_child(body);body.queue_free()
var file:=FileAccess.open("res://playtest/artifacts/styled/ball_materials_report.json",FileAccess.WRITE)
file.store_string(JSON.stringify({"engine":Engine.get_version_info().string,"physicsHz":120,
"windSpeedMps":20,"windDurationSeconds":5,"windComparisons":wind_measurements,
"passed":results.size()-failures,"failed":failures,"results":results}," "));file.close()
print("BALL_MATERIALS_REPORT ",results.size()-failures," passed, ",failures," failed")
quit(1 if failures else 0)
+20 -6
View File
@@ -41,7 +41,7 @@ func run() -> void:
{"id":"wall2","kind":"wall","position":[0,2,0],"quarter":0}],"balls":[]})
app.select_category("balls");app.target=Vector3(0,1,0);app.camera_size=9;app.update_camera();await settle()
await click_world(app,Vector3(.1,3.001,.1))
check("mouse_picks_wall_top",app.ball_cursor.distance_to(Vector3(.1,3.32,.1))<.02 and no_overlap(app,app.ball_cursor),{"position":app.codec.array_from(app.ball_cursor)})
check("mouse_picks_wall_top",app.ball_cursor.is_equal_approx(Vector3(0,3.32,0)) and no_overlap(app,app.ball_cursor),{"position":app.codec.array_from(app.ball_cursor)})
await click_button(app.add_ball_button);await settle()
var original: Vector3=app.balls[0].position
await click_world(app,Vector3(2,0,1))
@@ -71,11 +71,15 @@ func run() -> void:
app.yaw=.72+quarter*PI/2;app.pitch=.95;app.camera_size=7;app.update_camera();await settle()
var record: Dictionary=app.records[0]
var transform:=Transform3D(Basis(Vector3.UP,-quarter*PI/2),app.lib.record_center(record))
var target: Vector3=transform*(app.lib.path_point(kind,.45)-Vector3.UP*float(app.lib.catalog[kind].grooveRadius))
await click_world(app,target)
var local: Vector3=transform.affine_inverse()*app.ball_cursor
var bounds: AABB=app.lib.record_bounds(record).grow(.35)
check("chute_pick_"+kind+"_"+str(quarter),bounds.has_point(app.ball_cursor) and no_overlap(app,app.ball_cursor) and local.y>.4,{"position":app.codec.array_from(app.ball_cursor)})
var paths: Array = app.lib.catalog[kind].upperPaths
for branch in range(paths.size()):
var expected: Vector3 = (transform * app.lib.ball_on_surface(kind,.5,branch)).snapped(Vector3.ONE*.01)
# Both Y branches have distinct inlets; the outlet is shared.
for t in [.12, .35]:
var target: Vector3 = transform * (app.lib.path_point(kind,t,branch) - Vector3.UP * float(app.lib.catalog[kind].grooveRadius))
app.ball_cursor = Vector3(10,10,10)
await click_world(app,target)
check("chute_midpoint_%s_%d_%d_%.2f" % [kind,quarter,branch,t],app.ball_cursor.is_equal_approx(expected) and no_overlap(app,app.ball_cursor),{"actual":app.ball_cursor,"expected":expected})
# The picked location must remain a normal rigid-body spawn, not attached to the track.
if kind=="gentle" and quarter==2:
await click_button(app.add_ball_button);await settle()
@@ -87,6 +91,16 @@ func run() -> void:
await click_world(app,Vector3(3,0,3))
check("simulation_blocks_ball_picking",app.ball_cursor.is_equal_approx(pending))
app.reset_simulation()
for kind in ["directional_boost","water","ice","goal_hole"]:
var level := empty_level()
level.entities = [{"id":"top","kind":kind,"position":[0,1,0],"quarter":1}]
app.apply_data(level)
app.select_category("balls")
app.pitch=1.1;app.camera_size=7;app.update_camera();await settle()
var top_y := 1.0 if kind=="goal_hole" else 2.0
app.ball_cursor = Vector3(10,10,10)
await click_world(app,Vector3(.42,top_y,.35))
check("entity_top_center_"+kind,app.ball_cursor.is_equal_approx(Vector3(0,top_y+.32,0)) and no_overlap(app,app.ball_cursor),{"actual":app.ball_cursor})
var seam:=empty_level()
seam.pieces=[{"id":"ramp","kind":"steep","position":[0,1,0],"quarter":0}]
seam.entities=[{"id":"back_wall","kind":"wall","position":[1,1.5,0],"quarter":0}]
+4 -2
View File
@@ -44,10 +44,12 @@ func run() -> void:
check("interactive_palette_exposes_boost",app.kind=="directional_boost" and app.boost_controls.is_visible_in_tree())
check("editor_has_fixed_gain_label_and_no_speed_input",app.boost_controls.find_children("*","SpinBox",true,false).is_empty() and app.boost_controls.find_children("*","Label",true,false).any(func(l):return l.text=="固定增速:+5 m/s"))
app.quarter=3;app.cursor=Vector3(2,0,-1);app.refresh_selection()
var preview=app.selection
check("standalone_preview_has_guide_and_arrow",preview.find_children("ink_boost_arrow_fill*","MeshInstance3D",true,false).size()==1 and preview.find_children("directional_boost*","MeshInstance3D",true,false).any(func(m):return is_equal_approx(m.mesh.get_aabb().size.y,1.32)))
await click(app.place_button);await frames(3)
var id: String=app.last_placed_id
check("gui_places_boost_without_gain_override",app.records.size()==1 and not app.records[0].has("speedGain") and app.records[0].quarter==3)
check("boost_retains_solid_wall_bounds",app.lib.record_bounds(app.records[0]).size==Vector3.ONE and app.pieces[0].find_children("*","StaticBody3D",true,false).size()==1)
check("boost_includes_permanent_guide_bounds",app.lib.record_bounds(app.records[0]).size.is_equal_approx(Vector3(1,1.32,1)) and app.pieces[0].find_children("*","StaticBody3D",true,false).size()==1)
app.select_record(id);app.cursor.y=1;await click(app.apply_button)
check("gui_moves_selected_boost",app.records[0].position.y==1)
app.undo();check("undo_restores_boost_position",app.records[0].position.y==0)
@@ -76,7 +78,7 @@ func run() -> void:
await load_case([{"id":"base","kind":"wall","position":[0,0,0],"quarter":0}],[])
app.select_category("interactive");app.cursor=Vector3(0,1,0);app.quarter=1;app.refresh_selection()
await click(app.place_button);await frames(3)
check("boost_stacks_on_wall",app.records.size()==2 and app.lib.record_bounds(app.records[1]).end.y==2)
check("boost_stacks_on_wall",app.records.size()==2 and is_equal_approx(app.lib.record_bounds(app.records[1]).end.y,2.32))
app.select_category("balls");await frames(3)
await click_point(app.camera.unproject_position(Vector3(0,2.001,0)))
check("mouse_places_ball_on_boost_top",app.ball_cursor.distance_to(Vector3(0,2.32,0))<.02)
+3 -2
View File
@@ -145,14 +145,15 @@ func run() -> void:
var name: String=kind+("_rolling" if rolling else "_sliding")
measurements.braking[name]={"wall":wall,"ice":ice}
check("wall_quick_stop_"+name,wall.speedMps<.1 and wall.stopSeconds>0 and wall.stopSeconds<1.2 and wall.distanceM<1.8,wall)
check("zero_native_friction_"+name,is_zero_approx(wall.nativeFriction) and is_zero_approx(ice.nativeFriction))
check("ice_remains_slippery_"+name,ice.distanceM>wall.distanceM+2 and ice.speedMps>1.5,ice)
# Wall side faces also select the same rough contact material.
# A loaded wall face brakes tangential travel with zero native friction.
for kind in TYPES:
await clear();piece("wall",Vector3.ZERO)
var body=ball(kind,Vector3(.802,.5,0));body.gravity_scale=0
await frames(3);body.freeze=false;body.constant_force=Vector3(-body.mass*9.81,0,0);body.linear_velocity=Vector3(0,0,1)
await frames(30)
check("wall_side_uses_high_friction_"+kind,body.active_surface=="wall" and body.physics_material_override.friction>=.9 and absf(body.linear_velocity.z)<.6,{"speedZ":body.linear_velocity.z,"surface":body.active_surface})
check("loaded_wall_side_uses_only_rolling_resistance_"+kind,body.active_surface=="wall" and is_zero_approx(body.physics_material_override.friction) and absf(body.linear_velocity.z)<.6,{"speedZ":body.linear_velocity.z,"surface":body.active_surface})
await clear()
# Real editor registry, flow rendering, ray selection, serialization, reset.
var app=load("res://designer/scenes/workshop.tscn").instantiate();root.add_child(app);await frames(3)
+2 -2
View File
@@ -50,7 +50,7 @@ func run() -> void:
var launcher:Dictionary=app.records[app.index_for("launcher")]
var bounds:AABB=lib.record_bounds(launcher)
var start_ball:Vector3=app.balls[0].position
check("L%d_ball_on_boost"%(index+1),launcher.kind=="directional_boost" and absf(start_ball.y-bounds.end.y-.32)<.0001 and absf(start_ball.x-bounds.get_center().x)<.5)
check("L%d_ball_on_boost"%(index+1),launcher.kind=="directional_boost" and absf(start_ball.y-launcher.position.y-lib.catalog.directional_boost.baseHeight-.32)<.0001 and absf(start_ball.x-bounds.get_center().x)<.5)
check("L%d_has_no_support_walls_or_grid_colliders"%(index+1),app.records.filter(func(r):return r.kind=="wall").all(func(r):return r.id=="stop") and app.slots_view.find_children("*","CollisionObject3D",true,false).is_empty() and app.ground_view.find_children("*","CollisionObject3D",true,false).is_empty())
# Empty virtual grids cannot catch a sphere or satisfy physics support.
var query:=PhysicsShapeQueryParameters3D.new();var shape:=SphereShape3D.new();shape.radius=.12
@@ -74,7 +74,7 @@ func run() -> void:
var boosts:Array=app.balls[0].boost_controller.events
var gain:=0.0
if boosts.size()==1:gain=Vector2(boosts[0].after.x,boosts[0].after.z).length()-Vector2(boosts[0].before.x,boosts[0].before.z).length()
check("L%d_boosted_floating_run_%d"%[index+1,repeat+1],app.solved and boosts.size()==1 and boosts[0].blockId=="launcher" and absf(gain-5)<.00001 and app.pieces.map(func(p):return p.global_transform)==originals,{"time":app.elapsed,"boosts":boosts.size(),"speed_gain":gain})
check("L%d_boosted_floating_run_%d"%[index+1,repeat+1],app.solved and boosts.size()==1 and boosts[0].blockId=="launcher" and absf(gain-app.Booster.SPEED_GAIN)<.00001 and app.pieces.map(func(p):return p.global_transform)==originals,{"time":app.elapsed,"boosts":boosts.size(),"speed_gain":gain})
var file:=FileAccess.open("res://playtest/artifacts/tutorial/floating_report.json",FileAccess.WRITE)
file.store_string(JSON.stringify({"passed":results.size()-failures,"failed":failures,"engine":Engine.get_version_info().string,"results":results}," "));file.close()
quit(1 if failures else 0)
+27
View File
@@ -12,8 +12,31 @@ func check(name: String, passed: bool, detail: Dictionary = {}) -> void:
if not passed:failures += 1
print(("PASS " if passed else "FAIL ") + name)
func check_supported_workshop_goal() -> void:
var workshop = load("res://designer/scenes/workshop.tscn").instantiate()
root.add_child(workshop)
workshop.apply_data({"schemaVersion":2, "pieces":[], "entities":[
{"id":"support", "kind":"wall", "position":[2,0,-1], "quarter":0},
{"id":"hole", "kind":"goal_hole", "position":[2,2,-1], "quarter":0}
], "balls":[{"id":"iron", "ballTypeId":"iron_ball", "position":[2.24,3.2,-1]}]})
await physics_frame
workshop.toggle_run()
for frame in range(360):
await physics_frame
var ball = workshop.balls[0]
check("workshop_scores_inside_supported_goal", workshop.events.size()==1
and workshop.events[0].goalId=="hole" and workshop.entered.size()==1
and workshop.status.begins_with("全部入洞") and not ball.visible and ball.position.y>1.3,
{"events":workshop.events.duplicate(true), "centerY":ball.position.y, "status":workshop.status})
root.remove_child(workshop)
workshop.queue_free()
func run() -> void:
await check_supported_workshop_goal()
var lib = Library.new()
check("skimming_above_mouth_does_not_score", not lib.crossed_goal(Vector3(-.3,.4,0),Vector3(.3,.3,0),Vector3.ZERO,.3))
check("grazing_throat_edge_does_not_score", not lib.crossed_goal(Vector3(.08,.4,0),Vector3(.08,-1.2,0),Vector3.ZERO,.3))
check("rising_from_below_does_not_score", not lib.crossed_goal(Vector3.DOWN*1.2,Vector3.UP,Vector3.ZERO,.3))
var arena := Node3D.new();root.add_child(arena)
var trials: Array = []
var offsets := [Vector2.ZERO,Vector2(.12,0),Vector2(.26,0),Vector2(.36,0),
@@ -60,6 +83,10 @@ func run() -> void:
app.started=false;app.unlocked=4;app.open_lesson(index)
for r in Maps.solution(app.lesson):
app.records.append({"id":r.id,"kind":r.kind,"position":app.lib.vector(r.position),"quarter":int(r.quarter)})
if index==0:
# Exercise a rolling approach with the exit sealed, as in the workshop.
var bottom: Vector3 = app.placement.bottom_of(app.goals[0])
app.records.append({"id":"support","kind":"wall","position":bottom-Vector3.UP,"quarter":0})
app.rebuild();app.reset_simulation()
for i in range(3):await physics_frame
app.toggle_run()
+32 -7
View File
@@ -70,6 +70,8 @@ func run() -> void:
var slope:=placement.align_surfaces(record("steep",Vector3(0,2,0),2),[launcher])
check("screenshot_reproduces_old_018_lip",absf(seam(record("steep",Vector3(0,2,0),2),launcher)-.18)<.00001)
check("screenshot_exact_y_182",absf(slope.position.y-1.82)<.00001 and seam(slope,launcher)<.00001)
var reverse_join := placement.align_surfaces(record("directional_boost",launcher.position+Vector3.UP*.5,0,"launcher"),[slope])
check("placing_launcher_second_joins_same_surface",reverse_join.position.is_equal_approx(launcher.position))
var wall:=record("wall",Vector3(-1,2,0),0,"wall")
check("top_click_still_stacks",placement.on_face(wall,Vector3(-1,3,0),Vector3.UP,"steep",2)==Vector3(-1,3,0))
check("wall_side_still_bottom_aligned",placement.on_face(wall,Vector3(-.5,2.5,0),Vector3.RIGHT,"wall",0)==Vector3(0,2,0))
@@ -81,14 +83,18 @@ func run() -> void:
# No direct initial velocity or test-only material overrides: normal iron,
# real launcher top contact, real imported solid meshes, all four rotations.
for kind in ["gentle","steep"]:
for quarter in range(4):await roll_across(kind,quarter)
for quarter in range(4):
for offset in [0.0,-.05,.05]:await roll_across(kind,quarter,offset)
var file:=FileAccess.open(Output,FileAccess.WRITE)
file.store_string(JSON.stringify({"engine":Engine.get_version_info().string,"passed":results.size()-failures,"failed":failures,"results":results}," "));file.close()
quit(1 if failures else 0)
func check_interfaces(launcher:Dictionary) -> void:
var app=load("res://designer/scenes/workshop.tscn").instantiate();root.add_child(app);await frames(3)
app.records=[launcher];app.rebuild();app.select_category("chutes");app.kind="steep";app.quarter=2
app.records=[launcher];app.rebuild()
var meshes:Array=app.pieces[0].find_children("*","MeshInstance3D",true,false)
check("standalone_launcher_has_rims_and_arrow",meshes.any(func(m):return not str(m.name).begins_with("ink_") and absf(m.mesh.get_aabb().size.y-1.32)<.001) and meshes.any(func(m):return str(m.name).begins_with("ink_boost_arrow_fill")))
app.select_category("chutes");app.kind="steep";app.quarter=2
app.target=Vector3(0,2,0);app.camera_size=8;app.update_camera();await frames(3)
await click(app.camera.unproject_position(Vector3(-.499,2.7,0)))
check("workshop_mouse_side_pick_aligns",not app.face_pick.is_empty() and absf(app.cursor.y-1.82)<.00001,{"cursor":str(app.cursor)})
@@ -123,27 +129,46 @@ func check_interfaces(launcher:Dictionary) -> void:
check("player_preview_matches_commit",index>=0 and app.records[index].position.is_equal_approx(preview))
root.remove_child(app);app.queue_free();await frames(3)
func roll_across(kind:String,quarter:int) -> void:
func roll_across(kind:String,quarter:int,offset:float) -> void:
var basis:=Basis(Vector3.UP,-quarter*PI/2)
var direction:Vector3=basis*Vector3.LEFT # local high end to low end
var launch:=record("directional_boost",-direction+Vector3.UP*2,(quarter+2)%4,"launch")
var slope:=placement.align_surfaces(record(kind,Vector3.UP*2,quarter,"slope"),[launch])
var tail:=placement.align_surfaces(record("straight",direction+Vector3.UP*2,quarter,"tail"),[slope])
var arena:=Node3D.new();root.add_child(arena)
for item in [launch,slope,tail]:
var pieces := [launch,slope,tail]
var across := direction.cross(Vector3.UP)
for item in pieces:
var piece:Node3D=lib.create_piece(item.kind,lib.record_center(item),item.quarter)
piece.set_meta("record_id",item.id);arena.add_child(piece)
var ball=lib.create_ball();ball.freeze=true;arena.add_child(ball)
ball.position=launch.position+Vector3.UP*(1+lib.ball_radius()+.02)
await frames(3);ball.freeze=false
ball.position=launch.position+Vector3.UP*(1+lib.ball_radius()+.02)+across*offset
await frames(3)
var mouth:Vector3 = launch.position + Vector3.UP + direction*.5
if offset==0:
# Compare both sides 1 mm from the joint, across floor, curved sides and rims.
var max_step := 0.0
for z in [-.45,-.32,-.25,-.15,0,.15,.25,.32,.45]:
var heights:Array[float]=[]
for side in [-1,1]:
var sample:Vector3=mouth+across*z+direction*.001*side
var ray:=PhysicsRayQueryParameters3D.create(sample+Vector3.UP,sample-Vector3.UP,1)
var hit:=arena.get_world_3d().direct_space_state.intersect_ray(ray)
heights.append(hit.position.y if not hit.is_empty() else INF)
max_step=maxf(max_step,absf(heights[0]-heights[1]))
check("%s_q%d_full_mouth" % [kind,quarter],max_step<.003,{"max_step_m":max_step})
ball.freeze=false
var entry_speed := -1.0
var contacts:Array=[];var crossed:=false;var time:=0.0
for tick in range(480):
await physics_frame;time=(tick+1)/120.0
if entry_speed<0 and (ball.position-mouth).dot(direction)>.06:
entry_speed=ball.linear_velocity.dot(direction)
for collider in ball.get_colliding_bodies():
var node:Node=collider
while node!=null and not node.has_meta("record_id"):node=node.get_parent()
if node!=null and node.get_meta("record_id") not in contacts:contacts.append(node.get_meta("record_id"))
if ball.position.dot(direction)>1.3 and "tail" in contacts:crossed=true;break
if ball.position.y<0:break
check("%s_q%d_real_ball_crosses_both_seams"%[kind,quarter],crossed and "slope" in contacts and ball.boost_controller.events.size()==1,{"contacts":contacts,"time":time,"final":str(ball.position),"slope_y":slope.position.y,"tail_y":tail.position.y,"boosts":ball.boost_controller.events.size()})
check("%s_q%d_offset_%.2f_real_ball"%[kind,quarter,offset],entry_speed>lib.Booster.SPEED_GAIN*.5 and crossed and "slope" in contacts and ball.boost_controller.events.size()==1,{"entry_speed_mps":entry_speed,"contacts":contacts,"time":time,"final":str(ball.position),"slope_y":slope.position.y,"tail_y":tail.position.y,"boosts":ball.boost_controller.events.size()})
root.remove_child(arena);arena.queue_free();await frames(3)
+1 -1
View File
@@ -115,7 +115,7 @@ func run() -> void:
check("L%d_gui_solution_enters_goal"%(index+1),app.solved and app.entered.size()==1 and app.lost.is_empty() and app.events.size()==1 and app.events[0].goalId=="goal" and required.all(func(id):return app.contact_ids.has(id)),{"time":app.elapsed,"contacts":app.contact_ids.keys(),"events":app.events})
if not app.solved:write_report();quit(1);return
var boosts:Array=app.balls[0].boost_controller.events
check("L%d_real_launch_block_fires_once"%(index+1),boosts.size()==1 and boosts[0].blockId=="launcher" and is_equal_approx(Vector2(boosts[0].after.x,boosts[0].after.z).length()-Vector2(boosts[0].before.x,boosts[0].before.z).length(),5.0))
check("L%d_real_launch_block_fires_once"%(index+1),boosts.size()==1 and boosts[0].blockId=="launcher" and is_equal_approx(Vector2(boosts[0].after.x,boosts[0].after.z).length()-Vector2(boosts[0].before.x,boosts[0].before.z).length(),app.Booster.SPEED_GAIN))
var accepted:Dictionary={"lesson":index+1,"time":app.elapsed,"layout":layout,"input_events":app.interface_events.duplicate(true),"contacts":app.contact_ids.keys(),"goal_events":app.events.duplicate(true),"trace":app.samples.duplicate(true),"launch_boosts":boosts.map(func(e):return {"blockId":e.blockId,"before":app.codec.array_from(e.before),"after":app.codec.array_from(e.after),"tick":e.tick})}
runs.append(accepted);save_json("%02d_accepted.json"%(index+1),accepted)
await snapshot("%02d_completed"%(index+1))
+7 -7
View File
@@ -18,15 +18,15 @@
水流固定为 **5 m/s**,由 [behavior.gd](../../assets/blocks/water/behavior.gd) 的常量定义;关卡只保存位置与朝向,没有逐块速度控件。额外写入的 `flowSpeed` 字段不会被载入为速度,也不保留在再次保存的文件中。
当前测试使用水密度 1000 kg/m³、水中阻力系数 0.47,三种球共用水的作用公式,保持原有质量、尺寸和空气响应配置。浸没体积通过球体竖直截柱与相邻水格范围的并集求得;浮力为排开水的重量,水阻力按相对流速计算。跨格不产生固体接缝,重叠体积不会重复提供浮力。不同流向接缝按浸没部分合成当前有效流速,是首版近似。
当前测试使用水密度 1000 kg/m³、水中阻力系数 0.47,三种球共用水的作用公式,保留原有质量和尺寸。浸没体积通过球体竖直截柱与相邻水格范围的并集求得;浮力为排开水的重量,水阻力按相对流速计算。跨格不产生固体接缝,重叠体积不会重复提供浮力。不同流向接缝按浸没部分合成当前有效流速,是首版近似。
当前是由作者铺设的固定水域,不进行水源扩散、水量守恒或河道流体求解。方块朝向指定局部流向;水不能把球穿过实际河岸。没有按球种类硬编码浮沉或锁定沉底球。
三球同时释放后,木球浮起并到达下游;330 kg 陶瓷球与铁球沉到粗糙墙壁河床,仍受水流作用。8 秒模拟时陶瓷球最大水平位移约 1.36 m、速度约 0.10 m/s;铁球位移约 0.38 m、速度约 0.039 m/s。木球到达尽头后会受到岸壁碰撞和摩擦,截图中的最终浸没比例不应当作为自由漂浮平衡比例。水速 5 m/s 不等于小球必须以 5 m/s 运动。
三球同时释放后,木球浮起并到达下游;330 kg 陶瓷球与铁球沉到粗糙墙壁河床,仍受水流作用。旧接触模型的 8 秒模拟中,陶瓷球最大水平位移约 1.36 m、速度约 0.10 m/s;铁球位移约 0.38 m、速度约 0.039 m/s。木球到达尽头后会受到岸壁碰撞和摩擦,截图中的最终浸没比例不应当作为自由漂浮平衡比例。水速 5 m/s 不等于小球必须以 5 m/s 运动。
## 冰块
冰块是静态实心 1×1×1 方块。与三种球的接触参数统一采用静摩擦 0.03、动摩擦 0.02、滚动阻力 0.002、恢复系数 0.02;配置见 [physics.json](../../assets/collections/storybook/physics.json)。
冰块是静态实心 1×1×1 方块。与三种球的接触参数统一采用滚动阻力 0.002、恢复系数 0.02;配置见 [physics.json](../../assets/collections/storybook/physics.json)。
破碎按一次真实接触事件的**法向冲量 1000 N·s**判定,接近速度需达到 0.5 m/s 以排除静态接触及低速噪声。冲量是力对碰撞时间的积分,这里不使用依赖物理步长的单帧“力峰值”。同一事件的接触点合并计算,持续承重不累计冲量;预测接触不会提前消耗本次撞击。破碎后移除该冰块的实体碰撞与外观,重置恢复完整冰块及判定状态。
@@ -44,11 +44,11 @@ Jolt 的接触冲量属于预估值,多物体同时接触时可能不精确。
## 墙壁减速
所有现用 `wall` 方块与三种球的接触参数均调整为静摩擦 **1.0**、动摩擦 **0.9**、滚动阻力 **0.8**、恢复系数 **0.02**。各面共享同一规则,无需逐块配置;滑槽、球洞、加速方块不因外观接近墙块而继承这些数值。
所有现用 `wall` 方块与三种球的运行时接触参数为滚动阻力 **0.8**、恢复系数 **0.02**。各面共享同一规则,无需逐块配置;滑槽、球洞、加速方块不因外观接近墙块而继承这些数值。
滑动摩擦由原生接触求解,滚动阻力通过受限力矩耗能;受压墙侧面也参与。没有按位置停止球、修改球质量或添加泥沙机制。当前仍沿用每刚体摩擦近似:同时接触多种表面时选择较粗糙的已配置接触对,不等价于独立逐接触材质求解。
原生接触摩擦为零。滚动阻力作用在承托面的切向,受压墙侧面也参与。多个接触同时存在时合成承托方向,只对球施加一次滚动阻力。
3 m/s 初速的专项测试中,三球从滑动开始约 0.40~0.41 秒、0.52 m 后降至停止容差;从纯滚动开始约 0.54 秒、0.81 m。停止容差为线速度低于 0.05 m/s。相同初态的冰面对照在 2 秒后仍有约 2.4~2.8 m/s。
旧接触模型的 3 m/s 初速专项测试中,三球从滑动开始约 0.40~0.41 秒、0.52 m 后降至停止容差;从纯滚动开始约 0.54 秒、0.81 m。停止容差为线速度低于 0.05 m/s。相同初态的冰面对照在 2 秒后仍有约 2.4~2.8 m/s。
可视墙面/冰面场景使用相同固定加速块从静止起步(+5 m/s);上述 3 m/s 初态只用于受控制动测量。
@@ -56,7 +56,7 @@ Jolt 的接触冲量属于预估值,多物体同时接触时可能不精确。
实际修改 [现用 physics.json](../../assets/collections/storybook/physics.json) 中对应预设的 `massKg`:原木 `wood_game`、陶瓷 `ceramic_game`、铁球 `solid_iron_test`。当前起始质量为 60 / 330 / 890.0760306150601 kg;330 kg 陶瓷球已正式应用,计算阶段的 75 kg 输入与原结果作为历史记录保留。质量改变后,运行时按原半径和惯量模型重新计算转动惯量,不需要重建模型。
每轮先明确预期,优先只改一种球的质量;固定水速、冰块阈值、表面接触参数、几何及对照初态。重跑相关场景,记录浮沉、冲量/破碎、停止时间和距离。三球从相同高度释放,不通过改变初速度或高度抵消质量变化;既有受风、入洞和加速回归仍在 `playtest/materials/`。
每轮先明确预期,优先只改一种球的质量;固定水速、冰块阈值、表面接触参数、几何及对照初态。重跑相关场景,记录浮沉、冲量/破碎、停止时间和距离。三球从相同高度释放,不通过改变初速度或高度抵消质量变化;自由飞行、入洞和加速回归仍在 `playtest/materials/`。
`test-environment` 与 `test-balls` 的断言包含当前质量、比例和玩法预期。调整后若失败,应先解释差异并确认新的目标,再更新预期;不能静默覆盖测试中的真实质量或为了通过而降低检查标准。将每轮实际配置、初态与报告保留到 `playtest/artifacts/environment/mass_tuning/<轮次>/`,完整约定见 [质量调校流程](../../references/design/physics_system.md#25-小球质量的持续调校)。
+2 -2
View File
@@ -88,8 +88,8 @@ func refresh_ui() -> void:
description.text={"water":"流速固定 5 m/s · 水面泡沫顺流漂动\n水体可穿入 · 河床/岸壁是独立墙块",
"ice":"同一高度从静止释放 · 冲量 ≥ 1000 N·s 破碎\n不累计静置承重 · 不是按球种类判定",
"rest":"三球直接放在冰面上 · 无释放落差\n检验重铁球持续承重也不会压碎冰块",
"wall":"固定加速块起步 +5 m/s · 粗糙墙面制动\n三种球使用相同的墙面接触规则",
"ice_slide":"相同加速起点 · 冰面低摩擦、低滚阻\n与墙面场景对比滑行距离"}[test_mode]
"wall":"固定加速块起步 +%.0f m/s · 粗糙墙面制动\n三种球使用相同的墙面接触规则" % Booster.SPEED_GAIN,
"ice_slide":"相同加速起点 · 冰面滚动阻力低\n与墙面场景对比滑行距离"}[test_mode]
var lines: PackedStringArray=[]
for i in range(balls.size()):
var ball=balls[i]
@@ -0,0 +1,13 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 75.0 kg; x=8.20289516448975 m; final_y=1.93543541431427
MASS_TRIAL 114.0 kg; x=8.20000076293945 m; final_y=1.42689049243927
MASS_TRIAL 150.0 kg; x=8.20236778259277 m; final_y=1.30000948905945
MASS_TRIAL 200.0 kg; x=8.20000267028809 m; final_y=1.3000100851059
MASS_TRIAL 250.0 kg; x=7.8447847366333 m; final_y=1.30000996589661
MASS_TRIAL 300.0 kg; x=2.97876834869385 m; final_y=1.30000984668732
MASS_TRIAL 310.0 kg; x=2.23834562301636 m; final_y=1.30000984668732
MASS_TRIAL 330.0 kg; x=1.36199700832367 m; final_y=1.30000984668732
MASS_TRIAL 350.0 kg; x=1.11907255649567 m; final_y=1.29922604560852
MASS_TRIAL 400.0 kg; x=0.95344060659409 m; final_y=1.30000984668732
MASS_TRIAL 500.0 kg; x=0.73166847229004 m; final_y=1.2998274564743
@@ -0,0 +1,3 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 320.0 kg; x=1.53083384037018 m; final_y=1.29988706111908
@@ -0,0 +1,3 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 315.0 kg; x=1.83812749385834 m; final_y=1.30000984668732
@@ -0,0 +1,3 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 312.5 kg; x=2.02345991134644 m; final_y=1.30000996589661
@@ -0,0 +1,3 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 313.75 kg; x=1.92791843414307 m; final_y=1.30000984668732
@@ -0,0 +1,3 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 313.125 kg; x=1.96931135654449 m; final_y=1.30000984668732
@@ -0,0 +1,3 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 312.8125 kg; x=2.00182914733887 m; final_y=1.30000996589661
@@ -0,0 +1,3 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 312.96875 kg; x=1.99357950687408 m; final_y=1.30000984668732
@@ -0,0 +1,7 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 312.96875 kg; x=1.99357950687408 m; final_y=1.30000984668732
MASS_TRIAL 330.0 kg; x=1.36199700832367 m; final_y=1.30000984668732
MASS_TRIAL 312.96875 kg; x=1.99360370635986 m; final_y=1.30000984668732
MASS_TRIAL 330.0 kg; x=1.36199700832367 m; final_y=1.30000984668732
MASS_TRIAL 330.0 kg; x=1.36222124099731 m; final_y=1.29912185668945
@@ -0,0 +1,13 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 75.0 kg; x=8.20289516448975 m; final_y=1.93543541431427
MASS_TRIAL 114.0 kg; x=8.20000076293945 m; final_y=1.42689049243927
MASS_TRIAL 150.0 kg; x=8.20236778259277 m; final_y=1.30000948905945
MASS_TRIAL 200.0 kg; x=8.20000267028809 m; final_y=1.3000100851059
MASS_TRIAL 250.0 kg; x=7.8447847366333 m; final_y=1.30000996589661
MASS_TRIAL 300.0 kg; x=2.97876834869385 m; final_y=1.30000984668732
MASS_TRIAL 310.0 kg; x=2.23834562301636 m; final_y=1.30000984668732
MASS_TRIAL 330.0 kg; x=1.36199700832367 m; final_y=1.30000984668732
MASS_TRIAL 350.0 kg; x=1.11907255649567 m; final_y=1.29922604560852
MASS_TRIAL 400.0 kg; x=0.95344060659409 m; final_y=1.30000984668732
MASS_TRIAL 500.0 kg; x=0.73166847229004 m; final_y=1.2998274564743
@@ -0,0 +1,3 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 320.0 kg; x=1.53083384037018 m; final_y=1.29988706111908
@@ -0,0 +1,3 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 315.0 kg; x=1.83812749385834 m; final_y=1.30000984668732
@@ -0,0 +1,3 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 312.5 kg; x=2.02345991134644 m; final_y=1.30000996589661
@@ -0,0 +1,3 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 313.75 kg; x=1.92791843414307 m; final_y=1.30000984668732
@@ -0,0 +1,3 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 313.125 kg; x=1.96931135654449 m; final_y=1.30000984668732
@@ -0,0 +1,3 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 312.8125 kg; x=2.00182914733887 m; final_y=1.30000996589661
@@ -0,0 +1,3 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 312.96875 kg; x=1.99357950687408 m; final_y=1.30000984668732
@@ -0,0 +1,7 @@
Godot Engine v4.7.2.stable.official.ed1daf0bf - https://godotengine.org
MASS_TRIAL 312.96875 kg; x=1.99357950687408 m; final_y=1.30000984668732
MASS_TRIAL 330.0 kg; x=1.36199700832367 m; final_y=1.30000984668732
MASS_TRIAL 312.96875 kg; x=1.99360370635986 m; final_y=1.30000984668732
MASS_TRIAL 330.0 kg; x=1.36199700832367 m; final_y=1.30000984668732
MASS_TRIAL 330.0 kg; x=1.36222124099731 m; final_y=1.29912185668945
+9 -12
View File
@@ -2,13 +2,7 @@
2026-11-17。原木球、陶瓷球和铁球使用同一球面几何,半径均为 0.3 m,具有独立 `.blend` / `.glb` 与材质。木球使用原木纹理;陶瓷使用浅色釉面及蓝色纹饰。工坊在「小球」菜单中提供三种球,放置、贴表面点选、悬空坐标、移动、撤销与保存均保留所选球种;旧关卡继续按铁球读取。
| 球种 | 质量 | 空气阻力系数 | 当前风场行为 |
| --- | ---: | ---: | --- |
| 原木球 | 60 kg | 0.47 | 明显受风。 |
| 陶瓷球 | 330 kg | 0.04 | 弱受风;质量为木球的 5.5 倍。 |
| 铁球 | 约 890.08 kg | 0.47 | 正常受风,普通测试风场下难以推动。 |
质量与阻力系数是当前玩法验证参数,不是现实材料测量值。使用现有相对空气速度阻力公式,不额外施加“风扇倍率”,不通过改写球位移或速度制造风效应;铁球恢复使用 0.47 的非零阻力系数,风力和静止空气阻力均正常计算。相同尺寸和瞬间相对风速下,铁球与木球受到相同空气力;铁球的大质量带来更小空气加速度,在滑槽上也产生更大的正常滚动阻力。三种球沿用原有滚动/接触调校。完整规则见 [物理系统](../../references/design/physics_system.md#332-当前三种球的玩法参数),数据见 [physics.json](../../assets/collections/storybook/physics.json)。
木球 60 kg、陶瓷球 330 kg、铁球约 890.08 kg。三种球使用相同的滚动阻力模型。水中根据质量与浸没体积产生浮沉差异,飞行时保留水平速度。[现行物理规则](../../references/design/physics_system.md)
## 打开对照场景
@@ -16,21 +10,24 @@
./scripts/materials.zsh
```
原生入口是 [materials.tscn](scenes/materials.tscn)。菜单提供三种独立布局,切换会重置实验:
原生入口是 [materials.tscn](scenes/materials.tscn)。菜单提供两种独立布局,切换会重置实验:
- **滚动入洞**:三条同样的坡道,各球从静止滚入自己的球洞。
- **同风对照**:三条相同水平滑槽,统一沿 +X 施加 20 m/s 的风;面板实时显示速度和位移。
- **定向加速**:三种球落在同朝向的加速块上,首次真实顶面接触后都沿箭头获得固定 +5 m/s。
启动/暂停、重置均在面板中;右键旋转、中键平移、滚轮缩放、F 全景。风场由该实验的环境配置提供。场景没有被列为正式关卡,也不改变工坊草稿。
启动/暂停、重置均在面板中;右键旋转、中键平移、滚轮缩放、F 全景。场景没有被列为正式关卡,也不改变工坊草稿。
![三种独立小球及工坊菜单](../artifacts/styled/ball_materials.png)
![同一风场运行五秒后的原生画面](../artifacts/styled/ball_materials_wind.png)
## 旧版风场实验记录
以下为停用风力前的测试与截图。当前专项以三球各自的自由飞行验证零空气阻力。
![旧版同一风场运行五秒后的原生画面](../artifacts/styled/ball_materials_wind.png)
截图保留此前材质展示;下列数值与材质球报告已按 330 kg 陶瓷球重新验证。冰块行为及新增方块的工坊放置由 [环境专项](../environment/README.md) 覆盖。
## 已运行验证
### 当时的验证
```sh
./scripts/run.zsh test-balls
-4
View File
@@ -1,7 +1,6 @@
extends RefCounted
const TYPES = ["wood_ball","ceramic_ball","iron_ball"]
const WIND = Vector3(20,0,0)
static func level(mode: String, lib) -> Dictionary:
var pieces: Array=[]
@@ -15,9 +14,6 @@ static func level(mode: String, lib) -> Dictionary:
for x in range(-1,2):pieces.append({"id":"track_%d_%d"%[i,x],"kind":"straight","position":[x,.5,z],"quarter":0})
entities.append({"id":"goal_%d"%i,"kind":"goal_hole","position":[2,1.18,z],"quarter":0})
position=Vector3(-2,1,z)+Basis(Vector3.UP,-PI)*lib.ball_on_surface("gentle",.82)
elif mode=="wind":
for x in range(-1,8):pieces.append({"id":"track_%d_%d"%[i,x],"kind":"straight","position":[x,0,z],"quarter":0})
position=Vector3(0,0,z)+lib.ball_on_surface("straight",.5)
else:
entities.append({"id":"boost_%d"%i,"kind":"directional_boost","position":[-2,0,z],"quarter":0})
for x in range(-1,5):entities.append({"id":"floor_%d_%d"%[i,x],"kind":"wall","position":[x,0,z],"quarter":0})
+6 -10
View File
@@ -5,7 +5,6 @@ var test_mode := "roll"
var mode_selector: OptionButton
var metrics_label: Label
var description_label: Label
var wind_setting := Vector3.ZERO
func setup_environment() -> void:
super.setup_environment()
@@ -26,8 +25,8 @@ func setup_ui() -> void:
var col:=VBoxContainer.new();col.add_theme_constant_override("separation",10);panel.add_child(col)
col.add_child(label("小球材质对照",24))
mode_selector=OptionButton.new()
for title in ["滚动入洞","同风对照 · 20 m/s →","定向加速 · 固定 +5 m/s"]:mode_selector.add_item(title)
mode_selector.item_selected.connect(func(i):load_mode(["roll","wind","boost"][i]))
for title in ["滚动入洞","定向加速 · 固定 +%.0f m/s" % Booster.SPEED_GAIN]:mode_selector.add_item(title)
mode_selector.item_selected.connect(func(i):load_mode(["roll","boost"][i]))
col.add_child(mode_selector)
description_label=label("",14);description_label.custom_minimum_size.x=290;col.add_child(description_label)
var controls:=row(col)
@@ -42,18 +41,16 @@ func initialize_level() -> void:
load_mode(test_mode)
func load_mode(mode: String) -> void:
test_mode=mode if mode in ["roll","wind","boost"] else "roll"
wind_setting=Cases.WIND if test_mode=="wind" else Vector3.ZERO
mode_selector.select(["roll","wind","boost"].find(test_mode))
test_mode=mode if mode in ["roll","boost"] else "roll"
mode_selector.select(["roll","boost"].find(test_mode))
apply_data(Cases.level(test_mode,lib))
target=Vector3(2 if test_mode=="wind" else 0,.8,0)
target=Vector3(0,.8,0)
camera_size=12.5;update_camera()
refresh_ui()
func reset_simulation() -> void:
super.reset_simulation()
for i in range(balls.size()):
balls[i].wind_velocity=wind_setting
tags[i].text=kind_name(spawn_specs[i].ballTypeId)
tags[i].font_size=32
refresh_ui()
@@ -62,8 +59,7 @@ func refresh_ui() -> void:
if run_button==null or metrics_label==null:return
run_button.text="继续" if paused else ("暂停" if started else "启动")
description_label.text={"roll":"同一坡道 · 从静止出发 · 各自进入球洞",
"wind":"同尺寸、同风场、同一平直滑槽\n原木易受风 · 陶瓷弱受风 · 铁球难推动",
"boost":"三种球均沿箭头转向,再增加 5 m/s\n每次顶面接触只触发一次"}[test_mode]
"boost":"三种球均沿箭头转向,再增加 %.0f m/s\n每次顶面接触只触发一次" % Booster.SPEED_GAIN}[test_mode]
var lines: PackedStringArray=[]
for i in range(balls.size()):
var b=balls[i]
+1 -1
View File
@@ -20,7 +20,7 @@
| 04 [读懂两种坡度](scenes/lesson_04.tscn) | 按 0.5 m / 1 m 落差搭配缓坡和急坡 | 缓坡 ×1、急坡 ×1、直槽 ×2 | 空中格高度不同,需比较槽口并正确旋转;交换两种坡会受阻。 |
| 05 [山间长路](scenes/lesson_05.tscn) | 综合前四关,规划较长路线 | 直槽 ×5、90°弯槽 ×3、缓坡 ×1、急坡 ×1 | 参考路线包含三次转弯和两种下降坡段,玩家可在配额内探索其他路线。 |
前两关提供便于起步的初始朝向,五关均采用相同的缩略图旋转操作;第三关开始必须主动调整朝向。每关提供概念提示,不自动填入参考解,也不按排列与参考解一致来判胜;**真实穿过球洞底部截面才算成功**,其他物理解法同样有效。
前两关提供便于起步的初始朝向,五关均采用相同的缩略图旋转操作;第三关开始必须主动调整朝向。每关提供概念提示,不自动填入参考解,也不按排列与参考解一致来判胜;**球心从上方进入球洞喉口并满足净空即算入洞**,其他物理解法同样有效。
## 操作
+1 -1
View File
@@ -10,7 +10,7 @@ static func initial_level(lesson: Dictionary, lib) -> Dictionary:
if entity.id==lesson.spawn.entityId:launcher=entity;break
assert(not launcher.is_empty(),"Missing launch block")
var basis:=Basis(Vector3.UP,-int(launcher.quarter)*PI/2)
var top:float=lib.catalog[launcher.kind].boundsBlender.max[2]
var top:float=lib.catalog[launcher.kind].baseHeight
var pos:Vector3=lib.vector(launcher.position)+basis*Vector3(float(lesson.spawn.get("localX",0)),top+lib.ball_radius()+.02,0)
data.balls = [{"id":"student_ball","ballTypeId":"iron_ball","position":[pos.x,pos.y,pos.z]}]
return data