Fix net code

This commit is contained in:
Andras Schmelczer 2026-06-14 15:01:36 +01:00
parent 1f10b9c750
commit a1fb6755c7
23 changed files with 408 additions and 236 deletions

View file

@ -4,11 +4,16 @@ import { Command } from '../command';
@serializable
export class PropertyUpdatesForObjects extends Command {
constructor(public readonly updates: Array<PropertyUpdatesForObject>) {
constructor(
public readonly updates: Array<PropertyUpdatesForObject>,
// Seconds on the server's monotonic clock at the moment this state was
// captured. Only differences between timestamps are meaningful.
public readonly timestamp: number,
) {
super();
}
public toArray(): Array<any> {
return [this.updates];
return [this.updates, this.timestamp];
}
}

View file

@ -18,6 +18,10 @@ export const settings = {
worldRadius: 4000,
objectsOnCircleLength: 0.002,
updateMessageInterval: 1 / 25,
// How far behind the estimated server time remote state is rendered: ~2.5
// update intervals, so a late packet rarely leaves the client without a
// newer snapshot to interpolate towards.
interpolationDelaySeconds: 0.1,
planetEdgeCount: 7,
playerKillPoint: 25,
takeControlTimeInSeconds: 2.5,