1 | | This development notepad is an organized way to jot down preliminary API decisions. Nothing is finalized. If it doesn't add up, it WILL change. |
2 | | [[BR]][[BR]] |
3 | | = TODO = |
4 | | Decision Tree Generation[[BR]] |
5 | | Event Handler[[BR]] |
6 | | State Machine[[BR]] |
7 | | |
8 | | = Mediator = |
9 | | Mediators encapsulate how a set of objects interact. We will have a mediator that describes the heirarchy and how the nodes (objects) relate to eachother. A scripter could choose to create his own mediator to change the way the AI "thinks". For example, one could make it so Military interacts directly to Economy and Diplomacy instead of having to go through Commander. The nodes somehow will be responsible for the pieces of the State Machine that pertain to it probably using a chain of responsibility or simply encapsulating it by node which is much more flexible. |
10 | | [[BR]][[BR]] |
11 | | The interaction between nodes will need handlers to Filter Up and Specify Down the various messages it needs to work with.[[BR]] |
12 | | [[BR]]'''Filter Up:'''[[BR]] |
13 | | We will need to create objects that can analyze an array of recieved messages and return a more general state/need. When it does that, it also removes the states/needs it used to make the recognition. |
14 | | [[BR]]'''Specify Down:'''[[BR]] |
15 | | We will also need objects that can intelligently seperate messages into smaller messages. |
16 | | == Commander == |
17 | | The Commander node makes sure everything is up to date and creates the strategies the other nodes must accomplish. |
18 | | == Economy == |
19 | | The Economy node makes sure the economy is running as smoothly as possible and decides on how to manage civilians based on needs. |
20 | | == Diplomacy == |
21 | | The Diplomacy node handles issues that can be categorized as diplomatic and political. The major role of diplomacy is communicating with the AI: Player to AI and AI to AI. The Diplomacy node can send messages to any AI's Commander node. It's the only way to communicate, it should not be possible to directly communicate with other nodes. Player to AI communication could simply be taking notice of all available ways a player can communicate such as signals and chat. The node can then decide what to do with that information. |
22 | | |
23 | | == Military == |
24 | | The Military node develops military tactics to accomplish goals set by the Commander. |
25 | | == Groups == |
26 | | The Groups node is the Flocking logic of the game. |
27 | | |
28 | | == Units == |
29 | | The Units node is the lowlevel logic for units such as attack, walk, garrison, etc. |
30 | | |
31 | | = Decision Trees = |
32 | | == Constraints == |
33 | | == Learning == |
34 | | The AI can be capable of learning by remembering past experiences. Experiences can be outlined using the route chosen in a Decision Tree. The AI could learn as it plays the game by figuring out which past decisions were more favorable to reach a defined goal. |
35 | | |
36 | | = State Machine = |
37 | | == Game == |
38 | | === State === |
39 | | string Game.getMap() |
40 | | |
41 | | Player Game.getPlayers() |
42 | | |
43 | | Resource Game.getStartingResources() |
44 | | |
45 | | int Game.getTime() |
46 | | |
47 | | int Game.getType() |
48 | | |
49 | | int Game.getStartingPhase() |
50 | | |
51 | | int Game.getMapSize() |
52 | | |
53 | | int Game.getBorderTimer() |
54 | | |
55 | | int Game.getMaxCenters() |
56 | | |
57 | | int Game.getVisibility() |
58 | | |
59 | | int Game.getPopCap() |
60 | | |
61 | | int Game.getDifficulty() |
62 | | |
63 | | int Game.getVictoryCondition() |
64 | | |
65 | | bool Game.isOnline() |
66 | | |
67 | | bool Game.hasTeams() |
68 | | |
69 | | bool Game.hasTeamsLocked() |
70 | | |
71 | | bool Game.cheatsEnabled() |
72 | | |
73 | | bool Game.playerInGame(String player) |
74 | | |
75 | | bool Game.playerResigned(String player) |
76 | | |
77 | | int Game.buyingPrice(String resource) |
78 | | |
79 | | int Game.sellingPrice(String resource) |
80 | | |
81 | | === Action === |
82 | | void Game.chatLocalToSelf(String message) |
83 | | |
84 | | void Game.chatToAllies(String message) |
85 | | |
86 | | void Game.chatToNeutrals(String message) |
87 | | |
88 | | void Game.chatToEnemies(String message) |
89 | | |
90 | | void Game.chatToPlayer(String player, String message) |
91 | | |
92 | | void Game.tauntLocalToSelf(int tauntID) |
93 | | |
94 | | void Game.tauntToAllies(String message) |
95 | | |
96 | | void Game.tauntToNeutrals(String message) |
97 | | |
98 | | void Game.tauntToEnemies(String message) |
99 | | |
100 | | void Game.tauntToPlayer(String player, String message) |
101 | | |
102 | | void !EventHandler.acknowledgeEvent(String eventID, String player) |
103 | | |
104 | | void !EventHandler.acknowledgeSignal(String signalID, String player) |
105 | | |
106 | | void !EventHandler.disableTimer(int id) |
107 | | |
108 | | void !EventHandler.enableTimer(int id, int time) |
109 | | |
110 | | == Players == |
111 | | === State === |
112 | | string Player.getCiv() |
113 | | |
114 | | bool Player.receivedResourceFromPlayer(String resource, String player) |
115 | | |
116 | | int Player.resourceAmountReceivedFromPlayer(String resource, String player) |
117 | | |
118 | | int Player.getID() |
119 | | |
120 | | int Player.getScore() |
121 | | |
122 | | int Player.getPhase() |
123 | | |
124 | | int Player.getTimeInAge() |
125 | | |
126 | | int Player.getCurrentPop() |
127 | | |
128 | | int Player.getEconomicPop() |
129 | | |
130 | | int Player.getNonEconomicPop() |
131 | | |
132 | | Resource Player.getResources() |
133 | | |
134 | | array Player.getUnits() |
135 | | |
136 | | array Player.getStructures() |
137 | | |
138 | | bool Player.isDefeated() |
139 | | |
140 | | bool Player.canAffordUnit(Type) |
141 | | |
142 | | bool Player.canAffordBuilding(Type) |
143 | | |
144 | | bool Player.canAffordTech(Type) |
145 | | |
146 | | bool Player.canAffordWall() |
147 | | |
148 | | bool Player.canBuy(Type) |
149 | | |
150 | | bool Player.canSell(Type) |
151 | | |
152 | | bool Player.canResearch(Type) |
153 | | |
154 | | bool Player.canTrain(Type) |
155 | | |
156 | | bool Player.canBuild(Type) |
157 | | |
158 | | int Player.getBuyPrice(Type) |
159 | | |
160 | | int Player.getSellPrice(Type) |
161 | | |
162 | | int Player.numEnemyBuildingsInTown() |
163 | | |
164 | | int Player.numEnemyBuildingsOfTypeInTown(Type t) |
165 | | |
166 | | int Player.wallCompletedPercentage(int perimeter) |
167 | | |
168 | | int Player.wallInvisblePercentage(int perimeter) |
169 | | |
170 | | int Player.stanceToward(String player) |
171 | | |
172 | | === Action === |
173 | | void Player.tribute(Player, int food, int wood, int stone, int ore) |
174 | | |
175 | | void Player.resign() |
176 | | |
177 | | void Player.setStance(Player, int) |
178 | | |
179 | | void Player.research(Type) |
180 | | |
181 | | void Player.buy(Type) |
182 | | |
183 | | void Player.sell(Type) |
184 | | |
185 | | void Player.declareCentralObject(Type t, Array pos) |
186 | | |
187 | | void Player.declarePlayerCentralObject(String player, Type t, Array pos) |
188 | | |
189 | | void Player.build(Type t, int distance) |
190 | | |
191 | | void Player.buildAtPos(Type t, Array pos) |
192 | | |
193 | | void Player.buildForward(Type t, String player, int distance) |
194 | | |
195 | | void Player.buildWall(int distance) |
196 | | |
197 | | void Player.buildWallAroundPlayer(String player, int distance) |
198 | | |
199 | | void Player.train(Type unitType) |
200 | | |
201 | | void Player.trainInBuilding(type unitType, Building b) |
202 | | |
203 | | void Player.acknowledgeTribute(String resource, String player) |
204 | | |
205 | | == Resources == |
206 | | === State === |
207 | | int Resource.getWood() |
208 | | |
209 | | int Resource.getFood() |
210 | | |
211 | | int Resource.getStone() |
212 | | |
213 | | int Resource.getOre() |
214 | | |
215 | | int Resource.getMinDistance() |
216 | | |
217 | | == Structures == |
218 | | === State === |
219 | | array Structure.getWaypoint() |
220 | | |
221 | | int Structure.getPercentConstructed() |
222 | | |
223 | | Unit Structure.getLastAttacker() |
224 | | |
225 | | int Structure.getLastAttacked() |
226 | | |
227 | | bool Structure.isConstructing() |
228 | | |
229 | | bool Structure.isConstructed() |
230 | | |
231 | | bool Structure.isLocked() |
232 | | |
233 | | bool Structure.isQueued() |
234 | | |
235 | | bool Structure.isUnderAttack() |
236 | | |
237 | | === Action === |
238 | | void Structure.setWaypoint(x, y) |
239 | | |
240 | | void Structure.train(Unit) |
241 | | |
242 | | void Structure.cancel(Unit, amount = 1) |
243 | | |
244 | | void Structure.lock() |
245 | | |
246 | | void Structure.unlock() |
247 | | |
248 | | void Structure.delete() |
249 | | |
250 | | == Units == |
251 | | === State === |
252 | | array Unit.getPosition() |
253 | | |
254 | | int Unit.getCurrentHP() |
255 | | |
256 | | int Unit.getMaxHP() |
257 | | |
258 | | int Unit.getCrushArmor() |
259 | | |
260 | | int Unit.getHackArmor() |
261 | | |
262 | | int Unit.getPierceArmor() |
263 | | |
264 | | Type Unit.getType() |
265 | | |
266 | | int Unit.getCurrUP() |
267 | | |
268 | | int Unit.getNextUP() |
269 | | |
270 | | Unit Unit.getLastAttacker() |
271 | | |
272 | | int Unit.getLastAttacked() |
273 | | |
274 | | bool Unit.isBalanced() |
275 | | |
276 | | bool Unit.isAggressive() |
277 | | |
278 | | bool Unit.isDefensive() |
279 | | |
280 | | bool Unit.isDead() |
281 | | |
282 | | bool Unit.isIdle() |
283 | | |
284 | | bool Unit.isRepairing() |
285 | | |
286 | | bool Unit.isConstructing() |
287 | | |
288 | | bool Unit.isPatrolling() |
289 | | |
290 | | bool Unit.isHealing() |
291 | | |
292 | | bool Unit.isEscorting() |
293 | | |
294 | | bool Unit.isAttacking() |
295 | | |
296 | | bool Unit.isGathering() |
297 | | |
298 | | bool Unit.isGatheringWood() |
299 | | |
300 | | bool Unit.isGatheringFood() |
301 | | |
302 | | bool Unit.isGatheringStone() |
303 | | |
304 | | bool Unit.isGatheringOre() |
305 | | |
306 | | bool Unit.isGarrisoned() |
307 | | |
308 | | array Unit.getPosition() |
309 | | |
310 | | int Unit.getCurrentHP() |
311 | | |
312 | | int Unit.getMaxHP() |
313 | | |
314 | | === Action === |
315 | | void Unit.repair(Structure) |
316 | | |
317 | | void Unit.patrol(array, array) |
318 | | |
319 | | void Unit.heal(Unit) |
320 | | |
321 | | void Unit.escort(Unit) |
322 | | |
323 | | void Unit.attack(Unit) |
324 | | |
325 | | void Unit.attackPlayer(Player) |
326 | | |
327 | | void Unit.gather(Type) |
328 | | |
329 | | void Unit.move(x, y) |
330 | | |
331 | | void Unit.garrison(Structure) |
332 | | |
333 | | void Unit.construct(Type, x, y) |
334 | | |
335 | | void Unit.buildWall(array, array) |
336 | | |
337 | | void Unit.delete() |
338 | | |
339 | | == Entity Filters == |