Merge lp:~widelands-dev/widelands/ai_differentiation into lp:widelands
- ai_differentiation
- Merge into trunk
Proposed by
TiborB
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 8461 | ||||
Proposed branch: | lp:~widelands-dev/widelands/ai_differentiation | ||||
Merge into: | lp:widelands | ||||
Diff against target: |
877 lines (+161/-107) 24 files modified
data/ai/ai_input_1.wai (+9/-9) data/ai/ai_input_2.wai (+11/-11) data/ai/ai_input_3.wai (+14/-14) data/ai/ai_input_4.wai (+12/-12) data/tribes/buildings/productionsites/atlanteans/blackroot_farm/init.lua (+3/-1) data/tribes/buildings/productionsites/atlanteans/farm/init.lua (+3/-1) data/tribes/buildings/productionsites/atlanteans/fishers_house/init.lua (+3/-1) data/tribes/buildings/productionsites/atlanteans/foresters_house/init.lua (+3/-1) data/tribes/buildings/productionsites/atlanteans/sawmill/init.lua (+1/-1) data/tribes/buildings/productionsites/barbarians/farm/init.lua (+3/-1) data/tribes/buildings/productionsites/barbarians/fishers_hut/init.lua (+3/-1) data/tribes/buildings/productionsites/barbarians/hunters_hut/init.lua (+3/-1) data/tribes/buildings/productionsites/barbarians/rangers_hut/init.lua (+3/-1) data/tribes/buildings/productionsites/empire/bakery/init.lua (+3/-1) data/tribes/buildings/productionsites/empire/farm/init.lua (+3/-1) data/tribes/buildings/productionsites/empire/foresters_house/init.lua (+3/-1) data/tribes/buildings/productionsites/empire/sawmill/init.lua (+1/-1) data/tribes/buildings/productionsites/empire/sheepfarm/init.lua (+3/-1) data/tribes/buildings/productionsites/empire/vineyard/init.lua (+4/-1) src/ai/ai_help_structs.cc (+33/-13) src/ai/ai_help_structs.h (+1/-3) src/ai/defaultai.cc (+32/-29) src/ai/defaultai.h (+0/-1) src/ai/defaultai_warfare.cc (+7/-0) |
||||
To merge this branch: | bzr merge lp:~widelands-dev/widelands/ai_differentiation | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
GunChleoc | Approve | ||
Review via email: mp+331085@code.launchpad.net |
Commit message
Description of the change
- Redesigned limitation of buildings count for weaker player (It seems that it was broken)
- New set of WAI files
- Slight change in mutation logic
To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote : | # |
Revision history for this message
GunChleoc (gunchleoc) wrote : | # |
Code LGTM, 1 nit. Not tested.
review:
Approve
Revision history for this message
TiborB (tiborb95) wrote : | # |
typo fixed...
Revision history for this message
GunChleoc (gunchleoc) wrote : | # |
Thanks! :)
@bunnybot merge
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'data/ai/ai_input_1.wai' |
2 | --- data/ai/ai_input_1.wai 2017-09-08 04:37:41 +0000 |
3 | +++ data/ai/ai_input_1.wai 2017-09-21 18:08:00 +0000 |
4 | @@ -1,4 +1,4 @@ |
5 | -# Automatically created by Widelands bzr8437[frisians] (Debug) |
6 | +# Automatically created by Widelands bzr8447[ai_adjust_hints] (Release) |
7 | # See wiki for more info: https://wl.widelands.org/wiki/Ai%20Training/ |
8 | |
9 | [magic_numbers] |
10 | @@ -25,7 +25,7 @@ |
11 | 20="58" |
12 | 21="-28" |
13 | 22="13" |
14 | -23="39" |
15 | +23="59" |
16 | 24="0" |
17 | 25="0" |
18 | 26="45" |
19 | @@ -44,7 +44,7 @@ |
20 | 39="-72" |
21 | 40="51" |
22 | 41="51" |
23 | -42="13" |
24 | +42="49" |
25 | 43="-49" |
26 | 44="73" |
27 | 45="-6" |
28 | @@ -54,7 +54,7 @@ |
29 | 49="-41" |
30 | 50="-3" |
31 | 51="-55" |
32 | -52="62" |
33 | +52="58" |
34 | 53="0" |
35 | 54="57" |
36 | 55="-92" |
37 | @@ -142,7 +142,7 @@ |
38 | 137="-100" |
39 | 138="36" |
40 | 139="-4" |
41 | -140="-28" |
42 | +140="-9" |
43 | 141="15" |
44 | 142="-57" |
45 | 143="-82" |
46 | @@ -321,7 +321,7 @@ |
47 | 0="483200277" |
48 | 1="1310583807" |
49 | 2="1146587310" |
50 | -3="3992184279" |
51 | +3="3992167895" |
52 | 4="2392253055" |
53 | 5="72410151" |
54 | 6="3177317446" |
55 | @@ -334,7 +334,7 @@ |
56 | 13="4031844007" |
57 | 14="466688301" |
58 | 15="1174624614" |
59 | -16="2326435667" |
60 | +16="2326697811" |
61 | 17="2785353768" |
62 | 18="2923165204" |
63 | 19="1657182988" |
64 | @@ -348,7 +348,7 @@ |
65 | 27="3069847931" |
66 | 28="4080809651" |
67 | 29="119008422" |
68 | -30="2921738017" |
69 | +30="2921738081" |
70 | 31="3462444063" |
71 | 32="4152203232" |
72 | 33="2048168826" |
73 | @@ -366,7 +366,7 @@ |
74 | 45="1543642853" |
75 | 46="1267826585" |
76 | 47="2484812109" |
77 | -48="2823884087" |
78 | +48="2832272695" |
79 | 49="3081242716" |
80 | 50="2293521686" |
81 | 51="727162548" |
82 | |
83 | === modified file 'data/ai/ai_input_2.wai' |
84 | --- data/ai/ai_input_2.wai 2017-09-08 04:37:41 +0000 |
85 | +++ data/ai/ai_input_2.wai 2017-09-21 18:08:00 +0000 |
86 | @@ -1,4 +1,4 @@ |
87 | -# Automatically created by Widelands bzr8437[frisians] (Debug) |
88 | +# Automatically created by Widelands bzr8447[ai_adjust_hints] (Release) |
89 | # See wiki for more info: https://wl.widelands.org/wiki/Ai%20Training/ |
90 | |
91 | [magic_numbers] |
92 | @@ -39,12 +39,12 @@ |
93 | 34="-72" |
94 | 35="52" |
95 | 36="-68" |
96 | -37="-31" |
97 | +37="-47" |
98 | 38="17" |
99 | 39="-72" |
100 | 40="51" |
101 | 41="51" |
102 | -42="0" |
103 | +42="-26" |
104 | 43="-49" |
105 | 44="47" |
106 | 45="0" |
107 | @@ -159,7 +159,7 @@ |
108 | 2="0" |
109 | 3="47" |
110 | 4="-93" |
111 | -5="-88" |
112 | +5="63" |
113 | 6="-47" |
114 | 7="86" |
115 | 8="50" |
116 | @@ -182,7 +182,7 @@ |
117 | 25="31" |
118 | 26="47" |
119 | 27="-49" |
120 | -28="79" |
121 | +28="68" |
122 | 29="0" |
123 | 30="0" |
124 | 31="25" |
125 | @@ -221,7 +221,7 @@ |
126 | 64="-14" |
127 | 65="-36" |
128 | 66="0" |
129 | -67="63" |
130 | +67="51" |
131 | 68="0" |
132 | 69="-26" |
133 | 70="48" |
134 | @@ -324,7 +324,7 @@ |
135 | 3="3989038583" |
136 | 4="2392240695" |
137 | 5="609313893" |
138 | -6="3177319494" |
139 | +6="3177319490" |
140 | 7="2470638061" |
141 | 8="1737719069" |
142 | 9="906272344" |
143 | @@ -358,8 +358,8 @@ |
144 | 37="2245976000" |
145 | 38="1096631444" |
146 | 39="3885459710" |
147 | -40="3462144474" |
148 | -41="996514907" |
149 | +40="3457950168" |
150 | +41="996531291" |
151 | 42="2041263380" |
152 | 43="3998980624" |
153 | 44="3482467367" |
154 | @@ -371,10 +371,10 @@ |
155 | 50="2293521678" |
156 | 51="727170724" |
157 | 52="2337924218" |
158 | -53="2822240129" |
159 | +53="2822240001" |
160 | 54="2099269402" |
161 | 55="3081820126" |
162 | 56="1364736179" |
163 | 57="3215255873" |
164 | -58="4220516419" |
165 | +58="3146774595" |
166 | 59="698271105" |
167 | |
168 | === modified file 'data/ai/ai_input_3.wai' |
169 | --- data/ai/ai_input_3.wai 2017-09-08 04:37:41 +0000 |
170 | +++ data/ai/ai_input_3.wai 2017-09-21 18:08:00 +0000 |
171 | @@ -1,4 +1,4 @@ |
172 | -# Automatically created by Widelands bzr8437[frisians] (Debug) |
173 | +# Automatically created by Widelands bzr8447[ai_adjust_hints] (Release) |
174 | # See wiki for more info: https://wl.widelands.org/wiki/Ai%20Training/ |
175 | |
176 | [magic_numbers] |
177 | @@ -20,7 +20,7 @@ |
178 | 15="-2" |
179 | 16="26" |
180 | 17="46" |
181 | -18="-77" |
182 | +18="-46" |
183 | 19="0" |
184 | 20="58" |
185 | 21="-28" |
186 | @@ -44,9 +44,9 @@ |
187 | 39="-72" |
188 | 40="51" |
189 | 41="51" |
190 | -42="49" |
191 | +42="11" |
192 | 43="-49" |
193 | -44="47" |
194 | +44="73" |
195 | 45="-3" |
196 | 46="6" |
197 | 47="3" |
198 | @@ -106,7 +106,7 @@ |
199 | 101="-42" |
200 | 102="31" |
201 | 103="-92" |
202 | -104="-62" |
203 | +104="-83" |
204 | 105="75" |
205 | 106="-35" |
206 | 107="-63" |
207 | @@ -326,8 +326,8 @@ |
208 | 5="72410151" |
209 | 6="3178103874" |
210 | 7="2466439405" |
211 | -8="1670593821" |
212 | -9="906270296" |
213 | +8="1637039389" |
214 | +9="906272344" |
215 | 10="1266807704" |
216 | 11="2811238757" |
217 | 12="1160748840" |
218 | @@ -336,16 +336,16 @@ |
219 | 15="1174624614" |
220 | 16="2326435667" |
221 | 17="2785353768" |
222 | -18="2923165204" |
223 | +18="2923034132" |
224 | 19="1657183084" |
225 | 20="127874232" |
226 | 21="2840446882" |
227 | 22="3269953620" |
228 | 23="2809068809" |
229 | -24="3213948893" |
230 | +24="3197171673" |
231 | 25="350248689" |
232 | 26="403599210" |
233 | -27="4143589755" |
234 | +27="4076480891" |
235 | 28="4078712499" |
236 | 29="119008422" |
237 | 30="2921738017" |
238 | @@ -364,12 +364,12 @@ |
239 | 43="3998980624" |
240 | 44="3381672999" |
241 | 45="1560420069" |
242 | -46="1267826589" |
243 | -47="2484803917" |
244 | +46="1272020893" |
245 | +47="2493192525" |
246 | 48="2832796979" |
247 | 49="3081242716" |
248 | 50="2293521686" |
249 | -51="727162548" |
250 | +51="727162556" |
251 | 52="2405032058" |
252 | 53="2822242065" |
253 | 54="1025593118" |
254 | @@ -377,4 +377,4 @@ |
255 | 56="1096297651" |
256 | 57="3215223873" |
257 | 58="3146774595" |
258 | -59="701417377" |
259 | +59="701482913" |
260 | |
261 | === modified file 'data/ai/ai_input_4.wai' |
262 | --- data/ai/ai_input_4.wai 2017-09-08 04:37:41 +0000 |
263 | +++ data/ai/ai_input_4.wai 2017-09-21 18:08:00 +0000 |
264 | @@ -1,4 +1,4 @@ |
265 | -# Automatically created by Widelands bzr8437[frisians] (Debug) |
266 | +# Automatically created by Widelands bzr8447[ai_adjust_hints] (Release) |
267 | # See wiki for more info: https://wl.widelands.org/wiki/Ai%20Training/ |
268 | |
269 | [magic_numbers] |
270 | @@ -44,7 +44,7 @@ |
271 | 39="-72" |
272 | 40="51" |
273 | 41="51" |
274 | -42="22" |
275 | +42="33" |
276 | 43="-49" |
277 | 44="47" |
278 | 45="-3" |
279 | @@ -193,7 +193,7 @@ |
280 | 36="-60" |
281 | 37="-42" |
282 | 38="-55" |
283 | -39="-34" |
284 | +39="-71" |
285 | 40="-27" |
286 | 41="-73" |
287 | 42="-87" |
288 | @@ -324,21 +324,21 @@ |
289 | 3="3990087127" |
290 | 4="2392236671" |
291 | 5="72410151" |
292 | -6="3178103874" |
293 | +6="3178102850" |
294 | 7="2466439405" |
295 | 8="1670593821" |
296 | -9="906272344" |
297 | +9="907318872" |
298 | 10="1266807704" |
299 | -11="2811238765" |
300 | +11="2811238757" |
301 | 12="1160748840" |
302 | 13="4031844007" |
303 | 14="1540430125" |
304 | -15="1174657382" |
305 | +15="1174624614" |
306 | 16="2326435667" |
307 | 17="2785353768" |
308 | 18="2923165204" |
309 | -19="1657182988" |
310 | -20="127743160" |
311 | +19="1657183076" |
312 | +20="127874232" |
313 | 21="2840446882" |
314 | 22="3269953620" |
315 | 23="2809068809" |
316 | @@ -364,7 +364,7 @@ |
317 | 43="3998980624" |
318 | 44="3381672999" |
319 | 45="1560420069" |
320 | -46="1267826589" |
321 | +46="1269923741" |
322 | 47="2484803917" |
323 | 48="2832796979" |
324 | 49="3081242716" |
325 | @@ -372,9 +372,9 @@ |
326 | 51="727162548" |
327 | 52="2405032058" |
328 | 53="2822242065" |
329 | -54="1026640670" |
330 | +54="1025593118" |
331 | 55="859101088" |
332 | 56="1096297651" |
333 | -57="3214961729" |
334 | +57="3215223873" |
335 | 58="3146774595" |
336 | 59="701417377" |
337 | |
338 | === modified file 'data/tribes/buildings/productionsites/atlanteans/blackroot_farm/init.lua' |
339 | --- data/tribes/buildings/productionsites/atlanteans/blackroot_farm/init.lua 2017-09-03 07:59:51 +0000 |
340 | +++ data/tribes/buildings/productionsites/atlanteans/blackroot_farm/init.lua 2017-09-21 18:08:00 +0000 |
341 | @@ -29,7 +29,9 @@ |
342 | |
343 | aihints = { |
344 | prohibited_till = 550, |
345 | - space_consumer = true |
346 | + space_consumer = true, |
347 | + very_weak_ai_limit = 1, |
348 | + weak_ai_limit = 2 |
349 | }, |
350 | |
351 | working_positions = { |
352 | |
353 | === modified file 'data/tribes/buildings/productionsites/atlanteans/farm/init.lua' |
354 | --- data/tribes/buildings/productionsites/atlanteans/farm/init.lua 2017-09-03 07:59:51 +0000 |
355 | +++ data/tribes/buildings/productionsites/atlanteans/farm/init.lua 2017-09-21 18:08:00 +0000 |
356 | @@ -33,7 +33,9 @@ |
357 | basic_amount = 1, |
358 | -- Farm needs spidercloth to be built and spidercloth needs corn for production |
359 | -- -> farm should be built ASAP! |
360 | - prohibited_till = 250 |
361 | + prohibited_till = 250, |
362 | + very_weak_ai_limit = 1, |
363 | + weak_ai_limit = 3 |
364 | }, |
365 | |
366 | working_positions = { |
367 | |
368 | === modified file 'data/tribes/buildings/productionsites/atlanteans/fishers_house/init.lua' |
369 | --- data/tribes/buildings/productionsites/atlanteans/fishers_house/init.lua 2017-09-03 07:59:51 +0000 |
370 | +++ data/tribes/buildings/productionsites/atlanteans/fishers_house/init.lua 2017-09-21 18:08:00 +0000 |
371 | @@ -27,7 +27,9 @@ |
372 | aihints = { |
373 | needs_water = true, |
374 | basic_amount = 1, |
375 | - prohibited_till = 540 |
376 | + prohibited_till = 540, |
377 | + very_weak_ai_limit = 2, |
378 | + weak_ai_limit = 4 |
379 | }, |
380 | |
381 | working_positions = { |
382 | |
383 | === modified file 'data/tribes/buildings/productionsites/atlanteans/foresters_house/init.lua' |
384 | --- data/tribes/buildings/productionsites/atlanteans/foresters_house/init.lua 2017-09-03 07:59:51 +0000 |
385 | +++ data/tribes/buildings/productionsites/atlanteans/foresters_house/init.lua 2017-09-21 18:08:00 +0000 |
386 | @@ -28,7 +28,9 @@ |
387 | |
388 | aihints = { |
389 | space_consumer = true, |
390 | - supports_production_of = { "log" } |
391 | + supports_production_of = { "log" }, |
392 | + very_weak_ai_limit = 2, |
393 | + weak_ai_limit = 4 |
394 | }, |
395 | |
396 | working_positions = { |
397 | |
398 | === modified file 'data/tribes/buildings/productionsites/atlanteans/sawmill/init.lua' |
399 | --- data/tribes/buildings/productionsites/atlanteans/sawmill/init.lua 2017-09-03 07:59:51 +0000 |
400 | +++ data/tribes/buildings/productionsites/atlanteans/sawmill/init.lua 2017-09-21 18:08:00 +0000 |
401 | @@ -32,7 +32,7 @@ |
402 | |
403 | aihints = { |
404 | basic_amount = 2, |
405 | - very_weak_ai_limit = 1, |
406 | + very_weak_ai_limit = 2, |
407 | weak_ai_limit = 2 |
408 | }, |
409 | |
410 | |
411 | === modified file 'data/tribes/buildings/productionsites/barbarians/farm/init.lua' |
412 | --- data/tribes/buildings/productionsites/barbarians/farm/init.lua 2017-09-03 07:59:51 +0000 |
413 | +++ data/tribes/buildings/productionsites/barbarians/farm/init.lua 2017-09-21 18:08:00 +0000 |
414 | @@ -41,7 +41,9 @@ |
415 | |
416 | aihints = { |
417 | space_consumer = true, |
418 | - prohibited_till = 400 |
419 | + prohibited_till = 400, |
420 | + very_weak_ai_limit = 1, |
421 | + weak_ai_limit = 3 |
422 | }, |
423 | |
424 | working_positions = { |
425 | |
426 | === modified file 'data/tribes/buildings/productionsites/barbarians/fishers_hut/init.lua' |
427 | --- data/tribes/buildings/productionsites/barbarians/fishers_hut/init.lua 2017-09-03 07:59:51 +0000 |
428 | +++ data/tribes/buildings/productionsites/barbarians/fishers_hut/init.lua 2017-09-21 18:08:00 +0000 |
429 | @@ -33,7 +33,9 @@ |
430 | |
431 | aihints = { |
432 | needs_water = true, |
433 | - prohibited_till = 490 |
434 | + prohibited_till = 490, |
435 | + very_weak_ai_limit = 1, |
436 | + weak_ai_limit = 3 |
437 | }, |
438 | |
439 | working_positions = { |
440 | |
441 | === modified file 'data/tribes/buildings/productionsites/barbarians/hunters_hut/init.lua' |
442 | --- data/tribes/buildings/productionsites/barbarians/hunters_hut/init.lua 2017-09-03 07:59:51 +0000 |
443 | +++ data/tribes/buildings/productionsites/barbarians/hunters_hut/init.lua 2017-09-21 18:08:00 +0000 |
444 | @@ -35,7 +35,9 @@ |
445 | |
446 | aihints = { |
447 | prohibited_till = 480, |
448 | - basic_amount = 1 |
449 | + basic_amount = 1, |
450 | + very_weak_ai_limit = 1, |
451 | + weak_ai_limit = 2 |
452 | }, |
453 | |
454 | working_positions = { |
455 | |
456 | === modified file 'data/tribes/buildings/productionsites/barbarians/rangers_hut/init.lua' |
457 | --- data/tribes/buildings/productionsites/barbarians/rangers_hut/init.lua 2017-08-25 19:17:15 +0000 |
458 | +++ data/tribes/buildings/productionsites/barbarians/rangers_hut/init.lua 2017-09-21 18:08:00 +0000 |
459 | @@ -34,7 +34,9 @@ |
460 | aihints = { |
461 | supports_production_of = { "log" }, |
462 | space_consumer = true, |
463 | - basic_amount = 1 |
464 | + basic_amount = 1, |
465 | + very_weak_ai_limit = 3, |
466 | + weak_ai_limit = 5 |
467 | }, |
468 | |
469 | working_positions = { |
470 | |
471 | === modified file 'data/tribes/buildings/productionsites/empire/bakery/init.lua' |
472 | --- data/tribes/buildings/productionsites/empire/bakery/init.lua 2017-09-03 07:59:51 +0000 |
473 | +++ data/tribes/buildings/productionsites/empire/bakery/init.lua 2017-09-21 18:08:00 +0000 |
474 | @@ -37,7 +37,9 @@ |
475 | |
476 | aihints = { |
477 | prohibited_till = 550, |
478 | - basic_amount = 1 |
479 | + basic_amount = 1, |
480 | + very_weak_ai_limit = 1, |
481 | + weak_ai_limit = 2 |
482 | }, |
483 | |
484 | working_positions = { |
485 | |
486 | === modified file 'data/tribes/buildings/productionsites/empire/farm/init.lua' |
487 | --- data/tribes/buildings/productionsites/empire/farm/init.lua 2017-09-03 07:59:51 +0000 |
488 | +++ data/tribes/buildings/productionsites/empire/farm/init.lua 2017-09-21 18:08:00 +0000 |
489 | @@ -32,7 +32,9 @@ |
490 | aihints = { |
491 | basic_amount = 1, |
492 | space_consumer = true, |
493 | - prohibited_till = 510 |
494 | + prohibited_till = 510, |
495 | + very_weak_ai_limit = 1, |
496 | + weak_ai_limit = 3 |
497 | }, |
498 | |
499 | working_positions = { |
500 | |
501 | === modified file 'data/tribes/buildings/productionsites/empire/foresters_house/init.lua' |
502 | --- data/tribes/buildings/productionsites/empire/foresters_house/init.lua 2017-09-03 07:59:51 +0000 |
503 | +++ data/tribes/buildings/productionsites/empire/foresters_house/init.lua 2017-09-21 18:08:00 +0000 |
504 | @@ -28,7 +28,9 @@ |
505 | |
506 | aihints = { |
507 | space_consumer = true, |
508 | - supports_production_of = { "log" } |
509 | + supports_production_of = { "log" }, |
510 | + very_weak_ai_limit = 2, |
511 | + weak_ai_limit = 4 |
512 | }, |
513 | |
514 | working_positions = { |
515 | |
516 | === modified file 'data/tribes/buildings/productionsites/empire/sawmill/init.lua' |
517 | --- data/tribes/buildings/productionsites/empire/sawmill/init.lua 2017-09-03 07:59:51 +0000 |
518 | +++ data/tribes/buildings/productionsites/empire/sawmill/init.lua 2017-09-21 18:08:00 +0000 |
519 | @@ -32,7 +32,7 @@ |
520 | |
521 | aihints = { |
522 | basic_amount = 2, |
523 | - very_weak_ai_limit = 1, |
524 | + very_weak_ai_limit = 2, |
525 | weak_ai_limit = 2 |
526 | }, |
527 | |
528 | |
529 | === modified file 'data/tribes/buildings/productionsites/empire/sheepfarm/init.lua' |
530 | --- data/tribes/buildings/productionsites/empire/sheepfarm/init.lua 2017-09-03 07:59:51 +0000 |
531 | +++ data/tribes/buildings/productionsites/empire/sheepfarm/init.lua 2017-09-21 18:08:00 +0000 |
532 | @@ -31,7 +31,9 @@ |
533 | }, |
534 | |
535 | aihints = { |
536 | - prohibited_till = 380 |
537 | + prohibited_till = 380, |
538 | + very_weak_ai_limit = 1, |
539 | + weak_ai_limit = 3 |
540 | }, |
541 | |
542 | working_positions = { |
543 | |
544 | === modified file 'data/tribes/buildings/productionsites/empire/vineyard/init.lua' |
545 | --- data/tribes/buildings/productionsites/empire/vineyard/init.lua 2017-09-03 07:59:51 +0000 |
546 | +++ data/tribes/buildings/productionsites/empire/vineyard/init.lua 2017-09-21 18:08:00 +0000 |
547 | @@ -30,7 +30,10 @@ |
548 | aihints = { |
549 | space_consumer = true, |
550 | basic_amount = 1, |
551 | - prohibited_till = 490 |
552 | + prohibited_till = 490, |
553 | + very_weak_ai_limit = 1, |
554 | + weak_ai_limit = 3 |
555 | + |
556 | }, |
557 | |
558 | working_positions = { |
559 | |
560 | === modified file 'src/ai/ai_help_structs.cc' |
561 | --- src/ai/ai_help_structs.cc 2017-08-30 12:06:20 +0000 |
562 | +++ src/ai/ai_help_structs.cc 2017-09-21 18:08:00 +0000 |
563 | @@ -603,8 +603,16 @@ |
564 | // Mutating, but all done on persistent data |
565 | void ManagementData::mutate(const uint8_t pn) { |
566 | |
567 | + // Below numbers are used to dictate intensity of mutation |
568 | + // Probability that a value will be mutated = 1 / probability |
569 | + // (lesser number means higher probability and higher mutation) |
570 | int16_t probability = |
571 | shift_weight_value(get_military_number_at(kMutationRatePosition), false) + 101; |
572 | + // Some of mutation will be agressive - over full range of values, the number below |
573 | + // say how many (aproximately) they will be |
574 | + uint16_t preferred_numbers_count = 0; |
575 | + // This is used to store status whether wild card was or was not used |
576 | + bool wild_card = false; |
577 | |
578 | // When doing training mutation probability is to be bigger than not in training mode |
579 | if (ai_training_mode_) { |
580 | @@ -614,29 +622,32 @@ |
581 | if (probability < kLowerDefaultMutationLimit) { |
582 | probability = kLowerDefaultMutationLimit; |
583 | } |
584 | + preferred_numbers_count = 1; |
585 | } else { |
586 | probability = kNoAiTrainingMutation; |
587 | } |
588 | |
589 | set_military_number_at(kMutationRatePosition, probability - 101); |
590 | - |
591 | // decreasing probability (or rather increasing probability of mutation) if weaker player |
592 | if (ai_type == Widelands::AiType::kWeak) { |
593 | - probability /= 2; |
594 | - log("%2d: Weak mode, increasing mutation probability to 1 / %d\n", pn, probability); |
595 | + probability /= 15; |
596 | + preferred_numbers_count = 25; |
597 | } else if (ai_type == Widelands::AiType::kVeryWeak) { |
598 | - probability /= 4; |
599 | - log("%2d: Very weak mode, increasing mutation probability to 1 / %d\n", pn, probability); |
600 | + probability /= 40; |
601 | + preferred_numbers_count = 50; |
602 | } |
603 | |
604 | // Wildcard for ai trainingmode |
605 | - if (ai_training_mode_ && std::rand() % 8 == 0) { |
606 | + if (ai_training_mode_ && std::rand() % 8 == 0 && ai_type == Widelands::AiType::kNormal) { |
607 | probability /= 3; |
608 | + preferred_numbers_count = 5; |
609 | + wild_card = true; |
610 | } |
611 | |
612 | assert(probability > 0 && probability <= 201); |
613 | |
614 | - log("%2d: mutating DNA with probability 1 / %3d:\n", pn, probability); |
615 | + log("%2d: mutating DNA with probability 1 / %3d, preffered numbers target %d%s:\n", pn, |
616 | + probability, preferred_numbers_count, (wild_card) ? ", wild card" : ""); |
617 | |
618 | if (probability < 201) { |
619 | |
620 | @@ -644,8 +655,10 @@ |
621 | { |
622 | // Preferred numbers are ones that will be mutated agressively in full range |
623 | // [-kWeightRange, kWeightRange] |
624 | - std::set<int32_t> preferred_numbers = {std::rand() % kMagicNumbersSize * |
625 | - pref_number_probability}; |
626 | + std::set<int32_t> preferred_numbers; |
627 | + for (int i = 0; i < preferred_numbers_count; i++) { |
628 | + preferred_numbers.insert(std::rand() % pref_number_probability); |
629 | + } |
630 | |
631 | for (uint16_t i = 0; i < kMagicNumbersSize; i += 1) { |
632 | if (i == kMutationRatePosition) { // mutated above |
633 | @@ -670,8 +683,10 @@ |
634 | // Modifying pool of neurons |
635 | { |
636 | // Neurons to be mutated more agressively |
637 | - std::set<int32_t> preferred_neurons = {std::rand() % kNeuronPoolSize * |
638 | - pref_number_probability}; |
639 | + std::set<int32_t> preferred_neurons; |
640 | + for (int i = 0; i < preferred_numbers_count; i++) { |
641 | + preferred_neurons.insert(std::rand() % pref_number_probability); |
642 | + } |
643 | for (auto& item : neuron_pool) { |
644 | |
645 | const MutatingIntensity mutating_intensity = |
646 | @@ -701,8 +716,13 @@ |
647 | // Modifying pool of f-neurons |
648 | { |
649 | // FNeurons to be mutated more agressively |
650 | - std::set<int32_t> preferred_f_neurons = {std::rand() % kFNeuronPoolSize * |
651 | - pref_number_probability}; |
652 | + std::set<int32_t> preferred_f_neurons; |
653 | + // preferred_numbers_count is multiplied by 3 because FNeuron store more than |
654 | + // one value |
655 | + for (int i = 0; i < 3 * preferred_numbers_count; i++) { |
656 | + preferred_f_neurons.insert(std::rand() % pref_number_probability); |
657 | + } |
658 | + |
659 | for (auto& item : f_neuron_pool) { |
660 | uint8_t changed_bits = 0; |
661 | // is this a preferred neuron |
662 | |
663 | === modified file 'src/ai/ai_help_structs.h' |
664 | --- src/ai/ai_help_structs.h 2017-08-30 12:06:20 +0000 |
665 | +++ src/ai/ai_help_structs.h 2017-09-21 18:08:00 +0000 |
666 | @@ -124,7 +124,6 @@ |
667 | constexpr int kFNeuronPoolSize = 60; |
668 | constexpr int kFNeuronBitSize = 32; |
669 | constexpr int kMutationRatePosition = 42; |
670 | -constexpr int16_t AiPrefNumberProbability = 5; |
671 | |
672 | constexpr uint32_t kNever = std::numeric_limits<uint32_t>::max(); |
673 | |
674 | @@ -662,7 +661,6 @@ |
675 | } |
676 | void set_ai_training_mode() { |
677 | ai_training_mode_ = true; |
678 | - pref_number_probability = AiPrefNumberProbability; |
679 | } |
680 | |
681 | int16_t get_military_number_at(uint8_t); |
682 | @@ -685,7 +683,7 @@ |
683 | uint16_t performance_change = 0U; |
684 | Widelands::AiType ai_type = Widelands::AiType::kNormal; |
685 | bool ai_training_mode_ = false; |
686 | - uint16_t pref_number_probability = 100; |
687 | + uint16_t pref_number_probability = 200; |
688 | AiDnaHandler ai_dna_handler; |
689 | }; |
690 | |
691 | |
692 | === modified file 'src/ai/defaultai.cc' |
693 | --- src/ai/defaultai.cc 2017-08-30 12:06:20 +0000 |
694 | +++ src/ai/defaultai.cc 2017-09-21 18:08:00 +0000 |
695 | @@ -448,6 +448,14 @@ |
696 | ++conquered_wh; |
697 | } |
698 | }; |
699 | + if (!basic_economy_established) { |
700 | + assert(!persistent_data->remaining_basic_buildings.empty()); |
701 | + assert(persistent_data->remaining_buildings_size > 0); |
702 | + log("%2d: Basic economy not achieved, %lu building(s) missing, f.e.: %s\n", |
703 | + player_number(), persistent_data->remaining_basic_buildings.size(), |
704 | + get_building_observer(persistent_data->remaining_basic_buildings.begin()->first) |
705 | + .name); |
706 | + } |
707 | if (!enemy_warehouses.empty()) |
708 | log("Conquered warehouses: %d / %lu\n", conquered_wh, enemy_warehouses.size()); |
709 | management_data.review( |
710 | @@ -1007,7 +1015,7 @@ |
711 | if (!basic_economy_established) { |
712 | log("%2d: Initializing in the basic economy mode, required buildings:\n", player_number()); |
713 | for (auto bb : persistent_data->remaining_basic_buildings) { |
714 | - log(" %3d / %-25s- target %d\n", bb.first, get_building_observer(bb.first).name, |
715 | + log(" %3d / %-28s- target %d\n", bb.first, get_building_observer(bb.first).name, |
716 | bb.second); |
717 | } |
718 | } |
719 | @@ -1045,6 +1053,9 @@ |
720 | |
721 | productionsites_ratio_ = management_data.get_military_number_at(86) / 10 + 12; |
722 | |
723 | + assert(persistent_data->remaining_basic_buildings.size() == |
724 | + persistent_data->remaining_buildings_size); |
725 | + |
726 | // Just to be initialized |
727 | soldier_status_ = SoldiersStatus::kEnough; |
728 | vacant_mil_positions_average_ = 0; |
729 | @@ -1989,6 +2000,9 @@ |
730 | player_number(), persistent_data->remaining_basic_buildings.size(), |
731 | gamestring_with_leading_zeros(gametime)); |
732 | basic_economy_established = true; |
733 | + // Zeroing following to preserve consistency |
734 | + persistent_data->remaining_buildings_size = 0; |
735 | + persistent_data->remaining_basic_buildings.clear(); |
736 | } |
737 | |
738 | // *_military_scores are used as minimal score for a new military building |
739 | @@ -2352,14 +2366,13 @@ |
740 | bo.primary_priority = 0; |
741 | } |
742 | |
743 | - if (ai_training_mode_ && bo.type == BuildingObserver::Type::kProductionsite) { |
744 | + const bool log_needed = (bo.new_building == BuildingNecessity::kAllowed || |
745 | + bo.new_building == BuildingNecessity::kForced || |
746 | + bo.new_building == BuildingNecessity::kNeeded); |
747 | + if (ai_training_mode_ && bo.type == BuildingObserver::Type::kProductionsite && |
748 | + (gametime % 20 == 0 || log_needed)) { |
749 | log("%2d: %-35s(%2d now) %-11s: max prec: %2d/%2d, primary priority: %4d, overdue: %3d\n", |
750 | - player_number(), bo.name, bo.total_count(), |
751 | - (bo.new_building == BuildingNecessity::kAllowed || |
752 | - bo.new_building == BuildingNecessity::kForced || |
753 | - bo.new_building == BuildingNecessity::kNeeded) ? |
754 | - "needed" : |
755 | - "not needed", |
756 | + player_number(), bo.name, bo.total_count(), (log_needed) ? "needed" : "not needed", |
757 | bo.max_needed_preciousness, bo.max_preciousness, bo.primary_priority, |
758 | bo.new_building_overdue); |
759 | } |
760 | @@ -3580,6 +3593,12 @@ |
761 | // Get link to productionsite that should be checked |
762 | ProductionSiteObserver& site = productionsites.front(); |
763 | |
764 | + // Make sure we are not above ai type limit |
765 | + if (site.bo->total_count() > site.bo->cnt_limit_by_aimode) { |
766 | + log("Too many %s: %d, ai limit: %d\n", site.bo->name, site.bo->total_count(), site.bo->cnt_limit_by_aimode); |
767 | + } |
768 | + assert(site.bo->total_count() <= site.bo->cnt_limit_by_aimode); |
769 | + |
770 | // first we werify if site is working yet (can be unoccupied since the start) |
771 | if (!site.site->can_start_working()) { |
772 | site.unoccupied_till = game().get_gametime(); |
773 | @@ -4502,6 +4521,7 @@ |
774 | // And finally the 'core' of this function |
775 | // First deal with construction of new sites |
776 | if (purpose == PerfEvaluation::kForConstruction) { |
777 | + assert(bo.total_count() <= bo.cnt_limit_by_aimode); |
778 | if (bo.forced_after < gametime && bo.total_count() == 0 && !has_substitution_building) { |
779 | if (!bo.is(BuildingAttribute::kBarracks)) { |
780 | bo.max_needed_preciousness = bo.max_preciousness; |
781 | @@ -4579,7 +4599,7 @@ |
782 | } |
783 | bo.cnt_target = 3; |
784 | // adjusting/decreasing based on cnt_limit_by_aimode |
785 | - bo.cnt_target = limit_cnt_target(bo.cnt_target, bo.cnt_limit_by_aimode); |
786 | + bo.cnt_target = std::min(bo.cnt_target, bo.cnt_limit_by_aimode); |
787 | |
788 | // for case the wood is not needed yet, to avoid inconsistency later on |
789 | bo.max_needed_preciousness = bo.max_preciousness; |
790 | @@ -4718,7 +4738,7 @@ |
791 | bo.cnt_target = tmp_target; |
792 | |
793 | // adjusting/decreasing based on cnt_limit_by_aimode |
794 | - bo.cnt_target = limit_cnt_target(bo.cnt_target, bo.cnt_limit_by_aimode); |
795 | + bo.cnt_target = std::min(bo.cnt_target, bo.cnt_limit_by_aimode); |
796 | |
797 | assert(bo.cnt_target > 1 && bo.cnt_target < 1000); |
798 | |
799 | @@ -5418,6 +5438,8 @@ |
800 | } |
801 | } |
802 | |
803 | + log("Sorry, cannot find building with id %d", static_cast<int32_t>(di)); |
804 | + // I noticed that exception test is being lost so will will print it into log as well |
805 | throw wexception("Sorry, cannot find building with id %d", static_cast<int32_t>(di)); |
806 | } |
807 | |
808 | @@ -6169,25 +6191,6 @@ |
809 | } |
810 | } |
811 | |
812 | -int32_t DefaultAI::limit_cnt_target(const int32_t current_cnt_target, const int32_t ai_limit) { |
813 | - |
814 | - if (ai_limit >= std::numeric_limits<int32_t>::max() - 1) { |
815 | - // = ai limit is not set |
816 | - return current_cnt_target; |
817 | - } |
818 | - |
819 | - int32_t new_target = current_cnt_target; |
820 | - |
821 | - if (current_cnt_target > (ai_limit + 1) / 2) { |
822 | - new_target = (ai_limit + 1) / 2; |
823 | - } |
824 | - assert(new_target * 2 >= ai_limit); |
825 | - assert(new_target > 0); |
826 | - assert(new_target <= ai_limit); |
827 | - |
828 | - return new_target; |
829 | -} |
830 | - |
831 | // Looking for situation where for a critical mine (iron, or marble) there is just one mine and it |
832 | // is |
833 | // unoccupied, probably we need to dismantle another one to release a miner |
834 | |
835 | === modified file 'src/ai/defaultai.h' |
836 | --- src/ai/defaultai.h 2017-09-03 11:19:21 +0000 |
837 | +++ src/ai/defaultai.h 2017-09-21 18:08:00 +0000 |
838 | @@ -327,7 +327,6 @@ |
839 | uint32_t military_last_dismantle_; |
840 | uint32_t military_last_build_; // sometimes expansions just stops, this is time of last military |
841 | // building built |
842 | - int32_t limit_cnt_target(int32_t, int32_t); |
843 | uint32_t time_of_last_construction_; |
844 | uint32_t next_mine_construction_due_; |
845 | uint16_t fishers_count_; |
846 | |
847 | === modified file 'src/ai/defaultai_warfare.cc' |
848 | --- src/ai/defaultai_warfare.cc 2017-08-30 12:06:20 +0000 |
849 | +++ src/ai/defaultai_warfare.cc 2017-09-21 18:08:00 +0000 |
850 | @@ -567,6 +567,9 @@ |
851 | TrainingSite* ts = trainingsites.front().site; |
852 | TrainingSiteObserver& tso = trainingsites.front(); |
853 | |
854 | + // Make sure we are not above ai type limit |
855 | + assert(tso.bo->total_count() <= tso.bo->cnt_limit_by_aimode); |
856 | + |
857 | const DescriptionIndex enhancement = ts->descr().enhancement(); |
858 | |
859 | if (enhancement != INVALID_INDEX && ts_without_trainers_ == 0 && mines_.size() > 3 && |
860 | @@ -778,6 +781,7 @@ |
861 | // Check next militarysite |
862 | bool changed = false; |
863 | MilitarySite* ms = militarysites.front().site; |
864 | + MilitarySiteObserver& mso = militarysites.front(); |
865 | |
866 | // Don't do anything if last change took place lately |
867 | if (militarysites.front().last_change + 2 * 60 * 1000 > gametime) { |
868 | @@ -786,6 +790,9 @@ |
869 | return false; |
870 | } |
871 | |
872 | + // Make sure we are not above ai type limit |
873 | + assert(mso.bo->total_count() <= mso.bo->cnt_limit_by_aimode); |
874 | + |
875 | FCoords f = game().map().get_fcoords(ms->get_position()); |
876 | |
877 | BuildableField bf(f); |
Continuous integration builds have changed state:
Travis build 2681. State: passed. Details: https:/ /travis- ci.org/ widelands/ widelands/ builds/ 277952118. /ci.appveyor. com/project/ widelands- dev/widelands/ build/_ widelands_ dev_widelands_ ai_differentiat ion-2501.
Appveyor build 2501. State: success. Details: https:/