/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // Set mouse visible IsMouseVisible = true; // Set the window title Window.Title = "Project Aona Test"; // Spritebatch _spriteBatch = new SpriteBatch(GraphicsDevice); // Initialize the configurations EngineConfig config = new EngineConfig(); // Create the engine _engine = new Engine.Core.Engine(this, config, _spriteBatch); // Start the screen manager GraphicsManager = new GraphicsManager(_graphicsDeviceManager, this); // Add the engine listener _engine.EngineStart += OnEngineStart; // Start the engine _engine.Run(); IsFixedTimeStep = false; // TODO: Remove? base.Initialize(); }
public Form1() { InitializeComponent(); Engine.Core.Engine engine = new Engine.Core.Engine(); Engine.Core.Scoring.StartEngine(engine); MouseDown += Form1_MouseDown1; Location = new Point(0, 0); TestTimer.Start(); }
public void Init() { _game = new GameClient(); this._config = new EngineConfig(); if(Engine.Core.Engine.Instance!=null) // if there exists already an engine instance, dispose it first. Engine.Core.Engine.Instance.Dispose(); this._engine = new Engine.Core.Engine(this._game, this._config); this._chunkStorage = new ChunkStorage(_game); this._chunk = new Chunk(new Vector2Int(0, 0)); }
static async Task Main(string[] args) { Console.WriteLine("Dynamix GNU debugging console v1.0"); Engine.Core.Engine engine = new Engine.Core.Engine(); Engine.Core.Scoring.StartEngine(engine); while (true) { await Task.Delay(10000); Console.WriteLine(DateTime.Now.ToShortTimeString() + ": i am still alive..."); } }
public void Init() { _game = new GameClient(); this._config = new EngineConfig(); if (Engine.Core.Engine.Instance != null) // if there exists already an engine instance, dispose it first. { Engine.Core.Engine.Instance.Dispose(); } this._engine = new Engine.Core.Engine(this._game, this._config); this._chunkStorage = new ChunkStorage(_game); this._chunk = new Chunk(new Vector2Int(0, 0)); }
public void Init() { _game = new GameClient(); this._config = new EngineConfig(); this._engine = new Engine.Core.Engine(this._game, this._config); var cacheWidthInBlocks = ((_config.Cache.CacheRange * 2) + 1) * _config.Chunk.WidthInBlocks; var cacheLenghtInBlocks = ((_config.Cache.CacheRange * 2) + 1) * _config.Chunk.LengthInBlocks; this._cacheXStartIndex = -cacheWidthInBlocks / 2; this._cacheXEndIndex = cacheWidthInBlocks / 2; this._cacheZStartIndex = -cacheLenghtInBlocks / 2; this._cacheZEndIndex = cacheLenghtInBlocks / 2; this._directlyIndexedValidationDictionary = new Dictionary <int, BlockType>(); // set the initial values. for (var x = this._cacheXStartIndex; x < this._cacheXEndIndex; x++) { for (var z = this._cacheZStartIndex; z < this._cacheZEndIndex; z++) { var offset = BlockStorage.BlockIndexByWorldPosition(x, z); for (var y = 0; y < _config.Chunk.HeightInBlocks; y++) { var index = offset + y; var block = new Block().RandomizeType(); this._directlyIndexedValidationDictionary.Add(index, block.Type); BlockStorage.Blocks[index] = block; } } } // check if validationDictionaries item count is equal to CacheRange's volume. Assert.AreEqual(this._directlyIndexedValidationDictionary.Values.Count, _config.Cache.CacheRangeVolume); }
public void Init() { _game = new GameClient(); this._config = new EngineConfig(); this._engine = new Engine.Core.Engine(this._game, this._config); var cacheWidthInBlocks = ((_config.Cache.CacheRange * 2) + 1) * _config.Chunk.WidthInBlocks; var cacheLenghtInBlocks = ((_config.Cache.CacheRange*2) + 1) * _config.Chunk.LengthInBlocks; this._cacheXStartIndex = -cacheWidthInBlocks/2; this._cacheXEndIndex = cacheWidthInBlocks / 2; this._cacheZStartIndex = -cacheLenghtInBlocks / 2; this._cacheZEndIndex = cacheLenghtInBlocks / 2; this._directlyIndexedValidationDictionary = new Dictionary<int, BlockType>(); // set the initial values. for (var x = this._cacheXStartIndex; x < this._cacheXEndIndex; x++) { for (var z = this._cacheZStartIndex; z < this._cacheZEndIndex; z++) { var offset = BlockStorage.BlockIndexByWorldPosition(x, z); for (var y = 0; y < _config.Chunk.HeightInBlocks; y++) { var index = offset + y; var block = new Block().RandomizeType(); this._directlyIndexedValidationDictionary.Add(index, block.Type); BlockStorage.Blocks[index] = block; } } } // check if validationDictionaries item count is equal to CacheRange's volume. Assert.AreEqual(this._directlyIndexedValidationDictionary.Values.Count, _config.Cache.CacheRangeVolume); }
static void Main(string[] args) { Engine.Core.Engine engine = new Engine.Core.Engine(); engine.Run(); }
/// <summary> /// Initializes the game. /// </summary> protected override void Initialize() { Logger.Trace("init()"); // log the init. this.Window.Title = string.Format("Voxeliq [{0}/{1}]", PlatformManager.GameFramework, PlatformManager.GraphicsApi); // set the window title. this.IsMouseVisible = false; // read settings. var audioSettings = new AudioSettings(); var graphicsSettings = new GraphicsSettings(); // create a new engine configuration. var config = new EngineConfig { Chunk = { WidthInBlocks = 16, HeightInBlocks = 128, LengthInBlocks = 16, }, Cache = { CacheExtraChunks = true, ViewRange = 12, CacheRange = 16, }, Graphics = { Width = graphicsSettings.Width, Height = graphicsSettings.Height, FullScreenEnabled = graphicsSettings.FullScreenEnabled, VerticalSyncEnabled = graphicsSettings.VerticalSyncEnabled, FixedTimeStepsEnabled = graphicsSettings.FixedTimeStepsEnabled, }, World = { IsInfinitive = true, }, Debugging = { GraphsEnabled = true, }, Bloom = { Enabled = false, State = BloomState.Saturated, }, Audio = { Enabled = audioSettings.Enabled, } }; var engine = new Engine.Core.Engine(this, config); this.ScreenManager = new GraphicsManager(this._graphicsDeviceManager, this); // start the screen manager. engine.EngineStart += OnEngineStart; engine.Run(); base.Initialize(); }
public void TestDefaultValidConfig() { var game = new GameClient(); var config = new EngineConfig(); var engine = new Engine.Core.Engine(game, config); Assert.IsTrue(config.Validate()); // expect config validation to succeed. Assert.IsNotNull(config.Chunk); // chunk configuration should exist. Assert.IsNotNull(config.Cache); // cache configuratio should exists. #region validate chunk configuration // make sure default dimensions are valid. Assert.Greater(config.Chunk.WidthInBlocks, 0); Assert.Greater(config.Chunk.HeightInBlocks, 0); Assert.Greater(config.Chunk.LengthInBlocks, 0); // calculate expected chunk volume in blocks var expectedChunkVolumeInBlocks = config.Chunk.WidthInBlocks* config.Chunk.HeightInBlocks* config.Chunk.LengthInBlocks; Assert.AreEqual(config.Chunk.Volume, expectedChunkVolumeInBlocks); // make sure max-width-index is valid. Assert.AreEqual(config.Chunk.MaxWidthInBlocks, config.Chunk.WidthInBlocks - 1); // make sure max-height-index is valid. Assert.AreEqual(config.Chunk.MaxHeightInBlocks, config.Chunk.HeightInBlocks - 1); // make sure max-lenght-index is valid. Assert.AreEqual(config.Chunk.MaxLengthInBlocks, config.Chunk.LengthInBlocks - 1); #endregion #region validate cache configuration // make sure default dimensions are valid. Assert.Greater(config.Cache.ViewRange, 0); Assert.Greater(config.Cache.CacheRange, 0); // make sure cache-dimension in blocks are calculated correctly. var expectedCacheWidthInBlocks = (config.Cache.CacheRange * 2 + 1) * config.Chunk.WidthInBlocks; var expectedCacheHeightInBlocks = config.Chunk.HeightInBlocks; var expectedCacheLenghtInBlocks = (config.Cache.CacheRange * 2 + 1) * config.Chunk.LengthInBlocks; Assert.AreEqual(config.Cache.CacheRangeWidthInBlocks, expectedCacheWidthInBlocks); Assert.AreEqual(config.Cache.CacheRangeHeightInBlocks, expectedCacheHeightInBlocks); Assert.AreEqual(config.Cache.CacheRangeLenghtInBlocks, expectedCacheLenghtInBlocks); // if by default, cache-extra-chunks option is set to true, make sure that default cache-range > default view-range. if (config.Cache.CacheExtraChunks) Assert.Greater(config.Cache.CacheRange, config.Cache.ViewRange, "Cache range must be greater view range when CacheExtraChunk option is set to true."); else // if by default, cache-extra-chunks option is set to false, make sure that default cache-range = default view-range. Assert.AreEqual(config.Cache.ViewRange, config.Cache.CacheRange, "Cache range can not be different than view range when CacheExtraChunk option is set to false."); #endregion }
public void TestDefaultValidConfig() { var game = new GameClient(); var config = new EngineConfig(); var engine = new Engine.Core.Engine(game, config); Assert.IsTrue(config.Validate()); // expect config validation to succeed. Assert.IsNotNull(config.Chunk); // chunk configuration should exist. Assert.IsNotNull(config.Cache); // cache configuratio should exists. #region validate chunk configuration // make sure default dimensions are valid. Assert.Greater(config.Chunk.WidthInBlocks, 0); Assert.Greater(config.Chunk.HeightInBlocks, 0); Assert.Greater(config.Chunk.LengthInBlocks, 0); // calculate expected chunk volume in blocks var expectedChunkVolumeInBlocks = config.Chunk.WidthInBlocks * config.Chunk.HeightInBlocks * config.Chunk.LengthInBlocks; Assert.AreEqual(config.Chunk.Volume, expectedChunkVolumeInBlocks); // make sure max-width-index is valid. Assert.AreEqual(config.Chunk.MaxWidthInBlocks, config.Chunk.WidthInBlocks - 1); // make sure max-height-index is valid. Assert.AreEqual(config.Chunk.MaxHeightInBlocks, config.Chunk.HeightInBlocks - 1); // make sure max-lenght-index is valid. Assert.AreEqual(config.Chunk.MaxLengthInBlocks, config.Chunk.LengthInBlocks - 1); #endregion #region validate cache configuration // make sure default dimensions are valid. Assert.Greater(config.Cache.ViewRange, 0); Assert.Greater(config.Cache.CacheRange, 0); // make sure cache-dimension in blocks are calculated correctly. var expectedCacheWidthInBlocks = (config.Cache.CacheRange * 2 + 1) * config.Chunk.WidthInBlocks; var expectedCacheHeightInBlocks = config.Chunk.HeightInBlocks; var expectedCacheLenghtInBlocks = (config.Cache.CacheRange * 2 + 1) * config.Chunk.LengthInBlocks; Assert.AreEqual(config.Cache.CacheRangeWidthInBlocks, expectedCacheWidthInBlocks); Assert.AreEqual(config.Cache.CacheRangeHeightInBlocks, expectedCacheHeightInBlocks); Assert.AreEqual(config.Cache.CacheRangeLenghtInBlocks, expectedCacheLenghtInBlocks); // if by default, cache-extra-chunks option is set to true, make sure that default cache-range > default view-range. if (config.Cache.CacheExtraChunks) { Assert.Greater(config.Cache.CacheRange, config.Cache.ViewRange, "Cache range must be greater view range when CacheExtraChunk option is set to true."); } else // if by default, cache-extra-chunks option is set to false, make sure that default cache-range = default view-range. { Assert.AreEqual(config.Cache.ViewRange, config.Cache.CacheRange, "Cache range can not be different than view range when CacheExtraChunk option is set to false."); } #endregion }