Minor Balancing Fixes

This commit is contained in:
Jan Grießhaber
2024-10-24 17:15:51 +02:00
parent 1bb56adceb
commit b6576b2d3b
2 changed files with 23 additions and 6 deletions

View File

@@ -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;
}
}

View File

@@ -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<Model>("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);
}