@woosh/meep-engine 3.14.3 → 3.14.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core/geom/3d/mat4/m4_rigidity_defect.d.ts +30 -0
- package/src/core/geom/3d/mat4/m4_rigidity_defect.d.ts.map +1 -0
- package/src/core/geom/3d/mat4/m4_rigidity_defect.js +71 -0
- package/src/engine/Engine.d.ts.map +1 -1
- package/src/engine/Engine.js +733 -726
- package/src/engine/network/NetworkSession.d.ts +24 -4
- package/src/engine/network/NetworkSession.d.ts.map +1 -1
- package/src/engine/network/NetworkSession.js +28 -4
- package/src/engine/network/orchestrator/NetworkPeer.d.ts +96 -7
- package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/NetworkPeer.js +392 -68
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts +6 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +6 -0
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts +105 -13
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +306 -59
- package/src/engine/network/replication/Replicator.d.ts +43 -7
- package/src/engine/network/replication/Replicator.d.ts.map +1 -1
- package/src/engine/network/replication/Replicator.js +309 -111
- package/src/engine/network/sim/ActionLog.d.ts +23 -3
- package/src/engine/network/sim/ActionLog.d.ts.map +1 -1
- package/src/engine/network/sim/ActionLog.js +26 -3
- package/src/engine/network/sim/ActionRecordCursor.d.ts +82 -0
- package/src/engine/network/sim/ActionRecordCursor.d.ts.map +1 -0
- package/src/engine/network/sim/ActionRecordCursor.js +120 -0
- package/src/engine/network/sim/RewindEngine.d.ts.map +1 -1
- package/src/engine/network/sim/RewindEngine.js +13 -29
- package/src/engine/network/sim/SimAction.d.ts +15 -0
- package/src/engine/network/sim/SimAction.d.ts.map +1 -1
- package/src/engine/network/sim/SimAction.js +15 -0
- package/src/engine/network/sim/SimActionExecutor.d.ts +51 -2
- package/src/engine/network/sim/SimActionExecutor.d.ts.map +1 -1
- package/src/engine/network/sim/SimActionExecutor.js +74 -7
- package/src/engine/network/transport/Channel.d.ts +1 -1
- package/src/engine/network/transport/Channel.js +1 -1
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/simulation/Ticker.d.ts.map +1 -1
- package/src/engine/simulation/Ticker.js +4 -1
- package/src/engine/ui/GUIEngine.d.ts.map +1 -1
- package/src/engine/ui/GUIEngine.js +6 -0
- package/src/shade/playground/particle_system/README.md +98 -0
- package/src/shade/playground/particle_system/index.html +124 -0
- package/src/shade/playground/particle_system/main.d.ts +2 -0
- package/src/shade/playground/particle_system/main.d.ts.map +1 -0
- package/src/shade/playground/particle_system/main.js +180 -0
- package/src/shade/playground/particle_system/particle_scene.d.ts +52 -0
- package/src/shade/playground/particle_system/particle_scene.d.ts.map +1 -0
- package/src/shade/playground/particle_system/particle_scene.js +553 -0
- package/src/shade/playground/skinned_mesh_soup/README.md +143 -0
- package/src/shade/playground/skinned_mesh_soup/index.html +202 -0
- package/src/shade/playground/skinned_mesh_soup/main.d.ts +7 -0
- package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -0
- package/src/shade/playground/skinned_mesh_soup/main.js +567 -0
- package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.d.ts +29 -0
- package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.d.ts.map +1 -0
- package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.js +428 -0
- package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
- package/src/shade/renderer/animation/GPUAnimationManager.js +1958 -1796
- package/src/shade/renderer/animation/SKINNING_FRAME_PLAN.md +357 -0
- package/src/shade/renderer/animation/skin_bind_transform.d.ts +25 -0
- package/src/shade/renderer/animation/skin_bind_transform.d.ts.map +1 -0
- package/src/shade/renderer/animation/skin_bind_transform.js +33 -0
- package/src/shade/renderer/animation/skin_clip_scale_conflicts.d.ts +67 -0
- package/src/shade/renderer/animation/skin_clip_scale_conflicts.d.ts.map +1 -0
- package/src/shade/renderer/animation/skin_clip_scale_conflicts.js +199 -0
- package/src/shade/renderer/animation/skin_frame_defect.d.ts +34 -0
- package/src/shade/renderer/animation/skin_frame_defect.d.ts.map +1 -0
- package/src/shade/renderer/animation/skin_frame_defect.js +132 -0
- package/src/shade/renderer/animation/skin_joint_matrix.d.ts +24 -0
- package/src/shade/renderer/animation/skin_joint_matrix.d.ts.map +1 -0
- package/src/shade/renderer/animation/skin_joint_matrix.js +46 -0
- package/src/shade/renderer/animation/skin_normalize_mesh_frame.d.ts +70 -0
- package/src/shade/renderer/animation/skin_normalize_mesh_frame.d.ts.map +1 -0
- package/src/shade/renderer/animation/skin_normalize_mesh_frame.js +216 -0
- package/src/shade/renderer/animation/skin_test_fixtures.d.ts +86 -0
- package/src/shade/renderer/animation/skin_test_fixtures.d.ts.map +1 -0
- package/src/shade/renderer/animation/skin_test_fixtures.js +250 -0
- package/src/shade/renderer/animation/skinning/chunk_skin_blend_mesh_local.d.ts +18 -4
- package/src/shade/renderer/animation/skinning/chunk_skin_blend_mesh_local.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/chunk_skin_blend_mesh_local.js +18 -4
- package/src/shade/renderer/particles/DESIGN.md +5 -5
- package/src/shade/renderer/particles/cull/chunk_particle_cull.d.ts.map +1 -1
- package/src/shade/renderer/particles/cull/chunk_particle_cull.js +3 -1
- package/src/shade/renderer/particles/data/chunk_particle_emitter.js +1 -1
- package/src/shade/renderer/particles/graph/ParticleNodeDescription.d.ts +43 -0
- package/src/shade/renderer/particles/graph/ParticleNodeDescription.d.ts.map +1 -0
- package/src/shade/renderer/particles/graph/ParticleNodeDescription.js +44 -0
- package/src/shade/renderer/particles/graph/ParticleNodeRegistry.d.ts +33 -59
- package/src/shade/renderer/particles/graph/ParticleNodeRegistry.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/ParticleNodeRegistry.js +185 -118
- package/src/shade/renderer/particles/graph/compile_particle_graph.d.ts +15 -10
- package/src/shade/renderer/particles/graph/compile_particle_graph.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/compile_particle_graph.js +205 -170
- package/src/shade/renderer/particles/graph/particle_graph_authoring.d.ts +44 -0
- package/src/shade/renderer/particles/graph/particle_graph_authoring.d.ts.map +1 -0
- package/src/shade/renderer/particles/graph/particle_graph_authoring.js +108 -0
- package/src/shade/renderer/particles/isa/InstructionStream.d.ts +89 -0
- package/src/shade/renderer/particles/isa/InstructionStream.d.ts.map +1 -0
- package/src/shade/renderer/particles/isa/InstructionStream.js +162 -0
- package/src/shade/renderer/particles/isa/ParticleAssembler.d.ts +1 -48
- package/src/shade/renderer/particles/isa/ParticleAssembler.d.ts.map +1 -1
- package/src/shade/renderer/particles/isa/ParticleAssembler.js +25 -114
- package/src/shade/renderer/particles/particle_prototype.d.ts.map +1 -1
- package/src/shade/renderer/particles/particle_prototype.js +181 -180
- package/src/shade/renderer/particles/runtime/create_particle_effect.d.ts +4 -4
- package/src/shade/renderer/particles/runtime/create_particle_effect.d.ts.map +1 -1
- package/src/shade/renderer/particles/runtime/create_particle_effect.js +19 -19
- package/src/shade/renderer/particles/shaders/chunk_particle_curve_animation.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_curve_animation.js +4 -2
- package/src/shade/renderer/particles/shaders/chunk_particle_lighting.d.ts +4 -4
- package/src/shade/renderer/particles/shaders/chunk_particle_lighting.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_lighting.js +7 -5
- package/src/shade/renderer/particles/shaders/chunk_particle_render_math.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_render_math.js +3 -1
- package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_emit.js +3 -1
- package/src/shade/renderer/particles/shaders/shader_particle_finalize.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_finalize.js +5 -2
- package/src/shade/renderer/particles/shaders/shader_particle_render.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_render.js +9 -2
- package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_simulate.js +3 -1
- package/src/shade/renderer/particles/vm/chunk_particle_vm.js +1 -1
- package/src/shade/renderer/scene/SkinnedMesh.d.ts +11 -0
- package/src/shade/renderer/scene/SkinnedMesh.d.ts.map +1 -1
- package/src/shade/renderer/scene/SkinnedMesh.js +11 -0
- package/src/shade/renderer/shader/chunk/geometry/quaternion/dual/chunk_dual_quat_from_m4.d.ts +33 -3
- package/src/shade/renderer/shader/chunk/geometry/quaternion/dual/chunk_dual_quat_from_m4.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/quaternion/dual/chunk_dual_quat_from_m4.js +58 -37
- package/src/shade/renderer/particles/graph/ParticleGraph.d.ts +0 -54
- package/src/shade/renderer/particles/graph/ParticleGraph.d.ts.map +0 -1
- package/src/shade/renderer/particles/graph/ParticleGraph.js +0 -99
- package/src/shade/renderer/particles/prototypeParticleSystem.d.ts +0 -2
- package/src/shade/renderer/particles/prototypeParticleSystem.d.ts.map +0 -1
- package/src/shade/renderer/particles/prototypeParticleSystem.js +0 -448
|
@@ -367,10 +367,30 @@ export class NetworkSession {
|
|
|
367
367
|
*/
|
|
368
368
|
private normalize_if_dirty;
|
|
369
369
|
/**
|
|
370
|
-
* Dispatch one user-defined action
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
370
|
+
* Dispatch one user-defined action, without needing a reference to the
|
|
371
|
+
* executor or knowledge of the local peer id.
|
|
372
|
+
*
|
|
373
|
+
* Called with a frame open — from an `onLocalSim` handler on a host, or an
|
|
374
|
+
* `onPredict` handler on a client — the action executes immediately, into
|
|
375
|
+
* that frame. Its provenance follows its context: on a host, actions a
|
|
376
|
+
* local-sim handler executes are the frame's DERIVED output, recomputed on
|
|
377
|
+
* every replay of the frame rather than replayed from the log. That is what
|
|
378
|
+
* a handler that sends every tick wants, and it is why such a handler does
|
|
379
|
+
* not accumulate copies under rollback.
|
|
380
|
+
*
|
|
381
|
+
* Called with NO frame open — between ticks, from a lobby event, a timer, a
|
|
382
|
+
* console command — a host queues the action via
|
|
383
|
+
* {@link ServerAuthoritativeServer#enqueue_action}: it applies once, on the
|
|
384
|
+
* next frame the server simulates, and is recorded as INPUT, so replays
|
|
385
|
+
* take it from the log. This is the path for a one-shot. Do NOT reach for a
|
|
386
|
+
* latched local-sim handler (`if (already_sent) return`) instead: the
|
|
387
|
+
* handler's output is derived, so the replay expects it to be re-emitted,
|
|
388
|
+
* and a latch that stops it re-emitting loses the action the first time a
|
|
389
|
+
* rollback crosses its frame.
|
|
390
|
+
*
|
|
391
|
+
* (A client outside a prediction frame has nowhere to put the action and
|
|
392
|
+
* still throws — client actions are re-derived from the InputRing during
|
|
393
|
+
* reconciliation, so they belong in an `onPredict` handler.)
|
|
374
394
|
*
|
|
375
395
|
* @param {SimAction} action_instance
|
|
376
396
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkSession.d.ts","sourceRoot":"","sources":["../../../../src/engine/network/NetworkSession.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;iCAsCoB,MAAM;AAhB1B;;;;;;;;;;;;;;;;;GAiBG;AACH;;;GAGG;AAiFH;;;;;;;;;;;;;;;;;;GAkBG;AACH;IAgPI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmDG;IACH,0QAnDW;QACV,cAAkB,gBAAgB;QAClC,SAAa,CAAC,EAAE,MAAM,CAAC;QACvB,iBAAqB,CAAC,EAAE,CAAC,MAAM,MAAM,CAAC,CAAC;QACvC,IAAQ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,CAIT;IAEP;;;;;;OAMG;IACH,yBAFU,MAAM,CAEoB;IAEpC;;;OAGG;IACH,wBAFU,MAAM,CAIgC;IAEhD;;;OAGG;IACH,0BAFU,2BAA2B,CAEsC;IA0C/E;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,mDAFW,0BAA0B,QA4BpC;IAED;;;;;;;;OAQG;IACH,6CAIC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,uCAFmB,MAAM,KAAK,MAAM,SAAS,CAAC,GAAC,IAAI,QAWlD;IAMD;;;;;;;;;OASG;IACH,uBAyMC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,wBAHW,MAAM,aACN,MAAM,QA8DhB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,mBAHW,MAAM,WACN,MAAM,QA8BhB;IAED;;;;;;OAMG;IACH,oBAFW,MAAM,QAkChB;IAED;;OAEG;IACH,aAcC;IAMD;;;;;;OAMG;IACH,iBAFW,MAAM,QAyChB;IAED;;;;;;;;;;OAUG;IACH,2BA8BC;IAED
|
|
1
|
+
{"version":3,"file":"NetworkSession.d.ts","sourceRoot":"","sources":["../../../../src/engine/network/NetworkSession.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;iCAsCoB,MAAM;AAhB1B;;;;;;;;;;;;;;;;;GAiBG;AACH;;;GAGG;AAiFH;;;;;;;;;;;;;;;;;;GAkBG;AACH;IAgPI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmDG;IACH,0QAnDW;QACV,cAAkB,gBAAgB;QAClC,SAAa,CAAC,EAAE,MAAM,CAAC;QACvB,iBAAqB,CAAC,EAAE,CAAC,MAAM,MAAM,CAAC,CAAC;QACvC,IAAQ,CAAC,EAAE,QAAQ,GAAC,MAAM,CAAC;QAC3B,aAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,sBAA0B,CAAC,EAAE,MAAM,CAAC;QACpC,YAAgB,CAAC,EAAE,MAAM,CAAC;QA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;;;;;;;OAoBG;IACH,mDAFW,0BAA0B,QA4BpC;IAED;;;;;;;;OAQG;IACH,6CAIC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,uCAFmB,MAAM,KAAK,MAAM,SAAS,CAAC,GAAC,IAAI,QAWlD;IAMD;;;;;;;;;OASG;IACH,uBAyMC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,wBAHW,MAAM,aACN,MAAM,QA8DhB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,mBAHW,MAAM,WACN,MAAM,QA8BhB;IAED;;;;;;OAMG;IACH,oBAFW,MAAM,QAkChB;IAED;;OAEG;IACH,aAcC;IAMD;;;;;;OAMG;IACH,iBAFW,MAAM,QAyChB;IAED;;;;;;;;;;OAUG;IACH,2BA8BC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,sBAFW,SAAS,QAYnB;IAMD;;OAEG;IACH,wCAEC;IAED;;OAEG;IACH,wCAEC;IAED;;OAEG;IACH,wBAEC;IAED;;OAEG;IACH,0CAEC;IAED;;OAEG;IACH,iDAEC;IAED;;OAEG;IACH,kCAEC;IAED;;OAEG;IACH,4BAGC;;CA26BJ;qBAnoEoB,qBAAqB;mBAFvB,oCAAoC;4CAGV,sDAAsD;2CAUpC,gDAAgD;0BAErF,oBAAoB;0CAJJ,6CAA6C;0CAD7C,6CAA6C;4BADtC,+BAA+B;iCAK/C,sCAAsC;oCAGnC,+BAA+B;6BACtC,wBAAwB"}
|
|
@@ -1151,10 +1151,30 @@ export class NetworkSession {
|
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
1153
|
/**
|
|
1154
|
-
* Dispatch one user-defined action
|
|
1155
|
-
*
|
|
1156
|
-
*
|
|
1157
|
-
*
|
|
1154
|
+
* Dispatch one user-defined action, without needing a reference to the
|
|
1155
|
+
* executor or knowledge of the local peer id.
|
|
1156
|
+
*
|
|
1157
|
+
* Called with a frame open — from an `onLocalSim` handler on a host, or an
|
|
1158
|
+
* `onPredict` handler on a client — the action executes immediately, into
|
|
1159
|
+
* that frame. Its provenance follows its context: on a host, actions a
|
|
1160
|
+
* local-sim handler executes are the frame's DERIVED output, recomputed on
|
|
1161
|
+
* every replay of the frame rather than replayed from the log. That is what
|
|
1162
|
+
* a handler that sends every tick wants, and it is why such a handler does
|
|
1163
|
+
* not accumulate copies under rollback.
|
|
1164
|
+
*
|
|
1165
|
+
* Called with NO frame open — between ticks, from a lobby event, a timer, a
|
|
1166
|
+
* console command — a host queues the action via
|
|
1167
|
+
* {@link ServerAuthoritativeServer#enqueue_action}: it applies once, on the
|
|
1168
|
+
* next frame the server simulates, and is recorded as INPUT, so replays
|
|
1169
|
+
* take it from the log. This is the path for a one-shot. Do NOT reach for a
|
|
1170
|
+
* latched local-sim handler (`if (already_sent) return`) instead: the
|
|
1171
|
+
* handler's output is derived, so the replay expects it to be re-emitted,
|
|
1172
|
+
* and a latch that stops it re-emitting loses the action the first time a
|
|
1173
|
+
* rollback crosses its frame.
|
|
1174
|
+
*
|
|
1175
|
+
* (A client outside a prediction frame has nowhere to put the action and
|
|
1176
|
+
* still throws — client actions are re-derived from the InputRing during
|
|
1177
|
+
* reconciliation, so they belong in an `onPredict` handler.)
|
|
1158
1178
|
*
|
|
1159
1179
|
* @param {SimAction} action_instance
|
|
1160
1180
|
*/
|
|
@@ -1163,6 +1183,10 @@ export class NetworkSession {
|
|
|
1163
1183
|
if (!action_instance || action_instance.isSimAction !== true) {
|
|
1164
1184
|
throw new Error("NetworkSession.send: argument must be a SimAction instance");
|
|
1165
1185
|
}
|
|
1186
|
+
if (this.#server !== null && !this.#peer.action_log.has_open_frame()) {
|
|
1187
|
+
this.#server.enqueue_action(action_instance);
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1166
1190
|
this.#peer.executor.execute(action_instance, this.local_peer_id);
|
|
1167
1191
|
}
|
|
1168
1192
|
|
|
@@ -50,14 +50,39 @@ export const ResumeRejectReason: Readonly<{
|
|
|
50
50
|
*/
|
|
51
51
|
NoSessionToken: 5;
|
|
52
52
|
}>;
|
|
53
|
+
/**
|
|
54
|
+
* One outbound action-stream send, awaiting confirmation.
|
|
55
|
+
*
|
|
56
|
+
* A send occupies one transport seq when it fits the MTU and N consecutive
|
|
57
|
+
* seqs when it has to be fragmented. All of those seqs map to the SAME record:
|
|
58
|
+
* the receiver reassembles a fragmented message all-or-nothing, so the frame
|
|
59
|
+
* range is confirmed only when `unacked` reaches zero without `abandoned`
|
|
60
|
+
* having been set by a loss along the way.
|
|
61
|
+
*
|
|
62
|
+
* A tick may make several sends to one peer, each carrying the next slice of
|
|
63
|
+
* the owed range (see {@link NetworkPeer#flush_outbound}). They confirm
|
|
64
|
+
* independently, and the baseline advances only through slices confirmed in
|
|
65
|
+
* order — a later slice landing says nothing about an earlier one still in
|
|
66
|
+
* flight. `head` marks the first slice of a tick, whose start is the pack
|
|
67
|
+
* start itself; see {@link NetworkPeer#__credit_confirmed}.
|
|
68
|
+
*
|
|
69
|
+
* @typedef {{frame_start: number, frame_end: number, head: boolean, unacked: number, abandoned: boolean}} PendingAck
|
|
70
|
+
* @property {number} frame_start first frame in the packed range
|
|
71
|
+
* @property {number} frame_end last frame in the packed range
|
|
72
|
+
* @property {boolean} head this send began at the pack start, so nothing
|
|
73
|
+
* sendable lies before it and its confirmation credits outright
|
|
74
|
+
* @property {number} unacked seqs of this send not yet acked or declared lost
|
|
75
|
+
* @property {boolean} abandoned at least one seq was declared lost, so the
|
|
76
|
+
* message is forfeit and must never advance the baseline
|
|
77
|
+
*/
|
|
53
78
|
/**
|
|
54
79
|
* Per-tick orchestrator that wires the action infrastructure to one or more
|
|
55
80
|
* peers over a Transport.
|
|
56
81
|
*
|
|
57
82
|
* Holds a single world (`EntityComponentDataset`) plus the action machinery
|
|
58
83
|
* (executor, replicator, action log). For each connected peer it owns a
|
|
59
|
-
* `Channel` and a `seq →
|
|
60
|
-
* `Baseline.last_acked(peer_id)` watermark.
|
|
84
|
+
* `Channel` and a `seq` → {@link PendingAck} map so that ack notifications
|
|
85
|
+
* advance the `Baseline.last_acked(peer_id)` watermark.
|
|
61
86
|
*
|
|
62
87
|
* Use as both server (many connected peers) and client (one peer = the server).
|
|
63
88
|
* The asymmetry is in *who* connects — the orchestrator itself is symmetric.
|
|
@@ -87,9 +112,10 @@ export class NetworkPeer {
|
|
|
87
112
|
* initial_buffer_size?: number,
|
|
88
113
|
* mutation_ledger?: MutationLedger|null,
|
|
89
114
|
* changed_set_capacity?: number,
|
|
115
|
+
* max_packets_per_tick?: number,
|
|
90
116
|
* }} options
|
|
91
117
|
*/
|
|
92
|
-
constructor({ world, binary_registry, replicated_components, action_classes, scope_filter, frame_capacity, initial_buffer_size, mutation_ledger, changed_set_capacity, }: {
|
|
118
|
+
constructor({ world, binary_registry, replicated_components, action_classes, scope_filter, frame_capacity, initial_buffer_size, mutation_ledger, changed_set_capacity, max_packets_per_tick, }: {
|
|
93
119
|
world: EntityComponentDataset;
|
|
94
120
|
binary_registry: BinarySerializationRegistry;
|
|
95
121
|
replicated_components: Function[];
|
|
@@ -101,6 +127,7 @@ export class NetworkPeer {
|
|
|
101
127
|
initial_buffer_size?: number;
|
|
102
128
|
mutation_ledger?: MutationLedger | null;
|
|
103
129
|
changed_set_capacity?: number;
|
|
130
|
+
max_packets_per_tick?: number;
|
|
104
131
|
});
|
|
105
132
|
/** @type {EntityComponentDataset} */
|
|
106
133
|
world: EntityComponentDataset;
|
|
@@ -112,6 +139,32 @@ export class NetworkPeer {
|
|
|
112
139
|
slot_table: ReplicationSlotTable;
|
|
113
140
|
/** @type {ActionLog} */
|
|
114
141
|
action_log: ActionLog;
|
|
142
|
+
/**
|
|
143
|
+
* Most action-stream packets {@link flush_outbound} may send one peer
|
|
144
|
+
* in a tick. Each carries the next slice of what the peer is owed and
|
|
145
|
+
* is confirmed on its own, so this caps how fast a peer that has
|
|
146
|
+
* fallen behind catches up: a slice is re-sent every tick until its ack
|
|
147
|
+
* returns, so a peer is confirmed at most this many packets of frames
|
|
148
|
+
* per round trip, against the one frame per tick the simulation
|
|
149
|
+
* produces. One packet a tick keeps up only while a round trip's frames
|
|
150
|
+
* fit one packet; past that the owed range grows until it meets the
|
|
151
|
+
* ring floor and frames are lost.
|
|
152
|
+
*
|
|
153
|
+
* It is also the bandwidth ceiling under catch-up — this many MTUs per
|
|
154
|
+
* tick per peer — and it has to stay inside the channel's ack window.
|
|
155
|
+
* A peer's ack header covers its latest 33 seqs, so with a peer that
|
|
156
|
+
* replies once a tick, `33 / max_packets_per_tick` consecutive lost
|
|
157
|
+
* replies leave a delivered packet outside the window and it is
|
|
158
|
+
* declared lost: a wasted re-send rather than a defect, since the
|
|
159
|
+
* receiver skips frames it has already applied. Eight tolerates three
|
|
160
|
+
* such losses in a row (one tick in sixteen at 50% loss, one in ten
|
|
161
|
+
* thousand at 10%), and lets a 60 Hz stream at 100 ms RTT carry a full
|
|
162
|
+
* packet of actions per frame. Lower it for peers that reply less often
|
|
163
|
+
* than every tick.
|
|
164
|
+
*
|
|
165
|
+
* @type {number}
|
|
166
|
+
*/
|
|
167
|
+
max_packets_per_tick: number;
|
|
115
168
|
/**
|
|
116
169
|
* Optional per-tick mutation tracker. When a `MutationLedger` is supplied,
|
|
117
170
|
* this peer records each tick's affected network IDs into a fresh
|
|
@@ -262,6 +315,17 @@ export class NetworkPeer {
|
|
|
262
315
|
* @returns {number}
|
|
263
316
|
*/
|
|
264
317
|
inbound_count(peer_id: number): number;
|
|
318
|
+
/**
|
|
319
|
+
* Number of outbound action-stream seqs for `peer_id` still awaiting an
|
|
320
|
+
* ack-or-lost verdict. Returns 0 for an unknown peer.
|
|
321
|
+
*
|
|
322
|
+
* Diagnostics: this is bounded by the channel's in-flight window and must
|
|
323
|
+
* fall back to 0 once a stream of acks has resolved everything sent. A
|
|
324
|
+
* value that only grows is a leak in the ack accounting.
|
|
325
|
+
* @param {number} peer_id
|
|
326
|
+
* @returns {number}
|
|
327
|
+
*/
|
|
328
|
+
pending_ack_count(peer_id: number): number;
|
|
265
329
|
/**
|
|
266
330
|
* Direct access to a peer's channel (for sending acks-only packets, raw payloads, etc.).
|
|
267
331
|
* @param {number} peer_id
|
|
@@ -280,8 +344,8 @@ export class NetworkPeer {
|
|
|
280
344
|
/**
|
|
281
345
|
* Close the current tick and send pending action records to every peer.
|
|
282
346
|
* For each peer, packs frames `[Baseline.last_acked(peer) + 1, current_frame]`
|
|
283
|
-
* and sends via the channel; records the
|
|
284
|
-
*
|
|
347
|
+
* and sends via the channel; records the seqs the send went out under so
|
|
348
|
+
* that acks for all of them advance the baseline.
|
|
285
349
|
*
|
|
286
350
|
* If a {@link MutationLedger} was supplied at construction, this tick's
|
|
287
351
|
* accumulated changed-entity set is also compacted into the ledger.
|
|
@@ -299,8 +363,10 @@ export class NetworkPeer {
|
|
|
299
363
|
* by the caller. Records the tick's accumulated mutations into the
|
|
300
364
|
* MutationLedger (if configured), then packs frames
|
|
301
365
|
* `[last_acked+1, current_frame]` for each peer via
|
|
302
|
-
* `Replicator.pack_for_peer
|
|
303
|
-
*
|
|
366
|
+
* `Replicator.pack_for_peer` into up to {@link max_packets_per_tick}
|
|
367
|
+
* channel packets, each the next slice of that range. Empty packs (no
|
|
368
|
+
* in-scope actions) are not sent. Clears the per-tick changed-entity set
|
|
369
|
+
* after recording.
|
|
304
370
|
*
|
|
305
371
|
* @param {number} current_frame
|
|
306
372
|
*/
|
|
@@ -421,6 +487,29 @@ export class NetworkPeer {
|
|
|
421
487
|
send_reliable_command(peer_id: number, payload: Uint8Array, length: number): number;
|
|
422
488
|
#private;
|
|
423
489
|
}
|
|
490
|
+
/**
|
|
491
|
+
* One outbound action-stream send, awaiting confirmation.
|
|
492
|
+
*
|
|
493
|
+
* A send occupies one transport seq when it fits the MTU and N consecutive
|
|
494
|
+
* seqs when it has to be fragmented. All of those seqs map to the SAME record:
|
|
495
|
+
* the receiver reassembles a fragmented message all-or-nothing, so the frame
|
|
496
|
+
* range is confirmed only when `unacked` reaches zero without `abandoned`
|
|
497
|
+
* having been set by a loss along the way.
|
|
498
|
+
*
|
|
499
|
+
* A tick may make several sends to one peer, each carrying the next slice of
|
|
500
|
+
* the owed range (see {@link NetworkPeerflush_outbound }). They confirm
|
|
501
|
+
* independently, and the baseline advances only through slices confirmed in
|
|
502
|
+
* order — a later slice landing says nothing about an earlier one still in
|
|
503
|
+
* flight. `head` marks the first slice of a tick, whose start is the pack
|
|
504
|
+
* start itself; see {@link NetworkPeer__credit_confirmed }.
|
|
505
|
+
*/
|
|
506
|
+
export type PendingAck = {
|
|
507
|
+
frame_start: number;
|
|
508
|
+
frame_end: number;
|
|
509
|
+
head: boolean;
|
|
510
|
+
unacked: number;
|
|
511
|
+
abandoned: boolean;
|
|
512
|
+
};
|
|
424
513
|
import { ReplicatedComponentRegistry } from "../sim/ReplicatedComponentRegistry.js";
|
|
425
514
|
import { SimActionRegistry } from "../sim/SimActionRegistry.js";
|
|
426
515
|
import { ReplicationSlotTable } from "../state/ReplicationSlotTable.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkPeer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/network/orchestrator/NetworkPeer.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"NetworkPeer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/network/orchestrator/NetworkPeer.js"],"names":[],"mappings":";;;;;gCAgDU,MAAM;;;;;;;;;;;;;;;;;;;iCA2HI,MAAM;AAF1B;;;GAGG;AACH;;;;;IAKI;;;;;OAKG;;IAEH;;;;;;;;OAQG;;GAEJ;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IAgDI;;;;;;;;;;;;;OAaG;IACH;;;+BAV4B,UAAU;wBACjB,UAAU;;wCACmB,MAAM,cAAc,MAAM,GAAG,OAAO;;yBAChE,MAAM;8BACD,MAAM;0BACV,cAAc,GAAC,IAAI;+BACd,MAAM;+BACN,MAAM;OAwPjC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