Commit graph

1012 commits

Author SHA1 Message Date
mattsc
455a50e30b Add Fast Micro AI test scenario 2015-09-02 19:05:38 -07:00
mattsc
334bbf6319 Micro AI test scenario: fix a menu item id
Not that it matters for anything practical in this case, but just for
consistency.
2015-09-02 17:37:00 -07:00
mattsc
3ae127dcb5 Micro AI test scenario: fix broken image path 2015-09-02 17:21:16 -07:00
mattsc
ac3b9e6325 Fast MAI: use the new attack utility functions 2015-09-02 17:05:49 -07:00
mattsc
e098ef180d Fast Micro AI: add new set attack utility functions
These functions are newer and more efficient versions of those in
battle_calcs.lua. They are much faster in many situations.
2015-09-02 17:05:49 -07:00
mattsc
9520513d81 Fast Micro AI: exclude hidden enemies from attacks by default
This is done in this way to keep computational overhead as low as
possible.

Also add an optional key attack_hidden_enemies. This can be used to
attack also hidden enemies; or to speed up the AI a little when no
hidden enemies are present.
2015-05-20 07:21:47 -07:00
mattsc
05eb2d7620 Lua AI helper functions: modify a comment 2015-05-20 07:13:11 -07:00
mattsc
25e10121f5 Lua AIs: fix bug occurring when number= in an attack is set to zero
Apparently, when this is the case, the number key is not included at
all, rather than set to zero, when the Lua table containing the attack
information is retrieved.
2015-05-19 19:54:41 -07:00
mattsc
c538e5f984 Micro AIs: issue warning if side defined in [micro_ai] tag does not exist
Previously this would cause a whole series of Lua error messages and,
potentially, some code not being executed.
2015-05-19 19:44:18 -07:00
mattsc
b657bbc862 Forest Animals MAI: bug fix, exclude border hexes for wander terrain
wesnoth.get_locations includes border hexes, so they need to be
excluded specifically. Previously this could cause error messages and
the CA to be blacklisted.
2015-04-02 08:22:23 -07:00
mattsc
38b089358a Herding Micro AI: bug fix for dogs sometimes having moves left at end
The problem is due to a dog adjacent to a sheep being excluded from the
dog_move CA (so that it can act further later on in case the sheep
moves again). It is fixed by adding another CA at the end that simply
takes all moves away from all dogs once all other CAs are done.
2015-04-02 08:22:02 -07:00
mattsc
95616c5af9 Bottleneck MAI: bug fix for when allied units are present
Hexes occupied by allied units were previously not excluded properly by
the AI, which could lead to error messages and the candidate action to
be blacklisted.
2015-04-02 08:21:36 -07:00
mattsc
1ea71c1a4d Bottleneck Micro AI: fix indenting 2015-04-02 08:19:49 -07:00
Bär Halberkamp
e90ed17aa3 Fixed the rushers micro ai crashing 2015-03-18 12:27:12 +01:00
mattsc
448e300763 Fast MAI: bug fix for error when attacker runs into ambush
If the move of the attacker toward the target is interrupted by an
ambush, the attack action previously caused an error, because the
attacker did  not get to its target.
2015-02-12 12:18:17 -08:00
mattsc
b7907127ae Fast MAI: bug fix for scenarios when there is no enemy leader (for the AI)
In this case, it can happen that there are no goals (e.g. if there are
also no villages or if the AI has no leader). Previously, this
situation caused an error message.
2015-02-12 12:15:04 -08:00
mattsc
b8608b199f Fast MAI: bug fix for leaderless AI sides
Leaderless AI sides cannot capture villages, thus villages should not
be set as goals.
2015-02-12 12:12:27 -08:00
aquileia
504fd44747 Fixup and expand cc8ec3a934
[skip ci]
2015-01-29 01:36:34 +01:00
mattsc
f57485a8c0 Add conditional inclusion of AI macros to AI cfgs in data/ai
In normal MP and SP games, these macros are defined previously and
including them here produces unnecessary overhead. However, they are
not defined when an AI MP game is started from the commandline with the
-m and --ai-config options.
2015-01-11 08:47:33 -08:00
Ignacio R. Morelle
277402966a Remove inclusions of data/core/macros from data/ai
These files do not seem to be preprocessed separately from the rest,
resulting in data/core/macros being included twice for no obvious gain.
2015-01-10 13:15:57 -03:00
Matthias Schoeck
bad5e79f67 Lurkers Micro AI: bug fix for attempting to attack petrified units 2014-12-15 19:23:06 -08:00
mattsc
17e758a3c4 Lurkers MAI: bug fix for attack error when lurker runs into ambush
If the lurker move is interrupted by an ambush, the attack action
previously sometimes caused an error, because the lurker might not get
to its target.
2014-11-27 19:10:32 -08:00
mattsc
051644b00f Big Animals MAI: bug fix for units sometimes not attacking 2014-11-27 07:03:33 -08:00
mattsc
f111bf3c01 Station Guardian MAI: bug fix for unreachable stations
Keep guardian in place if the station is unreachable.
2014-11-21 19:44:54 -08:00
mattsc
ada80cfd34 Micro AIs: only display on-screen error messages when in debug mode 2014-11-01 07:45:15 -07:00
mattsc
b2581bcb7c Lurkers Micro AI: fix bug in wander terrain selection
Need to verify that the goal hex for the wander is not occupied by an
ally, otherwise the unit might end up on the wrong type of terrain.
2014-10-16 13:16:33 -07:00
Kevin_Xi
cb482a38fc Register the new stage and update build files 2014-08-23 01:12:51 +08:00
mattsc
bc3f4b0f16 Dragon MAI test scenario: turn off debug output
The messages spoken by the hunter (dragon) are debug output and not
translatable.  They should not appear in the scenario.
2014-08-18 18:34:34 -07:00
mattsc
25ff143349 MAI test scenario: fix string that caused trouble for translations
Somehow the combination of “” and new lines caused the string to be
terminated prematurely when it was extracted into the .pot file.  Fixed
by removing the “”.
2014-08-18 07:35:56 -07:00
mattsc
607f91a473 Goto MAI: fix bug causing errors for unreachable goal hexes
This includes hexes occupied by an enemy unit.
2014-08-11 18:56:50 -07:00
mattsc
241faebd7a Guardian Micro AI: remove translation marks from map labels
These are meant as technical information for UMC authors, not “normal
users”.
2014-07-15 17:18:19 -07:00
mattsc
474b8990d8 Return Guardian MAI: fix bug when path to return hex is blocked
Such as when the unit is surrounded.
2014-06-19 11:30:02 -07:00
mattsc
1491934224 Random Recruit Micro AI: fix bug with custom castle terrain
Previously, only terrain with C or K in the terrain code passed the
SLF.  Now we check whether the hex is a castle instead, independent of
the terrain code.
2014-06-19 09:33:17 -07:00
mattsc
156726a6a4 ai_helper.move_unit_out_of_way: fix direction rating
This is supposed to be a minor rating, secondary to the main rating.
2014-06-16 08:08:01 -07:00
mattsc
9e8ee00ad0 battle_calcs: provide default value for resistance modifiers
This is done for cases when the value cannot be read from the unit_info
table, which might happen in some UMC.  This fixes a rare bug affecting
the Fast Micro AI attack evaluation
2014-06-15 19:34:25 -07:00
mattsc
faeaf5e47c ai_helper.get_attacks: improve check for units in the way
Check whether the unit in the way has an unoccupied hex to move to.
Previously, it was only checked whether its reach was >1, which
sometimes can include only hexes occupied by units on its own side,
making the actual move impossible.
2014-06-15 14:22:18 -07:00
mattsc
ded53dd332 Stationed Guardian Micro AI: make guard_x/y optional keys
If not provided, they now default to stationed_x/y.
2014-06-15 11:59:36 -07:00
mattsc
9645fc466b Coward Micro AI: add optional attack_if_trapped key
If set, the unit attacks the weakest enemy next to which it ends up at
the end of its move.
2014-06-15 07:21:34 -07:00
mattsc
54b3030676 MAI test scenarios: fight_on_without_leader -> defeat_condition
Necessary due to a recent change how the victory conditions are
evaluated.
2014-05-22 19:51:51 -07:00
mattsc
053a9350a1 Fast MAI: don't target unowned villages if AI side has no leader
Only enemy-owned villages should be targets for leaderless AI sides.
2014-05-05 07:23:02 -07:00
mattsc
7ef7d14978 Fast Micro AI: use hex 2 steps beyond next hop for move evaluation
It results in a better evaluation of the best hex to move to when
distance criterion is used (that is, when we are not in dungeon mode).
2014-05-04 14:18:15 -07:00
mattsc
ade936e0b0 Fast Micro AI: Add closeness-to-goal to unit order criterion
How fast (in how many turns) the unit can get there remains the main
criterion, but if that is equal for two units, use the closer unit
first.
2014-05-04 14:18:14 -07:00
mattsc
1dd6f7494e Fast Micro AI: add a dungeon mode 2014-05-04 14:18:14 -07:00
mattsc
6cfbe69784 Fast Micro AI: remove debug output 2014-05-04 14:18:14 -07:00
mattsc
48a0920732 Fast Micro AI: exclude guardians from move-to-targets CA 2014-05-03 17:46:37 -07:00
mattsc
d8b5984a19 Fast Micro AI: use wesnoth.require instead of wesnoth.dofile 2014-05-03 17:45:46 -07:00
mattsc
feabdfb4ea New Micro AI: Fast AI
This AI is meant as a fall-back AI for scenarios where there are so
many units that attacks and moves done by the default AI are slow with
long delays before each move. It replaces the default combat and
move-to-targets candidate actions.
See http://wiki.wesnoth.org/Micro_AIs
2014-05-03 16:52:58 -07:00
mattsc
03c1b97802 next_hop(): bug fix for ignoring units when ignore_units=true is set
A bug in the previous version let to them not being ignored when  the
were on the last hex of the next hop.
2014-05-02 19:29:37 -07:00
mattsc
82e4ccad4d battle_calcs.attack_rating(): overhaul attack rating system
This was long overdue.  The return value is now much closer to
something describing the actual gain/loss (roughly) in units of gold.
2014-04-30 19:09:28 -07:00
mattsc
7623c5513a battle_calcs: do not use variance of attack in attack rating
This was an idea we tried so that we’d start with the most uncertain
attack first, but it did not work very well.
Keep the code for now, just comment it out.
2014-04-30 19:06:57 -07:00