AI (Artificial Intelligence) - some thoughts (and perhaps someone else has ideas for improvements)

General feedback and discussion of the game.

Moderator: Forum Moderators

Post Reply
shevegen
Posts: 497
Joined: June 3rd, 2004, 4:35 pm

AI (Artificial Intelligence) - some thoughts (and perhaps someone else has ideas for improvements)

Post by shevegen »

The AI in wesnoth is, as probably most know, somewhat limited.

The thread here is not about pointing out at that fact, but more
that players can manipulate the AI.

Part of this is strategy, fair enough - but the other part is
how to make it predictable how the wesnoth AI may behave,
leading to easier games and easier wins as a result. Again:
part of this is strategy, and may be used in player-to-player
games, but I am mostly just referring to the simple ways to
exploit/manipulate the enemy AI. There are also some
campaigns and scenarios where this is not an issue,
largely due to constraints in resources or because too many
enemies appearing anyway. So this thread here is mostly
about balanced scenarios.

A particularly effective strategy, and a simple one, is what I
call the "baiting" strategy. Either place a wounded unit, and/or
a low hp unit, or a low-level unit next to your stronger units
to absorb the hits. I have been doing this just now in a scenario
where there is quite a lot of water, and regular infantry-like
units. So the enemy goes in and kills the units that I use as
bait. And then my higher level units go in and do much more
damage. This in turn means that I have a fairly easy time to
win that scenario (if it is somewhat balanced).

I do not have a good way to solve this, and I would not know
which algorithms could help here, but I think it may be useful
to add a bit of randomness or cautiousness to enemy units
sometimes. Randomness so that the player can not predict it,
and may instead make a mistake too.

For example, if 1 out of 4 events is "played" that the enemy
is NOT advancing full-speed forward but tactically retreating
sometimes, then this may counter my bait-strategy to some
extent.

I have no real simple solution either, but perhaps what may
help is to build up some different AI "profiles" that are
having some different styles to "play", e. g. more aggressive,
more cautious and so forth. The reason why I think that basic
profiles may be useful is because they may be simpler to tweak,
and we could always flip the AI a bit between different profiles
during a given turn. So perhaps the enemy is more aggressive at
the beginning, but less aggressive lateron.

There was an interesting add-on that had enemy "bosses" which
had different strengths and weaknesses. Something like this
would be interesting for AIs. For example, the "arrogant
aggressive" AI initially, but when some units are lost, the
units are behaving more defensively.

I know that there were other factors suggested in the past,
such as morale, but the usual comments were that wesnoth is
to be kept simple, so to not make it too complicated. Which
is fine. The AI itself, though, should ideally be good and
"challenging".

So the whole purpose of this thread is really mostly just to
provide some food of thoughts for whoever is able to come
up with improvements to the AI (I suppose this is one of the
harder things to do, since it does not only involve a few
static variables and methods, but an interplay of factors).
Mawmoocn
Posts: 156
Joined: March 16th, 2019, 3:54 pm

AI needs cats (and mostly dogs)

Post by Mawmoocn »

Personal opinion, I don’t think making the AI “random” would help the AI game.

Killing Defeating the AI (with the AI doing random things) would probably be quite annoying to deal with and there are people that hate unpredictability, to a certain extent.



Discarding what I said, letting the AI find counters to plans can be dangerous as ... if your goal is to kill the AI and if the AI could think for itself, the most logical way to defeat a player are to counter their goals (it relates mostly to “kill a unit” to win) which are to stop them from gaining any type of experience, play defensively (basically rotate units at a location to block player movement), attack only when the current enemy units can annihilate player units without recovery or backup, have a separate offensive team (that acts independently) to kill player units, and lastly to make it very special, set up “traps”, that should eat turns and will force a player to go very risky / aggressive with very high chance to lose because the enemy (AI) would “never” go to your desired position.

Making you lose the game because of turns / dead units. Yay!

So the AI must “understand“ what can defeat us (to make us stop playing) :lol: which really is about killing your units actions, gold and turns.

Similar to how chess works, “threats” and “feints” would not work for people who know how to counter them..... (I don’t play chess :whistle:)

Anyways, it can be exploitable predictable if you are able to “bait” the AI to do what you want if that includes levelling the AI just to kill them and all sorts of traps.

Though because most of it takes time, letting the AI learn that you have limited “time” (turns), can potentially place a heavy emphasis into AI’s favor and will always force out complaints “your full potential”.


In conclusion, making the AI “cautious” will be in their favor, assuming time is not within your hands (and if the AI do their job).

Games are made to be enjoyed beaten so.... you need a balance somewhere.


shevegen wrote: March 3rd, 2020, 11:47 pm A particularly effective strategy, and a simple one, is what I
call the "baiting" strategy. Either place a wounded unit, and/or
a low hp unit, or a low-level unit next to your stronger units
to absorb the hits.
I don’t recommend wasting units if you can save them. It’s effective but not every time.

In particular, you should “bait” healthy units and heal them to do the same thing all over again as your meat shield.



shevegen wrote: March 3rd, 2020, 11:47 pm I have no real simple solution either, but perhaps what may
help is to build up some different AI "profiles" that are
having some different styles to "play", e. g. more aggressive,
more cautious and so forth. The reason why I think that basic
profiles may be useful is because they may be simpler to tweak,
and we could always flip the AI a bit between different profiles
during a given turn. So perhaps the enemy is more aggressive at
the beginning, but less aggressive lateron.
I think “profiles” for AI can be interesting, though switching profiles would probably take a long time if it happens per unit decision.

But well (this was already stated somewhere), the AI can’t plan ahead to some extent.

So because of that, maybe... assigning a “mini” AI per “unit group (team?)” would make the AI use “profiles” more effectively than using “one” AI to decide for all units.



shevegen wrote: March 3rd, 2020, 11:47 pm For example, if 1 out of 4 events is "played" that the enemy
is NOT advancing full-speed forward but tactically retreating
sometimes, then this may counter my bait-strategy to some
extent.
To a certain extent, AI does some of it but won’t consider it if, it overrides a score of what it should do. Which is the main weakness of the AI. (if you know how to make them do it)


It’s limited to certain scenarios but you can “threaten” the AI to force them to retreat / gather more units. It always include a unit that can deal high damage on counterattack (if not wounded) and the leader being alone and broke, to make the AI forcibly retreat other units (on its control) to current leader AI’s location.

Making enemy units wounded, would also make them retreat and using Poison.

Gathering a ton of units on a certain spot, will also “threaten” the AI to take action (run away :lol: :lol: :lol: sometimes they fight :whistle:).

Most of the time, they generally want to go where your leader is.

Eh but I rarely use “threats”, because, it’s hard to do it without flying / hidden / fast / (insert specific combination) units to use this type of (insert specific “threat”) and it’s much simpler to bait and destroy :lol:.
User avatar
lhybrideur
Posts: 357
Joined: July 9th, 2019, 1:46 pm

Re: AI (Artificial Intelligence) - some thoughts (and perhaps someone else has ideas for improvements)

Post by lhybrideur »

shevegen wrote:I have no real simple solution either, but perhaps what may
help is to build up some different AI "profiles" that are
having some different styles to "play", e. g. more aggressive,
more cautious and so forth. The reason why I think that basic
profiles may be useful is because they may be simpler to tweak,
and we could always flip the AI a bit between different profiles
during a given turn. So perhaps the enemy is more aggressive at
the beginning, but less aggressive lateron.
It kinda already exist as you can change the parameters of the AI, even during the scenario. So you can for example trigger a change in the AI behavior impulsed by various parameters (events)
Post Reply