@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
37 lines • 1.49 kB
TypeScript
/**
* Network-replication adapter for {@link Transform}. Mirrors
* {@link TransformSerializationAdapter} but uses Float32 for position instead
* of Float64, halving the per-component cost (12 B vs 24 B) for a precision
* loss that is below visible threshold for typical action-game scales.
*
* Wire layout (typical 17 B, 13 B if scale is identity):
* - position: 3 × Float32 = 12 bytes
* - rotation: smallest-three uint32 = 4 bytes
* - scale: `v3_binary_equality_encode` = 1 byte (identity) or 13 bytes (full)
*
* Total: 17 bytes typical, 29 bytes max.
*
* Distinct from {@link TransformSerializationAdapter} so save-game files keep
* Float64 position precision while wire packets stay tight.
*
* @author Alex Goldring
* @copyright Company Named Limited (c) 2025
*/
export class TransformReplicationAdapter extends BinaryClassSerializationAdapter<any> {
constructor();
klass: typeof Transform;
version: number;
/**
* @param {BinaryBuffer} buffer
* @param {Transform} value
*/
serialize(buffer: BinaryBuffer, value: Transform): void;
/**
* @param {BinaryBuffer} buffer
* @param {Transform} value
*/
deserialize(buffer: BinaryBuffer, value: Transform): void;
}
import { BinaryClassSerializationAdapter } from "../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
import { Transform } from "../../ecs/transform/Transform.js";
//# sourceMappingURL=TransformReplicationAdapter.d.ts.map