//! metaverseserver entry point.  Processes commandline arguments; starts dbinterface and serverfileagent components; handles initialization
        public void Init(IConfigSource commandlineConfig, IServerControllers controllers)
        {
            config = Config.GetInstance();

            Test.Info("*** Server starting ***");

            Running = true;

            network = new NetworkLevel2Controller();

            ServerPort = commandlineConfig.Configs["CommandLineArgs"].GetInt("serverport", config.ServerPort);
            Test.Debug("Creating Metaverse Client listener on port " + ServerPort);

            network.ListenAsServer(ServerPort);

            network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);
            network.Disconnection += new Level2DisconnectionHandler(network_Disconnection);

            rpc = new RpcController(network);
            netreplicationcontroller = new NetReplicationController(rpc);
            World = new WorldModel(netreplicationcontroller);

            controllers.Plugin.LoadServerPlugins();

            Test.Info("*** Server initialization complete ***");
        }
Exemple #2
0
 public WorldModel(NetReplicationController netreplicationcontroller)
 {
     this.netreplicationcontroller = netreplicationcontroller;
     entities = new List <Entity>();
     netreplicationcontroller.RegisterReplicatedObjectController(this, typeof(Entity));
     terrainmodel = new TerrainModel();
 }
 public DirtyObjectController( NetReplicationController netreplicationcontroller, NetworkLevel2Controller network, RpcController rpc )
 {
     if (!network.IsServer)
     {
         throw new Exception( "Shouldnt be instantiating dirtyobjectcontroller on client" );
     }
     this.netreplicationcontroller = netreplicationcontroller;
     this.rpc = rpc;
     this.network = network;
     //network = NetworkControllerFactory.GetInstance();
     network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);
     network.Disconnection += new Level2DisconnectionHandler(network_Disconnection);
 }
Exemple #4
0
 public DirtyObjectController(NetReplicationController netreplicationcontroller, NetworkLevel2Controller network, RpcController rpc)
 {
     if (!network.IsServer)
     {
         throw new Exception("Shouldnt be instantiating dirtyobjectcontroller on client");
     }
     this.netreplicationcontroller = netreplicationcontroller;
     this.rpc     = rpc;
     this.network = network;
     //network = NetworkControllerFactory.GetInstance();
     network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);
     network.Disconnection += new Level2DisconnectionHandler(network_Disconnection);
 }
        public int Init( IConfigSource commandlineConfig, IClientControllers controllers )
        {
            Type type = Type.GetType( "OSMP.ObjectReplicationClientToServer" );
            LogFile.WriteLine( "type: [" + type + "] " + type.AssemblyQualifiedName );
            //System.Environment.Exit( 0 );

            Tao.DevIl.Il.ilInit();
               	Tao.DevIl.Ilu.iluInit();

            config = Config.GetInstance();

            string serverip = commandlineConfig.Configs["CommandLineArgs"].GetString( "serverip", config.ServerIPAddress );
            int port = commandlineConfig.Configs["CommandLineArgs"].GetInt( "serverport", config.ServerPort );

            network = new NetworkLevel2Controller();
            network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);

            network.ConnectAsClient(serverip, port);

            rpc = new RpcController(network);
            netreplicationcontroller = new NetReplicationController(rpc);

            renderer = RendererFactory.GetInstance();
            renderer.Tick += new OSMP.TickHandler( MainLoop );
            renderer.Init();

            worldstorage = new WorldModel(netreplicationcontroller);
            worldview = new WorldView( worldstorage );
            playermovement = PlayerMovement.GetInstance();

            InitializePlayermovement();

            myavatar = new Avatar();
            worldstorage.AddEntity(myavatar);

               controllers.Plugin.LoadClientPlugins();
            if (!commandlineConfig.Configs["CommandLineArgs"].Contains("nochat" ))
            {
                LoadChat();
            }

            if( commandlineConfig.Configs["CommandLineArgs"].Contains("url" ) )
            {
            string url = commandlineConfig.Configs["CommandLineArgs"].GetString("url" );
                LogFile.WriteLine( "url: " +  url);

                if (url.StartsWith( "osmp://" ))
                {
                    targettoload = "http://" + url.Substring( "osmp://".Length );
                    LogFile.WriteLine( "target: " + targettoload );
                }
                else
                {
                    targettoload = url;
                }
            }

            renderer.StartMainLoop();

            return 0;
        }
Exemple #6
0
 public WorldModel( NetReplicationController netreplicationcontroller )
 {
     this.netreplicationcontroller = netreplicationcontroller;
     entities = new List<Entity>();
     netreplicationcontroller.RegisterReplicatedObjectController(this, typeof(Entity));
     terrainmodel = new TerrainModel();
 }
Exemple #7
0
        public int Init(IConfigSource commandlineConfig, IClientControllers controllers)
        {
            Type type = Type.GetType("OSMP.ObjectReplicationClientToServer");

            LogFile.WriteLine("type: [" + type + "] " + type.AssemblyQualifiedName);
            //System.Environment.Exit( 0 );

            Tao.DevIl.Il.ilInit();
            Tao.DevIl.Ilu.iluInit();

            config = Config.GetInstance();

            string serverip = commandlineConfig.Configs["CommandLineArgs"].GetString("serverip", config.ServerIPAddress);
            int    port     = commandlineConfig.Configs["CommandLineArgs"].GetInt("serverport", config.ServerPort);

            network = new NetworkLevel2Controller();
            network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);

            network.ConnectAsClient(serverip, port);

            rpc = new RpcController(network);
            netreplicationcontroller = new NetReplicationController(rpc);

            renderer       = RendererFactory.GetInstance();
            renderer.Tick += new OSMP.TickHandler(MainLoop);
            renderer.Init();

            worldstorage   = new WorldModel(netreplicationcontroller);
            worldview      = new WorldView(worldstorage);
            playermovement = PlayerMovement.GetInstance();

            InitializePlayermovement();

            myavatar = new Avatar();
            worldstorage.AddEntity(myavatar);


            controllers.Plugin.LoadClientPlugins();
            if (!commandlineConfig.Configs["CommandLineArgs"].Contains("nochat"))
            {
                LoadChat();
            }

            if (commandlineConfig.Configs["CommandLineArgs"].Contains("url"))
            {
                string url = commandlineConfig.Configs["CommandLineArgs"].GetString("url");
                LogFile.WriteLine("url: " + url);

                if (url.StartsWith("osmp://"))
                {
                    targettoload = "http://" + url.Substring("osmp://".Length);
                    LogFile.WriteLine("target: " + targettoload);
                }
                else
                {
                    targettoload = url;
                }
            }

            renderer.StartMainLoop();

            return(0);
        }
        //! metaverseserver entry point.  Processes commandline arguments; starts dbinterface and serverfileagent components; handles initialization
        public void Init( IConfigSource commandlineConfig, IServerControllers controllers )
        {
            config = Config.GetInstance();

            Test.Info("*** Server starting ***");

            Running = true;

            network = new NetworkLevel2Controller();

            ServerPort = commandlineConfig.Configs["CommandLineArgs"].GetInt( "serverport", config.ServerPort );
            Test.Debug("Creating Metaverse Client listener on port " + ServerPort );

            network.ListenAsServer(ServerPort);

            network.NewConnection += new Level2NewConnectionHandler(network_NewConnection);
            network.Disconnection += new Level2DisconnectionHandler(network_Disconnection);

            rpc = new RpcController(network);
            netreplicationcontroller = new NetReplicationController( rpc );
            World = new WorldModel(netreplicationcontroller);

            controllers.Plugin.LoadServerPlugins();

            Test.Info("*** Server initialization complete ***");
        }