BlueGit

projects-timfalken-com meteors

Merge branch 'feature/t1124-cluster-descent-only'

timfa Grok Bot · pushed by timfa

Authored 2026-11-13 · 4 days ago

Hash
59ab8ab3a09d0494b6bd91a0aeaa7910153db363
Pipeline
Passed
11 files changed +221 −76
README.md +7 −4
@@ -76,10 +76,13 @@ hoger); een verticale match van 3 krijgt 120 % daarvan, en elk extra
76 76 blokje +5 % (wordt nergens in het spel uitgelegd). De massa bepaalt hoe
77 77 lang de sprong omhoog duurt (onafhankelijk van de hoogte). Op de apex
78 78 versnelt de cluster geleidelijk tot de valsnelheid
79 (`apexEaseTime = 0,15 × fallTime`); daarna is de daalsnelheid constant
80 en **gehalveerd** (`fallSpeed = 0,5 × 13 / fallTime`, t1122). De
81 luchtweerstand (`fallTime`) bepaalt die valsnelheid én hoe snel de
82 visuele landing-bounce is (`bounceDuration = 0,12 × fallTime`). Een
79 (`apexEaseTime = 0,15 × fallTime`); daarna zweeft een cluster omlaag
80 op de **gehalveerde** eindsnelheid
81 (`clusterFallSpeed = 0,5 × 13 / fallTime`, t1122/t1124). Losse blokjes
82 (spawn, ongesteund, cargo) vallen op de volle
83 `fallSpeed = 13 / fallTime`. De luchtweerstand (`fallTime`) bepaalt die
84 valsnelheden én hoe snel de visuele landing-bounce is
85 (`bounceDuration = 0,12 × fallTime`). Een
83 86 vastgehouden blokje krijgt dezelfde schaal-tween als Tim's KWin Click
84 87 Tween (150 ms easeOutBack naar 80 %, 720 ms easeOutElastic terug).
85 88 Wissels (speler en bot) animeren visueel in 100 ms easeOutCubic (t1121).
@@ -76,10 +76,13 @@ hoger); een verticale match van 3 krijgt 120 % daarvan, en elk extra
76blokje +5 % (wordt nergens in het spel uitgelegd). De massa bepaalt hoe
76blokje +5 % (wordt nergens in het spel uitgelegd). De massa bepaalt hoe
77lang de sprong omhoog duurt (onafhankelijk van de hoogte). Op de apex
77lang de sprong omhoog duurt (onafhankelijk van de hoogte). Op de apex
78versnelt de cluster geleidelijk tot de valsnelheid
78versnelt de cluster geleidelijk tot de valsnelheid
79(`apexEaseTime = 0,15 × fallTime`); daarna is de daalsnelheid constant
79(`apexEaseTime = 0,15 × fallTime`); daarna zweeft een cluster omlaag
80en **gehalveerd** (`fallSpeed = 0,5 × 13 / fallTime`, t1122). De
80op de **gehalveerde** eindsnelheid
81luchtweerstand (`fallTime`) bepaalt die valsnelheid én hoe snel de
81(`clusterFallSpeed = 0,5 × 13 / fallTime`, t1122/t1124). Losse blokjes
82visuele landing-bounce is (`bounceDuration = 0,12 × fallTime`). Een
82(spawn, ongesteund, cargo) vallen op de volle
83`fallSpeed = 13 / fallTime`. De luchtweerstand (`fallTime`) bepaalt die
84valsnelheden én hoe snel de visuele landing-bounce is
85(`bounceDuration = 0,12 × fallTime`). Een
83vastgehouden blokje krijgt dezelfde schaal-tween als Tim's KWin Click
86vastgehouden blokje krijgt dezelfde schaal-tween als Tim's KWin Click
84Tween (150 ms easeOutBack naar 80 %, 720 ms easeOutElastic terug).
87Tween (150 ms easeOutBack naar 80 %, 720 ms easeOutElastic terug).
85Wissels (speler en bot) animeren visueel in 100 ms easeOutCubic (t1121).
88Wissels (speler en bot) animeren visueel in 100 ms easeOutCubic (t1121).
build/game.js +40 −19
@@ -262,10 +262,11 @@ else if (typeof globalThis !== 'undefined')
262 262 * one jump from the floor clears the 13-tile field with room to spare;
263 263 * at 4 you still need more than one jump, but each is 50% taller.
264 264 * Air (fallTime): 1 s (hard, fast fall) .. 5 s (easy, slow fall).
265 * After a jump peaks, blocks float down at DESCENT_SPEED_SCALE *
266 * FIELD_HEIGHT / fallTime tiles/s (DESCENT_SPEED_SCALE is 0.5 since
267 * t1122: all descent speeds are halved). Relative differences between
268 * planets (1 / fallTime) are unchanged. Upward launch is not affected.
265 * Spawn, unsupported and cargo blocks fall at FIELD_HEIGHT / fallTime
266 * tiles/s. After a jump peaks, a flying cluster floats down at
267 * DESCENT_SPEED_SCALE * that speed (0.5 since t1122 / t1124: only the
268 * cluster float-down is halved). Relative differences between planets
269 * (1 / fallTime) are unchanged. Upward launch is not affected.
269 270 * Mass (riseTime): 0.5 s (hard, fast jump) .. 3 s (easy, slow jump).
270 271 * Time to reach the apex, independent of jump height.
271 272 *
@@ -283,9 +284,10 @@ var FIELD_HEIGHT = 13;
283 284 /** t1119: every match jump (the gravity-applied minimum and the
284 285 * vertical / extra-block bonuses derived from it) is 50% higher. */
285 286 var JUMP_HEIGHT_SCALE = 1.5;
286 /** t1122: every descent speed is halved. Terminal fallSpeed, spawn
287 * fall, unsupported / released / cargo fall, and the post-apex
288 * float-down all use this scale. Upward launch is unchanged. */
287 /** t1122 / t1124: only a flying cluster's post-apex float-down
288 * (terminal speed and the apex ease into it) is halved. Spawn fall,
289 * unsupported / released singles and dropped cargo use the full
290 * fallSpeed. Upward launch is unchanged. */
289 291 var DESCENT_SPEED_SCALE = 0.5;
290 292
291 293
@@ -321,13 +323,16 @@ function createPlanet (opts)
321 323 riseTime: riseTime,
322 324 colors: colors,
323 325 baseJumpHeight: JUMP_HEIGHT_SCALE * FIELD_HEIGHT / jumpsToClear,
324 fallSpeed: DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime,
325 // Time to ease from vy=0 at the apex to terminal fallSpeed.
326 // Shorter when air resistance is low (small fallTime). The ease
327 // duration is unchanged; fallAccel scales with the halved
328 // fallSpeed so the ease still lasts apexEaseTime seconds.
326 // Single-block fall (spawn, unsupported, dropped cargo).
327 fallSpeed: FIELD_HEIGHT / fallTime,
328 // Time to ease from vy=0 at the apex to terminal speed.
329 // Shorter when air resistance is low (small fallTime).
329 330 apexEaseTime: 0.15 * fallTime,
330 fallAccel: (DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime) / (0.15 * fallTime),
331 fallAccel: (FIELD_HEIGHT / fallTime) / (0.15 * fallTime),
332 // t1122 / t1124: flying-cluster float-down only. Same ease
333 // duration; accel scales with the halved terminal speed.
334 clusterFallSpeed: DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime,
335 clusterFallAccel: (DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime) / (0.15 * fallTime),
331 336 // Visual landing bounce: faster at low air resistance. Stage-3 params.
332 337 bounceDuration: 0.12 * fallTime,
333 338 bounceSquash: 0.16
@@ -1409,10 +1414,25 @@ GameCore.prototype.clusterMembers = function (clusterId)
1409 1414 * Advance a jump (cluster or manual) by dt. Uses exact kinematics so a
1410 1415 * jump of height H peaks at exactly H after riseTime. Returns dy.
1411 1416 * Mutates body.vy and body.phase ('up' / 'down'). body.decel is the
1412 * upward deceleration. After the apex, vy eases from 0 to -fallSpeed
1413 * at planet.fallAccel, then stays at terminal fallSpeed.
1417 * upward deceleration. After the apex, vy eases from 0 to the
1418 * terminal descent speed at the matching accel, then stays there.
1419 * Flying clusters (forCluster) use the halved cluster float-down
1420 * (t1122 / t1124); manual jumps use the full single-block fallSpeed.
1414 1421 */
1415 GameCore.prototype.advanceJump = function (body, dt)
1422 GameCore.prototype.descentParams = function (forCluster)
1423 {
1424 var p = this.planet;
1425 if (forCluster)
1426 {
1427 return {
1428 fallSpeed: p.clusterFallSpeed,
1429 fallAccel: p.clusterFallAccel
1430 };
1431 }
1432 return { fallSpeed: p.fallSpeed, fallAccel: p.fallAccel };
1433 };
1434
1435 GameCore.prototype.advanceJump = function (body, dt, forCluster)
1416 1436 {
1417 1437 var dy = 0;
1418 1438 var left = dt;
@@ -1443,8 +1463,9 @@ GameCore.prototype.advanceJump = function (body, dt)
1443 1463 }
1444 1464 if (body.phase === 'down' && left > 0)
1445 1465 {
1446 var target = -this.planet.fallSpeed;
1447 var accel = this.planet.fallAccel;
1466 var desc = this.descentParams(forCluster);
1467 var target = -desc.fallSpeed;
1468 var accel = desc.fallAccel;
1448 1469 if (accel < 1e-12)
1449 1470 {
1450 1471 body.vy = target;
@@ -1494,7 +1515,7 @@ GameCore.prototype.integrateClusters = function (dt)
1494 1515 { continue; }
1495 1516
1496 1517 this.prepareClusterBody(cluster);
1497 var dy = this.advanceJump(cluster, dt);
1518 var dy = this.advanceJump(cluster, dt, true);
1498 1519 cluster.anchorY += dy;
1499 1520 this.syncClusterMembers(cluster);
1500 1521
@@ -262,10 +262,11 @@ else if (typeof globalThis !== 'undefined')
262 * one jump from the floor clears the 13-tile field with room to spare;
262 * one jump from the floor clears the 13-tile field with room to spare;
263 * at 4 you still need more than one jump, but each is 50% taller.
263 * at 4 you still need more than one jump, but each is 50% taller.
264 * Air (fallTime): 1 s (hard, fast fall) .. 5 s (easy, slow fall).
264 * Air (fallTime): 1 s (hard, fast fall) .. 5 s (easy, slow fall).
265 * After a jump peaks, blocks float down at DESCENT_SPEED_SCALE *
265 * Spawn, unsupported and cargo blocks fall at FIELD_HEIGHT / fallTime
266 * FIELD_HEIGHT / fallTime tiles/s (DESCENT_SPEED_SCALE is 0.5 since
266 * tiles/s. After a jump peaks, a flying cluster floats down at
267 * t1122: all descent speeds are halved). Relative differences between
267 * DESCENT_SPEED_SCALE * that speed (0.5 since t1122 / t1124: only the
268 * planets (1 / fallTime) are unchanged. Upward launch is not affected.
268 * cluster float-down is halved). Relative differences between planets
269 * (1 / fallTime) are unchanged. Upward launch is not affected.
269 * Mass (riseTime): 0.5 s (hard, fast jump) .. 3 s (easy, slow jump).
270 * Mass (riseTime): 0.5 s (hard, fast jump) .. 3 s (easy, slow jump).
270 * Time to reach the apex, independent of jump height.
271 * Time to reach the apex, independent of jump height.
271 *
272 *
@@ -283,9 +284,10 @@ var FIELD_HEIGHT = 13;
283/** t1119: every match jump (the gravity-applied minimum and the
284/** t1119: every match jump (the gravity-applied minimum and the
284 * vertical / extra-block bonuses derived from it) is 50% higher. */
285 * vertical / extra-block bonuses derived from it) is 50% higher. */
285var JUMP_HEIGHT_SCALE = 1.5;
286var JUMP_HEIGHT_SCALE = 1.5;
286/** t1122: every descent speed is halved. Terminal fallSpeed, spawn
287/** t1122 / t1124: only a flying cluster's post-apex float-down
287 * fall, unsupported / released / cargo fall, and the post-apex
288 * (terminal speed and the apex ease into it) is halved. Spawn fall,
288 * float-down all use this scale. Upward launch is unchanged. */
289 * unsupported / released singles and dropped cargo use the full
290 * fallSpeed. Upward launch is unchanged. */
289var DESCENT_SPEED_SCALE = 0.5;
291var DESCENT_SPEED_SCALE = 0.5;
290
292
291
293
@@ -321,13 +323,16 @@ function createPlanet (opts)
321 riseTime: riseTime,
323 riseTime: riseTime,
322 colors: colors,
324 colors: colors,
323 baseJumpHeight: JUMP_HEIGHT_SCALE * FIELD_HEIGHT / jumpsToClear,
325 baseJumpHeight: JUMP_HEIGHT_SCALE * FIELD_HEIGHT / jumpsToClear,
324 fallSpeed: DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime,
326 // Single-block fall (spawn, unsupported, dropped cargo).
325 // Time to ease from vy=0 at the apex to terminal fallSpeed.
327 fallSpeed: FIELD_HEIGHT / fallTime,
326 // Shorter when air resistance is low (small fallTime). The ease
328 // Time to ease from vy=0 at the apex to terminal speed.
327 // duration is unchanged; fallAccel scales with the halved
329 // Shorter when air resistance is low (small fallTime).
328 // fallSpeed so the ease still lasts apexEaseTime seconds.
329 apexEaseTime: 0.15 * fallTime,
330 apexEaseTime: 0.15 * fallTime,
330 fallAccel: (DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime) / (0.15 * fallTime),
331 fallAccel: (FIELD_HEIGHT / fallTime) / (0.15 * fallTime),
332 // t1122 / t1124: flying-cluster float-down only. Same ease
333 // duration; accel scales with the halved terminal speed.
334 clusterFallSpeed: DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime,
335 clusterFallAccel: (DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime) / (0.15 * fallTime),
331 // Visual landing bounce: faster at low air resistance. Stage-3 params.
336 // Visual landing bounce: faster at low air resistance. Stage-3 params.
332 bounceDuration: 0.12 * fallTime,
337 bounceDuration: 0.12 * fallTime,
333 bounceSquash: 0.16
338 bounceSquash: 0.16
@@ -1409,10 +1414,25 @@ GameCore.prototype.clusterMembers = function (clusterId)
1409 * Advance a jump (cluster or manual) by dt. Uses exact kinematics so a
1414 * Advance a jump (cluster or manual) by dt. Uses exact kinematics so a
1410 * jump of height H peaks at exactly H after riseTime. Returns dy.
1415 * jump of height H peaks at exactly H after riseTime. Returns dy.
1411 * Mutates body.vy and body.phase ('up' / 'down'). body.decel is the
1416 * Mutates body.vy and body.phase ('up' / 'down'). body.decel is the
1412 * upward deceleration. After the apex, vy eases from 0 to -fallSpeed
1417 * upward deceleration. After the apex, vy eases from 0 to the
1413 * at planet.fallAccel, then stays at terminal fallSpeed.
1418 * terminal descent speed at the matching accel, then stays there.
1419 * Flying clusters (forCluster) use the halved cluster float-down
1420 * (t1122 / t1124); manual jumps use the full single-block fallSpeed.
1414 */
1421 */
1415GameCore.prototype.advanceJump = function (body, dt)
1422GameCore.prototype.descentParams = function (forCluster)
1423{
1424 var p = this.planet;
1425 if (forCluster)
1426 {
1427 return {
1428 fallSpeed: p.clusterFallSpeed,
1429 fallAccel: p.clusterFallAccel
1430 };
1431 }
1432 return { fallSpeed: p.fallSpeed, fallAccel: p.fallAccel };
1433};
1434
1435GameCore.prototype.advanceJump = function (body, dt, forCluster)
1416{
1436{
1417 var dy = 0;
1437 var dy = 0;
1418 var left = dt;
1438 var left = dt;
@@ -1443,8 +1463,9 @@ GameCore.prototype.advanceJump = function (body, dt)
1443 }
1463 }
1444 if (body.phase === 'down' && left > 0)
1464 if (body.phase === 'down' && left > 0)
1445 {
1465 {
1446 var target = -this.planet.fallSpeed;
1466 var desc = this.descentParams(forCluster);
1447 var accel = this.planet.fallAccel;
1467 var target = -desc.fallSpeed;
1468 var accel = desc.fallAccel;
1448 if (accel < 1e-12)
1469 if (accel < 1e-12)
1449 {
1470 {
1450 body.vy = target;
1471 body.vy = target;
@@ -1494,7 +1515,7 @@ GameCore.prototype.integrateClusters = function (dt)
1494 { continue; }
1515 { continue; }
1495
1516
1496 this.prepareClusterBody(cluster);
1517 this.prepareClusterBody(cluster);
1497 var dy = this.advanceJump(cluster, dt);
1518 var dy = this.advanceJump(cluster, dt, true);
1498 cluster.anchorY += dy;
1519 cluster.anchorY += dy;
1499 this.syncClusterMembers(cluster);
1520 this.syncClusterMembers(cluster);
1500
1521
docs/ASSUMPTIONS.md +23 −14
@@ -258,8 +258,9 @@ Aanname:
258 258 getoonde Power 92 %). Terra (44 % getoonde Power) blijft de standaard.
259 259 - Zwaartekracht (`jumpsToClear` 1–4): één sprong haalt
260 260 `1,5 / jumpsToClear` van de veldhoogte (t1119, +50 %). Luchtweerstand
261 (`fallTime` 1–5; de tijd tot de bodem is sindsdien 2× `fallTime`
262 door de gehalveerde daalsnelheid, t1122). Massa
261 (`fallTime` 1–5 s tot de bodem voor losse blokjes; een vliegende
262 cluster zweeft na de apex in 2× `fallTime` naar beneden, t1122/t1124).
263 Massa
263 264 (`riseTime` 0,5–3 s tot de apex). Lage massa en lage luchtweerstand en
264 265 hoge zwaartekracht zijn moeilijker. Bounce-duur en apex-ease schalen al
265 266 met `fallTime` (gebouwd in stage 1).
@@ -515,18 +516,26 @@ Aanname:
515 516 - Bij snelle opeenvolgende wissels start een lopende tween opnieuw
516 517 vanaf de huidige visuele y, zodat er niet wordt gesnapt.
517 518
518 ## t1122 — alle daalsnelheden gehalveerd
519
520 - `fallSpeed = 0,5 × FIELD_HEIGHT / fallTime`. Dat dekt: nieuwe
521 spawn-val, losgelaten en ongesteunde blokjes, clusters na hun sprong
522 (terminale zweefsnelheid), en gevallen cargo. Alle planeten, alle
523 modes (inclusief bots). De relatieve verschillen tussen planeten
524 (omgekeerd evenredig met `fallTime`) blijven.
525 - De apex-ease duurt nog steeds `0,15 × fallTime`; `fallAccel` schaalt
526 mee met de gehalveerde `fallSpeed`. Bounce-duur is onveranderd
527 (`0,12 × fallTime`). Omhoog-lancering is onveranderd, behalve de
528 aparte +50 % spronghoogte van t1119. `fallTime` in de catalogus en
529 in de Power-formule blijft hetzelfde getal (1–5).
519 ## t1122 / t1124 — alleen de cluster-zweef naar beneden is gehalveerd
520
521 - Tim bedoelde met „daalsnelheid” alleen hoe een cluster na zijn sprong
522 weer omlaag zweeft (t1124). Nieuwe blokjes die het scherm in vallen
523 waren al goed en gaan weer op de oude snelheid:
524 `fallSpeed = FIELD_HEIGHT / fallTime`. Hetzelfde geldt voor
525 losgelaten of ongesteunde losse blokjes en gevallen cargo, tenzij ze
526 lid zijn van een dalende cluster (dan zweven ze mee).
527 - Alleen de post-apex-zweef van een **vliegende cluster** is gehalveerd
528 (alle modes, inclusief bots):
529 `clusterFallSpeed = 0,5 × FIELD_HEIGHT / fallTime`. De relatieve
530 verschillen tussen planeten (omgekeerd evenredig met `fallTime`)
531 blijven. Een handmatige sprong (omhooggetrokken blokje) daalt op de
532 volle `fallSpeed`.
533 - De apex-ease van die clusterzweef duurt nog steeds
534 `0,15 × fallTime`; `clusterFallAccel` schaalt mee met de gehalveerde
535 eindsnelheid. Bounce-duur is onveranderd (`0,12 × fallTime`).
536 Omhoog-lancering is onveranderd, behalve de aparte +50 % spronghoogte
537 van t1119. `fallTime` in de catalogus en in de Power-formule blijft
538 hetzelfde getal (1–5).
530 539
531 540 ## t1123 — rode puls bij volle kolommen
532 541
@@ -258,8 +258,9 @@ Aanname:
258 getoonde Power 92 %). Terra (44 % getoonde Power) blijft de standaard.
258 getoonde Power 92 %). Terra (44 % getoonde Power) blijft de standaard.
259- Zwaartekracht (`jumpsToClear` 1–4): één sprong haalt
259- Zwaartekracht (`jumpsToClear` 1–4): één sprong haalt
260 `1,5 / jumpsToClear` van de veldhoogte (t1119, +50 %). Luchtweerstand
260 `1,5 / jumpsToClear` van de veldhoogte (t1119, +50 %). Luchtweerstand
261 (`fallTime` 1–5; de tijd tot de bodem is sindsdien 2× `fallTime`
261 (`fallTime` 1–5 s tot de bodem voor losse blokjes; een vliegende
262 door de gehalveerde daalsnelheid, t1122). Massa
262 cluster zweeft na de apex in 2× `fallTime` naar beneden, t1122/t1124).
263 Massa
263 (`riseTime` 0,5–3 s tot de apex). Lage massa en lage luchtweerstand en
264 (`riseTime` 0,5–3 s tot de apex). Lage massa en lage luchtweerstand en
264 hoge zwaartekracht zijn moeilijker. Bounce-duur en apex-ease schalen al
265 hoge zwaartekracht zijn moeilijker. Bounce-duur en apex-ease schalen al
265 met `fallTime` (gebouwd in stage 1).
266 met `fallTime` (gebouwd in stage 1).
@@ -515,18 +516,26 @@ Aanname:
515- Bij snelle opeenvolgende wissels start een lopende tween opnieuw
516- Bij snelle opeenvolgende wissels start een lopende tween opnieuw
516 vanaf de huidige visuele y, zodat er niet wordt gesnapt.
517 vanaf de huidige visuele y, zodat er niet wordt gesnapt.
517
518
518## t1122 — alle daalsnelheden gehalveerd
519## t1122 / t1124 — alleen de cluster-zweef naar beneden is gehalveerd
519
520
520- `fallSpeed = 0,5 × FIELD_HEIGHT / fallTime`. Dat dekt: nieuwe
521- Tim bedoelde met „daalsnelheid” alleen hoe een cluster na zijn sprong
521 spawn-val, losgelaten en ongesteunde blokjes, clusters na hun sprong
522 weer omlaag zweeft (t1124). Nieuwe blokjes die het scherm in vallen
522 (terminale zweefsnelheid), en gevallen cargo. Alle planeten, alle
523 waren al goed en gaan weer op de oude snelheid:
523 modes (inclusief bots). De relatieve verschillen tussen planeten
524 `fallSpeed = FIELD_HEIGHT / fallTime`. Hetzelfde geldt voor
524 (omgekeerd evenredig met `fallTime`) blijven.
525 losgelaten of ongesteunde losse blokjes en gevallen cargo, tenzij ze
525- De apex-ease duurt nog steeds `0,15 × fallTime`; `fallAccel` schaalt
526 lid zijn van een dalende cluster (dan zweven ze mee).
526 mee met de gehalveerde `fallSpeed`. Bounce-duur is onveranderd
527- Alleen de post-apex-zweef van een **vliegende cluster** is gehalveerd
527 (`0,12 × fallTime`). Omhoog-lancering is onveranderd, behalve de
528 (alle modes, inclusief bots):
528 aparte +50 % spronghoogte van t1119. `fallTime` in de catalogus en
529 `clusterFallSpeed = 0,5 × FIELD_HEIGHT / fallTime`. De relatieve
529 in de Power-formule blijft hetzelfde getal (1–5).
530 verschillen tussen planeten (omgekeerd evenredig met `fallTime`)
531 blijven. Een handmatige sprong (omhooggetrokken blokje) daalt op de
532 volle `fallSpeed`.
533- De apex-ease van die clusterzweef duurt nog steeds
534 `0,15 × fallTime`; `clusterFallAccel` schaalt mee met de gehalveerde
535 eindsnelheid. Bounce-duur is onveranderd (`0,12 × fallTime`).
536 Omhoog-lancering is onveranderd, behalve de aparte +50 % spronghoogte
537 van t1119. `fallTime` in de catalogus en in de Power-formule blijft
538 hetzelfde getal (1–5).
530
539
531## t1123 — rode puls bij volle kolommen
540## t1123 — rode puls bij volle kolommen
532
541
src/gameCore.js +22 −6
@@ -730,10 +730,25 @@ GameCore.prototype.clusterMembers = function (clusterId)
730 730 * Advance a jump (cluster or manual) by dt. Uses exact kinematics so a
731 731 * jump of height H peaks at exactly H after riseTime. Returns dy.
732 732 * Mutates body.vy and body.phase ('up' / 'down'). body.decel is the
733 * upward deceleration. After the apex, vy eases from 0 to -fallSpeed
734 * at planet.fallAccel, then stays at terminal fallSpeed.
733 * upward deceleration. After the apex, vy eases from 0 to the
734 * terminal descent speed at the matching accel, then stays there.
735 * Flying clusters (forCluster) use the halved cluster float-down
736 * (t1122 / t1124); manual jumps use the full single-block fallSpeed.
735 737 */
736 GameCore.prototype.advanceJump = function (body, dt)
738 GameCore.prototype.descentParams = function (forCluster)
739 {
740 var p = this.planet;
741 if (forCluster)
742 {
743 return {
744 fallSpeed: p.clusterFallSpeed,
745 fallAccel: p.clusterFallAccel
746 };
747 }
748 return { fallSpeed: p.fallSpeed, fallAccel: p.fallAccel };
749 };
750
751 GameCore.prototype.advanceJump = function (body, dt, forCluster)
737 752 {
738 753 var dy = 0;
739 754 var left = dt;
@@ -764,8 +779,9 @@ GameCore.prototype.advanceJump = function (body, dt)
764 779 }
765 780 if (body.phase === 'down' && left > 0)
766 781 {
767 var target = -this.planet.fallSpeed;
768 var accel = this.planet.fallAccel;
782 var desc = this.descentParams(forCluster);
783 var target = -desc.fallSpeed;
784 var accel = desc.fallAccel;
769 785 if (accel < 1e-12)
770 786 {
771 787 body.vy = target;
@@ -815,7 +831,7 @@ GameCore.prototype.integrateClusters = function (dt)
815 831 { continue; }
816 832
817 833 this.prepareClusterBody(cluster);
818 var dy = this.advanceJump(cluster, dt);
834 var dy = this.advanceJump(cluster, dt, true);
819 835 cluster.anchorY += dy;
820 836 this.syncClusterMembers(cluster);
821 837
@@ -730,10 +730,25 @@ GameCore.prototype.clusterMembers = function (clusterId)
730 * Advance a jump (cluster or manual) by dt. Uses exact kinematics so a
730 * Advance a jump (cluster or manual) by dt. Uses exact kinematics so a
731 * jump of height H peaks at exactly H after riseTime. Returns dy.
731 * jump of height H peaks at exactly H after riseTime. Returns dy.
732 * Mutates body.vy and body.phase ('up' / 'down'). body.decel is the
732 * Mutates body.vy and body.phase ('up' / 'down'). body.decel is the
733 * upward deceleration. After the apex, vy eases from 0 to -fallSpeed
733 * upward deceleration. After the apex, vy eases from 0 to the
734 * at planet.fallAccel, then stays at terminal fallSpeed.
734 * terminal descent speed at the matching accel, then stays there.
735 * Flying clusters (forCluster) use the halved cluster float-down
736 * (t1122 / t1124); manual jumps use the full single-block fallSpeed.
735 */
737 */
736GameCore.prototype.advanceJump = function (body, dt)
738GameCore.prototype.descentParams = function (forCluster)
739{
740 var p = this.planet;
741 if (forCluster)
742 {
743 return {
744 fallSpeed: p.clusterFallSpeed,
745 fallAccel: p.clusterFallAccel
746 };
747 }
748 return { fallSpeed: p.fallSpeed, fallAccel: p.fallAccel };
749};
750
751GameCore.prototype.advanceJump = function (body, dt, forCluster)
737{
752{
738 var dy = 0;
753 var dy = 0;
739 var left = dt;
754 var left = dt;
@@ -764,8 +779,9 @@ GameCore.prototype.advanceJump = function (body, dt)
764 }
779 }
765 if (body.phase === 'down' && left > 0)
780 if (body.phase === 'down' && left > 0)
766 {
781 {
767 var target = -this.planet.fallSpeed;
782 var desc = this.descentParams(forCluster);
768 var accel = this.planet.fallAccel;
783 var target = -desc.fallSpeed;
784 var accel = desc.fallAccel;
769 if (accel < 1e-12)
785 if (accel < 1e-12)
770 {
786 {
771 body.vy = target;
787 body.vy = target;
@@ -815,7 +831,7 @@ GameCore.prototype.integrateClusters = function (dt)
815 { continue; }
831 { continue; }
816
832
817 this.prepareClusterBody(cluster);
833 this.prepareClusterBody(cluster);
818 var dy = this.advanceJump(cluster, dt);
834 var dy = this.advanceJump(cluster, dt, true);
819 cluster.anchorY += dy;
835 cluster.anchorY += dy;
820 this.syncClusterMembers(cluster);
836 this.syncClusterMembers(cluster);
821
837
src/planet.js +18 −13
@@ -14,10 +14,11 @@
14 14 * one jump from the floor clears the 13-tile field with room to spare;
15 15 * at 4 you still need more than one jump, but each is 50% taller.
16 16 * Air (fallTime): 1 s (hard, fast fall) .. 5 s (easy, slow fall).
17 * After a jump peaks, blocks float down at DESCENT_SPEED_SCALE *
18 * FIELD_HEIGHT / fallTime tiles/s (DESCENT_SPEED_SCALE is 0.5 since
19 * t1122: all descent speeds are halved). Relative differences between
20 * planets (1 / fallTime) are unchanged. Upward launch is not affected.
17 * Spawn, unsupported and cargo blocks fall at FIELD_HEIGHT / fallTime
18 * tiles/s. After a jump peaks, a flying cluster floats down at
19 * DESCENT_SPEED_SCALE * that speed (0.5 since t1122 / t1124: only the
20 * cluster float-down is halved). Relative differences between planets
21 * (1 / fallTime) are unchanged. Upward launch is not affected.
21 22 * Mass (riseTime): 0.5 s (hard, fast jump) .. 3 s (easy, slow jump).
22 23 * Time to reach the apex, independent of jump height.
23 24 *
@@ -35,9 +36,10 @@ var FIELD_HEIGHT = 13;
35 36 /** t1119: every match jump (the gravity-applied minimum and the
36 37 * vertical / extra-block bonuses derived from it) is 50% higher. */
37 38 var JUMP_HEIGHT_SCALE = 1.5;
38 /** t1122: every descent speed is halved. Terminal fallSpeed, spawn
39 * fall, unsupported / released / cargo fall, and the post-apex
40 * float-down all use this scale. Upward launch is unchanged. */
39 /** t1122 / t1124: only a flying cluster's post-apex float-down
40 * (terminal speed and the apex ease into it) is halved. Spawn fall,
41 * unsupported / released singles and dropped cargo use the full
42 * fallSpeed. Upward launch is unchanged. */
41 43 var DESCENT_SPEED_SCALE = 0.5;
42 44
43 45
@@ -73,13 +75,16 @@ function createPlanet (opts)
73 75 riseTime: riseTime,
74 76 colors: colors,
75 77 baseJumpHeight: JUMP_HEIGHT_SCALE * FIELD_HEIGHT / jumpsToClear,
76 fallSpeed: DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime,
77 // Time to ease from vy=0 at the apex to terminal fallSpeed.
78 // Shorter when air resistance is low (small fallTime). The ease
79 // duration is unchanged; fallAccel scales with the halved
80 // fallSpeed so the ease still lasts apexEaseTime seconds.
78 // Single-block fall (spawn, unsupported, dropped cargo).
79 fallSpeed: FIELD_HEIGHT / fallTime,
80 // Time to ease from vy=0 at the apex to terminal speed.
81 // Shorter when air resistance is low (small fallTime).
81 82 apexEaseTime: 0.15 * fallTime,
82 fallAccel: (DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime) / (0.15 * fallTime),
83 fallAccel: (FIELD_HEIGHT / fallTime) / (0.15 * fallTime),
84 // t1122 / t1124: flying-cluster float-down only. Same ease
85 // duration; accel scales with the halved terminal speed.
86 clusterFallSpeed: DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime,
87 clusterFallAccel: (DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime) / (0.15 * fallTime),
83 88 // Visual landing bounce: faster at low air resistance. Stage-3 params.
84 89 bounceDuration: 0.12 * fallTime,
85 90 bounceSquash: 0.16
@@ -14,10 +14,11 @@
14 * one jump from the floor clears the 13-tile field with room to spare;
14 * one jump from the floor clears the 13-tile field with room to spare;
15 * at 4 you still need more than one jump, but each is 50% taller.
15 * at 4 you still need more than one jump, but each is 50% taller.
16 * Air (fallTime): 1 s (hard, fast fall) .. 5 s (easy, slow fall).
16 * Air (fallTime): 1 s (hard, fast fall) .. 5 s (easy, slow fall).
17 * After a jump peaks, blocks float down at DESCENT_SPEED_SCALE *
17 * Spawn, unsupported and cargo blocks fall at FIELD_HEIGHT / fallTime
18 * FIELD_HEIGHT / fallTime tiles/s (DESCENT_SPEED_SCALE is 0.5 since
18 * tiles/s. After a jump peaks, a flying cluster floats down at
19 * t1122: all descent speeds are halved). Relative differences between
19 * DESCENT_SPEED_SCALE * that speed (0.5 since t1122 / t1124: only the
20 * planets (1 / fallTime) are unchanged. Upward launch is not affected.
20 * cluster float-down is halved). Relative differences between planets
21 * (1 / fallTime) are unchanged. Upward launch is not affected.
21 * Mass (riseTime): 0.5 s (hard, fast jump) .. 3 s (easy, slow jump).
22 * Mass (riseTime): 0.5 s (hard, fast jump) .. 3 s (easy, slow jump).
22 * Time to reach the apex, independent of jump height.
23 * Time to reach the apex, independent of jump height.
23 *
24 *
@@ -35,9 +36,10 @@ var FIELD_HEIGHT = 13;
35/** t1119: every match jump (the gravity-applied minimum and the
36/** t1119: every match jump (the gravity-applied minimum and the
36 * vertical / extra-block bonuses derived from it) is 50% higher. */
37 * vertical / extra-block bonuses derived from it) is 50% higher. */
37var JUMP_HEIGHT_SCALE = 1.5;
38var JUMP_HEIGHT_SCALE = 1.5;
38/** t1122: every descent speed is halved. Terminal fallSpeed, spawn
39/** t1122 / t1124: only a flying cluster's post-apex float-down
39 * fall, unsupported / released / cargo fall, and the post-apex
40 * (terminal speed and the apex ease into it) is halved. Spawn fall,
40 * float-down all use this scale. Upward launch is unchanged. */
41 * unsupported / released singles and dropped cargo use the full
42 * fallSpeed. Upward launch is unchanged. */
41var DESCENT_SPEED_SCALE = 0.5;
43var DESCENT_SPEED_SCALE = 0.5;
42
44
43
45
@@ -73,13 +75,16 @@ function createPlanet (opts)
73 riseTime: riseTime,
75 riseTime: riseTime,
74 colors: colors,
76 colors: colors,
75 baseJumpHeight: JUMP_HEIGHT_SCALE * FIELD_HEIGHT / jumpsToClear,
77 baseJumpHeight: JUMP_HEIGHT_SCALE * FIELD_HEIGHT / jumpsToClear,
76 fallSpeed: DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime,
78 // Single-block fall (spawn, unsupported, dropped cargo).
77 // Time to ease from vy=0 at the apex to terminal fallSpeed.
79 fallSpeed: FIELD_HEIGHT / fallTime,
78 // Shorter when air resistance is low (small fallTime). The ease
80 // Time to ease from vy=0 at the apex to terminal speed.
79 // duration is unchanged; fallAccel scales with the halved
81 // Shorter when air resistance is low (small fallTime).
80 // fallSpeed so the ease still lasts apexEaseTime seconds.
81 apexEaseTime: 0.15 * fallTime,
82 apexEaseTime: 0.15 * fallTime,
82 fallAccel: (DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime) / (0.15 * fallTime),
83 fallAccel: (FIELD_HEIGHT / fallTime) / (0.15 * fallTime),
84 // t1122 / t1124: flying-cluster float-down only. Same ease
85 // duration; accel scales with the halved terminal speed.
86 clusterFallSpeed: DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime,
87 clusterFallAccel: (DESCENT_SPEED_SCALE * FIELD_HEIGHT / fallTime) / (0.15 * fallTime),
83 // Visual landing bounce: faster at low air resistance. Stage-3 params.
88 // Visual landing bounce: faster at low air resistance. Stage-3 params.
84 bounceDuration: 0.12 * fallTime,
89 bounceDuration: 0.12 * fallTime,
85 bounceSquash: 0.16
90 bounceSquash: 0.16
test/cluster-descent.test.js added +79 −0
@@ -0,0 +1,79 @@
1 'use strict';
2
3 const { describe, it } = require('node:test');
4 const assert = require('node:assert/strict');
5 const { makeGame, placeRow, almost, Planet } = require('./helpers.js');
6
7 describe('Cluster float-down is halved, single-block fall is not (t1124)', () =>
8 {
9 it('a newly spawned block falls at the full fallSpeed', () =>
10 {
11 const g = makeGame({ seed: 3 });
12 const spawned = g.trySpawn();
13 assert.ok(spawned);
14 assert.equal(spawned.state, 'falling');
15 assert.ok(almost(spawned.vy, -g.planet.fallSpeed, 1e-12));
16 assert.ok(g.planet.fallSpeed > g.planet.clusterFallSpeed + 0.5);
17 const y1 = spawned.y;
18 g.step(0.2, 1 / 120);
19 const speed = (y1 - spawned.y) / 0.2;
20 assert.ok(almost(speed, g.planet.fallSpeed, 0.15), 'spawn speed=' + speed);
21 });
22
23 it('unsupported and ingested garbage fall at the full fallSpeed', () =>
24 {
25 const g = makeGame({ noSpawn: true, seed: 2 });
26 const hanging = g.place(0, 4, 1);
27 g.releaseUnsupported();
28 assert.equal(hanging.state, 'falling');
29 assert.ok(almost(hanging.vy, 0, 1e-12), 'starts from rest');
30 g.step(g.planet.apexEaseTime + 0.05, 1 / 120);
31 assert.ok(almost(Math.abs(hanging.vy), g.planet.fallSpeed, 0.1),
32 'unsupported terminal vy=' + hanging.vy);
33
34 const garbage = g.ingestGarbage(3);
35 assert.ok(almost(garbage.vy, -g.planet.fallSpeed, 1e-12));
36 });
37
38 it('a launched cluster eases into the halved clusterFallSpeed, not fallSpeed', () =>
39 {
40 const g = makeGame({ noSpawn: true });
41 placeRow(g, 0, [0, 1, 2], 0);
42 g.resolveMatches();
43 g.step(g.planet.riseTime + g.planet.apexEaseTime + 0.05, 1 / 240);
44 const cluster = g.clusters[g.blocks[0].clusterId];
45 assert.ok(cluster, 'still flying');
46 assert.equal(cluster.phase, 'down');
47 assert.ok(almost(Math.abs(cluster.vy), g.planet.clusterFallSpeed, 0.08),
48 'cluster vy=' + cluster.vy + ' expected ' + (-g.planet.clusterFallSpeed));
49 assert.ok(Math.abs(cluster.vy) < g.planet.fallSpeed - 0.5,
50 'must not use the full single-block fallSpeed');
51 });
52
53 it('a manual jump comes down at the full fallSpeed', () =>
54 {
55 const g = makeGame({ noSpawn: true });
56 const block = g.place(4, 0, 2);
57 g.startManualLaunch(block);
58 assert.equal(block.state, 'manual');
59 g.step(g.planet.riseTime + g.planet.apexEaseTime + 0.05, 1 / 240);
60 assert.equal(block.manualPhase, 'down');
61 assert.ok(almost(Math.abs(block.vy), g.planet.fallSpeed, 0.12),
62 'manual vy=' + block.vy + ' expected ' + (-g.planet.fallSpeed));
63 assert.ok(Math.abs(block.vy) > g.planet.clusterFallSpeed + 0.5);
64 });
65
66 it('cargo riding a descending cluster shares the halved float-down', () =>
67 {
68 const g = makeGame({ noSpawn: true });
69 placeRow(g, 0, [0, 1, 2], 0);
70 const cargo = g.place(1, 1, 4);
71 g.resolveMatches();
72 assert.equal(cargo.state, 'flying');
73 g.step(g.planet.riseTime + g.planet.apexEaseTime + 0.05, 1 / 240);
74 const cluster = g.clusters[cargo.clusterId];
75 assert.ok(cluster);
76 assert.ok(almost(Math.abs(cluster.vy), g.planet.clusterFallSpeed, 0.08));
77 assert.ok(almost(cargo.vy, cluster.vy, 1e-9));
78 });
79 });
@@ -0,0 +1,79 @@
1'use strict';
2
3const { describe, it } = require('node:test');
4const assert = require('node:assert/strict');
5const { makeGame, placeRow, almost, Planet } = require('./helpers.js');
6
7describe('Cluster float-down is halved, single-block fall is not (t1124)', () =>
8{
9 it('a newly spawned block falls at the full fallSpeed', () =>
10 {
11 const g = makeGame({ seed: 3 });
12 const spawned = g.trySpawn();
13 assert.ok(spawned);
14 assert.equal(spawned.state, 'falling');
15 assert.ok(almost(spawned.vy, -g.planet.fallSpeed, 1e-12));
16 assert.ok(g.planet.fallSpeed > g.planet.clusterFallSpeed + 0.5);
17 const y1 = spawned.y;
18 g.step(0.2, 1 / 120);
19 const speed = (y1 - spawned.y) / 0.2;
20 assert.ok(almost(speed, g.planet.fallSpeed, 0.15), 'spawn speed=' + speed);
21 });
22
23 it('unsupported and ingested garbage fall at the full fallSpeed', () =>
24 {
25 const g = makeGame({ noSpawn: true, seed: 2 });
26 const hanging = g.place(0, 4, 1);
27 g.releaseUnsupported();
28 assert.equal(hanging.state, 'falling');
29 assert.ok(almost(hanging.vy, 0, 1e-12), 'starts from rest');
30 g.step(g.planet.apexEaseTime + 0.05, 1 / 120);
31 assert.ok(almost(Math.abs(hanging.vy), g.planet.fallSpeed, 0.1),
32 'unsupported terminal vy=' + hanging.vy);
33
34 const garbage = g.ingestGarbage(3);
35 assert.ok(almost(garbage.vy, -g.planet.fallSpeed, 1e-12));
36 });
37
38 it('a launched cluster eases into the halved clusterFallSpeed, not fallSpeed', () =>
39 {
40 const g = makeGame({ noSpawn: true });
41 placeRow(g, 0, [0, 1, 2], 0);
42 g.resolveMatches();
43 g.step(g.planet.riseTime + g.planet.apexEaseTime + 0.05, 1 / 240);
44 const cluster = g.clusters[g.blocks[0].clusterId];
45 assert.ok(cluster, 'still flying');
46 assert.equal(cluster.phase, 'down');
47 assert.ok(almost(Math.abs(cluster.vy), g.planet.clusterFallSpeed, 0.08),
48 'cluster vy=' + cluster.vy + ' expected ' + (-g.planet.clusterFallSpeed));
49 assert.ok(Math.abs(cluster.vy) < g.planet.fallSpeed - 0.5,
50 'must not use the full single-block fallSpeed');
51 });
52
53 it('a manual jump comes down at the full fallSpeed', () =>
54 {
55 const g = makeGame({ noSpawn: true });
56 const block = g.place(4, 0, 2);
57 g.startManualLaunch(block);
58 assert.equal(block.state, 'manual');
59 g.step(g.planet.riseTime + g.planet.apexEaseTime + 0.05, 1 / 240);
60 assert.equal(block.manualPhase, 'down');
61 assert.ok(almost(Math.abs(block.vy), g.planet.fallSpeed, 0.12),
62 'manual vy=' + block.vy + ' expected ' + (-g.planet.fallSpeed));
63 assert.ok(Math.abs(block.vy) > g.planet.clusterFallSpeed + 0.5);
64 });
65
66 it('cargo riding a descending cluster shares the halved float-down', () =>
67 {
68 const g = makeGame({ noSpawn: true });
69 placeRow(g, 0, [0, 1, 2], 0);
70 const cargo = g.place(1, 1, 4);
71 g.resolveMatches();
72 assert.equal(cargo.state, 'flying');
73 g.step(g.planet.riseTime + g.planet.apexEaseTime + 0.05, 1 / 240);
74 const cluster = g.clusters[cargo.clusterId];
75 assert.ok(cluster);
76 assert.ok(almost(Math.abs(cluster.vy), g.planet.clusterFallSpeed, 0.08));
77 assert.ok(almost(cargo.vy, cluster.vy, 1e-9));
78 });
79});
test/falling-cluster.test.js +9 −9
@@ -38,9 +38,9 @@ describe('Falling blocks land on flying clusters', () =>
38 38 cluster.vy = 0;
39 39 const falling = g.createBlock(3, 10, 1, 'falling');
40 40 falling.vy = -g.planet.fallSpeed;
41 // Fall from 10 onto 6+1=7: distance 3, at halved fallSpeed
42 // 0.5 * 13/3 ≈ 2.17 → ~1.4s (t1122).
43 g.step(2.0, 1 / 120);
41 // Fall from 10 onto 6+1=7: distance 3, at full spawn fallSpeed
42 // 13/3 ≈ 4.33 → ~0.7s (t1124: singles are not halved).
43 g.step(1.0, 1 / 120);
44 44 assert.equal(falling.state, 'flying', 'should have attached, state=' + falling.state + ' y=' + falling.y);
45 45 assert.equal(falling.clusterId, cluster.id);
46 46 assert.equal(falling.flame, false, 'cargo has no flame');
@@ -49,7 +49,7 @@ describe('Falling blocks land on flying clusters', () =>
49 49
50 50 // Now let the cluster descend: cargo must move with it, same dy.
51 51 cluster.phase = 'down';
52 cluster.vy = 0; // will ease into fallSpeed
52 cluster.vy = 0; // will ease into clusterFallSpeed
53 53 const yCargo = falling.y;
54 54 const yFlyer = members[1].y;
55 55 g.step(0.4, 1 / 120);
@@ -69,10 +69,10 @@ describe('Falling blocks land on flying clusters', () =>
69 69 cluster.vy = -g.planet.fallSpeed;
70 70 const falling = g.createBlock(1, 8, 2, 'falling');
71 71 falling.vy = -g.planet.fallSpeed;
72 // Same terminal speed as the cluster, so they only meet after
73 // the cluster lands. With halved descent (t1122) that takes
74 // roughly 2× as long as before (~3.7 s).
75 g.step(5.0, 1 / 120);
72 // The falling single is at full fallSpeed; the cluster floats
73 // at the halved clusterFallSpeed (t1124), so the single catches
74 // up. 2 s is plenty for a 3-tile gap.
75 g.step(2.0, 1 / 120);
76 76 assert.notEqual(falling.state, 'falling');
77 77 assert.ok(falling.state === 'flying' || falling.state === 'settling' || falling.state === 'still',
78 78 'must not still be falling through, state=' + falling.state + ' y=' + falling.y);
@@ -174,7 +174,7 @@ describe('Rigid grey landing', () =>
174 174 assert.ok(right.state === 'falling' || (right.state === 'still' && almost(right.y, 0, 0.05)),
175 175 'right falls, state=' + right.state);
176 176 // Give them time to land individually.
177 g.step(g.planet.fallTime / Planet.DESCENT_SPEED_SCALE + 0.5, 1 / 60);
177 g.step(g.planet.fallTime + 0.5, 1 / 60);
178 178 assert.equal(left.state, 'still');
179 179 assert.ok(almost(left.y, 0, 0.05), 'left lands on the floor, y=' + left.y);
180 180 assert.equal(right.state, 'still');
@@ -38,9 +38,9 @@ describe('Falling blocks land on flying clusters', () =>
38 cluster.vy = 0;
38 cluster.vy = 0;
39 const falling = g.createBlock(3, 10, 1, 'falling');
39 const falling = g.createBlock(3, 10, 1, 'falling');
40 falling.vy = -g.planet.fallSpeed;
40 falling.vy = -g.planet.fallSpeed;
41 // Fall from 10 onto 6+1=7: distance 3, at halved fallSpeed
41 // Fall from 10 onto 6+1=7: distance 3, at full spawn fallSpeed
42 // 0.5 * 13/3 ≈ 2.17 → ~1.4s (t1122).
42 // 13/3 ≈ 4.33 → ~0.7s (t1124: singles are not halved).
43 g.step(2.0, 1 / 120);
43 g.step(1.0, 1 / 120);
44 assert.equal(falling.state, 'flying', 'should have attached, state=' + falling.state + ' y=' + falling.y);
44 assert.equal(falling.state, 'flying', 'should have attached, state=' + falling.state + ' y=' + falling.y);
45 assert.equal(falling.clusterId, cluster.id);
45 assert.equal(falling.clusterId, cluster.id);
46 assert.equal(falling.flame, false, 'cargo has no flame');
46 assert.equal(falling.flame, false, 'cargo has no flame');
@@ -49,7 +49,7 @@ describe('Falling blocks land on flying clusters', () =>
49
49
50 // Now let the cluster descend: cargo must move with it, same dy.
50 // Now let the cluster descend: cargo must move with it, same dy.
51 cluster.phase = 'down';
51 cluster.phase = 'down';
52 cluster.vy = 0; // will ease into fallSpeed
52 cluster.vy = 0; // will ease into clusterFallSpeed
53 const yCargo = falling.y;
53 const yCargo = falling.y;
54 const yFlyer = members[1].y;
54 const yFlyer = members[1].y;
55 g.step(0.4, 1 / 120);
55 g.step(0.4, 1 / 120);
@@ -69,10 +69,10 @@ describe('Falling blocks land on flying clusters', () =>
69 cluster.vy = -g.planet.fallSpeed;
69 cluster.vy = -g.planet.fallSpeed;
70 const falling = g.createBlock(1, 8, 2, 'falling');
70 const falling = g.createBlock(1, 8, 2, 'falling');
71 falling.vy = -g.planet.fallSpeed;
71 falling.vy = -g.planet.fallSpeed;
72 // Same terminal speed as the cluster, so they only meet after
72 // The falling single is at full fallSpeed; the cluster floats
73 // the cluster lands. With halved descent (t1122) that takes
73 // at the halved clusterFallSpeed (t1124), so the single catches
74 // roughly 2× as long as before (~3.7 s).
74 // up. 2 s is plenty for a 3-tile gap.
75 g.step(5.0, 1 / 120);
75 g.step(2.0, 1 / 120);
76 assert.notEqual(falling.state, 'falling');
76 assert.notEqual(falling.state, 'falling');
77 assert.ok(falling.state === 'flying' || falling.state === 'settling' || falling.state === 'still',
77 assert.ok(falling.state === 'flying' || falling.state === 'settling' || falling.state === 'still',
78 'must not still be falling through, state=' + falling.state + ' y=' + falling.y);
78 'must not still be falling through, state=' + falling.state + ' y=' + falling.y);
@@ -174,7 +174,7 @@ describe('Rigid grey landing', () =>
174 assert.ok(right.state === 'falling' || (right.state === 'still' && almost(right.y, 0, 0.05)),
174 assert.ok(right.state === 'falling' || (right.state === 'still' && almost(right.y, 0, 0.05)),
175 'right falls, state=' + right.state);
175 'right falls, state=' + right.state);
176 // Give them time to land individually.
176 // Give them time to land individually.
177 g.step(g.planet.fallTime / Planet.DESCENT_SPEED_SCALE + 0.5, 1 / 60);
177 g.step(g.planet.fallTime + 0.5, 1 / 60);
178 assert.equal(left.state, 'still');
178 assert.equal(left.state, 'still');
179 assert.ok(almost(left.y, 0, 0.05), 'left lands on the floor, y=' + left.y);
179 assert.ok(almost(left.y, 0, 0.05), 'left lands on the floor, y=' + left.y);
180 assert.equal(right.state, 'still');
180 assert.equal(right.state, 'still');
test/match.test.js +7 −5
@@ -159,21 +159,23 @@ describe('Launch physics', () =>
159 159 assert.ok(Math.abs(apex - (startY + H)) < 0.08, 'apex y=' + apex + ' expected ' + (startY + H));
160 160 const cluster = g.clusters[g.blocks[0].clusterId];
161 161 assert.equal(cluster.phase, 'down');
162 // Just after the apex, speed is still below terminal fallSpeed.
162 // Just after the apex, speed is still below the (halved) cluster float-down.
163 163 const ease = g.planet.apexEaseTime;
164 const clusterFall = g.planet.clusterFallSpeed;
164 165 assert.ok(ease > 0.1, 'apexEaseTime=' + ease);
165 166 g.step(ease * 0.4, 1 / 240);
166 167 const midVy = Math.abs(g.blocks[0].vy);
167 168 assert.ok(midVy > 0.2, 'should have started descending, vy=' + g.blocks[0].vy);
168 assert.ok(midVy < g.planet.fallSpeed - 0.3, 'should still be easing, vy=' + g.blocks[0].vy + ' fall=' + g.planet.fallSpeed);
169 // After the ease, descent is at constant fallSpeed.
169 assert.ok(midVy < clusterFall - 0.15, 'should still be easing, vy=' + g.blocks[0].vy + ' clusterFall=' + clusterFall);
170 // After the ease, descent is at constant clusterFallSpeed (t1124).
170 171 g.step(ease * 0.6 + 0.05, 1 / 240);
171 assert.ok(Math.abs(Math.abs(g.blocks[0].vy) - g.planet.fallSpeed) < 0.08, 'terminal vy=' + g.blocks[0].vy);
172 assert.ok(Math.abs(Math.abs(g.blocks[0].vy) - clusterFall) < 0.08, 'terminal vy=' + g.blocks[0].vy);
173 assert.ok(clusterFall < g.planet.fallSpeed - 0.5, 'cluster float-down is slower than spawn fall');
172 174 const y1 = g.blocks[0].y;
173 175 g.step(0.2, 1 / 120);
174 176 const y2 = g.blocks[0].y;
175 177 const speed = (y1 - y2) / 0.2;
176 assert.ok(Math.abs(speed - g.planet.fallSpeed) < 0.15, 'fall speed ' + speed);
178 assert.ok(Math.abs(speed - clusterFall) < 0.15, 'fall speed ' + speed);
177 179 assert.ok(y2 < y1, 'must be going down');
178 180 });
179 181 });
@@ -159,21 +159,23 @@ describe('Launch physics', () =>
159 assert.ok(Math.abs(apex - (startY + H)) < 0.08, 'apex y=' + apex + ' expected ' + (startY + H));
159 assert.ok(Math.abs(apex - (startY + H)) < 0.08, 'apex y=' + apex + ' expected ' + (startY + H));
160 const cluster = g.clusters[g.blocks[0].clusterId];
160 const cluster = g.clusters[g.blocks[0].clusterId];
161 assert.equal(cluster.phase, 'down');
161 assert.equal(cluster.phase, 'down');
162 // Just after the apex, speed is still below terminal fallSpeed.
162 // Just after the apex, speed is still below the (halved) cluster float-down.
163 const ease = g.planet.apexEaseTime;
163 const ease = g.planet.apexEaseTime;
164 const clusterFall = g.planet.clusterFallSpeed;
164 assert.ok(ease > 0.1, 'apexEaseTime=' + ease);
165 assert.ok(ease > 0.1, 'apexEaseTime=' + ease);
165 g.step(ease * 0.4, 1 / 240);
166 g.step(ease * 0.4, 1 / 240);
166 const midVy = Math.abs(g.blocks[0].vy);
167 const midVy = Math.abs(g.blocks[0].vy);
167 assert.ok(midVy > 0.2, 'should have started descending, vy=' + g.blocks[0].vy);
168 assert.ok(midVy > 0.2, 'should have started descending, vy=' + g.blocks[0].vy);
168 assert.ok(midVy < g.planet.fallSpeed - 0.3, 'should still be easing, vy=' + g.blocks[0].vy + ' fall=' + g.planet.fallSpeed);
169 assert.ok(midVy < clusterFall - 0.15, 'should still be easing, vy=' + g.blocks[0].vy + ' clusterFall=' + clusterFall);
169 // After the ease, descent is at constant fallSpeed.
170 // After the ease, descent is at constant clusterFallSpeed (t1124).
170 g.step(ease * 0.6 + 0.05, 1 / 240);
171 g.step(ease * 0.6 + 0.05, 1 / 240);
171 assert.ok(Math.abs(Math.abs(g.blocks[0].vy) - g.planet.fallSpeed) < 0.08, 'terminal vy=' + g.blocks[0].vy);
172 assert.ok(Math.abs(Math.abs(g.blocks[0].vy) - clusterFall) < 0.08, 'terminal vy=' + g.blocks[0].vy);
173 assert.ok(clusterFall < g.planet.fallSpeed - 0.5, 'cluster float-down is slower than spawn fall');
172 const y1 = g.blocks[0].y;
174 const y1 = g.blocks[0].y;
173 g.step(0.2, 1 / 120);
175 g.step(0.2, 1 / 120);
174 const y2 = g.blocks[0].y;
176 const y2 = g.blocks[0].y;
175 const speed = (y1 - y2) / 0.2;
177 const speed = (y1 - y2) / 0.2;
176 assert.ok(Math.abs(speed - g.planet.fallSpeed) < 0.15, 'fall speed ' + speed);
178 assert.ok(Math.abs(speed - clusterFall) < 0.15, 'fall speed ' + speed);
177 assert.ok(y2 < y1, 'must be going down');
179 assert.ok(y2 < y1, 'must be going down');
178 });
180 });
179});
181});
test/offline-playwright.py +3 −1
@@ -83,6 +83,7 @@ def run(page, tag):
83 83 schedule: app.battle && app.battle.schedule,
84 84 jump: app.planet && app.planet.baseJumpHeight,
85 85 fall: app.planet && app.planet.fallSpeed,
86 clusterFall: app.planet && app.planet.clusterFallSpeed,
86 87 })""")
87 88 print("HUD", hud)
88 89 check(hud["hidden"] is False, f"{tag}: offline HUD visible")
@@ -91,7 +92,8 @@ def run(page, tag):
91 92 check(hud["skill"] == "Skill 5%", f"{tag}: skill 5% ({hud['skill']})")
92 93 check(hud["bots"] == 1, f"{tag}: one bot field")
93 94 check(abs(hud["jump"] - 1.5 * 13 / 2) < 1e-9, f"{tag}: +50% jump height ({hud['jump']})")
94 check(abs(hud["fall"] - 0.5 * 13 / 3) < 1e-9, f"{tag}: halved fallSpeed ({hud['fall']})")
95 check(abs(hud["fall"] - 13 / 3) < 1e-9, f"{tag}: full spawn fallSpeed ({hud['fall']})")
96 check(abs(hud["clusterFall"] - 0.5 * 13 / 3) < 1e-9, f"{tag}: halved cluster float-down ({hud['clusterFall']})")
95 97 mini = page.locator("#minis .mini")
96 98 check(mini.count() >= 1, f"{tag}: at least one bot mini")
97 99 name = mini.first.locator(".mini-name").inner_text()
@@ -83,6 +83,7 @@ def run(page, tag):
83 schedule: app.battle && app.battle.schedule,
83 schedule: app.battle && app.battle.schedule,
84 jump: app.planet && app.planet.baseJumpHeight,
84 jump: app.planet && app.planet.baseJumpHeight,
85 fall: app.planet && app.planet.fallSpeed,
85 fall: app.planet && app.planet.fallSpeed,
86 clusterFall: app.planet && app.planet.clusterFallSpeed,
86 })""")
87 })""")
87 print("HUD", hud)
88 print("HUD", hud)
88 check(hud["hidden"] is False, f"{tag}: offline HUD visible")
89 check(hud["hidden"] is False, f"{tag}: offline HUD visible")
@@ -91,7 +92,8 @@ def run(page, tag):
91 check(hud["skill"] == "Skill 5%", f"{tag}: skill 5% ({hud['skill']})")
92 check(hud["skill"] == "Skill 5%", f"{tag}: skill 5% ({hud['skill']})")
92 check(hud["bots"] == 1, f"{tag}: one bot field")
93 check(hud["bots"] == 1, f"{tag}: one bot field")
93 check(abs(hud["jump"] - 1.5 * 13 / 2) < 1e-9, f"{tag}: +50% jump height ({hud['jump']})")
94 check(abs(hud["jump"] - 1.5 * 13 / 2) < 1e-9, f"{tag}: +50% jump height ({hud['jump']})")
94 check(abs(hud["fall"] - 0.5 * 13 / 3) < 1e-9, f"{tag}: halved fallSpeed ({hud['fall']})")
95 check(abs(hud["fall"] - 13 / 3) < 1e-9, f"{tag}: full spawn fallSpeed ({hud['fall']})")
96 check(abs(hud["clusterFall"] - 0.5 * 13 / 3) < 1e-9, f"{tag}: halved cluster float-down ({hud['clusterFall']})")
95 mini = page.locator("#minis .mini")
97 mini = page.locator("#minis .mini")
96 check(mini.count() >= 1, f"{tag}: at least one bot mini")
98 check(mini.count() >= 1, f"{tag}: at least one bot mini")
97 name = mini.first.locator(".mini-name").inner_text()
99 name = mini.first.locator(".mini-name").inner_text()
test/planet.test.js +12 −4
@@ -22,7 +22,8 @@ describe('Planet field and defaults', () =>
22 22 assert.equal(p.riseTime, 1.5);
23 23 assert.equal(p.colors.length, 5);
24 24 assert.equal(p.baseJumpHeight, 1.5 * 13 / 2);
25 assert.equal(p.fallSpeed, 0.5 * 13 / 3);
25 assert.equal(p.fallSpeed, 13 / 3);
26 assert.equal(p.clusterFallSpeed, 0.5 * 13 / 3);
26 27 });
27 28
28 29 it('clamps gravity, air and mass to the stage-3 ranges', () =>
@@ -119,16 +120,23 @@ describe('Launch and fall physics parameters', () =>
119 120 assert.ok(Math.abs(v2 / a2 - p.riseTime) < 1e-12);
120 121 });
121 122
122 it('fall speed is half the field height over fallTime (t1122), ratios kept', () =>
123 it('single-block fall speed is field height over fallTime; cluster float-down is half (t1124)', () =>
123 124 {
124 125 const slow = Planet.createPlanet({ fallTime: 5 });
125 126 const fast = Planet.createPlanet({ fallTime: 1 });
126 127 assert.equal(Planet.DESCENT_SPEED_SCALE, 0.5);
127 assert.equal(slow.fallSpeed, 0.5 * 13 / 5);
128 assert.equal(fast.fallSpeed, 0.5 * 13);
128 assert.equal(slow.fallSpeed, 13 / 5);
129 assert.equal(fast.fallSpeed, 13);
130 assert.equal(slow.clusterFallSpeed, 0.5 * 13 / 5);
131 assert.equal(fast.clusterFallSpeed, 0.5 * 13);
129 132 assert.ok(fast.fallSpeed > slow.fallSpeed);
130 133 // Relative difference between planets is unchanged (1 / fallTime).
131 134 assert.ok(Math.abs(fast.fallSpeed / slow.fallSpeed - 5) < 1e-12);
135 assert.ok(Math.abs(fast.clusterFallSpeed / slow.clusterFallSpeed - 5) < 1e-12);
136 // Apex ease duration is shared; cluster accel scales with the halved speed.
137 assert.ok(Math.abs(slow.clusterFallAccel - slow.clusterFallSpeed / slow.apexEaseTime) < 1e-12);
138 assert.ok(Math.abs(slow.fallAccel - slow.fallSpeed / slow.apexEaseTime) < 1e-12);
139 assert.equal(slow.clusterFallSpeed, Planet.DESCENT_SPEED_SCALE * slow.fallSpeed);
132 140 });
133 141 });
134 142
@@ -22,7 +22,8 @@ describe('Planet field and defaults', () =>
22 assert.equal(p.riseTime, 1.5);
22 assert.equal(p.riseTime, 1.5);
23 assert.equal(p.colors.length, 5);
23 assert.equal(p.colors.length, 5);
24 assert.equal(p.baseJumpHeight, 1.5 * 13 / 2);
24 assert.equal(p.baseJumpHeight, 1.5 * 13 / 2);
25 assert.equal(p.fallSpeed, 0.5 * 13 / 3);
25 assert.equal(p.fallSpeed, 13 / 3);
26 assert.equal(p.clusterFallSpeed, 0.5 * 13 / 3);
26 });
27 });
27
28
28 it('clamps gravity, air and mass to the stage-3 ranges', () =>
29 it('clamps gravity, air and mass to the stage-3 ranges', () =>
@@ -119,16 +120,23 @@ describe('Launch and fall physics parameters', () =>
119 assert.ok(Math.abs(v2 / a2 - p.riseTime) < 1e-12);
120 assert.ok(Math.abs(v2 / a2 - p.riseTime) < 1e-12);
120 });
121 });
121
122
122 it('fall speed is half the field height over fallTime (t1122), ratios kept', () =>
123 it('single-block fall speed is field height over fallTime; cluster float-down is half (t1124)', () =>
123 {
124 {
124 const slow = Planet.createPlanet({ fallTime: 5 });
125 const slow = Planet.createPlanet({ fallTime: 5 });
125 const fast = Planet.createPlanet({ fallTime: 1 });
126 const fast = Planet.createPlanet({ fallTime: 1 });
126 assert.equal(Planet.DESCENT_SPEED_SCALE, 0.5);
127 assert.equal(Planet.DESCENT_SPEED_SCALE, 0.5);
127 assert.equal(slow.fallSpeed, 0.5 * 13 / 5);
128 assert.equal(slow.fallSpeed, 13 / 5);
128 assert.equal(fast.fallSpeed, 0.5 * 13);
129 assert.equal(fast.fallSpeed, 13);
130 assert.equal(slow.clusterFallSpeed, 0.5 * 13 / 5);
131 assert.equal(fast.clusterFallSpeed, 0.5 * 13);
129 assert.ok(fast.fallSpeed > slow.fallSpeed);
132 assert.ok(fast.fallSpeed > slow.fallSpeed);
130 // Relative difference between planets is unchanged (1 / fallTime).
133 // Relative difference between planets is unchanged (1 / fallTime).
131 assert.ok(Math.abs(fast.fallSpeed / slow.fallSpeed - 5) < 1e-12);
134 assert.ok(Math.abs(fast.fallSpeed / slow.fallSpeed - 5) < 1e-12);
135 assert.ok(Math.abs(fast.clusterFallSpeed / slow.clusterFallSpeed - 5) < 1e-12);
136 // Apex ease duration is shared; cluster accel scales with the halved speed.
137 assert.ok(Math.abs(slow.clusterFallAccel - slow.clusterFallSpeed / slow.apexEaseTime) < 1e-12);
138 assert.ok(Math.abs(slow.fallAccel - slow.fallSpeed / slow.apexEaseTime) < 1e-12);
139 assert.equal(slow.clusterFallSpeed, Planet.DESCENT_SPEED_SCALE * slow.fallSpeed);
132 });
140 });
133});
141});
134
142
test/points.test.js +1 −1
@@ -111,7 +111,7 @@ describe('Points, landing and recolor', () =>
111 111 g.step(1);
112 112 assert.equal(g.blocks.length, 2);
113 113 // Let the first one land.
114 g.step(g.planet.fallTime / Planet.DESCENT_SPEED_SCALE + 0.5);
114 g.step(g.planet.fallTime + 0.2);
115 115 const landed = g.blocks.filter((b) => b.state === 'still');
116 116 assert.ok(landed.length >= 1);
117 117 for (const b of landed)
@@ -111,7 +111,7 @@ describe('Points, landing and recolor', () =>
111 g.step(1);
111 g.step(1);
112 assert.equal(g.blocks.length, 2);
112 assert.equal(g.blocks.length, 2);
113 // Let the first one land.
113 // Let the first one land.
114 g.step(g.planet.fallTime / Planet.DESCENT_SPEED_SCALE + 0.5);
114 g.step(g.planet.fallTime + 0.2);
115 const landed = g.blocks.filter((b) => b.state === 'still');
115 const landed = g.blocks.filter((b) => b.state === 'still');
116 assert.ok(landed.length >= 1);
116 assert.ok(landed.length >= 1);
117 for (const b of landed)
117 for (const b of landed)