public ClientPlayerSnapshot(SnapshotSystem snapshotSystem, NetConnection otherConnection, bool dontAllocateId = false) : base(snapshotSystem, otherConnection, dontAllocateId) { x = AddPrimitiveField <float>(); y = AddPrimitiveField <float>(); z = AddPrimitiveField <float>(); camYaw = AddPrimitiveField <float>(); camPitch = AddPrimitiveField <float>(); actionFlag = AddPrimitiveField <ByteFlag>(); movementFlag = AddPrimitiveField <ByteFlag>(); selectedItem = AddPrimitiveField <byte>(); colorR = AddPrimitiveField <byte>(); colorG = AddPrimitiveField <byte>(); colorB = AddPrimitiveField <byte>(); bulletSnapshot = AddCustomField(BulletSnapshot = new ClientBulletSnapshot()); // TODO: Figure out why we can't compress ByteFlag's. // They won't always send the latest version. actionFlag.NeverCompress = true; movementFlag.NeverCompress = true; Setup(); // This snapshot updates so much that we really don't need // to store many delta snapshots. EnableDeltaCompression(4); }
public NetworkPlayerListSnapshot(SnapshotSystem snapshotSystem, NetConnection otherConnection, bool dontAllocateId = false, bool dontAwait = false) : base(snapshotSystem, otherConnection, dontAllocateId, dontAwait) { snapshotFields = new Dictionary <ushort, DynamicSnapshotField>(); Setup(); }
public Snapshot(SnapshotSystem snapshotSystem, NetConnection otherConnection, bool dontAllocateId = false, bool dontAwait = false) { this.snapshotSystem = snapshotSystem; this.dontAllocateId = dontAllocateId; this.dontAwait = dontAwait; OtherConnection = otherConnection; staticFields = new Dictionary <ushort, StaticSnapshotField>(); dynamicFields = new Dictionary <object, DynamicSnapshotField>(); }
public NetEntitySnapshot(INetEntity entity, NetCreatableInfo info, SnapshotSystem snapshotSystem) : base(snapshotSystem, info.Owner, !info.IsAppOwner) { Entity = entity; EntityInfo = info; if (entity != info.Creatable) { throw new Exception("Failed to create NetEntitySnapshot, entity does not match the creatable info!"); } EnableDeltaCompression(10); }
public NetworkPlayerSnapshot(SnapshotSystem snapshotSystem, NetConnection otherConnection, NetworkPlayer netPlayer, bool dontAllocateId = false, bool dontAwait = false) : base(snapshotSystem, otherConnection, dontAllocateId, dontAwait) { NetPlayer = netPlayer; teamField = AddPrimitiveField <byte>((byte)Team.None); scoreField = AddPrimitiveField <short>(); pingField = AddPrimitiveField <ushort>(); characterIdField = AddPrimitiveField <ushort>(); hasCharacterField = AddPrimitiveField <bool>(); Setup(); EnableDeltaCompression(4); }
public PlayerSnapshot(SnapshotSystem snapshotSystem, NetConnection otherConnection, bool isOwner, ushort id, bool dontAllocateId = false) : base(snapshotSystem, otherConnection, dontAllocateId) { initId = id; IsOwner = isOwner; netId = AddPrimitiveField(id); selectedItem = AddPrimitiveField <byte>(); if (isOwner) { currentMag = AddPrimitiveField <byte>(); storedAmmo = AddPrimitiveField <ushort>(); health = AddPrimitiveField <float>(); numBlocks = AddPrimitiveField <ushort>(); numGrenades = AddPrimitiveField <byte>(); numMelons = AddPrimitiveField <byte>(); AddCustomField(HitFeedbackSnapshot = new HitFeedbackSnapshot()); hitEnemy = (Trigger)AddTrigger().Value; } else { x = AddPrimitiveField <float>(); y = AddPrimitiveField <float>(); z = AddPrimitiveField <float>(); stateFlag = AddPrimitiveField <ByteFlag>(); stateFlag.NeverCompress = true; movementFlag = AddPrimitiveField <ByteFlag>(); movementFlag.NeverCompress = true; camYaw = AddPrimitiveField <float>(); camPitch = AddPrimitiveField <float>(); timesShot = (Trigger)AddTrigger().Value; } Setup(); EnableDeltaCompression(32); }
public WorldSnapshot(SnapshotSystem snapshotSystem, NetConnection otherConnection, bool dontAllocateId = false) : base(snapshotSystem, otherConnection, dontAllocateId) { playerFields = new Dictionary <ushort, DynamicSnapshotField>(); AddCustomField(TerrainSnapshot = new TerrainDeltaSnapshot()); AddNestedField(NetworkPlayerListSnapshot = new NetworkPlayerListSnapshot(snapshotSystem, otherConnection, dontAllocateId)); AddNestedField(NetEntityListSnapshot = new NetEntityListSnapshot(snapshotSystem, otherConnection, dontAllocateId)); time = AddPrimitiveField <float>(); ag_max_cl_tickrate = AddPrimitiveField <ushort>(); ag_force_cl_await_snap = AddPrimitiveField <bool>(); Setup(); EnableDeltaCompression(16); }
public TempSnapshot(SnapshotSystem snapshotSystem) : base(snapshotSystem, null, true, true) { }