public GameServer(IGameTransport transport, IMonotonicClock clock) { this.transport = transport; this.clock = clock; MaxTollerableMalus = 3; clientsTable = new Dictionary <EndPoint, GameClient>(); gameobjectsTable = new Dictionary <uint, GameObject>(); clientsToRemove = new List <EndPoint>(); /* DATI DEI COMANDI: * Join: 0; * Welcome : 1, ObjType, Id, X, Y, Z; * Spawn : 2, ObjType, Id, X, Y, Z; * Update : 3, Id, X, Y, Z; * Ack : 255, Id; */ commandsTable = new Dictionary <byte, GameCommand>(); commandsTable[0] = Join; commandsTable[3] = Update; commandsTable[255] = Ack; }
public GameServer(IGameTransport gameTransport, IMonotonicClock clock) { transport = gameTransport; this.clock = clock; clientsTable = new Dictionary <EndPoint, GameClient>(); gameObjectsTable = new Dictionary <uint, GameObject>(); commandsTable = new Dictionary <byte, GameCommand>(); commandsTable[0] = Join; commandsTable[3] = Update; commandsTable[255] = Ack; }
public GameServer(IGameTransport gameTransport, IMonotonicClock clock) { this.transport = gameTransport; this.clock = clock; clientsTable = new Dictionary <EndPoint, GameClient>(); commandsTable = new Dictionary <byte, GameCommand>(); commandsTable[0] = ReverseString; commandsTable[1] = Add; commandsTable[2] = Subtract; commandsTable[3] = Multiply; commandsTable[4] = Divide; }
public GameServer(IGameTransport transport, IMonotonicClock clock) { clientsTab = new Dictionary <EndPoint, GameClient>(); gameObjectsTab = new Dictionary <uint, GameObject>(); commandsTab = new Dictionary <byte, GameCommand>(); commandsTab[0] = Join; commandsTab[3] = Update; commandsTab[7] = Exit; commandsTab[255] = Ack; serverClock = clock; this.transport = transport; }
//constructor that init the server parameters public Server(ITransport transport, IMonotonicClock gameClock) { this.transport = transport; clock = gameClock; commands = new command[COMMAND_P_CONNECTED + 1]; commands[COMMAND_JOIN] = Join; commands[COMMAND_SETUP] = SetUp; commands[COMMAND_INTANGIBLE] = Intangible; clients = new List <Client>(); rooms = new List <Room>(); rooms.Add(new Room((uint)numOfRooms, this)); }
public GameServer(IGameTransport gameTransport, IMonotonicClock clock) { Rooms = new List <Room>(); transport = gameTransport; this.clock = clock; clientsTable = new Dictionary <EndPoint, GameClient>(); commandsTable = new Dictionary <byte, GameCommand>(); gameObjectToDelete = new Dictionary <uint, GameObject>(); GameObject.gameObjectCounter = 0; commandsTable[0] = Join; //welcome [1] //spawn[2] commandsTable[3] = Update; //commandsTable[5] = JoinRoom; //commandsTable[6] = SpawnAsteroids; //commandsTable[7] = UpdateAsteroids; commandsTable[8] = Ready; //commandsTable[9] = DestroyAsteroid; //commandsTable[10] = SpaceShipCollision; commandsTable[253] = StatusServer; // commandsTable[255] = Ack; }
public Connector(ILog log, uint frequency, IPort port, bool useThreads, bool useDebugLogging = false) { this.log = log; if (frequency < 1) { frequency = 1; } if (frequency > 60) { frequency = 60; } connectedPeriodInMs = 1000 / frequency; this.useDebugLogging = true; monotonicClock = monotonicStopwatch; incomingPacketBuffer = new PacketBuffer(monotonicClock); sessionId = RandomGenerator.RandomUniqueSessionId(); udpClient = new Client(this, port, useThreads); Reset(); }
public GameServer(IGameTransport transport, IMonotonicClock clock) { serverTransport = transport; serverClock = clock; clientsTable = new Dictionary <EndPoint, GameClient>(); serverRooms = new Dictionary <uint, ServerRoom>(); commandsTable = new Dictionary <byte, GameCommand>(); commandsTable[0] = Join; // commandsTable[1] = Welcome; commandsTable[2] = Spawn; // commandsTable[3] = Update; commandsTable[4] = Ready; //commandsTable[5] = GameStart; //commandsTable[6] = UIStart; commandsTable[7] = TurnCreation; commandsTable[8] = SetTurnParameter; //commandsTable[9] = ProcessTurn; commandsTable[10] = EndTurn; commandsTable[254] = StatusServer; }
public PacketBuffer(IMonotonicClock monotonicClock) { this.monotonicClock = monotonicClock; }