Example #1
0
        //Check if the shuttingDownCan be done safely
        public void ShuttingDownProcess()
        {
            //Check for fullscreen state
            if (IsFullScreen)
            {
                IsFullScreen = false;
                return;
            }

            if (OnShuttingDown != null)
            {
                OnShuttingDown(this, null);
            }

            //Independant Threaded work are still running, waiting them for shutting down.
            if (RunningThreadedWork.Count > 0)
            {
                return;
            }

            ThreadsManager.IsShuttingDown = true;

            if (ThreadsManager.RunningThreads > 0)
            {
                return;
            }

            ThreadsManager.Dispose();

            IsShuttingDownSafe = true;
        }
Example #2
0
        public override void FTSUpdate(GameTime timeSpent)
        {
            _brightness = _worldclock.ClockTime.SmartTimeInterpolation(0.2f);

            if ((Math.Abs(_smallOffset.X) > CloudBlockSize || Math.Abs(_smallOffset.Y) > CloudBlockSize) &&
                (_threadState == null || _threadState.IsCompleted) &&
                _newCloudGenerated == false
                )
            {
                // rebuild the grid in thread
                _threadState = ThreadsManager.RunAsync(FormClouds);
            }

            if (_newCloudGenerated)
            {
                if (Math.Abs((int)(_smallOffset.X / CloudBlockSize)) > 0)
                {
                    _smallOffset.X = _smallOffset.X % CloudBlockSize;
                }

                if (Math.Abs((int)(_smallOffset.Y / CloudBlockSize)) > 0)
                {
                    _smallOffset.Y = _smallOffset.Y % CloudBlockSize;
                }

                _instancedBuffer.SetInstancedData(_d3DEngine.Device.ImmediateContext, _clouds.ToArray());
                _cloudBlocksCount = _clouds.Count;
                _clouds.Clear();
                _newCloudGenerated = false;
            }
        }
Example #3
0
        /// <summary>
        /// All Components used by this GameState should be Added in the GameState here
        /// This will be called in a multithreaded way !
        /// </summary>
        public virtual void Initialize(DeviceContext context)
        {
            //Call the Initialized from each Registered component, if needed !
            //Will be thread dispatched !
            List <Task> _startedTask = new List <Task>();

            GameComponents.ForEach(gc =>
            {
                if (gc.IsInitialized == false)
                {
                    //Start the Initialize()
                    _startedTask.Add(ThreadsManager.RunAsync(gc.Initialize));
                }
            });

            Task.WaitAll(_startedTask.ToArray());

            //Call the LoadContents from each Registered component, if needed !
            //!! Those methods are not Thread Safe !! => cannot thread dispatch them, can only run once at a time in this thread context
            foreach (var gc in GameComponents.Where(x => x.IsDefferedLoadContent))
            {
                if (gc.IsInitialized == false)
                {
                    gc.LoadContent(context);
                    gc.IsInitialized = true;
                }
            }

            IsDirty = false;
        }
Example #4
0
        public static Type GetTypeControl(string alias)
        {
            var targetFramework = ThreadsManager.GetTargetFramework();
            var iterationsCount = targetFramework.SystemContext.GlobalConfiguraionFramework.SearchControlNumberOfRetries;

            while (iterationsCount > 0)
            {
                var result = targetFramework.TryGetTypeControl(alias);

                if (result != null)
                {
                    return(result);
                }

                if (iterationsCount != 1)
                {
                    //todo переделать
                    Thread.Sleep(targetFramework.SystemContext.GlobalConfiguraionFramework.SearchControlTimeBetweenRetries);
                }

                --iterationsCount;
            }
            var strException = $"Control {alias} is not found in active views.\n" +
                               $"Active views:";

            foreach (var activeView in targetFramework.SystemContext.Views.ActiveViews)
            {
                strException += "\n" + activeView.Key;
            }

            throw new Exception(strException);
        }
Example #5
0
        public static T GetView <T>()
        {
            var targetFramework = ThreadsManager.GetTargetFramework();
            var view            = (T)targetFramework.SystemContext.Views.AllViews[typeof(T)];

            return(view);
        }
Example #6
0
        /// <summary>
        /// Parallel decompress
        /// </summary>
        protected void DecompressParallel()
        {
            //Create thread pool
            var tPool = new ThreadsManager(base._totalThreads);

            try
            {
                Thread readThread = new Thread(this.ReadFromFile);
                readThread.Start();
                Thread writeThread = new Thread(this.WriteToFile);
                writeThread.Start();

                for (int i = 0; i < base._totalThreads; i++)
                {
                    tPool.AddThread(DataProcessing);
                }
                tPool.StartThreads();

                tPool.WaitAll();

                IsWorkComplete = true;

                writeThread.Join();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                tPool.Dispose();
            }
        }
Example #7
0
        public void ActivateGameStateAsync(GameState state, bool preservePreviousStates = false)
        {
            logger.Debug("Activating new game state {0}", state.Name);

            //_inActivationProcess filter that only one Activation can be requested at a time !
            //state.IsActivationRequested filter the case where the requested state is already on an Activation process (Cannot request it twice)
            if (_inActivationProcess == false || state.IsActivationRequested == false)
            {
                state.WithPreservePreviousStates = preservePreviousStates;
                _inActivationProcess             = true;
                state.IsActivationRequested      = true;

                state.PreviousGameState = _currentState;

#if DEBUG
                logger.Debug("State requested for activation : {0}", state.Name);
#endif

                //If ALL the components inside the states are already initiazed, switch directly the States
                if (state.GameComponents.Count > 0 && state.IsInitialized)
                {
                    SetCurrentState(state);
                    return;
                }

#if DEBUG
                logger.Debug("State Initialization requested in Async Mode : {0}", state.Name);
#endif
                AsyncStateInitResults.Add(ThreadsManager.RunAsync(() => InitializeComponentsAsync(state)));
            }
            else
            {
                logger.Warn("State : '{0}' requested to be activated while another activation requested is in initialization state, the request is dropped", state.Name);
            }
        }
Example #8
0
 public void RefreshWorldListAsync()
 {
     _savedGameList.Items.Clear();
     _savedGameList.SelectItem(-1);
     _savedGameList.Items.Add("Loading...");
     NeedShowResults = false;
     ThreadsManager.RunAsync(RefreshWorldList);
 }
Example #9
0
        public void PrepareStateAsync(GameState state)
        {
#if DEBUG
            logger.Debug("State Initialization requested (by Prepare) : {0}", state.Name);
#endif
            state.PreviousGameState = _currentState;
            AsyncStateInitResults.Add(ThreadsManager.RunAsync(() => InitializeComponentsAsync(state), singleConcurrencyRun: true));
        }
 public void ProcessMessageEntityIn(ProtocolMessageEventArgs <EntityInMessage> e)
 {
     //Only take into account static entity
     if (e.Message.Link.IsStatic)
     {
         ThreadsManager.RunAsync(() => AddEntity((IStaticEntity)e.Message.Entity, e.Message.SourceEntityId), singleConcurrencyRun: true);
     }
 }
 public void ProcessMessageEntityOut(ProtocolMessageEventArgs <EntityOutMessage> e)
 {
     // Only take into account static entity
     if (e.Message.Link.IsStatic)
     {
         //The server change modification will be queued inside a single concurrency thread pool. (Only one running at the same time)
         ThreadsManager.RunAsync(() => RemoveEntity(e.Message.Link, e.Message.TakerEntityId), singleConcurrencyRun: true);
     }
 }
Example #12
0
        public static T CreateControl <T>(string alias = "", string xpath = "", string css = "")
        {
            var targetFramework = ThreadsManager.GetTargetFramework();
            var resultControl   = (T)Activator.CreateInstance(typeof(T));

            typeof(T).GetProperty("Alias")?.SetValue(resultControl, alias);
            typeof(T).GetProperty("XPath")?.SetValue(resultControl, xpath);
            typeof(T).GetProperty("Css")?.SetValue(resultControl, css);
            return(resultControl);
        }
Example #13
0
        //The state is enabled, start loading other components in background while the Loading is shown
        public override void OnEnabled(GameState previousState)
        {
            if (PreviousGameState != this)
            {
                ThreadsManager.RunAsync(GameplayInitializeAsync);
            }

            var serverComponent = _ioc.Get <ServerComponent>();

            serverComponent.ConnectionStatusChanged += serverComponent_ConnectionStausChanged;

            base.OnEnabled(previousState);
        }
Example #14
0
        private void LoadMissingModels(WorldConfiguration configuration, VoxelModelManager voxelModelManager)
        {
            ThreadsManager.RunAsync(() => {
                voxelModelManager.Initialize();
                var availableModels = voxelModelManager.Enumerate().Select(m => m.VoxelModel.Name).ToList();
                var neededModels    = configuration.GetUsedModelsNames().Where(m => !availableModels.Contains(m)).ToList();

                foreach (var neededModel in neededModels)
                {
                    voxelModelManager.DownloadModel(neededModel);
                }
            });
        }
Example #15
0
 private void StopButton_Click(object sender, EventArgs e)
 {
     try
     {
         StartButton.Enabled = true;
         StopButton.Enabled  = false;
         ThreadsManager.Stop();
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.ToString(), "Error: Can not stop execution.",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #16
0
        public static void ExportEmptyActiveViews()
        {
            var targetFramework              = ThreadsManager.GetTargetFramework();
            var pathToFileDataExchange       = "DataExchange";
            var nameExchangeFile_ActiveViews = "activeViews.json";

            var listAliasActiveViews = new List <string>();

            string json = JsonConvert.SerializeObject(listAliasActiveViews);

            var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, pathToFileDataExchange);

            Directory.CreateDirectory(path);
            File.WriteAllText(Path.Combine(path, nameExchangeFile_ActiveViews), json);
        }
Example #17
0
        //Init + Start the pump !
        public virtual void Run()
        {
            //Check if the Threading engine has been initialize or not
            ThreadsManager.CheckInit();

            //Call the game Initialize !
            Initialize();

            //Call components Load Content
            LoadContent();

            ResetTimers();

            FixedTimeStepLoop();
        }
Example #18
0
        private void ThreadsManager_Tick(object sender, EventArgs e)
        {
            while (ThreadsNumeric.Value > ExecutionWorkers.Count)
            {
                var worker = new BackgroundWorker();
                worker.DoWork             += ExecutionWorker_DoWork;
                worker.RunWorkerCompleted += ExecutionWorker_RunWorkerCompleted;
                ExecutionWorkers.Add(worker);
            }
            bool enquire_next = false;

            for (int i = 0; i < ExecutionWorkers.Count; i++)
            {
                var worker = ExecutionWorkers[i];
                if (worker.IsBusy)
                {
                    enquire_next = true;
                    continue;
                }
                if (ThreadsNumeric.Value < ExecutionWorkers.Count)
                {
                    ExecutionWorkers.RemoveAt(i--);
                }
                else if (SubmitWork(worker))
                {
                    enquire_next = true;
                }
            }
            if (GraphDirty)
            {
                BuildGraph();
            }

            if (!enquire_next)
            {
                StartButton.Enabled = true;
                StopButton.Enabled  = false;
                ThreadsManager.Stop();
            }
        }
Example #19
0
        private void StartButton_Click(object sender, EventArgs e)
        {
            try
            {
                var configs = Directory.GetFiles(ConfigsTextBox.Text, FilterTextBox.Text, SearchOption.AllDirectories);
                GroupsCount      = configs.Length;
                ExecutionResults = new Dictionary <string, List <PointD>[]>();
                ResultsListBox.Items.Clear();
                ArgumentComboBox.Items.Clear();
                ArgumentComboBox.Items.Add("Input variable");
                ArgumentComboBox.SelectedIndex = 0;
                ExecutionNames   = new string[GroupsCount];
                ExecutionConfigs = new string[GroupsCount];

                for (int i = 0; i < GroupsCount; i++)
                {
                    ExecutionNames[i] = Path.GetFileNameWithoutExtension(configs[i]);
                }
                for (int i = 0; i < GroupsCount; i++)
                {
                    ExecutionConfigs[i] = Path.GetFullPath(configs[i]);
                }
                ExecutionProgress    = LowerNumeric.Value;
                ExecutionLowerBound  = LowerNumeric.Value;
                ExecutionHigherBound = HigherNumeric.Value;
                ExecutionStep        = StepNumeric.Value;
                ExecutablePath       = ExecutableTextBox.Text;

                StartButton.Enabled = false;
                StopButton.Enabled  = true;
                ThreadsManager.Start();
                BuildGraph();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.ToString(), "Error: Can not start execution.",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void ReplaceBlocks(Vector3I[] position, byte[] blockId, BlockTag[] tags, bool isNetworkChange)
        {
            //Single block to change =============================================
            if (blockId.Length == 1)
            {
                ThreadsManager.RunAsync(() => ReplaceBlockThreaded(position[0], blockId[0], isNetworkChange, tags != null ? tags[0] : null), singleConcurrencyRun: true);
                return;
            }

            //Multiple blocks to change =============================================
            Dictionary <VisualChunk, List <TerraCubePositionTag> > blockPerChunk = new Dictionary <VisualChunk, List <TerraCubePositionTag> >();
            List <TerraCubePositionTag> blockList;

            //Multiple block to changes at once
            //Split the various blocks by chunks
            for (int i = 0; i < blockId.Length; i++)
            {
                BlockTag    tag = tags != null ? tags[i] : null;
                VisualChunk impactedChunk;
                if (_worldChunks.GetSafeChunk(position[i].X, position[i].Z, out impactedChunk))
                {
                    if (!blockPerChunk.TryGetValue(impactedChunk, out blockList))
                    {
                        blockList = new List <TerraCubePositionTag>();
                        blockPerChunk[impactedChunk] = blockList;
                    }
                    blockList.Add(new TerraCubePositionTag(position[i], blockId[i], tag));
                }
            }

            //Create a thread for working on the update per chunk !
            foreach (var blocks in blockPerChunk)
            {
                ThreadsManager.RunAsync(() => ReplaceChunkBlocksThreaded(blocks.Key, blocks.Value, isNetworkChange), singleConcurrencyRun: true);
            }
        }
Example #21
0
        //todo переделать
        public static void ExportDefiniteActiveViews()
        {
            var targetFramework = ThreadsManager.GetTargetFramework();

            targetFramework.GetActiveViews();

            var pathToFileDataExchange       = "DataExchange";
            var nameExchangeFile_ActiveViews = "activeViews.json";

            var currentActiveViews   = targetFramework.SystemContext.Views.ActiveViews;
            var listAliasActiveViews = new List <string>();

            foreach (var currentActiveView in currentActiveViews)
            {
                listAliasActiveViews.Add(currentActiveView.Key.Name);
            }

            string json = JsonConvert.SerializeObject(listAliasActiveViews);

            var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, pathToFileDataExchange);

            Directory.CreateDirectory(path);
            File.WriteAllText(Path.Combine(path, nameExchangeFile_ActiveViews), json);
        }
Example #22
0
        /// <summary>
        /// Parallel compressing
        /// </summary>
        protected void CompressParallel()
        {
            //Create pool of threads
            var tPool = new ThreadsManager(base._totalThreads);

            try
            {
                //Thread for reading
                Thread readThread = new Thread(this.ReadFromFile);
                readThread.Start();
                //Thread for writing
                Thread writeThread = new Thread(this.WriteToFile);
                writeThread.Start();

                //Add threads
                for (int i = 0; i < base._totalThreads; i++)
                {
                    tPool.AddThread(DataProcessing);
                }

                //Start threads
                tPool.StartThreads();

                //Waiting
                tPool.WaitAll();

                IsWorkComplete = true;

                //Wait finish write
                writeThread.Join();
            }
            finally
            {
                tPool.Dispose();
            }
        }
        //Multiple blocks replace logic
        public bool ReplaceChunkBlocks(VisualChunk impactedChunk, List <TerraCubePositionTag> blocks, bool isNetworkChanged)
        {
            if (impactedChunk.State != ChunkState.DisplayInSyncWithMeshes && isNetworkChanged)
            {
                return(false);
            }

            Vector2I Min = new Vector2I(int.MaxValue, int.MaxValue);
            Vector2I Max = new Vector2I(int.MinValue, int.MinValue);

            foreach (var block in blocks)
            {
                var existingCube = _cubesHolder.Cubes[_cubesHolder.Index(ref block.Position)];
                var inChunkPos   = BlockHelper.GlobalToInternalChunkPosition(block.Position);

                //Cube not changed - Check Tags
                if (existingCube.Id == block.Cube.Id)
                {
                    var needChunkMeshUpdate = false;
                    var oldTag = impactedChunk.BlockData.GetTag(inChunkPos);
                    if (oldTag != null && oldTag.RequireChunkMeshUpdate)
                    {
                        needChunkMeshUpdate = true;
                    }

                    if (block.Tag != null && block.Tag.RequireChunkMeshUpdate)
                    {
                        needChunkMeshUpdate = true;
                    }

                    if (!needChunkMeshUpdate)
                    {
                        impactedChunk.BlockData.SetTag(block.Tag, inChunkPos);
                        continue;
                    }
                }

                if (Min.X > block.Position.X)
                {
                    Min.X = block.Position.X;
                }
                if (Min.Y > block.Position.Z)
                {
                    Min.Y = block.Position.Z;
                }
                if (Max.X < block.Position.X)
                {
                    Max.X = block.Position.X;
                }
                if (Max.Y < block.Position.Z)
                {
                    Max.Y = block.Position.Z;
                }

                // Change the cube in the big array
                impactedChunk.BlockData.SetBlock(inChunkPos, block.Cube.Id, block.Tag);
            }

            //Compute the Range impacted by the cube change
            var cubeRange = new Range3I
            {
                Position = new Vector3I(Min.X, 0, Min.Y),
                Size     = new Vector3I((Max.X - Min.X) + 1, 0, (Max.Y - Min.Y) + 1)
            };

            impactedChunk.UpdateOrder = 1;
            ThreadsManager.RunAsync(() => CheckImpact(impactedChunk, cubeRange), ThreadsManager.ThreadTaskPriority.High);

            // Save the modified Chunk in local buffer DB
            SendChunkForBuffering(impactedChunk);

            return(true);
        }
Example #24
0
 private void ChangeAllocatedThreads(int newValue)
 {
     ThreadsManager.SetOptimumNbrThread(ClientSettings.Current.Settings.DefaultAllocatedThreads + newValue, true);
 }
Example #25
0
        public static Dictionary <Type, object> GetAllViews()
        {
            var targetFramework = ThreadsManager.GetTargetFramework();

            return(targetFramework.SystemContext.Views.AllViews);
        }
Example #26
0
        public static void DefiniteActiveViews()
        {
            var targetFramework = ThreadsManager.GetTargetFramework();

            targetFramework.GetActiveViews();
        }
Example #27
0
        public static T GetView <T>(string alias)
        {
            var targetFramework = ThreadsManager.GetTargetFramework();

            return((T)targetFramework.SystemContext.Views.AllViews.FirstOrDefault(x => x.Value.Equals(alias)).Value);
        }
        public bool ReplaceBlock(int cubeArrayIndex, ref Vector3I cubeCoordinates, byte replacementCubeId, bool isNetworkChanged, BlockTag blockTag = null)
        {
            VisualChunk impactedChunk = _worldChunks.GetChunk(cubeCoordinates.X, cubeCoordinates.Z);

            if (impactedChunk.State != ChunkState.DisplayInSyncWithMeshes && isNetworkChanged)
            {
                return(false);
            }

            try
            {
                // Check if the cube is not already the same ? ! ?
                var existingCube = _cubesHolder.Cubes[cubeArrayIndex];

                var inChunkPos = BlockHelper.GlobalToInternalChunkPosition(cubeCoordinates);

                if (existingCube.Id == replacementCubeId)
                {
                    // tag change event
                    // some tags changes requires chunk mesh rebuild (LiquidTag), some not (DamageTag)
                    // we will update the mesh only if at least one tag (current or previous) requires mesh update

                    var needChunkMeshUpdate = false;

                    var oldTag = impactedChunk.BlockData.GetTag(inChunkPos);

                    if (oldTag != null && oldTag.RequireChunkMeshUpdate)
                    {
                        needChunkMeshUpdate = true;
                    }

                    if (blockTag != null && blockTag.RequireChunkMeshUpdate)
                    {
                        needChunkMeshUpdate = true;
                    }

                    if (!needChunkMeshUpdate)
                    {
                        impactedChunk.BlockData.SetTag(blockTag, inChunkPos);
                        return(true);
                    }
                }

                // Change the cube in the big array
                impactedChunk.BlockData.SetBlock(inChunkPos, replacementCubeId, blockTag);

                // Start Chunk Visual Impact to decide what needs to be redraw, will be done in async mode,
                // quite heavy, will also restart light computations for the impacted chunk range.
                var cube = new TerraCubeWithPosition(cubeCoordinates, replacementCubeId, _visualWorldParameters.WorldParameters.Configuration.BlockProfiles[replacementCubeId]);

#if PERFTEST
                if (Utopia.Worlds.Chunks.WorldChunks.perf.Actif == false)
                {
                    Utopia.Worlds.Chunks.WorldChunks.perf.Actif         = true;
                    Utopia.Worlds.Chunks.WorldChunks.perf.CollectedData = new List <string>();
                    Utopia.Worlds.Chunks.WorldChunks.perf.AddData("Started New User Action");
                    Utopia.Worlds.Chunks.WorldChunks.perf.sw.Restart();
                }
#endif

                impactedChunk.UpdateOrder = !cube.BlockProfile.IsBlockingLight ? 1 : 2;
                //Compute the Range impacted by the cube change
                var cubeRange = new Range3I
                {
                    Position = new Vector3I(cube.Position.X, 0, cube.Position.Z),
                    Size     = Vector3I.One
                };
                ThreadsManager.RunAsync(() => CheckImpact(impactedChunk, cubeRange), ThreadsManager.ThreadTaskPriority.High);

                // Raise event for sound
                OnBlockReplaced(new LandscapeBlockReplacedEventArgs {
                    IsLocalPLayerAction = !isNetworkChanged,
                    Position            = cubeCoordinates,
                    NewBlockType        = replacementCubeId,
                    PreviousBlock       = existingCube
                });

                return(true);
            }
            finally
            {
                // Save the modified Chunk in local buffer DB
                SendChunkForBuffering(impactedChunk);
            }
        }
Example #29
0
        /// <summary>
        /// Do validation on the settings values
        /// </summary>
        /// <returns></returns>
        private bool ValidateSettings()
        {
            var needSave = false;

            //If file was not present create a new one with the Qwerty Default mapping !
            if (ClientSettings.Current.Settings.KeyboardMapping == null)
            {
                var keyboardType = System.Globalization.CultureInfo.CurrentCulture.KeyboardLayoutId;

                if (keyboardType == 2060 || keyboardType == 1036)
                {
                    ClientSettings.Current.Settings = ClientConfig.DefaultAzerty;
                }
                else
                {
                    ClientSettings.Current.Settings = ClientConfig.DefaultQwerty;
                }
                needSave = true;
            }

            //Set Default Threads - initializing the thread Engine component
            if (ClientSettings.Current.Settings.DefaultAllocatedThreads == 0)
            {
                ClientSettings.Current.Settings.DefaultAllocatedThreads = ThreadsManager.SetOptimumNbrThread(0);
                needSave = true;
            }
            else
            {
                ThreadsManager.SetOptimumNbrThread(ClientSettings.Current.Settings.DefaultAllocatedThreads + ClientSettings.Current.Settings.EngineParameters.AllocatedThreadsModifier, true);
            }

            if (ClientSettings.Current.Settings.GraphicalParameters.StaticEntityViewSize == 0)
            {
                ClientSettings.Current.Settings.GraphicalParameters.StaticEntityViewSize = ClientSettings.Current.Settings.GraphicalParameters.WorldSize - 5;
                needSave = true;
            }

            if (string.IsNullOrEmpty(ClientSettings.Current.Settings.EngineParameters.EffectPack))
            {
                ClientSettings.Current.Settings.EngineParameters.EffectPack = "Default";
            }
            if (string.IsNullOrEmpty(ClientSettings.Current.Settings.GraphicalParameters.TexturePack))
            {
                ClientSettings.Current.Settings.GraphicalParameters.TexturePack = "Default";
            }

            if (ClientSettings.Current.Settings.GraphicalParameters.MSAA == null || ClientSettings.Current.Settings.GraphicalParameters.MSAA.SampleDescription.Count == 0)
            {
                ClientSettings.Current.Settings.GraphicalParameters.MSAA = new SampleDescriptionSetting()
                {
                    SampleDescription = new SharpDX.DXGI.SampleDescription(1, 0)
                };
                needSave = true;
            }

            //Set Default Threads - initializing the thread Engine component
            if (ClientSettings.Current.Settings.GraphicalParameters.LandscapeFog == null)
            {
                ClientSettings.Current.Settings.GraphicalParameters.LandscapeFog = "SkyFog";
            }

            return(needSave);
        }