From 83f51a6892629921b4cc482b986656a0a5cc5f6a Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 3 May 2018 14:41:01 -0400 Subject: Added simple AI implementation The new AutomatingSystem and AutomatableComponent are responsible for simple AI tasks. This currently is limited to moving entities at a certain speed for certain periods of time. These tasks are arranged as a set of behaviors, which are picked randomly when automation starts or when a behavior finishes executing. A behavior is a sequence of actions that run one after another. Currently, if an automated entity is blocked from moving by a collision, it will be coerced out of its intended path. This is because the automation parameters are stored as a speed and a duration, rather than a starting location and an ending location. This may end up being changed, or made configurable, as this is an early implementation of this feature and will need to be more complex later. Added an RNG object to the Game class, so that the AutomatingSystem can pick behaviors at random. --- src/game.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/game.h') diff --git a/src/game.h b/src/game.h index 92a67d9..dc256c6 100644 --- a/src/game.h +++ b/src/game.h @@ -1,6 +1,7 @@ #ifndef GAME_H_1014DDC9 #define GAME_H_1014DDC9 +#include #include "entity_manager.h" #include "system_manager.h" #include "renderer/renderer.h" @@ -8,10 +9,15 @@ class Game { public: - Game(); + Game(std::mt19937& rng); void execute(); + inline std::mt19937& getRng() + { + return rng_; + } + inline Renderer& getRenderer() { return renderer_; @@ -36,6 +42,7 @@ public: private: + std::mt19937 rng_; Renderer renderer_; EntityManager entityManager_; SystemManager systemManager_; -- cgit 1.4.1