@esengine/network 9.0.0 → 10.0.0
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/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +227 -0
- package/dist/index.js.map +1 -1
- package/dist/sync/fixed/FixedClientPrediction.d.ts +245 -0
- package/dist/sync/fixed/FixedClientPrediction.d.ts.map +1 -0
- package/dist/sync/fixed/FixedSnapshotBuffer.d.ts +141 -0
- package/dist/sync/fixed/FixedSnapshotBuffer.d.ts.map +1 -0
- package/dist/sync/fixed/FixedTransformInterpolator.d.ts +90 -0
- package/dist/sync/fixed/FixedTransformInterpolator.d.ts.map +1 -0
- package/dist/sync/fixed/FixedTransformState.d.ts +145 -0
- package/dist/sync/fixed/FixedTransformState.d.ts.map +1 -0
- package/dist/sync/fixed/index.d.ts +12 -0
- package/dist/sync/fixed/index.d.ts.map +1 -0
- package/dist/sync/index.d.ts +2 -0
- package/dist/sync/index.d.ts.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zh 定点数客户端预测
|
|
3
|
+
* @en Fixed-point Client Prediction
|
|
4
|
+
*
|
|
5
|
+
* @zh 用于帧同步的确定性客户端预测和回滚
|
|
6
|
+
* @en Deterministic client prediction and rollback for lockstep
|
|
7
|
+
*/
|
|
8
|
+
import { Fixed32, FixedVector2 } from '@esengine/ecs-framework-math';
|
|
9
|
+
/**
|
|
10
|
+
* @zh 定点数输入快照
|
|
11
|
+
* @en Fixed-point input snapshot
|
|
12
|
+
*/
|
|
13
|
+
export interface IFixedInputSnapshot<TInput> {
|
|
14
|
+
/**
|
|
15
|
+
* @zh 输入帧号
|
|
16
|
+
* @en Input frame number
|
|
17
|
+
*/
|
|
18
|
+
readonly frame: number;
|
|
19
|
+
/**
|
|
20
|
+
* @zh 输入数据
|
|
21
|
+
* @en Input data
|
|
22
|
+
*/
|
|
23
|
+
readonly input: TInput;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @zh 定点数预测状态
|
|
27
|
+
* @en Fixed-point predicted state
|
|
28
|
+
*/
|
|
29
|
+
export interface IFixedPredictedState<TState> {
|
|
30
|
+
/**
|
|
31
|
+
* @zh 状态数据
|
|
32
|
+
* @en State data
|
|
33
|
+
*/
|
|
34
|
+
readonly state: TState;
|
|
35
|
+
/**
|
|
36
|
+
* @zh 对应的帧号
|
|
37
|
+
* @en Corresponding frame number
|
|
38
|
+
*/
|
|
39
|
+
readonly frame: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @zh 定点数状态预测器接口
|
|
43
|
+
* @en Fixed-point state predictor interface
|
|
44
|
+
*
|
|
45
|
+
* @zh 必须使用定点数运算确保确定性
|
|
46
|
+
* @en Must use fixed-point arithmetic to ensure determinism
|
|
47
|
+
*/
|
|
48
|
+
export interface IFixedPredictor<TState, TInput> {
|
|
49
|
+
/**
|
|
50
|
+
* @zh 根据当前状态和输入预测下一状态
|
|
51
|
+
* @en Predict next state based on current state and input
|
|
52
|
+
*
|
|
53
|
+
* @param state - @zh 当前状态 @en Current state
|
|
54
|
+
* @param input - @zh 输入 @en Input
|
|
55
|
+
* @param deltaTime - @zh 固定时间步长(定点数)@en Fixed delta time (fixed-point)
|
|
56
|
+
* @returns @zh 预测的状态 @en Predicted state
|
|
57
|
+
*/
|
|
58
|
+
predict(state: TState, input: TInput, deltaTime: Fixed32): TState;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @zh 状态位置提取器接口
|
|
62
|
+
* @en State position extractor interface
|
|
63
|
+
*/
|
|
64
|
+
export interface IFixedStatePositionExtractor<TState> {
|
|
65
|
+
/**
|
|
66
|
+
* @zh 从状态中提取位置
|
|
67
|
+
* @en Extract position from state
|
|
68
|
+
*/
|
|
69
|
+
getPosition(state: TState): FixedVector2;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @zh 定点数客户端预测配置
|
|
73
|
+
* @en Fixed-point client prediction configuration
|
|
74
|
+
*/
|
|
75
|
+
export interface FixedClientPredictionConfig {
|
|
76
|
+
/**
|
|
77
|
+
* @zh 最大未确认输入数量
|
|
78
|
+
* @en Maximum unacknowledged inputs
|
|
79
|
+
*/
|
|
80
|
+
maxUnacknowledgedInputs: number;
|
|
81
|
+
/**
|
|
82
|
+
* @zh 固定时间步长(定点数)
|
|
83
|
+
* @en Fixed delta time (fixed-point)
|
|
84
|
+
*/
|
|
85
|
+
fixedDeltaTime: Fixed32;
|
|
86
|
+
/**
|
|
87
|
+
* @zh 校正阈值(定点数,超过此值才进行校正)
|
|
88
|
+
* @en Reconciliation threshold (fixed-point, correction only above this value)
|
|
89
|
+
*/
|
|
90
|
+
reconciliationThreshold: Fixed32;
|
|
91
|
+
/**
|
|
92
|
+
* @zh 是否启用平滑校正(帧同步通常关闭)
|
|
93
|
+
* @en Enable smooth reconciliation (usually disabled for lockstep)
|
|
94
|
+
*/
|
|
95
|
+
enableSmoothReconciliation: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* @zh 平滑校正速度(定点数)
|
|
98
|
+
* @en Smooth reconciliation speed (fixed-point)
|
|
99
|
+
*/
|
|
100
|
+
reconciliationSpeed: Fixed32;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @zh 定点数客户端预测管理器
|
|
104
|
+
* @en Fixed-point client prediction manager
|
|
105
|
+
*
|
|
106
|
+
* @zh 提供确定性的客户端预测和服务器状态回滚校正
|
|
107
|
+
* @en Provides deterministic client prediction and server state rollback reconciliation
|
|
108
|
+
*/
|
|
109
|
+
export declare class FixedClientPrediction<TState, TInput> {
|
|
110
|
+
private readonly _predictor;
|
|
111
|
+
private readonly _config;
|
|
112
|
+
private readonly _pendingInputs;
|
|
113
|
+
private _lastAcknowledgedFrame;
|
|
114
|
+
private _currentFrame;
|
|
115
|
+
private _lastServerState;
|
|
116
|
+
private _predictedState;
|
|
117
|
+
private _correctionOffset;
|
|
118
|
+
private _stateHistory;
|
|
119
|
+
private readonly _maxHistorySize;
|
|
120
|
+
constructor(predictor: IFixedPredictor<TState, TInput>, config?: Partial<FixedClientPredictionConfig>);
|
|
121
|
+
/**
|
|
122
|
+
* @zh 获取当前预测状态
|
|
123
|
+
* @en Get current predicted state
|
|
124
|
+
*/
|
|
125
|
+
get predictedState(): TState | null;
|
|
126
|
+
/**
|
|
127
|
+
* @zh 获取校正偏移(用于渲染平滑)
|
|
128
|
+
* @en Get correction offset (for render smoothing)
|
|
129
|
+
*/
|
|
130
|
+
get correctionOffset(): FixedVector2;
|
|
131
|
+
/**
|
|
132
|
+
* @zh 获取待确认输入数量
|
|
133
|
+
* @en Get pending input count
|
|
134
|
+
*/
|
|
135
|
+
get pendingInputCount(): number;
|
|
136
|
+
/**
|
|
137
|
+
* @zh 获取当前帧号
|
|
138
|
+
* @en Get current frame number
|
|
139
|
+
*/
|
|
140
|
+
get currentFrame(): number;
|
|
141
|
+
/**
|
|
142
|
+
* @zh 获取最后确认帧号
|
|
143
|
+
* @en Get last acknowledged frame
|
|
144
|
+
*/
|
|
145
|
+
get lastAcknowledgedFrame(): number;
|
|
146
|
+
/**
|
|
147
|
+
* @zh 记录并预测输入
|
|
148
|
+
* @en Record and predict input
|
|
149
|
+
*
|
|
150
|
+
* @param input - @zh 输入数据 @en Input data
|
|
151
|
+
* @param currentState - @zh 当前状态 @en Current state
|
|
152
|
+
* @returns @zh 预测的状态 @en Predicted state
|
|
153
|
+
*/
|
|
154
|
+
recordInput(input: TInput, currentState: TState): TState;
|
|
155
|
+
/**
|
|
156
|
+
* @zh 获取指定帧的输入
|
|
157
|
+
* @en Get input at specific frame
|
|
158
|
+
*/
|
|
159
|
+
getInputAtFrame(frame: number): IFixedInputSnapshot<TInput> | null;
|
|
160
|
+
/**
|
|
161
|
+
* @zh 获取所有待确认输入
|
|
162
|
+
* @en Get all pending inputs
|
|
163
|
+
*/
|
|
164
|
+
getPendingInputs(): readonly IFixedInputSnapshot<TInput>[];
|
|
165
|
+
/**
|
|
166
|
+
* @zh 处理服务器状态并进行回滚校正
|
|
167
|
+
* @en Process server state and perform rollback reconciliation
|
|
168
|
+
*
|
|
169
|
+
* @param serverState - @zh 服务器权威状态 @en Server authoritative state
|
|
170
|
+
* @param serverFrame - @zh 服务器状态对应的帧号 @en Server state frame number
|
|
171
|
+
* @param positionExtractor - @zh 状态位置提取器 @en State position extractor
|
|
172
|
+
* @returns @zh 校正后的状态 @en Reconciled state
|
|
173
|
+
*/
|
|
174
|
+
reconcile(serverState: TState, serverFrame: number, positionExtractor: IFixedStatePositionExtractor<TState>): TState;
|
|
175
|
+
/**
|
|
176
|
+
* @zh 回滚到指定帧并重新模拟
|
|
177
|
+
* @en Rollback to specific frame and re-simulate
|
|
178
|
+
*
|
|
179
|
+
* @param targetFrame - @zh 目标帧号 @en Target frame number
|
|
180
|
+
* @param authoritativeState - @zh 权威状态 @en Authoritative state
|
|
181
|
+
* @returns @zh 重新模拟后的当前状态 @en Re-simulated current state
|
|
182
|
+
*/
|
|
183
|
+
rollbackAndResimulate(targetFrame: number, authoritativeState: TState): TState;
|
|
184
|
+
/**
|
|
185
|
+
* @zh 获取历史状态
|
|
186
|
+
* @en Get historical state
|
|
187
|
+
*/
|
|
188
|
+
getStateAtFrame(frame: number): TState | null;
|
|
189
|
+
/**
|
|
190
|
+
* @zh 清空预测状态
|
|
191
|
+
* @en Clear prediction state
|
|
192
|
+
*/
|
|
193
|
+
clear(): void;
|
|
194
|
+
private _cleanupHistory;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* @zh 创建定点数客户端预测管理器
|
|
198
|
+
* @en Create fixed-point client prediction manager
|
|
199
|
+
*/
|
|
200
|
+
export declare function createFixedClientPrediction<TState, TInput>(predictor: IFixedPredictor<TState, TInput>, config?: Partial<FixedClientPredictionConfig>): FixedClientPrediction<TState, TInput>;
|
|
201
|
+
/**
|
|
202
|
+
* @zh 移动输入类型
|
|
203
|
+
* @en Movement input type
|
|
204
|
+
*/
|
|
205
|
+
export interface IFixedMovementInput {
|
|
206
|
+
/**
|
|
207
|
+
* @zh X方向输入 (-1, 0, 1)
|
|
208
|
+
* @en X direction input (-1, 0, 1)
|
|
209
|
+
*/
|
|
210
|
+
readonly dx: number;
|
|
211
|
+
/**
|
|
212
|
+
* @zh Y方向输入 (-1, 0, 1)
|
|
213
|
+
* @en Y direction input (-1, 0, 1)
|
|
214
|
+
*/
|
|
215
|
+
readonly dy: number;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* @zh 移动状态类型
|
|
219
|
+
* @en Movement state type
|
|
220
|
+
*/
|
|
221
|
+
export interface IFixedMovementState {
|
|
222
|
+
/**
|
|
223
|
+
* @zh 位置
|
|
224
|
+
* @en Position
|
|
225
|
+
*/
|
|
226
|
+
readonly position: FixedVector2;
|
|
227
|
+
/**
|
|
228
|
+
* @zh 速度
|
|
229
|
+
* @en Velocity
|
|
230
|
+
*/
|
|
231
|
+
readonly velocity: FixedVector2;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* @zh 创建简单移动预测器
|
|
235
|
+
* @en Create simple movement predictor
|
|
236
|
+
*
|
|
237
|
+
* @param speed - @zh 移动速度(定点数)@en Movement speed (fixed-point)
|
|
238
|
+
*/
|
|
239
|
+
export declare function createFixedMovementPredictor(speed: Fixed32): IFixedPredictor<IFixedMovementState, IFixedMovementInput>;
|
|
240
|
+
/**
|
|
241
|
+
* @zh 创建移动状态位置提取器
|
|
242
|
+
* @en Create movement state position extractor
|
|
243
|
+
*/
|
|
244
|
+
export declare function createFixedMovementPositionExtractor(): IFixedStatePositionExtractor<IFixedMovementState>;
|
|
245
|
+
//# sourceMappingURL=FixedClientPrediction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FixedClientPrediction.d.ts","sourceRoot":"","sources":["../../../src/sync/fixed/FixedClientPrediction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,O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H,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,EACtD,SAAS,EAAE,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,MAAM,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,GAC9C,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAEvC;AAMD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAEhC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CACxC,KAAK,EAAE,OAAO,GACf,eAAe,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAqB3D;AAED;;;GAGG;AACH,wBAAgB,oCAAoC,IAAI,4BAA4B,CAAC,mBAAmB,CAAC,CAMxG"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zh 定点数快照缓冲区
|
|
3
|
+
* @en Fixed-point Snapshot Buffer
|
|
4
|
+
*
|
|
5
|
+
* @zh 用于帧同步确定性计算的快照缓冲区
|
|
6
|
+
* @en Snapshot buffer for deterministic lockstep calculations
|
|
7
|
+
*/
|
|
8
|
+
import { Fixed32 } from '@esengine/ecs-framework-math';
|
|
9
|
+
/**
|
|
10
|
+
* @zh 定点数状态快照
|
|
11
|
+
* @en Fixed-point state snapshot
|
|
12
|
+
*/
|
|
13
|
+
export interface IFixedStateSnapshot<T> {
|
|
14
|
+
/**
|
|
15
|
+
* @zh 帧号(定点数时间戳)
|
|
16
|
+
* @en Frame number (fixed-point timestamp)
|
|
17
|
+
*/
|
|
18
|
+
readonly frame: number;
|
|
19
|
+
/**
|
|
20
|
+
* @zh 状态数据
|
|
21
|
+
* @en State data
|
|
22
|
+
*/
|
|
23
|
+
readonly state: T;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @zh 定点数快照缓冲区配置
|
|
27
|
+
* @en Fixed-point snapshot buffer configuration
|
|
28
|
+
*/
|
|
29
|
+
export interface IFixedSnapshotBufferConfig {
|
|
30
|
+
/**
|
|
31
|
+
* @zh 最大快照数量
|
|
32
|
+
* @en Maximum snapshot count
|
|
33
|
+
*/
|
|
34
|
+
maxSize: number;
|
|
35
|
+
/**
|
|
36
|
+
* @zh 插值延迟帧数
|
|
37
|
+
* @en Interpolation delay in frames
|
|
38
|
+
*/
|
|
39
|
+
interpolationDelayFrames: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @zh 插值结果
|
|
43
|
+
* @en Interpolation result
|
|
44
|
+
*/
|
|
45
|
+
export interface IFixedInterpolationResult<T> {
|
|
46
|
+
/**
|
|
47
|
+
* @zh 前一个快照
|
|
48
|
+
* @en Previous snapshot
|
|
49
|
+
*/
|
|
50
|
+
readonly from: IFixedStateSnapshot<T>;
|
|
51
|
+
/**
|
|
52
|
+
* @zh 后一个快照
|
|
53
|
+
* @en Next snapshot
|
|
54
|
+
*/
|
|
55
|
+
readonly to: IFixedStateSnapshot<T>;
|
|
56
|
+
/**
|
|
57
|
+
* @zh 插值因子 (0-1)
|
|
58
|
+
* @en Interpolation factor (0-1)
|
|
59
|
+
*/
|
|
60
|
+
readonly t: Fixed32;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @zh 定点数快照缓冲区
|
|
64
|
+
* @en Fixed-point snapshot buffer
|
|
65
|
+
*
|
|
66
|
+
* @zh 使用帧号而非毫秒时间戳,确保跨平台确定性
|
|
67
|
+
* @en Uses frame numbers instead of millisecond timestamps for cross-platform determinism
|
|
68
|
+
*/
|
|
69
|
+
export declare class FixedSnapshotBuffer<T> {
|
|
70
|
+
private readonly _buffer;
|
|
71
|
+
private readonly _maxSize;
|
|
72
|
+
private readonly _interpolationDelayFrames;
|
|
73
|
+
constructor(config: IFixedSnapshotBufferConfig);
|
|
74
|
+
/**
|
|
75
|
+
* @zh 获取缓冲区大小
|
|
76
|
+
* @en Get buffer size
|
|
77
|
+
*/
|
|
78
|
+
get size(): number;
|
|
79
|
+
/**
|
|
80
|
+
* @zh 获取插值延迟帧数
|
|
81
|
+
* @en Get interpolation delay in frames
|
|
82
|
+
*/
|
|
83
|
+
get interpolationDelayFrames(): number;
|
|
84
|
+
/**
|
|
85
|
+
* @zh 添加快照
|
|
86
|
+
* @en Add snapshot
|
|
87
|
+
*
|
|
88
|
+
* @param snapshot - @zh 状态快照 @en State snapshot
|
|
89
|
+
*/
|
|
90
|
+
push(snapshot: IFixedStateSnapshot<T>): void;
|
|
91
|
+
/**
|
|
92
|
+
* @zh 根据帧号获取插值快照
|
|
93
|
+
* @en Get interpolation snapshots by frame number
|
|
94
|
+
*
|
|
95
|
+
* @param currentFrame - @zh 当前帧号 @en Current frame number
|
|
96
|
+
* @returns @zh 插值结果(包含定点数插值因子)或 null @en Interpolation result with fixed-point factor or null
|
|
97
|
+
*/
|
|
98
|
+
getInterpolationSnapshots(currentFrame: number): IFixedInterpolationResult<T> | null;
|
|
99
|
+
/**
|
|
100
|
+
* @zh 根据精确帧时间获取插值快照(支持子帧插值)
|
|
101
|
+
* @en Get interpolation snapshots by precise frame time (supports sub-frame interpolation)
|
|
102
|
+
*
|
|
103
|
+
* @param frameTime - @zh 精确帧时间(定点数)@en Precise frame time (fixed-point)
|
|
104
|
+
* @returns @zh 插值结果或 null @en Interpolation result or null
|
|
105
|
+
*/
|
|
106
|
+
getInterpolationSnapshotsFixed(frameTime: Fixed32): IFixedInterpolationResult<T> | null;
|
|
107
|
+
/**
|
|
108
|
+
* @zh 获取最新快照
|
|
109
|
+
* @en Get latest snapshot
|
|
110
|
+
*/
|
|
111
|
+
getLatest(): IFixedStateSnapshot<T> | null;
|
|
112
|
+
/**
|
|
113
|
+
* @zh 获取特定帧号的快照
|
|
114
|
+
* @en Get snapshot at specific frame
|
|
115
|
+
*/
|
|
116
|
+
getAtFrame(frame: number): IFixedStateSnapshot<T> | null;
|
|
117
|
+
/**
|
|
118
|
+
* @zh 获取特定帧号之后的所有快照
|
|
119
|
+
* @en Get all snapshots after specific frame
|
|
120
|
+
*/
|
|
121
|
+
getSnapshotsAfter(frame: number): IFixedStateSnapshot<T>[];
|
|
122
|
+
/**
|
|
123
|
+
* @zh 移除指定帧号之前的所有快照
|
|
124
|
+
* @en Remove all snapshots before specific frame
|
|
125
|
+
*/
|
|
126
|
+
removeSnapshotsBefore(frame: number): void;
|
|
127
|
+
/**
|
|
128
|
+
* @zh 清空缓冲区
|
|
129
|
+
* @en Clear buffer
|
|
130
|
+
*/
|
|
131
|
+
clear(): void;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* @zh 创建定点数快照缓冲区
|
|
135
|
+
* @en Create fixed-point snapshot buffer
|
|
136
|
+
*
|
|
137
|
+
* @param maxSize - @zh 最大快照数量(默认 30)@en Maximum snapshot count (default 30)
|
|
138
|
+
* @param interpolationDelayFrames - @zh 插值延迟帧数(默认 2)@en Interpolation delay frames (default 2)
|
|
139
|
+
*/
|
|
140
|
+
export declare function createFixedSnapshotBuffer<T>(maxSize?: number, interpolationDelayFrames?: number): FixedSnapshotBuffer<T>;
|
|
141
|
+
//# sourceMappingURL=FixedSnapshotBuffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FixedSnapshotBuffer.d.ts","sourceRoot":"","sources":["../../../src/sync/fixed/FixedSnapshotBuffer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAMvD;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,C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C,GAAG,IAAI;IASxD;;;OAGG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAAC,CAAC,CAAC,EAAE;IAI1D;;;OAGG;IACH,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAM1C;;;OAGG;IACH,KAAK,IAAI,IAAI;CAGhB;AAMD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EACvC,OAAO,GAAE,MAAW,EACpB,wBAAwB,GAAE,MAAU,GACrC,mBAAmB,CAAC,CAAC,CAAC,CAExB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zh 定点数变换插值器
|
|
3
|
+
* @en Fixed-point Transform Interpolator
|
|
4
|
+
*
|
|
5
|
+
* @zh 用于帧同步确定性计算的插值器
|
|
6
|
+
* @en Interpolator for deterministic lockstep calculations
|
|
7
|
+
*/
|
|
8
|
+
import { Fixed32 } from '@esengine/ecs-framework-math';
|
|
9
|
+
import { FixedTransformState, FixedTransformStateWithVelocity, type IFixedTransformStateRaw, type IFixedTransformStateWithVelocityRaw } from './FixedTransformState';
|
|
10
|
+
/**
|
|
11
|
+
* @zh 定点数插值器接口
|
|
12
|
+
* @en Fixed-point interpolator interface
|
|
13
|
+
*/
|
|
14
|
+
export interface IFixedInterpolator<T> {
|
|
15
|
+
/**
|
|
16
|
+
* @zh 在两个状态之间插值
|
|
17
|
+
* @en Interpolate between two states
|
|
18
|
+
* @param from - @zh 起始状态 @en Start state
|
|
19
|
+
* @param to - @zh 结束状态 @en End state
|
|
20
|
+
* @param t - @zh 插值因子 (0-1) @en Interpolation factor (0-1)
|
|
21
|
+
*/
|
|
22
|
+
interpolate(from: T, to: T, t: Fixed32): T;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @zh 定点数外推器接口
|
|
26
|
+
* @en Fixed-point extrapolator interface
|
|
27
|
+
*/
|
|
28
|
+
export interface IFixedExtrapolator<T> {
|
|
29
|
+
/**
|
|
30
|
+
* @zh 基于速度外推状态
|
|
31
|
+
* @en Extrapolate state based on velocity
|
|
32
|
+
* @param state - @zh 当前状态 @en Current state
|
|
33
|
+
* @param deltaTime - @zh 时间增量 @en Time delta
|
|
34
|
+
*/
|
|
35
|
+
extrapolate(state: T, deltaTime: Fixed32): T;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @zh 定点数变换状态插值器
|
|
39
|
+
* @en Fixed-point transform state interpolator
|
|
40
|
+
*/
|
|
41
|
+
export declare class FixedTransformInterpolator implements IFixedInterpolator<FixedTransformState>, IFixedExtrapolator<FixedTransformStateWithVelocity> {
|
|
42
|
+
/**
|
|
43
|
+
* @zh 在两个变换状态之间插值
|
|
44
|
+
* @en Interpolate between two transform states
|
|
45
|
+
*/
|
|
46
|
+
interpolate(from: FixedTransformState, to: FixedTransformState, t: Fixed32): FixedTransformState;
|
|
47
|
+
/**
|
|
48
|
+
* @zh 基于速度外推变换状态
|
|
49
|
+
* @en Extrapolate transform state based on velocity
|
|
50
|
+
*/
|
|
51
|
+
extrapolate(state: FixedTransformStateWithVelocity, deltaTime: Fixed32): FixedTransformStateWithVelocity;
|
|
52
|
+
/**
|
|
53
|
+
* @zh 使用原始值进行插值
|
|
54
|
+
* @en Interpolate using raw values
|
|
55
|
+
*/
|
|
56
|
+
interpolateRaw(from: IFixedTransformStateRaw, to: IFixedTransformStateRaw, t: number): IFixedTransformStateRaw;
|
|
57
|
+
/**
|
|
58
|
+
* @zh 使用原始值进行外推
|
|
59
|
+
* @en Extrapolate using raw values
|
|
60
|
+
*/
|
|
61
|
+
extrapolateRaw(state: IFixedTransformStateWithVelocityRaw, deltaTimeMs: number): IFixedTransformStateWithVelocityRaw;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @zh 定点数赫尔米特变换插值器(更平滑的曲线)
|
|
65
|
+
* @en Fixed-point Hermite transform interpolator (smoother curves)
|
|
66
|
+
*/
|
|
67
|
+
export declare class FixedHermiteTransformInterpolator implements IFixedInterpolator<FixedTransformStateWithVelocity> {
|
|
68
|
+
/**
|
|
69
|
+
* @zh 快照间隔时间(秒)
|
|
70
|
+
* @en Snapshot interval in seconds
|
|
71
|
+
*/
|
|
72
|
+
private readonly snapshotInterval;
|
|
73
|
+
constructor(snapshotIntervalMs?: number);
|
|
74
|
+
/**
|
|
75
|
+
* @zh 使用赫尔米特插值
|
|
76
|
+
* @en Use Hermite interpolation
|
|
77
|
+
*/
|
|
78
|
+
interpolate(from: FixedTransformStateWithVelocity, to: FixedTransformStateWithVelocity, t: Fixed32): FixedTransformStateWithVelocity;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @zh 创建定点数变换插值器
|
|
82
|
+
* @en Create fixed-point transform interpolator
|
|
83
|
+
*/
|
|
84
|
+
export declare function createFixedTransformInterpolator(): FixedTransformInterpolator;
|
|
85
|
+
/**
|
|
86
|
+
* @zh 创建定点数赫尔米特变换插值器
|
|
87
|
+
* @en Create fixed-point Hermite transform interpolator
|
|
88
|
+
*/
|
|
89
|
+
export declare function createFixedHermiteTransformInterpolator(snapshotIntervalMs?: number): FixedHermiteTransformInterpolator;
|
|
90
|
+
//# sourceMappingURL=FixedTransformInterpolator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FixedTransformInterpolator.d.ts","sourceRoot":"","sources":["../../../src/sync/fixed/FixedTransformInterpolator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAA2B,MAAM,8BAA8B,CAAC;AAChF,OAAO,EACH,mBAAmB,EACnB,+BAA+B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,mCAAmC,EAC3C,MAAM,uBAAuB,CAAC;AAM/B;;;GAGG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACjC;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,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transform State
|
|
4
|
+
*
|
|
5
|
+
* @zh 用于帧同步确定性计算的变换状态
|
|
6
|
+
* @en Transform state for deterministic lockstep calculations
|
|
7
|
+
*/
|
|
8
|
+
import { Fixed32, FixedVector2 } from '@esengine/ecs-framework-math';
|
|
9
|
+
/**
|
|
10
|
+
* @zh 定点数变换状态(原始值)
|
|
11
|
+
* @en Fixed-point transform state (raw values)
|
|
12
|
+
*
|
|
13
|
+
* @zh 用于网络传输的原始整数格式,确保跨平台一致性
|
|
14
|
+
* @en Raw integer format for network transmission, ensures cross-platform consistency
|
|
15
|
+
*/
|
|
16
|
+
export interface IFixedTransformStateRaw {
|
|
17
|
+
/**
|
|
18
|
+
* @zh X 坐标原始值
|
|
19
|
+
* @en X coordinate raw value
|
|
20
|
+
*/
|
|
21
|
+
x: number;
|
|
22
|
+
/**
|
|
23
|
+
* @zh Y 坐标原始值
|
|
24
|
+
* @en Y coordinate raw value
|
|
25
|
+
*/
|
|
26
|
+
y: number;
|
|
27
|
+
/**
|
|
28
|
+
* @zh 旋转角度原始值(弧度 * 65536)
|
|
29
|
+
* @en Rotation raw value (radians * 65536)
|
|
30
|
+
*/
|
|
31
|
+
rotation: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @zh 带速度的定点数变换状态(原始值)
|
|
35
|
+
* @en Fixed-point transform state with velocity (raw values)
|
|
36
|
+
*/
|
|
37
|
+
export interface IFixedTransformStateWithVelocityRaw extends IFixedTransformStateRaw {
|
|
38
|
+
/**
|
|
39
|
+
* @zh X 速度原始值
|
|
40
|
+
* @en X velocity raw value
|
|
41
|
+
*/
|
|
42
|
+
velocityX: number;
|
|
43
|
+
/**
|
|
44
|
+
* @zh Y 速度原始值
|
|
45
|
+
* @en Y velocity raw value
|
|
46
|
+
*/
|
|
47
|
+
velocityY: number;
|
|
48
|
+
/**
|
|
49
|
+
* @zh 角速度原始值
|
|
50
|
+
* @en Angular velocity raw value
|
|
51
|
+
*/
|
|
52
|
+
angularVelocity: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @zh 定点数变换状态
|
|
56
|
+
* @en Fixed-point transform state
|
|
57
|
+
*/
|
|
58
|
+
export declare class FixedTransformState {
|
|
59
|
+
readonly position: FixedVector2;
|
|
60
|
+
readonly rotation: Fixed32;
|
|
61
|
+
constructor(position: FixedVector2, rotation: Fixed32);
|
|
62
|
+
/**
|
|
63
|
+
* @zh 从原始值创建
|
|
64
|
+
* @en Create from raw values
|
|
65
|
+
*/
|
|
66
|
+
static fromRaw(raw: IFixedTransformStateRaw): FixedTransformState;
|
|
67
|
+
/**
|
|
68
|
+
* @zh 从浮点数创建
|
|
69
|
+
* @en Create from floating-point numbers
|
|
70
|
+
*/
|
|
71
|
+
static from(x: number, y: number, rotation: number): FixedTransformState;
|
|
72
|
+
/**
|
|
73
|
+
* @zh 转换为原始值(用于网络传输)
|
|
74
|
+
* @en Convert to raw values (for network transmission)
|
|
75
|
+
*/
|
|
76
|
+
toRaw(): IFixedTransformStateRaw;
|
|
77
|
+
/**
|
|
78
|
+
* @zh 转换为浮点数对象(用于渲染)
|
|
79
|
+
* @en Convert to floating-point object (for rendering)
|
|
80
|
+
*/
|
|
81
|
+
toFloat(): {
|
|
82
|
+
x: number;
|
|
83
|
+
y: number;
|
|
84
|
+
rotation: number;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* @zh 检查是否相等
|
|
88
|
+
* @en Check equality
|
|
89
|
+
*/
|
|
90
|
+
equals(other: FixedTransformState): boolean;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @zh 带速度的定点数变换状态
|
|
94
|
+
* @en Fixed-point transform state with velocity
|
|
95
|
+
*/
|
|
96
|
+
export declare class FixedTransformStateWithVelocity {
|
|
97
|
+
readonly position: FixedVector2;
|
|
98
|
+
readonly rotation: Fixed32;
|
|
99
|
+
readonly velocity: FixedVector2;
|
|
100
|
+
readonly angularVelocity: Fixed32;
|
|
101
|
+
constructor(position: FixedVector2, rotation: Fixed32, velocity: FixedVector2, angularVelocity: Fixed32);
|
|
102
|
+
/**
|
|
103
|
+
* @zh 从原始值创建
|
|
104
|
+
* @en Create from raw values
|
|
105
|
+
*/
|
|
106
|
+
static fromRaw(raw: IFixedTransformStateWithVelocityRaw): FixedTransformStateWithVelocity;
|
|
107
|
+
/**
|
|
108
|
+
* @zh 从浮点数创建
|
|
109
|
+
* @en Create from floating-point numbers
|
|
110
|
+
*/
|
|
111
|
+
static from(x: number, y: number, rotation: number, velocityX: number, velocityY: number, angularVelocity: number): FixedTransformStateWithVelocity;
|
|
112
|
+
/**
|
|
113
|
+
* @zh 转换为原始值
|
|
114
|
+
* @en Convert to raw values
|
|
115
|
+
*/
|
|
116
|
+
toRaw(): IFixedTransformStateWithVelocityRaw;
|
|
117
|
+
/**
|
|
118
|
+
* @zh 转换为浮点数对象
|
|
119
|
+
* @en Convert to floating-point object
|
|
120
|
+
*/
|
|
121
|
+
toFloat(): {
|
|
122
|
+
x: number;
|
|
123
|
+
y: number;
|
|
124
|
+
rotation: number;
|
|
125
|
+
velocityX: number;
|
|
126
|
+
velocityY: number;
|
|
127
|
+
angularVelocity: number;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* @zh 检查是否相等
|
|
131
|
+
* @en Check equality
|
|
132
|
+
*/
|
|
133
|
+
equals(other: FixedTransformStateWithVelocity): boolean;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* @zh 创建零状态
|
|
137
|
+
* @en Create zero state
|
|
138
|
+
*/
|
|
139
|
+
export declare function createZeroFixedTransformState(): FixedTransformState;
|
|
140
|
+
/**
|
|
141
|
+
* @zh 创建带速度的零状态
|
|
142
|
+
* @en Create zero state with velocity
|
|
143
|
+
*/
|
|
144
|
+
export declare function createZeroFixedTransformStateWithVelocity(): FixedTransformStateWithVelocity;
|
|
145
|
+
//# sourceMappingURL=FixedTransformState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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;IAChC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;gBAG9B,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,YAAY,EACtB,eAAe,EAAE,OAAO;IAQ5B;;;OAGG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,mCAAmC,GAAG,+BAA+B;IASzF;;;OAGG;IACH,MAAM,CAAC,IAAI,CACP,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,GACxB,+BAA+B;IASlC;;;OAGG;IACH,KAAK,IAAI,mCAAmC;IAW5C;;;OAGG;IACH,OAAO,IAAI;QACP,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC;KAC3B;IAWD;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,+BAA+B,GAAG,OAAO;CAM1D;AAMD;;;GAGG;AACH,wBAAgB,6BAA6B,IAAI,mBAAmB,CAEnE;AAED;;;GAGG;AACH,wBAAgB,yCAAyC,IAAI,+BAA+B,CAO3F"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zh 定点数网络同步模块
|
|
3
|
+
* @en Fixed-point network sync module
|
|
4
|
+
*
|
|
5
|
+
* @zh 用于帧同步确定性计算的网络同步类型和工具
|
|
6
|
+
* @en Network sync types and utilities for deterministic lockstep calculations
|
|
7
|
+
*/
|
|
8
|
+
export { FixedTransformState, FixedTransformStateWithVelocity, createZeroFixedTransformState, createZeroFixedTransformStateWithVelocity, type IFixedTransformStateRaw, type IFixedTransformStateWithVelocityRaw, } from './FixedTransformState';
|
|
9
|
+
export { FixedTransformInterpolator, FixedHermiteTransformInterpolator, createFixedTransformInterpolator, createFixedHermiteTransformInterpolator, type IFixedInterpolator, type IFixedExtrapolator, } from './FixedTransformInterpolator';
|
|
10
|
+
export { FixedSnapshotBuffer, createFixedSnapshotBuffer, type IFixedStateSnapshot, type IFixedSnapshotBufferConfig, type IFixedInterpolationResult, } from './FixedSnapshotBuffer';
|
|
11
|
+
export { FixedClientPrediction, createFixedClientPrediction, createFixedMovementPredictor, createFixedMovementPositionExtractor, type IFixedInputSnapshot, type IFixedPredictedState, type IFixedPredictor, type IFixedStatePositionExtractor, type FixedClientPredictionConfig, type IFixedMovementInput, type IFixedMovementState, } from './FixedClientPrediction';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sync/fixed/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EACH,mBAAmB,EACnB,+BAA+B,EAC/B,6BAA6B,EAC7B,yCAAyC,EACzC,KAAK,uBAAuB,EAC5B,KAAK,mCAAmC,GAC3C,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EACH,0BAA0B,EAC1B,iCAAiC,EACjC,gCAAgC,EAChC,uCAAuC,EACvC,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GAC1B,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EACH,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,GACjC,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EACH,qBAAqB,EACrB,2BAA2B,EAC3B,4BAA4B,EAC5B,oCAAoC,EACpC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GAC3B,MAAM,yBAAyB,CAAC"}
|
package/dist/sync/index.d.ts
CHANGED
|
@@ -16,4 +16,6 @@ export type { EntityDeltaState, DeltaSyncData, DeltaCompressionConfig } from './
|
|
|
16
16
|
export { DeltaFlags, StateDeltaCompressor, createStateDeltaCompressor } from './StateDelta';
|
|
17
17
|
export type { ComponentSyncEventType, ComponentSyncEvent, ComponentSyncEventListener, ComponentSyncConfig } from './ComponentSync';
|
|
18
18
|
export { ComponentSyncSystem, createComponentSyncSystem } from './ComponentSync';
|
|
19
|
+
export { FixedTransformState, FixedTransformStateWithVelocity, createZeroFixedTransformState, createZeroFixedTransformStateWithVelocity, FixedTransformInterpolator, FixedHermiteTransformInterpolator, createFixedTransformInterpolator, createFixedHermiteTransformInterpolator, FixedSnapshotBuffer, createFixedSnapshotBuffer, FixedClientPrediction, createFixedClientPrediction, createFixedMovementPredictor, createFixedMovementPositionExtractor, } from './fixed';
|
|
20
|
+
export type { IFixedTransformStateRaw, IFixedTransformStateWithVelocityRaw, IFixedInterpolator, IFixedExtrapolator, IFixedStateSnapshot, IFixedSnapshotBufferConfig, IFixedInterpolationResult, IFixedInputSnapshot, IFixedPredictedState, IFixedPredictor, IFixedStatePositionExtractor, FixedClientPredictionConfig, IFixedMovementInput, IFixedMovementState, } from './fixed';
|
|
19
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/sync/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,YAAY,EACR,cAAc,EACd,eAAe,EACf,2BAA2B,EAC3B,qBAAqB,EACrB,eAAe,EAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAMxE,YAAY,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