Stress for create networks

This commit is contained in:
2026-10-28 21:28:36 -03:00
parent a70375c9ad
commit 507e9aab24
10 changed files with 276 additions and 46 deletions
+15 -4
View File
@@ -6,8 +6,9 @@ possible, and to stay fast on both the server and the client when a world has th
Built so far: the importer and Create's imported blocks and items, R1, R2, R3 (`transformed`, `rotating`, `fluid` and
items), R4, R5, R8, S0, S4, S7, S12, stonecutting from S9, the start of P1's kinetics (shafts and cogwheels turned by a
hand crank), Create's pressing recipes, and the mechanical press pressing items on the ground. Facts about Create come
from reading `ports/create1.21.1` and `ports/create1.19.3`, and facts about bworld from its source.
hand crank, with stress and overstress), Create's pressing recipes, and the mechanical press pressing items on the
ground. Facts about Create come from reading `ports/create1.21.1` and `ports/create1.19.3`, and facts about bworld from
its source.
## Sources
@@ -508,8 +509,18 @@ additions: `looking` in `state_for_placement` (`getNearestLookingDirection`), `f
(`getStateForPlacement` returning null), `ctx.blocks` in shared scripts, and `ctx.world.get_block_ref` for changing
another block's data (`getBlockEntity`).
**Chunk borders.** Tile data keeps speeds across unloading. Create tracks unloaded members' stress separately
(`KineticNetwork`'s unloaded stress). Do the same, so a network across an unloaded chunk counts right.
**Stress as built** (`scripts/kinetics/stress.ts`). Impacts and capacities are the config's `stress.impact` and
`stress.capacity` by block id, like `CStress`, with Create's values for the blocks built so far, and 0 for a block that
isn't listed. A network is the blocks whose `network` is the same generator. Each change in `spreading.ts` notes the
networks it touched, and then each of them is walked from its generator and summed. Every block in one that's
overstressed gets `overstressed` client data, which `actual_speed` in `connections.ts` reads as still, for the press and
for visuals, like `getSpeed`. Speeds and spreading are unchanged by it. The totals aren't kept, since only the
stressometer will show them. Both a second generator joining a network and one in it stopping change its capacity
without changing any speed, so a generator's change always reworks its network.
**Chunk borders.** Tile data keeps speeds across unloading. bworld keeps every tile in memory and reloads a chunk when a
block in it is read, so the walk sees a whole network, and Create's separate count of unloaded members' stress
(`KineticNetwork`'s unloaded stress) isn't needed.
## Phases