Beispiel #1
0
        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();
        }
Beispiel #2
0
        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.");
        }
Beispiel #3
0
 public static void JoinGame(int connectionID)
 {
     ServerTCP.SendInGame(connectionID);
     ServerTCP.SendInWorld(connectionID);
 }