static void PACKET_PLAYERMOVEMENT(long connectionID, byte[] data) { ByteBuffer buffer = new ByteBuffer(); buffer.WriteBytes(data); long packetIdentifier = buffer.ReadLong(); float x = buffer.ReadFloat(); float y = buffer.ReadFloat(); float z = buffer.ReadFloat(); //float rotx = buffer.ReadFloat(); //float roty = buffer.ReadFloat(); //float rotz = buffer.ReadFloat(); Logger.WriteInfo("Recieved position data from: " + connectionID.ToString()); ServerTCP.PlayerMovement((int)connectionID, x, y, z, 0, 0, 0); buffer.Dispose(); }
public static void InitializeServer() { int startTime = 0; int endTime = 0; startTime = GetTickCount(); Logger.WriteDebug("Initializing Server..."); //Intializing all game data arrays Logger.WriteDebug("Initializing Game Arrays..."); for (int i = 0; i < Constants.MAX_PLAYERS; i++) { ServerTCP.Client[i] = new Clients(); } //Start the Networking Logger.WriteDebug("Initializing Network..."); ServerHandleData.InitializePackets(); ServerTCP.InitializeNetwork(); endTime = GetTickCount(); Logger.WriteInfo("Initialization complete. Server loaded in " + (endTime - startTime) + " ms."); }
public static void JoinGame(int connectionID) { ServerTCP.SendInGame(connectionID); ServerTCP.SendInWorld(connectionID); }