Commit graph

1012 commits

Author SHA1 Message Date
Steve Cotton
3420bb17ea Test scenario High XP Attack: use the map that it expects
This scenario uses the huge final map from THoT, with different situations
split across different rooms of the map. THoT's final scenario was redesigned
with a completely new map in 457d9d17f, so this gives the test code its own
copy of the map.

There's a one-hex change to the original: the test puts side 1's leader in a
wall, isolated from the action. To clarify that that's intentional, the map
copy changes that hex to be passable, still surrounded by wall.
2019-03-23 10:10:53 -04:00
Andrius Štikonas
6152883645 Fix some spelling issues
Fix a typo in micro_ai simple_attack demo: you -> your.
Fix inconsistent spaces
Fix misspelled wesnoth in systemd unit file
2019-03-06 11:42:17 -05:00
mattsc
152eb37aec Goto/Assassin MAIs: fix AIs not always working with tunnels
The old syntax for using a custom cost function ignored teleports/tunnels. Using calculate= in the path options table allows also setting the ignore_teleports option (but in this syntax it defaults to 'false', so it does not need to be done specifically).
2018-12-30 16:26:18 -08:00
mattsc
8b3c6b1fa9 Forest Animals MAI: fix AI crash when using custom rabbit hole image 2018-12-27 14:53:47 -08:00
mattsc
8a7a5a153f AI configuration: invert mp_rank based ordering
This is supposed to be equivalent to the campaign rank, so it should be in ascending order.
2018-12-15 13:48:32 -08:00
mattsc
c731be58a9 AI configuration: new optional parameter mp_rank=
This parameter determines in which order the available AIs are shown in the MP computer player selection menu. This can be used for eras, modifications or cores to change which AI is first in the list.
2018-11-17 18:46:06 -08:00
mattsc
f00f9e3901 RCA AI: remove attack_depth aspect from default configuration 2018-11-16 06:45:40 -08:00
mattsc
8c8cafaa70 Deprecate EXPERIMENTAL_AI macro 2018-11-15 06:46:41 -08:00
mattsc
59397a40b5 ExpAI recruiting: fix AI crash for unit type with unknown race 2018-11-13 06:53:20 -08:00
Celtic Minstrel
639787e1c9 Merge pull request #2562 from wesnoth/schema 2018-11-11 13:52:19 -05:00
mattsc
30e1fd1742 Bottleneck Micro AI: simplify a conditional
Use elseif and no need to check experience again, that is already done earlier.
2018-11-09 06:57:07 -08:00
mattsc
bc956b3e7f Lua AIs: fix experience for killing level 0 units 2018-11-09 06:52:08 -08:00
mattsc
1856377d35 Lua AIs: distinguish between healing locations and villages
There are rating contributions for hexes which heal (not all of which are villages) and others for hexes that provide income (villages). Previously only villages were considered for both types of hexes.
2018-11-07 12:24:31 -08:00
mattsc
8bca955ad5 ai_helper: new function get_healing_locations() 2018-11-07 12:17:55 -08:00
mattsc
c1343227e2 Generic recruit engine: cache pathfinding data
This results in a significant speed-up starting from the second recruit each turn.
2018-11-06 09:44:03 -08:00
mattsc
e379cf7333 Generic recruit engine: replace slow location filters 2018-11-06 09:38:33 -08:00
mattsc
0c57ae16e4 Lua AIs: do not use hard-coded values for modifiable parameters 2018-11-05 20:22:11 -08:00
mattsc
e3b2cbfc25 ExpAI recruiting: consider all villages not owned by allies
Instead of only the unowned villages.
2018-11-05 07:19:23 -08:00
mattsc
5e0df80ad0 ExpAI retreating: take healthy trait into account 2018-11-05 07:02:46 -08:00
mattsc
dcf951434e Micro AIs: support named locations for [micro_ai] tag keys 2018-11-05 07:02:33 -08:00
mattsc
8676d3eaf1 ExpAI recruiting: add optional 'enemy_types' parameter
Ths is the enemy type list to be considered if the AI has no information about the enemies to expect, that is, if no enemy units are on the map and no enemy recruit lists can be found. It can be used to prepare AI recruiting for enemy sides that get added later during a scenario.
2018-11-02 15:43:14 -07:00
mattsc
873bf2f390 Multipack Wolves MAI: add [avoid] tag functionality
This includes both adding an [avoid] tag to the MAI itself, and taking the default AI [avoid] tag into account. If both are given, the former takes precedence over the latter.
2018-11-01 18:10:38 -07:00
mattsc
d7418ab8e2 Wolves Micro AI: take default AI [avoid] tag into account 2018-11-01 18:07:21 -07:00
mattsc
abaa2dcc84 Swarm Micro AI: add [avoid] tag functionality
This includes both adding an [avoid] tag to the MAI itself, and taking the default AI [avoid] tag into account. If both are given, the former takes precedence over the latter.
2018-11-01 18:05:17 -07:00
mattsc
7579d181c0 Goto Micro AI: add [avoid] tag functionality
This includes both adding an [avoid] tag to the MAI itself, and taking the default AI [avoid] tag into account. If both are given, the former takes precedence over the latter.
2018-11-01 08:03:24 -07:00
mattsc
f11700119a Micro AIs: use ai_helper.get_reachmap()
There are no functionality changes in this commit, it's simply switching over to the new ai_helper function. Changes to the MAI functionalities will be added separately.
2018-10-31 15:45:48 -07:00
mattsc
df4065c061 ai_helper: new function get_reachmap()
This is a generalized version of ai_helper.get_reachable_unocc(). It can include or exclude hexes with own units with moves > 0. It also allows passing an optional location set 'avoid_map' with hexes to be excluded.

In principle, this makes get_reachable_unocc() unnecessary, but we keep that function for backward compatibility.
2018-10-30 07:37:52 -07:00
mattsc
10b0631143 Micro AIs: use ai_helper.get_avoid_map()
There are no functionality changes in this commit, it's simply switching over to the new ai_helper function. Changes to the MAI functionalities will be added separately.
2018-10-29 07:26:07 -07:00
mattsc
ae22b2e08f ai_helper: new function get_avoid_map()
The goal is to add [avoid] tag capabilitiy to most Micro AIs.
2018-10-29 07:06:46 -07:00
mattsc
a831edda6b ai_helper.get_closest_enemy: change return values
This is done for consistency with similar functions in mainline, and so that the function actual returns what it name says. This breaks backward compatibility, but note that the only practical difference for that is the order in which the arguments are returned, as both 'closest_enemy' and 'location' contain the enemy location in .x/.y format.
2018-10-27 16:24:13 -07:00
mattsc
5c73537412 ai_helper.lua: deprecate some functions 2018-10-26 07:19:13 -07:00
mattsc
cd8af96607 ai_helper.find_best_move: return nil instead of {} if no move found
This is done for consistency with similar functions in mainline. In principle this breaks backward compatibility.  However, while it is theoretically possible for this to happen, this function will generally always return at least the hex the unit is on, so it is very unlikely that this actually makes a difference somewhere.
2018-10-26 07:19:13 -07:00
mattsc
41bd835f76 Old patrol.lua: deprecation message should not be translatable 2018-10-24 19:53:45 -07:00
mattsc
e3b86f5648 Lua AIs: increase deprecation level of old ai/lua/patrol.lua 2018-10-24 19:51:53 -07:00
mattsc
5fe283d06c Lua AIs: use wesnoth.label instead of wml_action_metatable 2018-10-24 19:50:09 -07:00
Celtic Minstrel
2410c9671c MicroAI Tests: Fix issues found by the schema validator
With this, the MicroAI test scenarios are clean of schema errors
2018-10-23 22:49:40 -04:00
Celtic Minstrel
02da99638a Fix a few schema issues in some of the interactive test scenarios 2018-10-23 22:49:37 -04:00
Celtic Minstrel
79eed95f98 Embrace turns=unlimited as a way of specifying unlimited turns 2018-10-23 22:39:29 -04:00
mattsc
09e3891668 ai_helper.move_unit_out_of_way: prevent potential for divide-by-zero
dx = dy = 0 is a perfectly acceptable choice of values when there is no preferred direction.
2018-10-21 19:30:34 -07:00
Severin Glöckner
a10888ca5b Micro AI Demos: use Cme instead of Chw for lurkers map
[ci skip]

(cherry-picked from commit c5cabd960b)
2018-10-07 03:25:08 +00:00
Severin Glöckner
ccaa9b75ed Micro AI Demos: save maps in new format
[ci skip]

(cherry-picked from commit c5d3539880)
2018-10-07 03:25:08 +00:00
mattsc
c5e41497e1 generic_recruit_engine: remove unnecessary variable assignment
(cherry-picked from commit a781139536)
2018-10-07 03:24:56 +00:00
mattsc
56934ad576 Lua AIs: use ai_helper.get_locations_no_borders()
(cherry-picked from commit dcadab91a4)
2018-10-07 03:24:56 +00:00
mattsc
319c98d616 ai_helper: new function get_locations_no_borders()
(cherry-picked from commit 10463fdf60)
2018-10-07 03:24:56 +00:00
mattsc
46efcf15fd Lua AIs: use ai_helper get_unit functions where applicable
The ai_helper functions are optimized for speed (as much as possible in a general setting) and do all the necessary tests.  For example, get_units_with_attacks() checks both whether the unit has attacks left, and whether it has any attacks in the first place.

(cherry-picked from commit 75843541bc)
2018-10-07 03:24:55 +00:00
mattsc
44ceaa1874 ai_helper: get_unit functions should only return live units
Live beiing defined as in get_live_units(), that is, non-petrified units

(cherry-picked from commit a7d80240f2)
2018-10-07 03:24:54 +00:00
mattsc
fc6d71b023 Lua AIs: use ai_helper.robust_move_and_attack()
ai_helper.robust_move_and_attack() does the stop_unit_moves automatically if the unit is at the destination hex.

(cherry-picked from commit fdc3249496)
2018-10-07 03:24:53 +00:00
mattsc
7e63932c8e Lua AIs: remove commented-out debug code
(cherry-picked from commit 23f35546fc)
2018-10-07 03:24:52 +00:00
mattsc
9e5ec5f060 Experimental AI: rename config file
This stopped being a rush AI long ago.

(cherry-picked from commit ec45b53fe2)
2018-10-07 03:24:51 +00:00
mattsc
4999b20bd1 Experimental AI: adjustments to candidate action scores
The relative ranking of the CA scores is not changed, except for one case when two CAs had the same score.

Reasons:
- All scores should be lower than the scores of the default Goto CA (200,000) and the default scores of most Micro AIs (300,000).
- Break tie, resulting in uncertain order of execution, of place_healers and retreat_injured CA. Healers should be placed first, to allow retreating injured units to adjacent hexes.
- Set default for generic_recruit_engine to slightly above default AI recruiting score. That way it takes effect even if the default CA is not removed.
- Increase move_to_any_enemy CA score from 1 to 1,000. It is still the lowest score that way, but allows for setting up custom CAs with even lower scores (even if it is just for end-of-turn statistics or the like).

(cherry-picked from commit 35ba820509)
2018-10-07 03:24:51 +00:00