@daneren2005/shared-memory-physics 1.6.3 → 1.7.1
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/README.md +23 -12
- package/dist/components/body-component.d.ts +4 -0
- package/dist/components/interpolation-component.d.ts +21 -13
- package/dist/index.d.ts +4 -3
- package/dist/index.js +326 -265
- package/dist/index.js.map +1 -1
- package/dist/systems/interpolation-channels.d.ts +6 -0
- package/dist/systems/interpolation-system.d.ts +3 -1
- package/dist/systems/interpolation-update.d.ts +5 -2
- package/dist/systems/physics-system.d.ts +3 -0
- package/dist/systems/physics-update.d.ts +1 -0
- package/package.json +11 -10
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface InterpolationCommitSource {
|
|
2
|
+
readonly committedTick: number;
|
|
3
|
+
}
|
|
4
|
+
export declare function registerInterpolationChannel(world: object, source: InterpolationCommitSource): number;
|
|
5
|
+
export declare function unregisterInterpolationChannel(world: object, channel: number): void;
|
|
6
|
+
export declare function snapshotCommittedTicks(world: object): Array<number> | undefined;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { EntityWorkerSystem } from '@daneren2005/shared-memory-ecs';
|
|
2
2
|
import type { BaseWorld, ComponentDefinitionMap, ComponentMap, EntityUpdateComponents, SystemConfig } from '@daneren2005/shared-memory-ecs';
|
|
3
3
|
import type { InterpolationComponents, InterpolationUpdateComponents } from '../components/registry';
|
|
4
|
+
import { type InterpolationWorld } from './interpolation-update';
|
|
4
5
|
export interface InterpolationSystemConfig extends Partial<SystemConfig> {
|
|
5
6
|
forceMainThread?: boolean;
|
|
6
7
|
getWorker?: () => Worker;
|
|
7
8
|
}
|
|
8
|
-
export default class InterpolationSystem<C extends ComponentMap & InterpolationComponents> extends EntityWorkerSystem<C, InterpolationUpdateComponents & EntityUpdateComponents<C
|
|
9
|
+
export default class InterpolationSystem<C extends ComponentMap & InterpolationComponents> extends EntityWorkerSystem<C, InterpolationUpdateComponents & EntityUpdateComponents<C>, InterpolationWorld> {
|
|
9
10
|
constructor(world: BaseWorld<ComponentDefinitionMap, C>, options?: InterpolationSystemConfig);
|
|
11
|
+
addDataToWorld(world: InterpolationWorld): void;
|
|
10
12
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { EntityUpdateFunction } from '@daneren2005/shared-memory-ecs';
|
|
1
|
+
import type { EntityUpdateFunction, EntityWorkerSystemWorld } from '@daneren2005/shared-memory-ecs';
|
|
2
2
|
import type { InterpolationComponents, InterpolationUpdateComponents } from '../components/registry';
|
|
3
3
|
export declare const BACKLOG_TARGET_STEPS = 1.5;
|
|
4
4
|
export declare const BACKLOG_CATCHUP_RATE = 0.5;
|
|
5
|
-
export
|
|
5
|
+
export interface InterpolationWorld extends EntityWorkerSystemWorld {
|
|
6
|
+
committedTicks?: Array<number>;
|
|
7
|
+
}
|
|
8
|
+
export declare const interpolationUpdate: EntityUpdateFunction<InterpolationComponents, InterpolationUpdateComponents, InterpolationWorld>;
|
|
6
9
|
export default interpolationUpdate;
|
|
@@ -28,9 +28,12 @@ export default class PhysicsSystem<C extends ComponentMap & PhysicsComponents, T
|
|
|
28
28
|
private pendingDynamicsCommands;
|
|
29
29
|
private readonly commandQueueId;
|
|
30
30
|
tick: number;
|
|
31
|
+
private readonly interpolationChannel;
|
|
31
32
|
reportMoves: boolean | undefined;
|
|
32
33
|
skipGroup: number | undefined;
|
|
33
34
|
constructor(world: BaseWorld<ComponentDefinitionMap, C> & PhysicalWorldSource, options?: PhysicsSystemConfig<C, T, W>);
|
|
35
|
+
get committedTick(): number;
|
|
36
|
+
destroy(): void;
|
|
34
37
|
startInterpolation(entity: SpawnableEntity): void;
|
|
35
38
|
queueForce(entity: BaseEntity<C> | number, forceX: number, forceY: number): void;
|
|
36
39
|
queueImpulse(entity: BaseEntity<C> | number, impulseX: number, impulseY: number): void;
|
|
@@ -6,6 +6,7 @@ import { type SpatialBlockComponents } from './spatial-bounds';
|
|
|
6
6
|
import { type PhysicalSystemWorld } from '../world';
|
|
7
7
|
export interface PhysicsWorld extends EntityWorkerSystemWorld, PhysicalSystemWorld, DynamicsWorld {
|
|
8
8
|
tick: number;
|
|
9
|
+
interpolationChannel?: number;
|
|
9
10
|
reportMoves?: boolean;
|
|
10
11
|
skipGroup?: number;
|
|
11
12
|
commandQueueId?: number;
|
package/package.json
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
"name": "@daneren2005/shared-memory-physics",
|
|
3
3
|
"description": "2D physics components and systems built on the shared-memory ECS.",
|
|
4
4
|
"author": "Scott Jackson",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.7.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
8
|
+
"license": "MIT",
|
|
8
9
|
"repository": {
|
|
9
10
|
"type": "git",
|
|
10
11
|
"url": "git+https://github.com/daneren2005/shared-memory-physics.git"
|
|
@@ -41,22 +42,22 @@
|
|
|
41
42
|
"prepare": "husky"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
|
-
"@daneren2005/shared-memory-ecs": "^1.7.
|
|
45
|
-
"@daneren2005/shared-memory-objects": "^1.5.
|
|
45
|
+
"@daneren2005/shared-memory-ecs": "^1.7.2",
|
|
46
|
+
"@daneren2005/shared-memory-objects": "^1.5.2",
|
|
46
47
|
"@semantic-release/git": "^10.0.1",
|
|
47
48
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
48
|
-
"@types/node": "^26.
|
|
49
|
-
"@vitest/web-worker": "^
|
|
49
|
+
"@types/node": "^26.5.1",
|
|
50
|
+
"@vitest/web-worker": "^5.0.0",
|
|
50
51
|
"cross-env": "^10.1.0",
|
|
51
52
|
"husky": "^9.1.7",
|
|
52
|
-
"lint-staged": "^17.
|
|
53
|
-
"oxlint": "^1.
|
|
53
|
+
"lint-staged": "^17.5.1",
|
|
54
|
+
"oxlint": "^1.82.0",
|
|
54
55
|
"oxlint-tsgolint": "^7.0.2001",
|
|
55
56
|
"phaser": "^4.2.1",
|
|
56
|
-
"semantic-release": "^25.0.
|
|
57
|
+
"semantic-release": "^25.0.9",
|
|
57
58
|
"typescript": "^7.0.2",
|
|
58
|
-
"vite": "^8.
|
|
59
|
-
"vitest": "^
|
|
59
|
+
"vite": "^8.3.0",
|
|
60
|
+
"vitest": "^5.0.0"
|
|
60
61
|
},
|
|
61
62
|
"peerDependencies": {
|
|
62
63
|
"@daneren2005/shared-memory-ecs": "^1.5.1",
|