lockstep-fixed-math-xunwujian
v1.0.0
Published
定点数学库,保证TypeScript和Go跨语言计算比特级一致
Maintainers
Readme
Lockstep Fixed-Point Math
🎯 跨语言定点数学库,保证TypeScript和Go计算结果比特级一致。
安装
npm install lockstep-fixed-math使用
import { Vec2, fromFloat, toFloat } from 'lockstep-fixed-math';
// 摇杆输入处理
const direction = Vec2.fromJoystick(joystickX, joystickY);
const newPosition = position.move(direction, speed, deltaTime);
// 网络传输用定点坐标
const networkData = newPosition.toFixed(); // {x: int32, y: int32}特性
- ✅ 比特级精确跨语言一致性
- ✅ 专为游戏帧同步设计
- ✅ 零依赖,高性能
- ✅ 完整的2D向量数学库
详细文档: https://github.com/your-username/lockstep-fixed-math
