示例#1
0
    void SendGameState()
    {
        GameState gs = gr.GetGameState();

        String outmsg = NetworkingMessageTranslator.GenerateGameStateMessage(gs);

        // Send players the location of all ships, env variables, player names, useable moves,
        // usable actions, everything for the game setup, etc
        // and request player move cmd. send turn time

        SendToAllPlayingClients(outmsg);

        // TODO
        // Fix this
        // each client should send "received game state msg" then "animation finished"
        // then server goes to cmd state
        state = ServerState.COMMAND;
    }
示例#2
0
        static void Main(string[] args)
        {
            var state = new Maze.Game.GameState();

            FormInput     input         = new FormInput();
            PhysicsEngine physicsEngine = new PhysicsEngine(state);
            GameEngine    engine        = new GameEngine(input, physicsEngine)
            {
                EnableRender   = false,
                MinFrameTime   = 16,
                UpdateTimeStep = 33,
            };

            var game = new GameRunner(engine, state);

            // TODO: Stop game thread and clean up when window starts closing
            game.RunAsync();

            new Services();
            new GameStateContext(new RoomState(new GameData(game.GetGameState(), new InputHandler(input))));

            Console.ReadKey(true);
        }