diff --git a/GameOfLife3D/GameModel/Balancing.cs b/GameOfLife3D/GameModel/Balancing.cs index 8f0c76e..58d9cdf 100644 --- a/GameOfLife3D/GameModel/Balancing.cs +++ b/GameOfLife3D/GameModel/Balancing.cs @@ -9,10 +9,10 @@ namespace GameOfLife3D.GameModel //Max Val is 27 internal static class Balancing { - public static readonly int MIN_ALIVE = 6; - public static readonly int MAX_ALIVE = 11; - public static readonly int CREATE_MIN = 8; - public static readonly int CREATE_MAX = 9; + public static readonly int MIN_ALIVE = 5; + public static readonly int MAX_ALIVE = 9; + public static readonly int CREATE_MIN = 6; + public static readonly int CREATE_MAX = 7; } } diff --git a/GameOfLife3D/GameOfLife.cs b/GameOfLife3D/GameOfLife.cs index fb43920..3ce0a1f 100644 --- a/GameOfLife3D/GameOfLife.cs +++ b/GameOfLife3D/GameOfLife.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using System; +using System.Diagnostics; namespace GameOfLife3D { @@ -13,6 +14,7 @@ namespace GameOfLife3D private GameOfLifeModel _gameOfLife; private bool paused= false; private Model model; + Stopwatch watch = new(); Vector3 CameraTarget, CameraPosition; Matrix ProjectionMatrix, ViewMatrix, WorldMatrix; @@ -33,8 +35,8 @@ namespace GameOfLife3D protected override void Initialize() { // TODO: Add your initialization logic here - _gameOfLife = new(16); - _gameOfLife.Map.SetRandom(2); + _gameOfLife = new(64); + _gameOfLife.Map.SetRandom(8); model = Content.Load("Models/Cube"); CameraTarget = new(0f,0f,0f); @@ -61,6 +63,10 @@ namespace GameOfLife3D protected override void Update(GameTime gameTime) { + + watch.Restart(); + + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); @@ -103,6 +109,11 @@ namespace GameOfLife3D orbit = !orbit; } + if (Keyboard.GetState().IsKeyDown(Keys.R)) + { + _gameOfLife.Map.SetRandom(8); + } + if (orbit) { @@ -132,6 +143,8 @@ namespace GameOfLife3D } } // TODO: Add your update logic here + Debug.WriteLine($"Logic took {watch.ElapsedMilliseconds}ms"); + watch.Stop(); base.Update(gameTime); @@ -139,6 +152,8 @@ namespace GameOfLife3D protected override void Draw(GameTime gameTime) { + watch.Restart(); + GraphicsDevice.Clear(Color.Black); foreach (var cell in _gameOfLife.Map.Cells) { @@ -167,6 +182,8 @@ namespace GameOfLife3D // TODO: Add your drawing code here + Debug.WriteLine($"Drawing took {watch.ElapsedMilliseconds}ms"); + base.Draw(gameTime); }