Deep RTS
Config.h
Go to the documentation of this file.
1//
2// Created by per on 12.02.18.
3//
4
5#pragma once
6#include <spdlog/spdlog.h>
7
8class Config {
9private:
10
11 float _boundLimits(float v, float min, float max){
12 if(v > max){
13 v = max;
14 SPDLOG_WARN("Yield modifier can not be above 10.0");
15 }else if(v < min){
16 v = min;
17 SPDLOG_WARN("Yield modifier can not be below 10.0");
18 }
19 return v;
20 }
21
22public:
23
24
25 int tickModifier = 10;
26 bool instantTownHall = true;
27 bool instantBuilding = true;
28 bool harvestForever = false;
29 bool autoAttack = true;
30 int foodLimit = 100;
31 bool farmEnabled = true;
32 bool barracksEnabled = true;
33 bool footmanEnabled = true;
34 bool archerEnabled = false;
35 bool pompd = false;
36 std::string gui = "Blend2DGui"; // No need to export because it is used to initiate gui on C++ side only
37 int startGold = 0;
38 int startStone = 0;
39 int startLumber = 0;
40 int startFood = 1;
41 int terminalSignal = true;
42 float yieldModifierGold = 1.0;
43 float yieldModifierStone = 1.0;
45 bool animationEnabled = true; // ~10% perf decay.
46
49
50 void setAnimationEnabled(bool v){
52 }
53
54 void setGUI(const std::string& b){
55 gui = b;
56 }
57
58 void setYieldModifierGold(float mod){
59 yieldModifierGold = _boundLimits(mod, 0.0, 10.0);
60 }
61
62 void setYieldModifierStone(float mod){
63 yieldModifierStone = _boundLimits(mod, 0.0, 10.0);
64 }
65
66 void setYieldModifierLumber(float mod){
67 yieldModifierLumber = _boundLimits(mod, 0.0, 10.0);
68 }
69
72 }
73
74 void setPOMDP(bool b){
75 pompd = b;
76 }
77
78 void setTickModifier(int tickmodifier){
79 tickModifier = tickmodifier;
80 }
81
82 void setInstantTownHall(bool b){
84 }
85
86 void setInstantBuilding(bool b){
88 }
89
90 void setHarvestForever(bool b){
92 }
93
94 void setAutoAttack(bool b){
95 autoAttack = b;
96 }
97
98 void setFoodLimit(int b){
99 foodLimit = b;
100 }
101
102 void setFarm(bool b){
103 farmEnabled = b;
104 }
105
106 void setBarracks(bool b){
107 barracksEnabled = b;
108 }
109
110 void setFootman(bool b){
111 footmanEnabled = b;
112 }
113
114 void setArcher(bool b){
115 archerEnabled = b;
116 }
117
118 void setStartGold(int v) {
119 startGold = v;
120 }
121
122 void setStartFood(int v) {
123 startFood = v;
124 }
125
126 void setStartStone(int v){
127 startStone = v;
128 }
129
130 void setStartLumber(int v){
131 startLumber = v;
132 }
133
134 void setTerminalSignal(bool b){
135 terminalSignal = b;
136 }
137
138 static Config defaults(){
139 Config config;
140 config.setTickModifier(10);
141 config.setInstantTownHall(false);
142 config.setInstantBuilding(true);
143 config.setHarvestForever(true);
144 config.setAutoAttack(true);
145 config.setFoodLimit(100);
146 config.setFarm(true);
147 config.setBarracks(false);
148 config.setFootman(true);
149 config.setArcher(false);
150 config.setConsoleCaptionEnabled(false);
151 config.setStartGold(1500);
152 config.setStartLumber(750);
153 config.setStartStone(0);
154 config.setTerminalSignal(true);
155 config.setPOMDP(false);
156
157 // Engine only
158 config.setGUI("Blend2DGui");
159 return config;
160 }
161
162
163
164};
Definition: Config.h:8
float yieldModifierStone
Definition: Config.h:43
int startGold
Definition: Config.h:37
bool autoAttack
Definition: Config.h:29
int startLumber
Definition: Config.h:39
void setArcher(bool b)
Definition: Config.h:114
bool instantTownHall
Definition: Config.h:26
void setInstantBuilding(bool b)
Definition: Config.h:86
void setTickModifier(int tickmodifier)
Definition: Config.h:78
float yieldModifierGold
Definition: Config.h:42
void setStartGold(int v)
Definition: Config.h:118
void setYieldModifierGold(float mod)
Definition: Config.h:58
void setFootman(bool b)
Definition: Config.h:110
void setAnimationEnabled(bool v)
Definition: Config.h:50
static Config defaults()
Definition: Config.h:138
void setFoodLimit(int b)
Definition: Config.h:98
void setStartStone(int v)
Definition: Config.h:126
float yieldModifierLumber
Definition: Config.h:44
void setTerminalSignal(bool b)
Definition: Config.h:134
void setPOMDP(bool b)
Definition: Config.h:74
int foodLimit
Definition: Config.h:30
bool footmanEnabled
Definition: Config.h:33
void setYieldModifierLumber(float mod)
Definition: Config.h:66
void setAutoAttack(bool b)
Definition: Config.h:94
int tickModifier
Definition: Config.h:25
int startStone
Definition: Config.h:38
bool barracksEnabled
Definition: Config.h:32
bool harvestForever
Definition: Config.h:28
bool archerEnabled
Definition: Config.h:34
int startFood
Definition: Config.h:40
bool animationEnabled
Definition: Config.h:45
void setYieldModifierStone(float mod)
Definition: Config.h:62
std::string gui
Definition: Config.h:36
int terminalSignal
Definition: Config.h:41
void setConsoleCaptionEnabled(bool b)
Definition: Config.h:70
bool pompd
Definition: Config.h:35
void setInstantTownHall(bool b)
Definition: Config.h:82
void setGUI(const std::string &b)
Definition: Config.h:54
bool farmEnabled
Definition: Config.h:31
void setFarm(bool b)
Definition: Config.h:102
bool consoleCaptionEnabled
Bool that determine print of FPS and UPS in console.
Definition: Config.h:48
void setStartFood(int v)
Definition: Config.h:122
void setHarvestForever(bool b)
Definition: Config.h:90
void setStartLumber(int v)
Definition: Config.h:130
void setBarracks(bool b)
Definition: Config.h:106
bool instantBuilding
Definition: Config.h:27