public ServerEngine(int serverPort, int maxClients/*map name, etc*/)
        {
            // Server creation
            elapsedTime = 0;
            commands = new ConcurrentQueue<Command.Command>();
            updatedPositions = new ConcurrentQueue<KeyValuePair<Player, Position>>();
            newPlayers = new ConcurrentQueue<Player>();
            communication = new ENetServer(serverPort, maxClients, this);
            communication.Launch();

            // Environment initialization
            //XMLReader xmlTest = new XMLReader("../../../map_official.xml");
            XMLReader xmlTest = new XMLReader("xml/map.xml");
            Constants.Instance.init();

            Map map = new Map(xmlTest.upperLeft, xmlTest.lowerRight, xmlTest.listObstacle, xmlTest.listWall);
            Player player = new Player("Champ");

            environment = GameEnvironment.Instance;
            environment.init(map, player);

            pengine = new PhysicsEngine(environment.Map);

            Character character = new Character("swattds", pengine, new Vector2(200, 100), new Vector2(75, 75), 55);

            //Character redshirt = new Character("Redshirt", pengine, new Vector2(400, 100), new Vector2(100, 100));
            player.addCharacter(character);
            //player.addCharacter(redshirt);
        }
 public Character(CharacterInfo.Type _type, String _texture, PhysicsEngine engine, Vector2 _position, Vector2 _size, float bodySize)
     : base(_texture, _size)
 {
     info = Constants.Instance.getCharacterInfo(_type);
     initCharacter ();
     //body.setPosition(_position);
     body = new Body(bodySize, _position); // TODO: size as a FLOAT instead?!
     engine.AddBody(body);
 }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            SpriteBatch spriteBatch = new SpriteBatch(GraphicsDevice);
            graphicEngine = new GraphicsEngine(spriteBatch, graphics, GraphicsDevice, Content);

            /*XMLReader xmlTest = new XMLReader("../../../map.xml");

            Map map = new Map(xmlTest.lowerRight, xmlTest.upperLeft, xmlTest.listObstacle, xmlTest.listWall);
            Player player = new Player("Champ");

            environment = new GameEnvironment(map, player);*/
            pengine = gengine.getPhysicsEngine();

            // TODO: use this.Content to load your game content here

            inputManager = new InputManager(Mouse.GetState(), Keyboard.GetState(), environment.LocalPlayer);
            //Character testCharacter = new Character("Bonhomme", pengine, new Vector2(200, 100), new Vector2(100, 100));
            //Character redshirt = new Character("Redshirt", pengine, new Vector2(400, 100), new Vector2(100, 100));
            //environment.LocalPlayer.addCharacter(testCharacter);
            //environment.LocalPlayer.addCharacter(redshirt);
            graphicEngine.setFollowedCharacter(environment.LocalPlayer.getCharacter());
            graphicEngine.setMap(environment.Map);
        }
        public void setEnvironment(LightEnvironment env)
        {
            Player local = new Player("Georges"); // TODO : change this

            environment = GameEnvironment.Instance;
            environment.init(env.map, local);

            pengine = new PhysicsEngine(environment.Map);

            //Character character = new Character("patate", pengine, new Vector2(150, 300), new Vector2(50, 50));
            Character character = new Character("swattds", pengine, new Vector2(150, 300), new Vector2(75, 75), 55);
            local.addCharacter(character);

            foreach (LightPlayer lp in env.players)
            {
                Player p = new Player(lp.name);
                Character c = new Character(lp.character.textureName, pengine, lp.character.position, lp.character.size, lp.character.size.X);
                p.addCharacter(c);
                environment.AddPlayer(p);
            }

            // Sending local info to server
            communication.SendReliable(new LightPlayer(local), NetFrame.FrameType.player);

            ready = true;
        }