コード例 #1
0
ファイル: BoltDebugStart.cs プロジェクト: ahvonenj/TheForest
    private void Start()
    {
        this._serverEndPoint = new UdpEndPoint(UdpIPv4Address.Localhost, (ushort)BoltRuntimeSettings.instance.debugStartPort);
        this._clientEndPoint = new UdpEndPoint(UdpIPv4Address.Localhost, 0);
        BoltConfig configCopy = BoltRuntimeSettings.instance.GetConfigCopy();

        configCopy.connectionTimeout         = 60000000;
        configCopy.connectionRequestTimeout  = 500;
        configCopy.connectionRequestAttempts = 1000;
        if (!string.IsNullOrEmpty(BoltRuntimeSettings.instance.debugStartMapName))
        {
            if (BoltDebugStartSettings.startServer)
            {
                BoltLauncher.StartServer(this._serverEndPoint, configCopy);
            }
            else if (BoltDebugStartSettings.startClient)
            {
                BoltLauncher.StartClient(this._clientEndPoint, configCopy);
            }
            BoltDebugStartSettings.PositionWindow();
        }
        if (BoltNetwork.isClient || !BoltNetwork.isServer)
        {
        }
    }
コード例 #2
0
    private IEnumerator Start()
    {
        PlayerPrefs.Save();
        CoopTreeGrid.Init();
        LoadSave.OnGameStart += this.OnGameStart;
        yield return(CoopPeerStarter.PrefabDbResource);

        if (!CoopPeerStarter.Dedicated)
        {
            CoopLobby.Instance.SetServer(SteamGameServer.GetSteamID());
        }
        BoltConfig config = base.GetConfig();

        config.serverConnectionLimit = ((!CoopPeerStarter.Dedicated) ? (CoopLobby.Instance.Info.MemberLimit - 1) : SteamDSConfig.ServerPlayers);
        if (CoopPeerStarter.Dedicated)
        {
            BoltLauncher.SetUdpPlatform(new DotNetPlatform());
            BoltLauncher.StartServer(SteamDSConfig.EndPoint, config);
        }
        else
        {
            BoltLauncher.StartServer(SteamGameServer.GetSteamID().ToEndPoint(), config);
        }
        try
        {
            BoltNetwork.AddGlobalEventListener(CoopAckChecker.Instance);
        }
        catch
        {
        }
        yield break;
    }
コード例 #3
0
ファイル: BoltLauncher.cs プロジェクト: K07H/The-Forest
 private static void Initialize(BoltNetworkModes modes, UdpEndPoint endpoint, BoltConfig config)
 {
     BoltNetworkInternal.DebugDrawer   = new UnityDebugDrawer();
     BoltNetworkInternal.UsingUnityPro = true;
     if (BoltLauncher.< > f__mg$cache0 == null)
     {
         BoltLauncher.< > f__mg$cache0 = new Func <int, string>(BoltLauncher.GetSceneName);
     }
     BoltNetworkInternal.GetSceneName = BoltLauncher.< > f__mg$cache0;
     if (BoltLauncher.< > f__mg$cache1 == null)
     {
         BoltLauncher.< > f__mg$cache1 = new Func <string, int>(BoltLauncher.GetSceneIndex);
     }
     BoltNetworkInternal.GetSceneIndex = BoltLauncher.< > f__mg$cache1;
     if (BoltLauncher.< > f__mg$cache2 == null)
     {
         BoltLauncher.< > f__mg$cache2 = new Func <List <STuple <BoltGlobalBehaviourAttribute, Type> > >(BoltLauncher.GetGlobalBehaviourTypes);
     }
     BoltNetworkInternal.GetGlobalBehaviourTypes = BoltLauncher.< > f__mg$cache2;
     if (BoltLauncher.< > f__mg$cache3 == null)
     {
         BoltLauncher.< > f__mg$cache3 = new Action(BoltNetworkInternal_User.EnvironmentSetup);
     }
     BoltNetworkInternal.EnvironmentSetup = BoltLauncher.< > f__mg$cache3;
     if (BoltLauncher.< > f__mg$cache4 == null)
     {
         BoltLauncher.< > f__mg$cache4 = new Action(BoltNetworkInternal_User.EnvironmentReset);
     }
     BoltNetworkInternal.EnvironmentReset = BoltLauncher.< > f__mg$cache4;
     BoltNetworkInternal.__Initialize(modes, endpoint, config, BoltLauncher.CreateUdpPlatform(), null);
 }
コード例 #4
0
    public static void StartSinglePlayer(BoltConfig config)
    {
        // set null platform
        SetUdpPlatform(new NullPlatform());

        // init server
        Initialize(BoltNetworkModes.Host, UdpEndPoint.Any, config);
    }
コード例 #5
0
    public static BoltConfig GetConfig()
    {
        BoltConfig newConfig = BoltRuntimeSettings.instance.GetConfigCopy();

        newConfig.disableAutoSceneLoading = true;

        return(newConfig);
    }
コード例 #6
0
        private void Start()
        {
            _config = BoltRuntimeSettings.instance.GetConfigCopy();

            if (BoltNetwork.IsRunning)
            {
                BoltNetwork.Shutdown();
            }
        }
コード例 #7
0
    void State_StartClient()
    {
        BoltConfig config = BoltRuntimeSettings.instance.GetConfigCopy();

        // config.EnableIPv6 = true;

        BoltLauncher.StartClient(UdpEndPoint.Any, config);
        state = State.Started;
    }
コード例 #8
0
    protected BoltConfig GetConfig()
    {
        BoltConfig configCopy = BoltRuntimeSettings.instance.GetConfigCopy();

        configCopy.connectionTimeout         = 500000;
        configCopy.connectionRequestAttempts = ((!CoopPeerStarter.Dedicated) ? 60 : 15);
        configCopy.connectionRequestTimeout  = 1000;
        return(configCopy);
    }
コード例 #9
0
    void Start()
    {
        _startServerButton.onClick.AddListener(StartServer);
        _joinRandomButton.onClick.AddListener(StartClient);

        // Configure Bolt to not sync scenes automatically
        _config = BoltRuntimeSettings.instance.GetConfigCopy();
        _config.disableAutoSceneLoading = true;
    }
コード例 #10
0
    void State_StartServer()
    {
        BoltConfig config = BoltRuntimeSettings.instance.GetConfigCopy();

        // config.EnableIPv6 = true;

        BoltLauncher.StartServer(new UdpEndPoint(UdpIPv4Address.Any, (ushort)serverPort), config);
        state = State.Started;
    }
コード例 #11
0
        internal void Register()
        {
            config = BoltRuntimeSettings.instance.GetConfigCopy();
            config.connectionRequestTimeout = (int)(MaxConnectionAttemptTime * 1000.0f);

            SetListeners(false, false, false);

            EventHandler.RegisterEvent <World, bool>(GameEvents.WorldStateChanged, OnWorldStateChanged);
        }
コード例 #12
0
    /// <summary>
    /// Starts Bolt as Client.
    /// </summary>
    /// <param name="endpoint">Custom EndPoint where Bolt will try to bind</param>
    /// <param name="config">Custom Bolt configuration</param>
    public static void StartClient(UdpEndPoint endpoint, BoltConfig config = null)
    {
        if (config == null)
        {
            config = BoltRuntimeSettings.instance.GetConfigCopy();
        }

        Initialize(BoltNetworkModes.Client, endpoint, config);
    }
コード例 #13
0
    // SINGLE PLAYER

    /// <summary>
    /// Starts Bolt as a Single Player game
    /// </summary>
    /// <param name="config">Custom Bolt configuration</param>
    public static void StartSinglePlayer(BoltConfig config = null)
    {
        if (config == null)
        {
            config = BoltRuntimeSettings.instance.GetConfigCopy();
        }

        // init server
        Initialize(BoltNetworkModes.None, UdpEndPoint.Any, config);
    }
コード例 #14
0
        internal void Register()
        {
            config = BoltRuntimeSettings.instance.GetConfigCopy();
            config.connectionRequestTimeout = (int)(MaxConnectionAttemptTime * 1000.0f);

            SetListeners(false, false, false);

            EventHandler.RegisterEvent <WorldManager>(EventHandler.GlobalDispatcher, GameEvents.WorldInitialized, OnWorldInitialized);
            EventHandler.RegisterEvent <WorldManager>(EventHandler.GlobalDispatcher, GameEvents.WorldDeinitializing, OnWorldDeinitializing);
        }
コード例 #15
0
        public void Instantiate_BoltConnectionString_BoltExecutionEngine()
        {
            var config          = new BoltConfig();
            var sessionProvider = new ClientProvider(config);
            var commandProvider = new CommandProvider(config);
            var factory         = new ExecutionEngineFactory(sessionProvider, commandProvider, config);

            var query = Mock.Of <IQuery>
                        (
                x => x.ConnectionString == "bolt://*****:*****@host:7687/" &&
                x.Statement == "MATCH(actor: Person) RETURN actor.name"
                        );

            var engine = factory.Instantiate(query);

            Assert.That(engine, Is.Not.Null);
            Assert.That(engine, Is.TypeOf <BoltExecutionEngine>());
        }
コード例 #16
0
    private void InitBolt()
    {
        if (this._connectionAttempts < 3)
        {
            CoopClientCallbacks.OnDisconnected = new Action(this.OnDisconnected);
        }
        BoltConfig config = base.GetConfig();

        if (CoopPeerStarter.Dedicated)
        {
            BoltLauncher.SetUdpPlatform(new DotNetPlatform());
            BoltLauncher.StartClient(config);
        }
        else
        {
            BoltLauncher.StartClient(SteamUser.GetSteamID().ToEndPoint(), config);
        }
        CoopAckChecker.ACKED = false;
    }
コード例 #17
0
    // Host a server
    public static void HostLobby(LobbySettings settings)
    {
        // If already connected, Bolt needs to be shutdown before joining a server
        if (IsHost || IsClient)
        {
            Debug.Log("Shutting down client...");
            BoltLauncher.Shutdown();
        }

        Debug.Log("...Restarting as Host");

        BoltConfig lobbySettings = new BoltConfig();

        lobbySettings.useNetworkSimulation       = settings.DEVSimulateNetworkCondition;
        lobbySettings.simulatedPingMean          = settings.DEVPingMean;
        lobbySettings.simulatedPingJitter        = settings.DEVPingJitter;
        lobbySettings.serverConnectionAcceptMode = BoltConnectionAcceptMode.Auto;

        BoltLauncher.StartServer(UdpEndPoint.Parse("0.0.0.0:27000"), lobbySettings);
    }
コード例 #18
0
    static void Initialize(BoltNetworkModes modes, UdpEndPoint endpoint, BoltConfig config)
    {
        BoltNetworkInternal.DebugDrawer = new BoltInternal.UnityDebugDrawer();

#if UNITY_PRO_LICENSE
        BoltNetworkInternal.UsingUnityPro = true;
#else
        BoltNetworkInternal.UsingUnityPro = false;
#endif

#if BOLT_UPNP_SUPPORT
        BoltNetworkInternal.NatCommunicator = new BoltInternal.StandaloneNatCommunicator();
#endif

        BoltNetworkInternal.GetSceneName            = GetSceneName;
        BoltNetworkInternal.GetSceneIndex           = GetSceneIndex;
        BoltNetworkInternal.GetGlobalBehaviourTypes = GetGlobalBehaviourTypes;
        BoltNetworkInternal.EnvironmentSetup        = BoltInternal.BoltNetworkInternal_User.EnvironmentSetup;
        BoltNetworkInternal.EnvironmentReset        = BoltInternal.BoltNetworkInternal_User.EnvironmentReset;
        BoltNetworkInternal.__Initialize(modes, endpoint, config, CreateUdpPlatform());
    }
コード例 #19
0
ファイル: BoltLauncher.cs プロジェクト: K07H/The-Forest
 public static void StartSinglePlayer(BoltConfig config)
 {
     BoltLauncher.SetUdpPlatform(new NullPlatform());
     BoltLauncher.Initialize(BoltNetworkModes.Host, UdpEndPoint.Any, config);
 }
コード例 #20
0
ファイル: EnemyBoltPool.cs プロジェクト: ilel777/SC
 public EnemyBoltPool(BoltConfig config, int initialCapacity = 10) : base(config, initialCapacity)
 {
 }
コード例 #21
0
    public static void StartSinglePlayer(BoltConfig config)
    {
        // set null platform
        SetUdpPlatform(new NullPlatform());

        // init server
        Initialize(BoltNetworkModes.Host, UdpEndPoint.Any, config);
    }
コード例 #22
0
 public static void StartClient(BoltConfig config)
 {
     StartClient(UdpEndPoint.Any, config);
 }
コード例 #23
0
 /// <summary>
 /// Starts Bolt as Client.
 /// </summary>
 /// <param name="config">Custom Bolt configuration</param>
 public static void StartClient(BoltConfig config)
 {
     StartClient(UdpEndPoint.Any, config);
 }
コード例 #24
0
 /// <summary>
 /// Starts Bolt as Server.
 /// </summary>
 /// <param name="config">Custom Bolt configuration</param>
 /// <param name="scene">Default Scene loaded by Bolt when the initialization is complete</param>
 public static void StartServer(BoltConfig config, string scene = null)
 {
     StartServer(UdpEndPoint.Any, config, scene);
 }
コード例 #25
0
 static void Initialize(BoltNetworkModes modes, UdpEndPoint endpoint, BoltConfig config)
 {
     Initialize(modes, endpoint, config, null);
 }
コード例 #26
0
 public static void StartClient(UdpEndPoint endpoint, BoltConfig config)
 {
     Initialize(BoltNetworkModes.Client, endpoint, config);
 }
コード例 #27
0
ファイル: BoltLauncher.cs プロジェクト: K07H/The-Forest
 public static void StartServer(BoltConfig config)
 {
     BoltLauncher.StartServer(UdpEndPoint.Any, config);
 }
コード例 #28
0
    // Utils

    /// <summary>
    /// Utility function to initialize Bolt with the specified modes, endpoint, config and scene.
    /// </summary>
    /// <param name="modes">Bolt mode. <see cref="BoltNetworkModes"/></param>
    /// <param name="endpoint">Custom EndPoint where Bolt will try to bind</param>
    /// <param name="config">Custom Bolt configuration</param>
    /// <param name="scene">Default Scene loaded by Bolt when the initialization is complete</param>
    static void Initialize(BoltNetworkModes modes, UdpEndPoint endpoint, BoltConfig config, string scene = null)
    {
        BoltDynamicData.Setup();
        BoltNetworkInternal.Initialize(modes, endpoint, config, TargetPlatform, scene);
    }
コード例 #29
0
ファイル: BoltLauncher.cs プロジェクト: K07H/The-Forest
 public static void StartClient(UdpEndPoint endpoint, BoltConfig config)
 {
     BoltLauncher.Initialize(BoltNetworkModes.Client, endpoint, config);
 }
コード例 #30
0
 public static void StartServer(BoltConfig config, string scene)
 {
     StartServer(UdpEndPoint.Any, config, scene);
 }
コード例 #31
0
 public static void StartServer(UdpEndPoint endpoint, BoltConfig config, string scene)
 {
     Initialize(BoltNetworkModes.Host, endpoint, config, scene);
 }
コード例 #32
0
 public static void StartServer(UdpEndPoint endpoint, BoltConfig config)
 {
     Initialize(BoltNetworkModes.Server, endpoint, config);
 }
コード例 #33
0
 static void Initialize(BoltNetworkModes modes, UdpEndPoint endpoint, BoltConfig config)
 {
     Initialize(modes, endpoint, config, null);
 }
コード例 #34
0
    static void Initialize(BoltNetworkModes modes, UdpEndPoint endpoint, BoltConfig config, string scene)
    {
        BoltNetworkInternal.DebugDrawer = new BoltInternal.UnityDebugDrawer();

        #if UNITY_PRO_LICENSE
        BoltNetworkInternal.UsingUnityPro = true;
        #else
        BoltNetworkInternal.UsingUnityPro = false;
        #endif

        #if BOLT_UPNP_SUPPORT
        BoltNetworkInternal.NatCommunicator = new BoltInternal.StandaloneNatCommunicator();
        #endif

        BoltNetworkInternal.GetSceneName = GetSceneName;
        BoltNetworkInternal.GetSceneIndex = GetSceneIndex;
        BoltNetworkInternal.GetGlobalBehaviourTypes = GetGlobalBehaviourTypes;
        BoltNetworkInternal.EnvironmentSetup = BoltInternal.BoltNetworkInternal_User.EnvironmentSetup;
        BoltNetworkInternal.EnvironmentReset = BoltInternal.BoltNetworkInternal_User.EnvironmentReset;
        BoltNetworkInternal.__Initialize(modes, endpoint, config, CreateUdpPlatform(), scene);
    }
コード例 #35
0
 public PlayerBoltPool(BoltConfig config, int initialCapacity = 10) : base(config, initialCapacity)
 {
 }
コード例 #36
0
 public static void StartServer(BoltConfig config)
 {
     StartServer(UdpEndPoint.Any, config);
 }
コード例 #37
0
 /// <summary>
 /// Starts Bolt as Server.
 /// </summary>
 /// <param name="endpoint">Custom EndPoint where Bolt will try to bind</param>
 /// <param name="config">Custom Bolt configuration</param>
 /// <param name="scene">Default Scene loaded by Bolt when the initialization is complete</param>
 public static void StartServer(UdpEndPoint endpoint, BoltConfig config, string scene = null)
 {
     Initialize(BoltNetworkModes.Server, endpoint, config, scene);
 }
コード例 #38
0
    private ConfigurationData()
    {
        // set default values for level configs
        levelsConfig = new LevelConfig[2];
        LevelConfig levelConfig = new LevelConfig("Level01");

        // set default values for spaceships configs
        SpaceShipConfig[] spaceShipsConfig = new SpaceShipConfig[2];

        // set default values for player configs
        PlayerShipConfig playerShipConfig = new PlayerShipConfig("Player", "Player");

        playerShipConfig.health   = new HealthConfig(100);
        playerShipConfig.movement = new MovementConfig(80);
        playerShipConfig.attack   = new AttackConfig(200, 0.5f);
        // set default values for player bolt config
        BoltConfig playerBoltConfig = new BoltConfig("Player Bolt", "Bolt");

        playerBoltConfig.movement   = new MovementConfig(100);
        playerBoltConfig.attack     = new AttackConfig(50);
        playerShipConfig.boltConfig = playerBoltConfig;

        spaceShipsConfig.SetValue(playerShipConfig, 0);

        // set default values for enemy config
        EnemyShipConfig enemyShipConfig = new EnemyShipConfig("Enemy", "SpaceItems/Enemy");

        enemyShipConfig.health     = new HealthConfig(50);
        enemyShipConfig.movement   = new MovementConfig(60, 1.0f, 10.0f, 30.0f);
        enemyShipConfig.attack     = new AttackConfig(70, 1.0f);
        enemyShipConfig.scoreValue = 150;
        // set default values for enemy bolt config
        BoltConfig enemyBoltConfig = new BoltConfig("Enemy Bolt", "Bolt");

        enemyBoltConfig.movement   = new MovementConfig(90);
        enemyBoltConfig.attack     = new AttackConfig(30);
        enemyShipConfig.boltConfig = enemyBoltConfig;

        spaceShipsConfig.SetValue(enemyShipConfig, 1);

        levelConfig.spaceShipsConfig = spaceShipsConfig;

        // set default values for obstacles
        ObstacleConfig[] obstaclesConfig = new ObstacleConfig[1];

        // set default values for asteroid config
        ObstacleConfig asteroidConfig = new ObstacleConfig("Red Asteroid", "SpaceItems/Red Asteroid");

        asteroidConfig.health     = new HealthConfig(100);
        asteroidConfig.movement   = new MovementConfig(60, 0.25f);
        asteroidConfig.scoreValue = 100;
        asteroidConfig.attack     = new AttackConfig(1000);
        obstaclesConfig.SetValue(asteroidConfig, 0);

        levelConfig.obstaclesConfig = obstaclesConfig;

        // set default values for collectible config
        CollectibleConfig[] collectiblesConfig = new CollectibleConfig[2];
        // collectibleConfig.speed = 55;
        collectiblesConfig[0]          = new CollectibleConfig("Health Powerup", "SpaceItems/Health Powerup");
        collectiblesConfig[0].movement = new MovementConfig(55);
        collectiblesConfig.SetValue(new CollectibleConfig("FireRate Powerup", "SpaceItems/FireRate Powerup"), 1);
        collectiblesConfig[1].movement = new MovementConfig(60);

        levelConfig.collectiblesConfig = collectiblesConfig;


        // set default values for wave config
        WaveConfig waveConfig = new WaveConfig();

        waveConfig.startWait         = 0.5f;
        waveConfig.spawnWaveWait     = 3.0f;
        waveConfig.spawnMessageDelay = 1.0f;
        waveConfig.spawnItemWait     = 1.0f;
        waveConfig.itemsNumber       = 5;

        levelConfig.waveConfig = waveConfig;
        levelsConfig.SetValue(levelConfig, 0);
    }