summary refs log tree commit diff stats
path: root/src/game.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-05-03 14:41:01 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-05-03 14:41:01 -0400
commit83f51a6892629921b4cc482b986656a0a5cc5f6a (patch)
tree50dcd4485a165b29591dafbec907c20dcf9284b1 /src/game.h
parentb2311e1ba43a72a205b51a24376a1f363faa569e (diff)
downloadtherapy-83f51a6892629921b4cc482b986656a0a5cc5f6a.tar.gz
therapy-83f51a6892629921b4cc482b986656a0a5cc5f6a.tar.bz2
therapy-83f51a6892629921b4cc482b986656a0a5cc5f6a.zip
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.
Diffstat (limited to 'src/game.h')
-rw-r--r--src/game.h9
1 files changed, 8 insertions, 1 deletions
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 @@
1#ifndef GAME_H_1014DDC9 1#ifndef GAME_H_1014DDC9
2#define GAME_H_1014DDC9 2#define GAME_H_1014DDC9
3 3
4#include <random>
4#include "entity_manager.h" 5#include "entity_manager.h"
5#include "system_manager.h" 6#include "system_manager.h"
6#include "renderer/renderer.h" 7#include "renderer/renderer.h"
@@ -8,10 +9,15 @@
8class Game { 9class Game {
9public: 10public:
10 11
11 Game(); 12 Game(std::mt19937& rng);
12 13
13 void execute(); 14 void execute();
14 15
16 inline std::mt19937& getRng()
17 {
18 return rng_;
19 }
20
15 inline Renderer& getRenderer() 21 inline Renderer& getRenderer()
16 { 22 {
17 return renderer_; 23 return renderer_;
@@ -36,6 +42,7 @@ public:
36 42
37private: 43private:
38 44
45 std::mt19937 rng_;
39 Renderer renderer_; 46 Renderer renderer_;
40 EntityManager entityManager_; 47 EntityManager entityManager_;
41 SystemManager systemManager_; 48 SystemManager systemManager_;