用于为多人游戏创建并发网络系统的轻量级工具集
Lightweight toolset for creating concurrent networking systems for multiplayer games.
NetStack is self-contained and has no dependencies.
Modules:
By default, all scripts are compiled for .NET Framework 3.5. Define NET_4_6 directive to build the assembly for .NET Framework 4.6 or higher. Define NET_STANDARD_2_0 to build the assembly for .NET Core 2.1 or higher.
Define NETSTACK_SPAN to enable support for Span.
Define NETSTACK_BUFFERS_LOG to enable buffers logging.
…// Create a new concurrent buffer limited to 8192 cells
ConcurrentBuffer conveyor = new ConcurrentBuffer(8192);
// Enqueue an object
conveyor.Enqueue(message);
// Dequeue object
MessageObject message = (MessageObject)conveyor.Dequeue();ushort quantizedSpeed = HalfPrecision.Quantize(speed);
float speed = HalfPrecision.Dequantize(quantizedSpeed);…// Quantize rotation data ready for compact bit-packing
QuantizedQuaternion quantizedRotation = SmallestThree.Quantize(rotation);
// Read quantized data
Console.WriteLine("Quantized rotation - M: " + quantizedRotation.m + ", A:" + quantizedRotation.a + ", B:" + quantizedRotation.b + ", C:" + quantizedRotation.c);
// Dequantize rotation data ready for reconstruction after bit-packing
Quaternion rotation = SmallestThree.Dequantize(quantizedRotation);…/*
Bits Min Dec Max Dec Max Hex Bytes Used
0-7 0 127 0x0000007F 1 byte
8-14 128 1023 0x00003FFF 2 bytes
15-21 1024 2097151 0x001FFFFF 3 bytes
22-28 2097152 268435455 0x0FFFFFFF 4 bytes
29-32 268435456 4294967295 0xFFFFFFFF 5 bytes
*/
data.Add(9, 256);
uint value = data.Read(9);…暂无开放 Issues,或尚未同步最近议题。