Commit graph

1020 commits

Author SHA1 Message Date
mattsc
3f665ae8b1 AI: do not use the recruit_rushers CA as default recruitment
It is too different from previous default recruiting and would significantly affect scenario balance. It also currently does not work with multiple leaders and many of the aspects. It will be made available as an option (and is already in the Experimental AI) after these shortcomings have been fixed.
2019-12-11 07:46:16 -08:00
mattsc
0806a2bbe1 AI spread poison CA: take attacks aspect into account 2019-12-11 07:12:10 -08:00
mattsc
d8b25ab149 Fast Micro AI: delete/add the new default AI CAs 2019-12-10 07:01:40 -08:00
mattsc
ecca2c43ba Fast Micro AI: fix re-adding default CAs when deleting the MAI
The high_xp_attack CA is deleted when adding the Fast MAI, but not added back in when deleting the MAI.
2019-12-10 06:42:08 -08:00
mattsc
6a3015f0e2 battle_calcs.lua: fix bug in relative_damage_map() 2019-12-07 19:08:48 -08:00
mattsc
c93b1db30a AI: do not use village hunt CA in any AI config
The algorithm used in this CA is too simple to work reliably in a general setting, it tends to send whole groups of units toward small numbers of villages, or even individual ones. In its current version, it should not be used at all, not even in the Experimental AI. The recommended way to emphasize village hunting is to set the village_value aspect to a larger-than-default value and let the move-to-targets CA take care of it.

We are, however, leaving the CA code and the macros in place for potential future work.
2019-12-07 14:02:52 -08:00
mattsc
009a9ef2da AI spread poison CA: apply aggression aspect
In the same way as it is done in the combat CA
2019-12-07 08:02:00 -08:00
mattsc
1ba7e9c76c AI spread poison CA: use more complete attack rating
battle_calcs.attack_rating() includes most of the contributions to the previous rating, plus a lot more.
2019-12-07 08:01:43 -08:00
mattsc
2cc8cce0e8 AI: use ai_helper.robust_move_and_attack() in all CAs 2019-12-06 08:18:47 -08:00
mattsc
96dd9c1712 AI castle switch CA: use leader-specific cheapest recruit cost 2019-12-06 08:18:47 -08:00
mattsc
f8a9238e3f ai_helper.get_cheapest_recruit_cost: add optional input 'leader' 2019-12-06 08:18:47 -08:00
mattsc
a227e768f9 ai_helper.get_cheapest_recruit_cost: add extra recruits 2019-12-06 08:18:47 -08:00
mattsc
fd05a01af5 AI: make recruitment work with multi-leader castle switch
Recruiting itself still only handles one leader. This will be taken care of later.
2019-12-06 08:18:47 -08:00
mattsc
917f7ef9a5 AI castle_switch: reconsider CA score when using saved data
If the units previously on the keep moved off, we don't have to use the low score any more.
2019-12-06 08:18:47 -08:00
mattsc
18b5d5159e AI castle switch: bug fix for units on keep check 2019-12-06 08:18:47 -08:00
mattsc
ab2c3bfcc2 AI: enable multiple leaders in castle_switch CA
Previously the CA would already move multiple leaders if all leaders were to be moved, but it would abandon moving any leader after finding one that should not move.
2019-12-06 08:18:47 -08:00
mattsc
64e969af11 AI: ensure all CAs respect passive_leader aspect
Most of the former Experimental AI CAs did already (or don't use the leader in the first place), but not quite all of them.
2019-12-06 08:18:47 -08:00
mattsc
1e01df84ff AI: do not use new grab_villages CA for default AI
The old villages CA is quite a bit better at distributing multiple units across multiple villages. The advantage of the new grab_villages CA is that it has a variable score, sometimes grabbing villages before, and sometimes after attacks. This does not outweigh its shortcomings though.

So for now, the default AI will continue to use the previous CA, and the Experimental AI will use the new one. Thus, the two AIs are not quite identical any more (but still very similar).

I also added a todo comment that the grab_villages CA might be reinstated if it is improved.
2019-12-06 08:18:47 -08:00
mattsc
038dc2d7fe AI: remove old retreat_phase CA from AI configs
It is now superseded by the retreat_injured CA (of the former Experimental AI).
2019-12-06 08:18:47 -08:00
mattsc
1391745c9f AI: consider caution in retreat_injured CA
Not retreating at all for caution <= 0 is the same as for the old retreating CA. The rest is specific to this CA.
2019-12-06 08:18:24 -08:00
mattsc
2d86cb20ce ai_helper.find_path_with_avoid: add 'ignore_enemies' option
Note that we do not add an 'ignore_units' option, as allies and enemies are taken into account in different ways and we want to have a way of ignoring each type individually.
2019-12-06 08:14:56 -08:00
mattsc
07d149cbfb ai_helper.next_hop: let units fan out
... as opposed to lining up if there are allied units in the way.

This changes (fixes) the default behavior. An optional 'no_fan_out' parameter is provided in order to restore the old behavior.
2019-12-06 08:14:57 -08:00
mattsc
34956ac15d AI: ensure all CAs respect [avoid] tags
This is for the candidate actions that were merged into the default AI from the former Experimental AI.
2019-12-06 08:14:56 -08:00
mattsc
620da22082 AI: fix score assignment in castle switch candidate action 2019-12-06 08:14:56 -08:00
mattsc
f5990b7e95 ai_helper.get_attackable_enemies: add optional parameter 'avoid_map' 2019-12-06 08:14:56 -08:00
mattsc
891ca93710 ai_helper.put_labels: add two optional parameters 2019-12-06 08:14:45 -08:00
Celtic Minstrel
732b7942bb Replace all references to deprecated functions in the helper module
(and remove the require if this meant it was no longer used)
2019-12-02 01:10:34 -05:00
mattsc
fdb3f2e71a ai_helper.next_hop: add optional parameter 'avoid_map' 2019-11-29 19:22:56 -08:00
mattsc
4e80a8f028 ai_helper.next_hop: add option to use pre-evaluated path 2019-11-29 19:22:56 -08:00
mattsc
bb23781b17 ai_helper: new function find_path_with_avoid()
This lets the AI find paths around areas defined by [avoid] tags, rather than being stopped dead by them. See comments in the code for details.

The relevant custom cost function, custom_cost_with_avoid(), can be accessed directly as well.
2019-11-29 19:22:56 -08:00
mattsc
3e70358d8d AI: ensure all CAs respect unit guardian status
This adds the correct behavior for the castle_switch, move_to_any_enemy and place_healers CAs.  It was already in place for the other former ExpAI CAs (except for recruiting and spread_poison, for which it does not apply).

This automatically also adds this behavior to the Healer Support Micro AI.
2019-11-29 19:22:56 -08:00
mattsc
24af20cf83 Experimental AI: show in MP menu in debug mode only
It is now identical to the default AI, so we only show it in debug mode in the MP computer player selection menu. It will be moved back to be always available when there is new development happening.
2019-11-29 19:22:56 -08:00
mattsc
a38356e61c Experimental AI: add comments that it is now same as default 2019-11-29 19:22:56 -08:00
mattsc
5c285cfde0 AI: copy Experimental AI candidate actions into default AI 2019-11-29 19:22:56 -08:00
mattsc
7bbe5329c1 AI: create copy of the current default AI
... and call it the "1.14 default AI".
2019-11-29 19:22:56 -08:00
mattsc
3bd6613dda AI: Set up macros for Experimental AI candidate actions
In the same way as they are set up for the default AI
2019-11-29 19:22:56 -08:00
Celtic Minstrel
3734bce276 Lua: Replace uses of deprecated (moved) sides functions 2019-11-23 14:41:03 -05:00
mattsc
74c7c17ec8 Experimental AI: fix AI setup max_score values
The return scores were changed in commit 4999b20bd1, but the max_score values in the configurations have not been updated yet. As the relative ranking was not changed, this should not have any effect on gameplay.
2019-11-21 21:11:34 -08:00
mattsc
1816ee5249 AI: add [filter_own] to all Experimental AI candidate actions 2019-11-21 19:15:11 -08:00
mattsc
997e08c5d3 Experimental AI: fix bug in move_to_any_enemy CA
Previously, if the best move found for a unit was its own position, the entire CA would be blacklisted and no other unit would be moved.
2019-11-21 13:04:26 -08:00
mattsc
626d7ee381 AI: add [filter_own] to all default AI candidate actions
This allows restricting each CA individually to only a subset of the units. It also means that several instances of the same CA can be used in the same AI configuration, in order to, for example, force the order in which units are dealt with, or to apply different settings to different units.
2019-11-21 12:09:33 -08:00
Celtic Minstrel
24b11221cf Use wml.array_variables instead of wml.array_access.get/set 2019-11-16 13:09:04 -05:00
Celtic Minstrel
aaa2dc4ece Rollback possibility of wesnoth.get_units matching recall list units
Now it's renamed to wesnoth.units.find_on_map.

wesnoth.units.find implements the case of finding units on either the map or a recall list.
2019-11-15 22:39:09 -05:00
Celtic Minstrel
977f05d77f Lua: Replace uses of deprecated (moved) unit functions
Also backtracked the removal of wesnoth.get_recall_units, which is now available as wesnoth.units.find_on_recall - it's just more convenient than passing x=recall to wesnoth.units.find
2019-11-15 22:39:08 -05:00
mattsc
cbf99a6f00 Fred ExpAI recruiting: set initial conditions for first recruit
Without this, the AI always starts with whatever it considers the best unit without taking the level bonus into account. This mostly only matters when one sets high_level_fraction to a very large value (1 or larger) in order to force only high-level recruits. In other cases it makes no, or no significant, difference.
2019-10-08 13:24:13 -07:00
mattsc
a51dee6761 Exp AI recruiting: add randomness as an optional parameter
This was already an optional parameter for the Recruit Rushers Micro AI.
2019-10-08 12:47:31 -07:00
mattsc
6dc199d4f8 ExpAI recruiting: make high_level_fraction parameter configurable
This also sets its default value to zero, in order to have consistent default behavior with versions from before this parameter was introduced.

It also provides a macro so that the ExpAI can be used with custom parameters in a scenario config, and adds high_level_fraction as an optional parameter to the Recruit Rushers Micro AI.
2019-10-08 12:45:59 -07:00
mattsc
b8d1ef94f0 Experimental AI: make AI recruit higher level units
Because unit cost is penalized in the ExpAI, it recruits almost no higher level units. This adds a bonus for such units to be recruited at approximately the ratio defined in 'high_level_fraction'.
2019-10-08 07:15:47 -07:00
Steve Cotton
39c5df7544
Simple Attack Micro AI Demo: Update dialogue for 1.14's AI improvements (#4431)
The default 1.14 already considers high-XP attacks.  Other than the dialogue,
the only change is to reduce the AI's default aggression, so there's more
contrast between what the Micro AI does compared to what the default AI does.

Switched to typographic quotation marks in the dialogue, and removed double
spaces between sentences.
2019-10-06 06:46:00 +02:00
mattsc
036bf8b6ae Experimental AI: fix poisoners ignoring [avoid] tag 2019-10-05 19:24:40 -07:00