// Create an instance of the server for the region represented by |scene|. public Server(Scene scene) { m_Scene = scene; m_CircuitManager = m_Scene.AuthenticateHandler; m_HttpServer = MainServer.Instance; // m_configSource = m_Scene.Config; }
public TestScene( RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, IConfigSource config, string simulatorVersion) : base(regInfo, authen, physicsScene, sceneGridService, simDataService, estateDataService, config, simulatorVersion) { }
public TestScene( RegionInfo regInfo, AgentCircuitManager authen, ISimulationDataService simDataService, IEstateDataService estateDataService, IConfigSource config, string simulatorVersion) : base(regInfo, authen, simDataService, estateDataService, config, simulatorVersion) { }
public TestScene( RegionInfo regInfo, AgentCircuitManager authen, SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, ModuleLoader moduleLoader, bool dumpAssetsToFile, IConfigSource config, string simulatorVersion) : base(regInfo, authen, sceneGridService, simDataService, estateDataService, moduleLoader, dumpAssetsToFile, config, simulatorVersion) { }
public TestScene( RegionInfo regInfo, AgentCircuitManager authen, SceneCommunicationService sceneGridService, StorageManager storeManager, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) : base(regInfo, authen, sceneGridService, storeManager, moduleLoader, dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion) { }
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager, StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version) { HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager); return new HGScene( regionInfo, circuitManager, m_commsManager, sceneGridService, storageManager, m_moduleLoader, false, m_configSettings.PhysicalPrim, m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); }
public HGScene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, SceneCommunicationService sceneGridService, StorageManager storeManager, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) : base(regInfo, authen, commsMan, sceneGridService, storeManager, moduleLoader, dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion) { m_log.Info("[HGScene]: Starting HGScene."); m_assMapper = new HGAssetMapper(this); EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem; }
/// <summary> /// Add a client for testing /// </summary> /// <param name="scene"></param> /// <param name="testLLUDPServer"></param> /// <param name="testPacketServer"></param> /// <param name="acm">Agent circuit manager used in setting up the stack</param> protected void SetupStack( IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer, out AgentCircuitManager acm) { IConfigSource configSource = new IniConfigSource(); ClientStackUserSettings userSettings = new ClientStackUserSettings(); testLLUDPServer = new TestLLUDPServer(); acm = new AgentCircuitManager(); uint port = 666; testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm); testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings); testLLUDPServer.LocalScene = scene; }
protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager) { SceneCommunicationService sceneGridService = new SceneCommunicationService(); return new Scene( regionInfo, circuitManager, sceneGridService, simDataService, estateDataService, m_moduleLoader, false, m_configSettings.PhysicalPrim, m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); }
public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) : base(listenIP, (int)port) { #region Environment.TickCount Measurement // Measure the resolution of Environment.TickCount TickCountResolution = 0f; for (int i = 0; i < 5; i++) { int start = Environment.TickCount; int now = start; while (now == start) now = Environment.TickCount; TickCountResolution += (float)(now - start) * 0.2f; } //m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); TickCountResolution = (float)Math.Ceiling(TickCountResolution); #endregion Environment.TickCount Measurement m_circuitManager = circuitManager; int sceneThrottleBps = 0; IConfig config = configSource.Configs["ClientStack.LindenUDP"]; if (config != null) { m_asyncPacketHandling = config.GetBoolean("async_packet_handling", false); m_recvBufferSize = config.GetInt("client_socket_rcvbuf_size", 0); sceneThrottleBps = config.GetInt("scene_throttle_max_bps", 0); PrimUpdatesPerCallback = config.GetInt("PrimUpdatesPerCallback", 100); TextureSendLimit = config.GetInt("TextureSendLimit", 20); m_defaultRTO = config.GetInt("DefaultRTO", 0); m_maxRTO = config.GetInt("MaxRTO", 0); ClientTimeOut = config.GetInt("ClientTimeOut", 60); m_disableFacelights = config.GetBoolean("DisableFacelights", false); } else { PrimUpdatesPerCallback = 100; TextureSendLimit = 20; ClientTimeOut = 60; } #region BinaryStats config = configSource.Configs["Statistics.Binary"]; m_shouldCollectStats = false; if (config != null) { if (config.Contains("enabled") && config.GetBoolean("enabled")) { if (config.Contains("collect_packet_headers")) m_shouldCollectStats = config.GetBoolean("collect_packet_headers"); if (config.Contains("packet_headers_period_seconds")) { binStatsMaxFilesize = TimeSpan.FromSeconds(config.GetInt("region_stats_period_seconds")); } if (config.Contains("stats_dir")) { binStatsDir = config.GetString("stats_dir"); } } else { m_shouldCollectStats = false; } } #endregion BinaryStats m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps); m_throttleRates = new ThrottleRates(configSource); }
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager) { bool hgrid = ConfigSource.Source.Configs["Startup"].GetBoolean("hypergrid", false); if (hgrid) return HGCommands.CreateScene(regionInfo, circuitManager, m_commsManager, storageManager, m_moduleLoader, m_configSettings, m_config, m_version); SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); return new Scene( regionInfo, circuitManager, m_commsManager, sceneGridService, storageManager, m_moduleLoader, false, m_configSettings.PhysicalPrim, m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); }
/// <summary> /// Create a scene and its initial base structures. /// </summary> /// <param name="regionInfo"></param> /// <param name="proxyOffset"></param> /// <param name="configSource"></param> /// <param name="clientServer"> </param> /// <returns></returns> protected Scene SetupScene( RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out IClientNetworkServer clientServer) { AgentCircuitManager circuitManager = new AgentCircuitManager(); IPAddress listenIP = regionInfo.InternalEndPoint.Address; //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) // listenIP = IPAddress.Parse("0.0.0.0"); uint port = (uint) regionInfo.InternalEndPoint.Port; if (m_autoCreateClientStack) { clientServer = m_clientStackManager.CreateServer( listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, circuitManager); } else { clientServer = null; } regionInfo.InternalEndPoint.Port = (int) port; Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); if (m_autoCreateClientStack) { clientServer.AddScene(scene); } scene.LoadWorldMap(); scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight); // TODO: Remove this cruft once MasterAvatar is fully deprecated //Master Avatar Setup UserProfileData masterAvatar; if (scene.RegionInfo.MasterAvatarAssignedUUID == UUID.Zero) { masterAvatar = m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName, scene.RegionInfo.MasterAvatarSandboxPassword); } else { masterAvatar = m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarAssignedUUID); scene.RegionInfo.MasterAvatarFirstName = masterAvatar.FirstName; scene.RegionInfo.MasterAvatarLastName = masterAvatar.SurName; } if (masterAvatar == null) { m_log.Info("[PARCEL]: No master avatar found, using null."); scene.RegionInfo.MasterAvatarAssignedUUID = UUID.Zero; } else { m_log.InfoFormat("[PARCEL]: Found master avatar {0} {1} [" + masterAvatar.ID.ToString() + "]", scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName); scene.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.ID; } return scene; }
public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, SceneCommunicationService sceneGridService, StorageManager storeManager, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) { m_config = config; Random random = new Random(); m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); m_moduleLoader = moduleLoader; m_authenticateHandler = authen; CommsManager = commsMan; m_sceneGridService = sceneGridService; m_storageManager = storeManager; m_regInfo = regInfo; m_regionHandle = m_regInfo.RegionHandle; m_regionName = m_regInfo.RegionName; m_datastore = m_regInfo.DataStore; m_physicalPrim = physicalPrim; m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor; m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); m_asyncSceneObjectDeleter.Enabled = true; // Load region settings m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); if (m_storageManager.EstateDataStore != null) { m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID); } //Bind Storage Manager functions to some land manager functions for this scene EventManager.OnLandObjectAdded += new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); EventManager.OnLandObjectRemoved += new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject); m_sceneGraph = new SceneGraph(this, m_regInfo); // If the scene graph has an Unrecoverable error, restart this sim. // Currently the only thing that causes it to happen is two kinds of specific // Physics based crashes. // // Out of memory // Operating system has killed the plugin m_sceneGraph.UnRecoverableError += RestartNow; RegisterDefaultSceneEvents(); DumpAssetsToFile = dumpAssetsToFile; m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics; StatsReporter = new SimStatsReporter(this); StatsReporter.OnSendStatsResult += SendSimStatsPackets; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; StatsReporter.SetObjectCapacity(objectCapacity); m_simulatorVersion = simulatorVersion + " (OS " + Util.GetOperatingSystemInformation() + ")" + " ChilTasks:" + m_seeIntoRegionFromNeighbor.ToString() + " PhysPrim:" + m_physicalPrim.ToString(); try { // Region config overrides global config // IConfig startupConfig = m_config.Configs["Startup"]; //Animation states m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); // TODO: Change default to true once the feature is supported m_usePreJump = startupConfig.GetBoolean("enableprejump", false); m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); if (RegionInfo.NonphysPrimMax > 0) { m_maxNonphys = RegionInfo.NonphysPrimMax; } m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); if (RegionInfo.PhysPrimMax > 0) { m_maxPhys = RegionInfo.PhysPrimMax; } // Here, if clamping is requested in either global or // local config, it will be used // m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); if (RegionInfo.ClampPrimSize) { m_clampPrimSize = true; } m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); m_dontPersistBefore = startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); m_dontPersistBefore *= 10000000; m_persistAfter = startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); m_persistAfter *= 10000000; m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine"); m_maxPrimsPerFrame = startupConfig.GetInt("MaxPrimsPerFrame", 200); IConfig packetConfig = m_config.Configs["PacketPool"]; if (packetConfig != null) { PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); } m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); } catch { m_log.Warn("[SCENE]: Failed to load StartupConfig"); } }
public Scene(RegionInfo regInfo, AgentCircuitManager authen, ISimulationDataService simDataService, IEstateDataService estateDataService, IConfigSource config, string simulatorVersion) : this(regInfo) { m_config = config; FrameTime = 0.0908f; FrameTimeWarnPercent = 60; FrameTimeCritPercent = 40; Normalized55FPS = true; MinMaintenanceTime = 1; SeeIntoRegion = true; Random random = new Random(); m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); m_authenticateHandler = authen; m_sceneGridService = new SceneCommunicationService(); m_SimulationDataService = simDataService; m_EstateDataService = estateDataService; m_lastIncoming = 0; m_lastOutgoing = 0; m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); m_asyncSceneObjectDeleter.Enabled = true; m_asyncInventorySender = new AsyncInventorySender(this); #region Region Settings // Load region settings // LoadRegionSettings creates new region settings in persistence if they don't already exist for this region. // However, in this case, the default textures are not set in memory properly, so we need to do it here and // resave. // FIXME: It shouldn't be up to the database plugins to create this data - we should do it when a new // region is set up and avoid these gyrations. RegionSettings rs = simDataService.LoadRegionSettings(RegionInfo.RegionID); m_extraSettings = simDataService.GetExtra(RegionInfo.RegionID); bool updatedTerrainTextures = false; if (rs.TerrainTexture1 == UUID.Zero) { rs.TerrainTexture1 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_1; updatedTerrainTextures = true; } if (rs.TerrainTexture2 == UUID.Zero) { rs.TerrainTexture2 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_2; updatedTerrainTextures = true; } if (rs.TerrainTexture3 == UUID.Zero) { rs.TerrainTexture3 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_3; updatedTerrainTextures = true; } if (rs.TerrainTexture4 == UUID.Zero) { rs.TerrainTexture4 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_4; updatedTerrainTextures = true; } if (updatedTerrainTextures) rs.Save(); RegionInfo.RegionSettings = rs; if (estateDataService != null) RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false); #endregion Region Settings //Bind Storage Manager functions to some land manager functions for this scene EventManager.OnLandObjectAdded += new EventManager.LandObjectAdded(simDataService.StoreLandObject); EventManager.OnLandObjectRemoved += new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); RegisterDefaultSceneEvents(); // XXX: Don't set the public property since we don't want to activate here. This needs to be handled // better in the future. m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; PhysicsEnabled = !RegionInfo.RegionSettings.DisablePhysics; m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")"; #region Region Config // Region config overrides global config // if (m_config.Configs["Startup"] != null) { IConfig startupConfig = m_config.Configs["Startup"]; StartDisabled = startupConfig.GetBoolean("StartDisabled", false); m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); m_maxDrawDistance = startupConfig.GetFloat("MaxDrawDistance", m_maxDrawDistance); m_maxRegionViewDistance = startupConfig.GetFloat("MaxRegionsViewDistance", m_maxRegionViewDistance); LegacySitOffsets = startupConfig.GetBoolean("LegacySitOffsets", LegacySitOffsets); if (m_defaultDrawDistance > m_maxDrawDistance) m_defaultDrawDistance = m_maxDrawDistance; if (m_maxRegionViewDistance > m_maxDrawDistance) m_maxRegionViewDistance = m_maxDrawDistance; UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); if (!UseBackup) m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); //Animation states m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); SeeIntoRegion = startupConfig.GetBoolean("see_into_region", SeeIntoRegion); MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); if (RegionInfo.NonphysPrimMin > 0) { m_minNonphys = RegionInfo.NonphysPrimMin; } m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); if (RegionInfo.NonphysPrimMax > 0) { m_maxNonphys = RegionInfo.NonphysPrimMax; } m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); if (RegionInfo.PhysPrimMin > 0) { m_minPhys = RegionInfo.PhysPrimMin; } m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); if (RegionInfo.PhysPrimMax > 0) { m_maxPhys = RegionInfo.PhysPrimMax; } m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); if (RegionInfo.LinksetCapacity > 0) { m_linksetCapacity = RegionInfo.LinksetCapacity; } m_linksetPhysCapacity = startupConfig.GetInt("LinksetPhysPrims", m_linksetPhysCapacity); SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); // Here, if clamping is requested in either global or // local config, it will be used // m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); if (RegionInfo.ClampPrimSize) { m_clampPrimSize = true; } m_clampNegativeZ = startupConfig.GetBoolean("ClampNegativeZ", m_clampNegativeZ); m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); m_dontPersistBefore = startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); m_dontPersistBefore *= 10000000; m_persistAfter = startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); m_persistAfter *= 10000000; m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; m_generateMaptiles = Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true); if (m_generateMaptiles) { int maptileRefresh = Util.GetConfigVarFromSections<int>(config, "MaptileRefresh", possibleMapConfigSections, 0); m_log.InfoFormat("[SCENE]: Region {0}, WORLD MAP refresh time set to {1} seconds", RegionInfo.RegionName, maptileRefresh); if (maptileRefresh != 0) { m_mapGenerationTimer.Interval = maptileRefresh * 1000; m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; m_mapGenerationTimer.AutoReset = true; m_mapGenerationTimer.Start(); } } else { string tile = Util.GetConfigVarFromSections<string>( config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString()); UUID tileID; if (tile != UUID.Zero.ToString() && UUID.TryParse(tile, out tileID)) { RegionInfo.RegionSettings.TerrainImageID = tileID; } else { RegionInfo.RegionSettings.TerrainImageID = RegionInfo.MaptileStaticUUID; m_log.InfoFormat("[SCENE]: Region {0}, maptile set to {1}", RegionInfo.RegionName, RegionInfo.MaptileStaticUUID.ToString()); } } string[] possibleAccessControlConfigSections = new string[] { "Startup", "AccessControl"}; string grant = Util.GetConfigVarFromSections<string>( config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); if (grant.Length > 0) { foreach (string viewer in grant.Split(',')) { m_AllowedViewers.Add(viewer.Trim().ToLower()); } } grant = Util.GetConfigVarFromSections<string>( config, "DeniedClients", possibleAccessControlConfigSections, String.Empty); // Deal with the mess of someone having used a different word at some point if (grant == String.Empty) grant = Util.GetConfigVarFromSections<string>( config, "BannedClients", possibleAccessControlConfigSections, String.Empty); if (grant.Length > 0) { foreach (string viewer in grant.Split(',')) { m_BannedViewers.Add(viewer.Trim().ToLower()); } } FrameTime = startupConfig.GetFloat( "FrameTime", FrameTime); FrameTimeWarnPercent = startupConfig.GetInt( "FrameTimeWarnPercent", FrameTimeWarnPercent); FrameTimeCritPercent = startupConfig.GetInt( "FrameTimeCritPercent", FrameTimeCritPercent); Normalized55FPS = startupConfig.GetBoolean( "Normalized55FPS", Normalized55FPS); m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); m_update_entitymovement = startupConfig.GetInt("UpdateEntityMovementEveryNFrames", m_update_entitymovement); m_update_events = startupConfig.GetInt("UpdateEventsEveryNFrames", m_update_events); m_update_objects = startupConfig.GetInt("UpdateObjectsEveryNFrames", m_update_objects); m_update_physics = startupConfig.GetInt("UpdatePhysicsEveryNFrames", m_update_physics); m_update_presences = startupConfig.GetInt("UpdateAgentsEveryNFrames", m_update_presences); m_update_terrain = startupConfig.GetInt("UpdateTerrainEveryNFrames", m_update_terrain); m_update_temp_cleaning = startupConfig.GetInt("UpdateTempCleaningEveryNSeconds", m_update_temp_cleaning); } // FIXME: Ultimately this should be in a module. SendPeriodicAppearanceUpdates = false; IConfig appearanceConfig = m_config.Configs["Appearance"]; if (appearanceConfig != null) { SendPeriodicAppearanceUpdates = appearanceConfig.GetBoolean("ResendAppearanceUpdates", SendPeriodicAppearanceUpdates); } #endregion Region Config IConfig entityTransferConfig = m_config.Configs["EntityTransfer"]; if (entityTransferConfig != null) { AllowAvatarCrossing = entityTransferConfig.GetBoolean("AllowAvatarCrossing", AllowAvatarCrossing); DisableObjectTransfer = entityTransferConfig.GetBoolean("DisableObjectTransfer", false); } #region Interest Management IConfig interestConfig = m_config.Configs["InterestManagement"]; if (interestConfig != null) { string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); try { UpdatePrioritizationScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true); } catch (Exception) { m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time"); UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time; } IsReprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", IsReprioritizationEnabled); ReprioritizationInterval = interestConfig.GetFloat("ReprioritizationInterval", ReprioritizationInterval); ReprioritizationDistance = interestConfig.GetFloat("RootReprioritizationDistance", ReprioritizationDistance); if(ReprioritizationDistance < m_minReprioritizationDistance) ReprioritizationDistance = m_minReprioritizationDistance; ObjectsCullingByDistance = interestConfig.GetBoolean("ObjectsCullingByDistance", ObjectsCullingByDistance); RootTerseUpdatePeriod = interestConfig.GetInt("RootTerseUpdatePeriod", RootTerseUpdatePeriod); ChildTerseUpdatePeriod = interestConfig.GetInt("ChildTerseUpdatePeriod", ChildTerseUpdatePeriod); RootPositionUpdateTolerance = interestConfig.GetFloat("RootPositionUpdateTolerance", RootPositionUpdateTolerance); RootRotationUpdateTolerance = interestConfig.GetFloat("RootRotationUpdateTolerance", RootRotationUpdateTolerance); RootVelocityUpdateTolerance = interestConfig.GetFloat("RootVelocityUpdateTolerance", RootVelocityUpdateTolerance); } m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", UpdatePrioritizationScheme); #endregion Interest Management StatsReporter = new SimStatsReporter(this); StatsReporter.OnSendStatsResult += SendSimStatsPackets; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; }
/// <summary> /// Create a server that can set up sessions for virtual world client <-> server communications /// </summary> /// <param name="_listenIP"></param> /// <param name="port"></param> /// <param name="proxyPortOffset"></param> /// <param name="allow_alternate_port"></param> /// <param name="assetCache"></param> /// <param name="authenticateClass"></param> /// <returns></returns> public IClientNetworkServer CreateServer( IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AgentCircuitManager authenticateClass) { return CreateServer( _listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass); }
protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager);
public LLUDPServer( IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) : base(listenIP, (int)port) { #region Environment.TickCount Measurement // Measure the resolution of Environment.TickCount TickCountResolution = 0f; for (int i = 0; i < 5; i++) { int start = Environment.TickCount; int now = start; while (now == start) now = Environment.TickCount; TickCountResolution += (float)(now - start) * 0.2f; } m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); TickCountResolution = (float)Math.Ceiling(TickCountResolution); #endregion Environment.TickCount Measurement m_circuitManager = circuitManager; int sceneThrottleBps = 0; bool usePools = false; IConfig config = configSource.Configs["ClientStack.LindenUDP"]; if (config != null) { m_asyncPacketHandling = config.GetBoolean("async_packet_handling", true); m_recvBufferSize = config.GetInt("client_socket_rcvbuf_size", 0); sceneThrottleBps = config.GetInt("scene_throttle_max_bps", 0); PrimUpdatesPerCallback = config.GetInt("PrimUpdatesPerCallback", 100); TextureSendLimit = config.GetInt("TextureSendLimit", 20); m_defaultRTO = config.GetInt("DefaultRTO", 0); m_maxRTO = config.GetInt("MaxRTO", 0); m_disableFacelights = config.GetBoolean("DisableFacelights", false); m_ackTimeout = 1000 * config.GetInt("AckTimeout", 60); m_pausedAckTimeout = 1000 * config.GetInt("PausedAckTimeout", 300); } else { PrimUpdatesPerCallback = 100; TextureSendLimit = 20; m_ackTimeout = 1000 * 60; // 1 minute m_pausedAckTimeout = 1000 * 300; // 5 minutes } // FIXME: This actually only needs to be done once since the PacketPool is shared across all servers. // However, there is no harm in temporarily doing it multiple times. IConfig packetConfig = configSource.Configs["PacketPool"]; if (packetConfig != null) { PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); usePools = packetConfig.GetBoolean("RecycleBaseUDPPackets", usePools); } #region BinaryStats config = configSource.Configs["Statistics.Binary"]; m_shouldCollectStats = false; if (config != null) { m_shouldCollectStats = config.GetBoolean("Enabled", false); binStatsMaxFilesize = TimeSpan.FromSeconds(config.GetInt("packet_headers_period_seconds", 300)); binStatsDir = config.GetString("stats_dir", "."); m_aggregatedBWStats = config.GetBoolean("aggregatedBWStats", false); } #endregion BinaryStats m_throttle = new TokenBucket(null, sceneThrottleBps); ThrottleRates = new ThrottleRates(configSource); if (usePools) EnablePools(); }
public Scene(RegionInfo regInfo, AgentCircuitManager authen, SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) { m_config = config; Random random = new Random(); BordersLocked = true; Border northBorder = new Border(); northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- northBorder.CrossDirection = Cardinals.N; NorthBorders.Add(northBorder); Border southBorder = new Border(); southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //---> southBorder.CrossDirection = Cardinals.S; SouthBorders.Add(southBorder); Border eastBorder = new Border(); eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- eastBorder.CrossDirection = Cardinals.E; EastBorders.Add(eastBorder); Border westBorder = new Border(); westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //---> westBorder.CrossDirection = Cardinals.W; WestBorders.Add(westBorder); BordersLocked = false; m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); m_moduleLoader = moduleLoader; m_authenticateHandler = authen; m_sceneGridService = sceneGridService; m_SimulationDataService = simDataService; m_EstateDataService = estateDataService; m_regInfo = regInfo; m_regionHandle = m_regInfo.RegionHandle; m_regionName = m_regInfo.RegionName; m_datastore = m_regInfo.DataStore; m_lastUpdate = Util.EnvironmentTickCount(); m_physicalPrim = physicalPrim; m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor; m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); m_asyncSceneObjectDeleter.Enabled = true; #region Region Settings // Load region settings m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID); if (estateDataService != null) m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); #endregion Region Settings MainConsole.Instance.Commands.AddCommand("region", false, "reload estate", "reload estate", "Reload the estate data", HandleReloadEstate); //Bind Storage Manager functions to some land manager functions for this scene EventManager.OnLandObjectAdded += new EventManager.LandObjectAdded(simDataService.StoreLandObject); EventManager.OnLandObjectRemoved += new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); m_sceneGraph = new SceneGraph(this, m_regInfo); // If the scene graph has an Unrecoverable error, restart this sim. // Currently the only thing that causes it to happen is two kinds of specific // Physics based crashes. // // Out of memory // Operating system has killed the plugin m_sceneGraph.UnRecoverableError += RestartNow; RegisterDefaultSceneEvents(); DumpAssetsToFile = dumpAssetsToFile; m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics; StatsReporter = new SimStatsReporter(this); StatsReporter.OnSendStatsResult += SendSimStatsPackets; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; // Old /* m_simulatorVersion = simulatorVersion + " (OS " + Util.GetOperatingSystemInformation() + ")" + " ChilTasks:" + m_seeIntoRegionFromNeighbor.ToString() + " PhysPrim:" + m_physicalPrim.ToString(); */ m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")"; #region Region Config try { // Region config overrides global config // IConfig startupConfig = m_config.Configs["Startup"]; //Animation states m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); // TODO: Change default to true once the feature is supported m_usePreJump = startupConfig.GetBoolean("enableprejump", false); m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); if (RegionInfo.NonphysPrimMax > 0) { m_maxNonphys = RegionInfo.NonphysPrimMax; } m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); if (RegionInfo.PhysPrimMax > 0) { m_maxPhys = RegionInfo.PhysPrimMax; } // Here, if clamping is requested in either global or // local config, it will be used // m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); if (RegionInfo.ClampPrimSize) { m_clampPrimSize = true; } m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); m_dontPersistBefore = startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); m_dontPersistBefore *= 10000000; m_persistAfter = startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); m_persistAfter *= 10000000; m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); IConfig packetConfig = m_config.Configs["PacketPool"]; if (packetConfig != null) { PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); } m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); if (m_generateMaptiles) { int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); if (maptileRefresh != 0) { m_mapGenerationTimer.Interval = maptileRefresh * 1000; m_mapGenerationTimer.Elapsed += RegenerateMaptile; m_mapGenerationTimer.AutoReset = true; m_mapGenerationTimer.Start(); } } else { string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); UUID tileID; if (UUID.TryParse(tile, out tileID)) { RegionInfo.RegionSettings.TerrainImageID = tileID; } } Random rnd = new Random(); GenerationSeed = startupConfig.GetLong("TerragenSeed", (long)rnd.Next()); } catch { m_log.Warn("[SCENE]: Failed to load StartupConfig"); } #endregion Region Config #region Interest Management if (m_config != null) { IConfig interestConfig = m_config.Configs["InterestManagement"]; if (interestConfig != null) { string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); try { m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true); } catch (Exception) { m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time"); m_priorityScheme = UpdatePrioritizationSchemes.Time; } m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true); m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0); m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0); m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0); } } m_log.Info("[SCENE]: Using the " + m_priorityScheme + " prioritization scheme"); #endregion Interest Management }
/// <summary> /// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions /// or a different, to get a brand new scene with new shared region modules. /// </summary> /// <param name="name">Name of the region</param> /// <param name="id">ID of the region</param> /// <param name="x">X co-ordinate of the region</param> /// <param name="y">Y co-ordinate of the region</param> /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> /// <returns></returns> public static TestScene SetupScene(string name, UUID id, uint x, uint y, CoreAssetCache cache) { Console.WriteLine("Setting up test scene {0}", name); // We must set up a console otherwise setup of some modules may fail MainConsole.Instance = new MockConsole("TEST PROMPT"); RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); regInfo.RegionName = name; regInfo.RegionID = id; AgentCircuitManager acm = new AgentCircuitManager(); SceneCommunicationService scs = new SceneCommunicationService(); ISimulationDataService simDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin<ISimulationDataService>("OpenSim.Tests.Common.dll", null); IEstateDataService estateDataService = null; IConfigSource configSource = new IniConfigSource(); TestScene testScene = new TestScene( regInfo, acm, scs, simDataService, estateDataService, null, false, configSource, null); IRegionModule godsModule = new GodsModule(); godsModule.Initialise(testScene, new IniConfigSource()); testScene.AddModule(godsModule.Name, godsModule); LocalAssetServicesConnector assetService = StartAssetService(testScene, cache); StartAuthenticationService(testScene); LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); StartGridService(testScene); LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); inventoryService.PostInitialise(); assetService.PostInitialise(); userAccountService.PostInitialise(); presenceService.PostInitialise(); testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); testScene.SetModuleInterfaces(); testScene.LandChannel = new TestLandChannel(testScene); testScene.LoadWorldMap(); PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); testScene.RegionInfo.EstateSettings = new EstateSettings(); testScene.LoginsDisabled = false; testScene.RegisterRegionWithGrid(); return testScene; }
protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager) { if (m_log.IsDebugEnabled) { m_log.DebugFormat ("{0} called", System.Reflection.MethodBase.GetCurrentMethod ().Name); } SceneCommunicationService sceneGridService = new SceneCommunicationService(); return new Scene( regionInfo, circuitManager, sceneGridService, simDataService, estateDataService, Config, m_version); }
public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) : base(listenIP, (int)port) { #region Environment.TickCount Measurement // Measure the resolution of Environment.TickCount TickCountResolution = 0f; for (int i = 0; i < 5; i++) { int start = Environment.TickCount; int now = start; while (now == start) now = Environment.TickCount; TickCountResolution += (float)(now - start) * 0.2f; } m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); TickCountResolution = (float)Math.Ceiling(TickCountResolution); #endregion Environment.TickCount Measurement m_circuitManager = circuitManager; int sceneThrottleBps = 0; IConfig config = configSource.Configs["ClientStack.LindenUDP"]; if (config != null) { m_asyncPacketHandling = config.GetBoolean("async_packet_handling", false); m_recvBufferSize = config.GetInt("client_socket_rcvbuf_size", 0); sceneThrottleBps = config.GetInt("scene_throttle_max_bps", 0); PrimTerseUpdatesPerPacket = config.GetInt("PrimTerseUpdatesPerPacket", 25); AvatarTerseUpdatesPerPacket = config.GetInt("AvatarTerseUpdatesPerPacket", 10); PrimFullUpdatesPerPacket = config.GetInt("PrimFullUpdatesPerPacket", 100); TextureSendLimit = config.GetInt("TextureSendLimit", 20); } else { PrimTerseUpdatesPerPacket = 25; AvatarTerseUpdatesPerPacket = 10; PrimFullUpdatesPerPacket = 100; TextureSendLimit = 20; } m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps); m_throttleRates = new ThrottleRates(configSource); }
/// <summary> /// Create a scene and its initial base structures. /// </summary> /// <param name="regionInfo"></param> /// <param name="proxyOffset"></param> /// <param name="configSource"></param> /// <param name="clientServer"> </param> /// <returns></returns> protected Scene SetupScene( RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out List<IClientNetworkServer> clientServer) { List<IClientNetworkServer> clientNetworkServers = null; AgentCircuitManager circuitManager = new AgentCircuitManager(); IPAddress listenIP = regionInfo.InternalEndPoint.Address; //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) // listenIP = IPAddress.Parse("0.0.0.0"); uint port = (uint) regionInfo.InternalEndPoint.Port; if (m_autoCreateClientStack) { clientNetworkServers = m_clientStackManager.CreateServers( listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, circuitManager); } else { clientServer = null; } regionInfo.InternalEndPoint.Port = (int) port; Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager); if (m_autoCreateClientStack) { foreach (IClientNetworkServer clientnetserver in clientNetworkServers) { clientnetserver.AddScene(scene); } } clientServer = clientNetworkServers; scene.LoadWorldMap(); scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); scene.PhysicsScene.RequestAssetMethod = scene.PhysicsRequestAsset; scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight); return scene; }
/// <summary> /// Create a server that can set up sessions for virtual world client <-> server communications /// </summary> /// <param name="_listenIP"></param> /// <param name="port"></param> /// <param name="proxyPortOffset"></param> /// <param name="allow_alternate_port"></param> /// <param name="configSource"> /// Can be null, in which case default values are used /// </param> /// <param name="assetCache"></param> /// <param name="authenticateClass"></param> /// <returns></returns> public IClientNetworkServer CreateServer( IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager authenticateClass) { if (plugin != null) { IClientNetworkServer server = (IClientNetworkServer)Activator.CreateInstance(pluginAssembly.GetType(plugin.ToString())); server.Initialise( _listenIP, ref port, proxyPortOffset, allow_alternate_port, configSource, authenticateClass); return server; } m_log.Error("[CLIENTSTACK]: Couldn't initialize a new server"); return null; }
public Scene(RegionInfo regInfo, AgentCircuitManager authen, SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, ModuleLoader moduleLoader, bool dumpAssetsToFile, IConfigSource config, string simulatorVersion) : this(regInfo) { m_config = config; MinFrameTime = 0.089f; MinMaintenanceTime = 1; Random random = new Random(); m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); m_moduleLoader = moduleLoader; m_authenticateHandler = authen; m_sceneGridService = sceneGridService; m_SimulationDataService = simDataService; m_EstateDataService = estateDataService; m_regionHandle = RegionInfo.RegionHandle; m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); m_asyncSceneObjectDeleter.Enabled = true; m_asyncInventorySender = new AsyncInventorySender(this); #region Region Settings // Load region settings // LoadRegionSettings creates new region settings in persistence if they don't already exist for this region. // However, in this case, the default textures are not set in memory properly, so we need to do it here and // resave. // FIXME: It shouldn't be up to the database plugins to create this data - we should do it when a new // region is set up and avoid these gyrations. RegionSettings rs = simDataService.LoadRegionSettings(RegionInfo.RegionID); m_extraSettings = simDataService.GetExtra(RegionInfo.RegionID); bool updatedTerrainTextures = false; if (rs.TerrainTexture1 == UUID.Zero) { rs.TerrainTexture1 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_1; updatedTerrainTextures = true; } if (rs.TerrainTexture2 == UUID.Zero) { rs.TerrainTexture2 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_2; updatedTerrainTextures = true; } if (rs.TerrainTexture3 == UUID.Zero) { rs.TerrainTexture3 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_3; updatedTerrainTextures = true; } if (rs.TerrainTexture4 == UUID.Zero) { rs.TerrainTexture4 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_4; updatedTerrainTextures = true; } if (updatedTerrainTextures) rs.Save(); RegionInfo.RegionSettings = rs; if (estateDataService != null) RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false); #endregion Region Settings //Bind Storage Manager functions to some land manager functions for this scene EventManager.OnLandObjectAdded += new EventManager.LandObjectAdded(simDataService.StoreLandObject); EventManager.OnLandObjectRemoved += new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); m_sceneGraph = new SceneGraph(this); // If the scene graph has an Unrecoverable error, restart this sim. // Currently the only thing that causes it to happen is two kinds of specific // Physics based crashes. // // Out of memory // Operating system has killed the plugin m_sceneGraph.UnRecoverableError += RestartNow; RegisterDefaultSceneEvents(); DumpAssetsToFile = dumpAssetsToFile; m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics; m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")"; #region Region Config // Region config overrides global config // if (m_config.Configs["Startup"] != null) { IConfig startupConfig = m_config.Configs["Startup"]; StartDisabled = startupConfig.GetBoolean("StartDisabled", false); m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); if (!m_useBackup) m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); //Animation states m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); if (RegionInfo.NonphysPrimMin > 0) { m_minNonphys = RegionInfo.NonphysPrimMin; } m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); if (RegionInfo.NonphysPrimMax > 0) { m_maxNonphys = RegionInfo.NonphysPrimMax; } m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); if (RegionInfo.PhysPrimMin > 0) { m_minPhys = RegionInfo.PhysPrimMin; } m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); if (RegionInfo.PhysPrimMax > 0) { m_maxPhys = RegionInfo.PhysPrimMax; } // Here, if clamping is requested in either global or // local config, it will be used // m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); if (RegionInfo.ClampPrimSize) { m_clampPrimSize = true; } m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); if (RegionInfo.LinksetCapacity > 0) { m_linksetCapacity = RegionInfo.LinksetCapacity; } m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete); m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); m_dontPersistBefore = startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); m_dontPersistBefore *= 10000000; m_persistAfter = startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); m_persistAfter *= 10000000; m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); if (m_generateMaptiles) { int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); if (maptileRefresh != 0) { m_mapGenerationTimer.Interval = maptileRefresh * 1000; m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; m_mapGenerationTimer.AutoReset = true; m_mapGenerationTimer.Start(); } } else { string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); UUID tileID; if (UUID.TryParse(tile, out tileID)) { RegionInfo.RegionSettings.TerrainImageID = tileID; } } string grant = startupConfig.GetString("AllowedClients", String.Empty); if (grant.Length > 0) { foreach (string viewer in grant.Split('|')) { m_AllowedViewers.Add(viewer.Trim().ToLower()); } } grant = startupConfig.GetString("BannedClients", String.Empty); if (grant.Length > 0) { foreach (string viewer in grant.Split('|')) { m_BannedViewers.Add(viewer.Trim().ToLower()); } } MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); } // FIXME: Ultimately this should be in a module. SendPeriodicAppearanceUpdates = true; IConfig appearanceConfig = m_config.Configs["Appearance"]; if (appearanceConfig != null) { SendPeriodicAppearanceUpdates = appearanceConfig.GetBoolean("ResendAppearanceUpdates", SendPeriodicAppearanceUpdates); } #endregion Region Config #region Interest Management IConfig interestConfig = m_config.Configs["InterestManagement"]; if (interestConfig != null) { string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); try { m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true); } catch (Exception) { m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time"); m_priorityScheme = UpdatePrioritizationSchemes.Time; } m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true); m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0); m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0); m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0); } m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme); #endregion Interest Management StatsReporter = new SimStatsReporter(this); StatsReporter.OnSendStatsResult += SendSimStatsPackets; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; }
/// <summary> /// Set up a test scene /// </summary> /// <param name="name">Name of the region</param> /// <param name="id">ID of the region</param> /// <param name="x">X co-ordinate of the region</param> /// <param name="y">Y co-ordinate of the region</param> /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> /// <param name="startServices">Start associated threads for the services used by the scene</param> /// <returns></returns> public static TestScene SetupScene( string name, UUID id, uint x, uint y, TestCommunicationsManager cm, bool startServices) { Console.WriteLine("Setting up test scene {0}", name); MainServer.Instance = new BaseHttpServer(980); RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); regInfo.RegionName = name; regInfo.RegionID = id; AgentCircuitManager acm = new AgentCircuitManager(); SceneCommunicationService scs = new SceneCommunicationService(cm); StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); IConfigSource configSource = new IniConfigSource(); TestScene testScene = new TestScene( regInfo, acm, cm, scs, sm, null, false, false, false, configSource, null); INonSharedRegionModule capsModule = new CapabilitiesModule(); capsModule.Initialise(new IniConfigSource()); testScene.AddRegionModule(capsModule.Name, capsModule); capsModule.AddRegion(testScene); IRegionModule godsModule = new GodsModule(); godsModule.Initialise(testScene, new IniConfigSource()); testScene.AddModule(godsModule.Name, godsModule); ISharedRegionModule assetService = new LocalAssetServicesConnector(); IniConfigSource config = new IniConfigSource(); config.AddConfig("Modules"); config.AddConfig("AssetService"); config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); assetService.Initialise(config); assetService.AddRegion(testScene); assetService.RegionLoaded(testScene); testScene.AddRegionModule(assetService.Name, assetService); assetService.PostInitialise(); ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); config = new IniConfigSource(); config.AddConfig("Modules"); config.AddConfig("InventoryService"); config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); inventoryService.Initialise(config); inventoryService.AddRegion(testScene); inventoryService.RegionLoaded(testScene); testScene.AddRegionModule(inventoryService.Name, inventoryService); inventoryService.PostInitialise(); testScene.SetModuleInterfaces(); testScene.LandChannel = new TestLandChannel(); testScene.LoadWorldMap(); PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); return testScene; }
public void Initialise(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) { m_udpServer = new LLUDPServer(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager); }
/// <summary> /// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions /// or a different, to get a brand new scene with new shared region modules. /// </summary> /// <param name="name">Name of the region</param> /// <param name="id">ID of the region</param> /// <param name="x">X co-ordinate of the region</param> /// <param name="y">Y co-ordinate of the region</param> /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> /// <returns></returns> public static TestScene SetupScene( string name, UUID id, uint x, uint y, TestCommunicationsManager cm, String realServices) { bool newScene = false; Console.WriteLine("Setting up test scene {0}", name); // If cm is the same as our last commsManager used, this means the tester wants to link // regions. In this case, don't use the sameshared region modules and dont initialize them again. // Also, no need to start another MainServer and MainConsole instance. if (cm == null || cm != commsManager) { System.Console.WriteLine("Starting a brand new scene"); newScene = true; MainConsole.Instance = new LocalConsole("TEST PROMPT"); MainServer.Instance = new BaseHttpServer(980); commsManager = cm; } // We must set up a console otherwise setup of some modules may fail RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); regInfo.RegionName = name; regInfo.RegionID = id; AgentCircuitManager acm = new AgentCircuitManager(); SceneCommunicationService scs = new SceneCommunicationService(cm); StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); IConfigSource configSource = new IniConfigSource(); TestScene testScene = new TestScene( regInfo, acm, cm, scs, sm, null, false, false, false, configSource, null); INonSharedRegionModule capsModule = new CapabilitiesModule(); capsModule.Initialise(new IniConfigSource()); testScene.AddRegionModule(capsModule.Name, capsModule); capsModule.AddRegion(testScene); IRegionModule godsModule = new GodsModule(); godsModule.Initialise(testScene, new IniConfigSource()); testScene.AddModule(godsModule.Name, godsModule); realServices = realServices.ToLower(); // IConfigSource config = new IniConfigSource(); // If we have a brand new scene, need to initialize shared region modules if ((m_assetService == null && m_inventoryService == null) || newScene) { if (realServices.Contains("asset")) StartAssetService(testScene, true); else StartAssetService(testScene, false); if (realServices.Contains("inventory")) StartInventoryService(testScene, true); else StartInventoryService(testScene, false); if (realServices.Contains("grid")) StartGridService(testScene, true); } // If not, make sure the shared module gets references to this new scene else { m_assetService.AddRegion(testScene); m_assetService.RegionLoaded(testScene); m_inventoryService.AddRegion(testScene); m_inventoryService.RegionLoaded(testScene); } m_inventoryService.PostInitialise(); m_assetService.PostInitialise(); testScene.CommsManager.UserService.SetInventoryService(testScene.InventoryService); testScene.SetModuleInterfaces(); testScene.LandChannel = new TestLandChannel(testScene); testScene.LoadWorldMap(); PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); return testScene; }
protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager) { SceneCommunicationService sceneGridService = new SceneCommunicationService(); return new Scene( regionInfo, circuitManager, sceneGridService, simDataService, estateDataService, Config, m_version); }
public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, SceneCommunicationService sceneGridService, StorageManager storeManager, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) { m_config = config; Random random = new Random(); BordersLocked = true; Border northBorder = new Border(); northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- northBorder.CrossDirection = Cardinals.N; NorthBorders.Add(northBorder); Border southBorder = new Border(); southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //---> southBorder.CrossDirection = Cardinals.S; SouthBorders.Add(southBorder); Border eastBorder = new Border(); eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- eastBorder.CrossDirection = Cardinals.E; EastBorders.Add(eastBorder); Border westBorder = new Border(); westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //---> westBorder.CrossDirection = Cardinals.W; WestBorders.Add(westBorder); BordersLocked = false; m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); m_moduleLoader = moduleLoader; m_authenticateHandler = authen; CommsManager = commsMan; m_sceneGridService = sceneGridService; m_storageManager = storeManager; m_regInfo = regInfo; m_regionHandle = m_regInfo.RegionHandle; m_regionName = m_regInfo.RegionName; m_datastore = m_regInfo.DataStore; m_lastUpdate = Util.EnvironmentTickCount(); m_physicalPrim = physicalPrim; m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor; m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); m_asyncSceneObjectDeleter.Enabled = true; // Load region settings m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); if (m_storageManager.EstateDataStore != null) { m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID); } //Bind Storage Manager functions to some land manager functions for this scene EventManager.OnLandObjectAdded += new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); EventManager.OnLandObjectRemoved += new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject); m_sceneGraph = new SceneGraph(this, m_regInfo); // If the scene graph has an Unrecoverable error, restart this sim. // Currently the only thing that causes it to happen is two kinds of specific // Physics based crashes. // // Out of memory // Operating system has killed the plugin m_sceneGraph.UnRecoverableError += RestartNow; RegisterDefaultSceneEvents(); DumpAssetsToFile = dumpAssetsToFile; m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics; StatsReporter = new SimStatsReporter(this); StatsReporter.OnSendStatsResult += SendSimStatsPackets; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; StatsReporter.SetObjectCapacity(objectCapacity); // Old /* m_simulatorVersion = simulatorVersion + " (OS " + Util.GetOperatingSystemInformation() + ")" + " ChilTasks:" + m_seeIntoRegionFromNeighbor.ToString() + " PhysPrim:" + m_physicalPrim.ToString(); */ m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")"; try { // Region config overrides global config // IConfig startupConfig = m_config.Configs["Startup"]; // Should we try to run loops synchronously or asynchronously? m_useAsyncWhenPossible = startupConfig.GetBoolean("use_async_when_possible", false); //Animation states m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); // TODO: Change default to true once the feature is supported m_usePreJump = startupConfig.GetBoolean("enableprejump", false); m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); if (RegionInfo.NonphysPrimMax > 0) { m_maxNonphys = RegionInfo.NonphysPrimMax; } m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); if (RegionInfo.PhysPrimMax > 0) { m_maxPhys = RegionInfo.PhysPrimMax; } // Here, if clamping is requested in either global or // local config, it will be used // m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); if (RegionInfo.ClampPrimSize) { m_clampPrimSize = true; } m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); m_dontPersistBefore = startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); m_dontPersistBefore *= 10000000; m_persistAfter = startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); m_persistAfter *= 10000000; m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); IConfig packetConfig = m_config.Configs["PacketPool"]; if (packetConfig != null) { PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); } m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); IConfig interest_management_config = m_config.Configs["InterestManagement"]; if (interest_management_config != null) { string update_prioritization_scheme = interest_management_config.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); switch (update_prioritization_scheme) { case "time": m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; break; case "distance": m_update_prioritization_scheme = UpdatePrioritizationSchemes.Distance; break; case "simpleangulardistance": m_update_prioritization_scheme = UpdatePrioritizationSchemes.SimpleAngularDistance; break; case "frontback": m_update_prioritization_scheme = UpdatePrioritizationSchemes.FrontBack; break; default: m_log.Warn("[SCENE]: UpdatePrioritizationScheme was not recognized, setting to default settomg of Time"); m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; break; } m_reprioritization_enabled = interest_management_config.GetBoolean("ReprioritizationEnabled", true); m_reprioritization_interval = interest_management_config.GetDouble("ReprioritizationInterval", 5000.0); m_root_reprioritization_distance = interest_management_config.GetDouble("RootReprioritizationDistance", 10.0); m_child_reprioritization_distance = interest_management_config.GetDouble("ChildReprioritizationDistance", 20.0); } m_log.Info("[SCENE]: Using the " + m_update_prioritization_scheme + " prioritization scheme"); #region BinaryStats try { IConfig statConfig = m_config.Configs["Statistics.Binary"]; if (statConfig.Contains("enabled") && statConfig.GetBoolean("enabled")) { if (statConfig.Contains("collect_region_stats")) { if (statConfig.GetBoolean("collect_region_stats")) { // if enabled, add us to the event. If not enabled, I won't get called StatsReporter.OnSendStatsResult += LogSimStats; } } if (statConfig.Contains("region_stats_period_seconds")) { m_statLogPeriod = TimeSpan.FromSeconds(statConfig.GetInt("region_stats_period_seconds")); } if (statConfig.Contains("stats_dir")) { m_statsDir = statConfig.GetString("stats_dir"); } } } catch { // if it doesn't work, we don't collect anything } #endregion BinaryStats } catch { m_log.Warn("[SCENE]: Failed to load StartupConfig"); } }