@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
|
@@ -45,6 +45,7 @@ export class ServerAuthoritativeClient {
|
|
|
45
45
|
* input_byte_size?: number,
|
|
46
46
|
* reconcile_epsilon?: number,
|
|
47
47
|
* time_dilation?: TimeDilation,
|
|
48
|
+
* max_packets_per_tick?: number,
|
|
48
49
|
* }} options
|
|
49
50
|
*
|
|
50
51
|
* `time_dilation`: optional pre-configured {@link TimeDilation}.
|
|
@@ -52,8 +53,11 @@ export class ServerAuthoritativeClient {
|
|
|
52
53
|
* {@link dilation_factor} for the caller to scale its tick cadence.
|
|
53
54
|
* Defaults to a stock instance; `dilation_factor` is 1.0 until the
|
|
54
55
|
* first feedback arrives.
|
|
56
|
+
*
|
|
57
|
+
* `max_packets_per_tick`: forwarded to {@link NetworkPeer}; how many
|
|
58
|
+
* action-stream packets a tick may send the server.
|
|
55
59
|
*/
|
|
56
|
-
constructor({ world, binary_registry, replicated_components, action_classes, scope_filter, frame_capacity, initial_buffer_size, input_ring_capacity, input_byte_size, reconcile_epsilon, time_dilation, }: {
|
|
60
|
+
constructor({ world, binary_registry, replicated_components, action_classes, scope_filter, frame_capacity, initial_buffer_size, input_ring_capacity, input_byte_size, reconcile_epsilon, time_dilation, max_packets_per_tick, }: {
|
|
57
61
|
world: EntityComponentDataset;
|
|
58
62
|
binary_registry: BinarySerializationRegistry;
|
|
59
63
|
replicated_components: Function[];
|
|
@@ -65,6 +69,7 @@ export class ServerAuthoritativeClient {
|
|
|
65
69
|
input_byte_size?: number;
|
|
66
70
|
reconcile_epsilon?: number;
|
|
67
71
|
time_dilation?: TimeDilation;
|
|
72
|
+
max_packets_per_tick?: number;
|
|
68
73
|
});
|
|
69
74
|
/** @type {number} */
|
|
70
75
|
reconcile_count: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerAuthoritativeClient.d.ts","sourceRoot":"","sources":["../../../../../src/engine/network/orchestrator/ServerAuthoritativeClient.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH;IAsBI
|
|
1
|
+
{"version":3,"file":"ServerAuthoritativeClient.d.ts","sourceRoot":"","sources":["../../../../../src/engine/network/orchestrator/ServerAuthoritativeClient.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH;IAsBI;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,iOAxBW;QACV,KAAS,yBAAyB;QAClC,eAAmB,8BAA8B;QACjD,qBAAyB,EAAE,UAA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AM,aACN,MAAM,QAIhB;IAED;;;OAGG;IACH,gCAFW,MAAM,QAIhB;IAED;iCAC6B;IAC7B,qBADW,MAAM,6CAGhB;IAED;;;;;;;;;;OAUG;IACH,oBAFW,MAAM,QAahB;IAED;;;;;;;OAOG;IACH,qBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;OAMG;IACH,iBAHW,MAAM,gBAKhB;IAiFD;;;;;OAKG;IACH,oBAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,oBAFW,MAAM,QAIhB;;CACJ;4BA7a2B,kBAAkB;0BAFpB,uBAAuB;6BADpB,wBAAwB;6BAExB,yBAAyB;mBAJnC,uCAAuC"}
|
|
@@ -75,6 +75,7 @@ export class ServerAuthoritativeClient {
|
|
|
75
75
|
* input_byte_size?: number,
|
|
76
76
|
* reconcile_epsilon?: number,
|
|
77
77
|
* time_dilation?: TimeDilation,
|
|
78
|
+
* max_packets_per_tick?: number,
|
|
78
79
|
* }} options
|
|
79
80
|
*
|
|
80
81
|
* `time_dilation`: optional pre-configured {@link TimeDilation}.
|
|
@@ -82,6 +83,9 @@ export class ServerAuthoritativeClient {
|
|
|
82
83
|
* {@link dilation_factor} for the caller to scale its tick cadence.
|
|
83
84
|
* Defaults to a stock instance; `dilation_factor` is 1.0 until the
|
|
84
85
|
* first feedback arrives.
|
|
86
|
+
*
|
|
87
|
+
* `max_packets_per_tick`: forwarded to {@link NetworkPeer}; how many
|
|
88
|
+
* action-stream packets a tick may send the server.
|
|
85
89
|
*/
|
|
86
90
|
constructor({
|
|
87
91
|
world,
|
|
@@ -95,6 +99,7 @@ export class ServerAuthoritativeClient {
|
|
|
95
99
|
input_byte_size = 4,
|
|
96
100
|
reconcile_epsilon = 1e-4,
|
|
97
101
|
time_dilation = new TimeDilation(),
|
|
102
|
+
max_packets_per_tick,
|
|
98
103
|
}) {
|
|
99
104
|
/** @type {NetworkPeer} */
|
|
100
105
|
this.peer = new NetworkPeer({
|
|
@@ -105,6 +110,7 @@ export class ServerAuthoritativeClient {
|
|
|
105
110
|
scope_filter,
|
|
106
111
|
frame_capacity,
|
|
107
112
|
initial_buffer_size,
|
|
113
|
+
max_packets_per_tick,
|
|
108
114
|
});
|
|
109
115
|
|
|
110
116
|
/** @type {EntityComponentDataset} */
|
|
@@ -6,23 +6,48 @@
|
|
|
6
6
|
*
|
|
7
7
|
* 1. Inbound action packets do NOT execute on arrival. Instead, a deferral
|
|
8
8
|
* hook on the {@link Replicator} drops them into a per-tick pending log
|
|
9
|
-
* tagged with `(client_frame, sender_id, type_id, payload_bytes)
|
|
9
|
+
* tagged with `(client_frame, sender_id, type_id, payload_bytes)` —
|
|
10
|
+
* unless the action log already holds that record. The action stream
|
|
11
|
+
* re-sends every unconfirmed frame each tick, so most arrivals at any
|
|
12
|
+
* real latency are copies of applied records; those are dropped where
|
|
13
|
+
* they arrive, and pending holds only input the log does not.
|
|
10
14
|
* 2. Once per server tick, `tick(current_frame)` consumes the pending log:
|
|
11
15
|
* - Rejects entries older than the action_log's rewindable window.
|
|
12
|
-
* - Determines the oldest pending frame
|
|
16
|
+
* - Determines `replay_start`: the oldest pending frame, which by the
|
|
17
|
+
* above is the oldest frame whose outcome can change.
|
|
13
18
|
* - Rewinds the server world back to end-of-(replay_start - 1) via the
|
|
14
19
|
* action_log's prior-state captures (see {@link RewindEngine}).
|
|
15
20
|
* - Replays forward `[replay_start, current_frame]`. For each frame `f`:
|
|
16
21
|
* - Read historical actions out of `action_log[f]` BEFORE
|
|
17
22
|
* `begin_frame(f)` recycles the buffer.
|
|
18
23
|
* - Append pending entries for `f`.
|
|
24
|
+
* - Append anything queued by {@link enqueue_action}.
|
|
19
25
|
* - Stable-sort the merged list by `sender_id` (so multi-client order
|
|
20
26
|
* is deterministic across peers — relies on per-record sender_id in
|
|
21
|
-
* the action log).
|
|
22
|
-
* -
|
|
23
|
-
* supplied local sim via {@link onLocalSim}.
|
|
27
|
+
* the action log), and `executor.execute` each in that order.
|
|
28
|
+
* - Run the user-supplied local sim via {@link onLocalSim}.
|
|
24
29
|
* - Clear pending.
|
|
25
30
|
*
|
|
31
|
+
* A frame's records have one of two provenances, and the replay treats them
|
|
32
|
+
* differently:
|
|
33
|
+
*
|
|
34
|
+
* - **Input** — actions that arrived from a peer, and actions the server
|
|
35
|
+
* authored via {@link enqueue_action}. Each happened once, at a point in
|
|
36
|
+
* time nothing can recompute, so a replay reapplies it from the log.
|
|
37
|
+
* - **Derived output** — everything {@link onLocalSim} executes. The handler
|
|
38
|
+
* runs again on every replay of the frame, against a world that now
|
|
39
|
+
* includes whatever late input forced the replay, so the replay recomputes
|
|
40
|
+
* it. Reapplying the previous pass's copy as well would apply the effect
|
|
41
|
+
* twice — and three times on the next replay, and so on, without bound.
|
|
42
|
+
* The executor stamps these {@link SENDER_DERIVED} while the handler runs
|
|
43
|
+
* and {@link __read_historical} drops them.
|
|
44
|
+
*
|
|
45
|
+
* Derived records are still written, and still replicate: the prior-state
|
|
46
|
+
* capture is what lets a rewind undo the local sim's effect on replicated
|
|
47
|
+
* components (so derived output need not be idempotent — only deterministic
|
|
48
|
+
* in the frame's post-input state), and the action stream carries them to
|
|
49
|
+
* clients like any other record.
|
|
50
|
+
*
|
|
26
51
|
* Net effect: a client action tagged at client tick K lands on the server as
|
|
27
52
|
* if applied against end-of-K-1 server state, regardless of arrival timing
|
|
28
53
|
* or order. Both peers compute identical world states for identical inputs.
|
|
@@ -51,8 +76,12 @@ export class ServerAuthoritativeServer {
|
|
|
51
76
|
* frame_capacity?: number,
|
|
52
77
|
* initial_buffer_size?: number,
|
|
53
78
|
* simulation_delay_ticks?: number,
|
|
79
|
+
* max_packets_per_tick?: number,
|
|
54
80
|
* }} options
|
|
55
81
|
*
|
|
82
|
+
* `max_packets_per_tick`: forwarded to {@link NetworkPeer}; how many
|
|
83
|
+
* action-stream packets a tick may send one peer.
|
|
84
|
+
*
|
|
56
85
|
* `simulation_delay_ticks`: server-side input buffer (Overwatch-style).
|
|
57
86
|
* When > 0, {@link tick}(wall_frame) simulates
|
|
58
87
|
* `sim_frame = wall_frame - simulation_delay_ticks`. Pending actions
|
|
@@ -62,7 +91,7 @@ export class ServerAuthoritativeServer {
|
|
|
62
91
|
* input-to-feedback latency (client prediction hides it). Default 0
|
|
63
92
|
* reproduces pre-feature behavior.
|
|
64
93
|
*/
|
|
65
|
-
constructor({ world, binary_registry, replicated_components, action_classes, scope_filter, frame_capacity, initial_buffer_size, simulation_delay_ticks, max_pending_future_lead, max_pending_total, identity_class, server_peer_id, }: {
|
|
94
|
+
constructor({ world, binary_registry, replicated_components, action_classes, scope_filter, frame_capacity, initial_buffer_size, simulation_delay_ticks, max_pending_future_lead, max_pending_total, identity_class, server_peer_id, max_packets_per_tick, }: {
|
|
66
95
|
world: EntityComponentDataset;
|
|
67
96
|
binary_registry: BinarySerializationRegistry;
|
|
68
97
|
replicated_components: Function[];
|
|
@@ -71,6 +100,7 @@ export class ServerAuthoritativeServer {
|
|
|
71
100
|
frame_capacity?: number;
|
|
72
101
|
initial_buffer_size?: number;
|
|
73
102
|
simulation_delay_ticks?: number;
|
|
103
|
+
max_packets_per_tick?: number;
|
|
74
104
|
});
|
|
75
105
|
/**
|
|
76
106
|
* Most recently simulated frame. `-1` during warmup
|
|
@@ -109,6 +139,15 @@ export class ServerAuthoritativeServer {
|
|
|
109
139
|
* @type {number}
|
|
110
140
|
*/
|
|
111
141
|
simulation_delay_ticks: number;
|
|
142
|
+
/**
|
|
143
|
+
* Peer id of this authoritative server, or `-1` when the session has no
|
|
144
|
+
* privileged peer. Actions from {@link enqueue_action} are tagged with
|
|
145
|
+
* it so they pass the owner-authorization gate on any entity (see
|
|
146
|
+
* {@link make_owner_authorization}), which is the documented convention
|
|
147
|
+
* for the server's own mutations.
|
|
148
|
+
* @type {number}
|
|
149
|
+
*/
|
|
150
|
+
server_peer_id: number;
|
|
112
151
|
/**
|
|
113
152
|
* Upper bound on how far ahead of the server's own simulation a peer
|
|
114
153
|
* may tag an inbound action. `frame_number` is an attacker-controlled
|
|
@@ -132,13 +171,35 @@ export class ServerAuthoritativeServer {
|
|
|
132
171
|
*/
|
|
133
172
|
max_pending_total: number;
|
|
134
173
|
/**
|
|
135
|
-
* Fires once per
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
174
|
+
* Fires once per execution of a frame, AFTER all input for that frame
|
|
175
|
+
* has been applied and BEFORE the action_log frame is closed. Use it
|
|
176
|
+
* for server-authoritative local sim: clamps, collision, AI step,
|
|
177
|
+
* damage resolution, spawning the effects a hit produces.
|
|
178
|
+
*
|
|
179
|
+
* **This is a derivation, not an event.** The handler runs again on
|
|
180
|
+
* every replay of the frame, and must produce the same result for the
|
|
181
|
+
* same post-input world state — it is a function OF that state, not a
|
|
182
|
+
* one-shot that happens to be called from it. Concretely:
|
|
183
|
+
*
|
|
184
|
+
* - Decide from world state and the frame number. Both are restored
|
|
185
|
+
* before the handler re-runs.
|
|
186
|
+
* - Do NOT latch on handler-local flags (`if (already_fired) return`)
|
|
187
|
+
* to make something happen once. The replay needs the handler to
|
|
188
|
+
* re-emit; a latch makes it emit nothing, and the action is lost
|
|
189
|
+
* the first time a rollback crosses its frame. For a genuine
|
|
190
|
+
* one-shot — a lobby spawn, an admin command, anything decided
|
|
191
|
+
* outside the simulation — use {@link enqueue_action}, which is
|
|
192
|
+
* recorded as input and replayed rather than recomputed.
|
|
193
|
+
*
|
|
194
|
+
* Actions the handler executes are recorded as derived output: they
|
|
195
|
+
* replicate to clients and their prior state is captured so a rewind
|
|
196
|
+
* undoes them, but a replay recomputes them instead of reapplying the
|
|
197
|
+
* previous pass's copy. So they need not be idempotent — a handler may
|
|
198
|
+
* subtract hit points — only deterministic in the frame's post-input
|
|
199
|
+
* state. Components the handler mutates DIRECTLY, without going through
|
|
200
|
+
* an action, have no prior-state capture and are not undone by a
|
|
201
|
+
* rewind; those must additionally be idempotent, which is why a clamp
|
|
202
|
+
* is safe to write that way and `hp -= 10` is not.
|
|
142
203
|
*
|
|
143
204
|
* Args: `(frame_number)`.
|
|
144
205
|
* @type {Signal}
|
|
@@ -215,6 +276,37 @@ export class ServerAuthoritativeServer {
|
|
|
215
276
|
* @param {number} peer_id
|
|
216
277
|
*/
|
|
217
278
|
send_time_dilation_feedback(peer_id: number): void;
|
|
279
|
+
/**
|
|
280
|
+
* Author a server-side action, to be applied on the next simulated frame.
|
|
281
|
+
*
|
|
282
|
+
* This is the supported path for a mutation the simulation cannot
|
|
283
|
+
* recompute — a spawn triggered by a lobby event, an admin command, a
|
|
284
|
+
* scripted trigger — as opposed to {@link onLocalSim}, which derives a
|
|
285
|
+
* frame's output from its state and is re-run on every replay.
|
|
286
|
+
*
|
|
287
|
+
* The action is serialized immediately (so the caller may reuse or discard
|
|
288
|
+
* the instance) and applied exactly once, on the next frame {@link tick}
|
|
289
|
+
* simulates for the first time, merged into that frame's input and ordered
|
|
290
|
+
* with it by sender. From then on it is ordinary history: replayed from the
|
|
291
|
+
* log like any other input, and never re-queued.
|
|
292
|
+
*
|
|
293
|
+
* Callable at any time EXCEPT from inside {@link onLocalSim}, which throws:
|
|
294
|
+
* that handler re-runs on every replay of its frame, so it would queue a
|
|
295
|
+
* fresh copy each time. (`executor.execute` is the opposite — it requires
|
|
296
|
+
* an open action_log frame, so it only works from inside the handler.)
|
|
297
|
+
*
|
|
298
|
+
* Recorded with {@link server_peer_id} as the sender when the session has
|
|
299
|
+
* one, so it passes the owner-authorization gate on any entity; with
|
|
300
|
+
* {@link SENDER_LOCAL} otherwise, which bypasses the gate.
|
|
301
|
+
*
|
|
302
|
+
* @param {SimAction} action
|
|
303
|
+
*/
|
|
304
|
+
enqueue_action(action: SimAction): void;
|
|
305
|
+
/**
|
|
306
|
+
* Number of locally-authored actions waiting for the next simulated frame.
|
|
307
|
+
* @returns {number}
|
|
308
|
+
*/
|
|
309
|
+
queued_local_action_count(): number;
|
|
218
310
|
/**
|
|
219
311
|
* Drive the rollback flow for one tick.
|
|
220
312
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerAuthoritativeServer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/network/orchestrator/ServerAuthoritativeServer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ServerAuthoritativeServer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/network/orchestrator/ServerAuthoritativeServer.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH;IAsCI;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,6PAxBW;QACV,KAAS,yBAAyB;QAClC,eAAmB,8BAA8B;QACjD,qBAAyB,EAAE,UAAU,CAAC;QACtC,cAAkB,EAAE,UAAU,CAAC;QAC/B,YAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,cAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,mBAAuB,CAAC,EAAE,MAAM,CAAC;QACjC,sBAA0B,CAAC,EAAE,MAAM,CAAC;QACpC,oBAAwB,CAAC,EAAE,MAAM,CAAC;KAC/B,EAiOH;IApPD;;;;;OAKG;IACH,mBAFU,MAAM,CAEO;IA6CnB,0BAA0B;IAC1B,MADW,WAAW,CAUpB;IAEF,qCAAqC;IACrC,8BAAkB;IAClB,gCAAgC;IAChC,4BAAkC;IAclC,mCAAmC;IACnC,iCAAsC;IACtC,wBAAwB;IACxB,sBAAsC;IACtC,gCAAgC;IAChC,mCAAgD;IAChD,0CAA0C;IAC1C,gDAAsD;IAEtD,2BAA2B;IAC3B,eADW,YAAY,CAKrB;IAEF;;;;;;OAMG;IACH,6BAFU,MAAM,CAEqB;IAErC;;;;OAIG;IACH,wBAFU,MAAM,CAEoC;IAEpD;;;;;;;OAOG;IACH,gBAFU,MAAM,CAEoB;IAEpC;;;;;;;;;OASG;IACH,yBAFU,MAAM,CAEsC;IAEtD;;;;;;;;;OASG;IACH,mBAF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