Big AI flaw with dead leaders factions

Discussion of all aspects of multiplayer development: unit balancing, map development, server development, and so forth.

Moderator: Forum Moderators

sacredceltic
Posts: 55
Joined: October 20th, 2013, 4:07 pm

Re: Big AI flaw with dead leaders factions

Post by sacredceltic »

Calling team "side" does not help your argument.
No, because it applies to teams, but also to single players. A SIDE is either a player alone or a team playing against other SIDES. In WWII, Italy was on German SIDE, while USSR was on the British SIDE. One sides by its allies or by oneself, when it has no allies...
If you don't understand proper English to start with, it's hopeless...

If you had read me properly, I had precisely defined what I was talking about, and I made a point explaining I was NOT speaking of dead ALLIES of factions that still have a living leader (of course, these dead allies must still fight on for the alliance !), but that I was speaking about dead SIDES, ie, a single player or a team that have no more living leaders but that still have remaining troops on the field.

So the problem is with AI not giving priority to fighting LIVING SIDES, and subsequently wasting time and energy fighting remaining troops from DEAD SIDES.

Do you understand the issue now?
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Big AI flaw with dead leaders factions

Post by zookeeper »

For clarity: in Wesnoth, "side" explicitly only refers to a single player, and "team" refers to teams of one or more sides.
User avatar
Ravana
Forum Moderator
Posts: 3002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Big AI flaw with dead leaders factions

Post by Ravana »

Proper English does not really matter here. In wesnoth side is object that might have units, gold, recruits and other stuff. Team is collection of one or more sides that can not attack each other normally.
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: Big AI flaw with dead leaders factions

Post by tekelili »

sacredceltic wrote:Do you understand the issue now?
Both Ravana and me are WML initiated, so forgive us for be aware about meaning of tag [side] and its game implications. Anyway, I still dont see a logic explanation to build an algorithm that weigth threat from units on "dead teams" controlled by human players from AI.
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: Big AI flaw with dead leaders factions

Post by gfgtdf »

I also dont see how it bad in FFA game to try to take the villages of the dead player first before attempting to attack the other players. Take for example the most common mainine 5p FFA map: auctionX. If you are in the middle and have already one player dead is seem to be a valid strategy to defend your center caslte and and go take the dead players villages at the same time, specially becasue they are hard to access by the other players so it's rather easy to defend them after you took them.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
sacredceltic
Posts: 55
Joined: October 20th, 2013, 4:07 pm

Re: Big AI flaw with dead leaders factions

Post by sacredceltic »

I still dont see a logic explanation to build an algorithm that weigth threat from units on "dead teams" controlled by human players from AI.
I don't understand your "controlled by human players from AI". It doesn't make sense. What is a "human player from AI"? I think you still don't get it.

Whether you see it or not is irrelevant. It's a big flaw anyway that makes fighting against AI boring. Maybe you don't care that Wesnoth is boring to others, because you're always playing your fine-tuned scenarios based on AI flaws (how exciting !), but maybe others do care.
For clarity: in Wesnoth, "side" explicitly only refers to a single player, and "team" refers to teams of one or more sides.
That does not bring any clarity to the matter. In a war, there are factions that take sides, forming alliances or not. If you're alone, you're not a team, but you're still a side... Calling a single player a team doesn't help at all!

Maybe AI is flawed because not everybody understands English vocabulary the same way? I wouldn't be surprised...
User avatar
Ravana
Forum Moderator
Posts: 3002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Big AI flaw with dead leaders factions

Post by Ravana »

Maybe you don't care that Wesnoth is boring to others, because you're always playing your fine-tuned scenarios based on AI flaws (how exciting !), but maybe others do care.
No personal attacks please.

Current topic seems to be continuation of viewtopic.php?t=39496.
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: Big AI flaw with dead leaders factions

Post by tekelili »

sacredceltic wrote:Whether you see it or not is irrelevant. It's a big flaw anyway that makes fighting against AI boring. Maybe you don't care that Wesnoth is boring to others, because you're always playing your fine-tuned scenarios based on AI flaws (how exciting !), but maybe others do care.
If I didnt care about others game experience I wouldnt have wasted time coding add ons. I also care about AI behavior as source of fun, and I just disagree from your point of view as someone that desires best for BfW. Your demand affect not only scenarios you use to play, but also a lot more. I dont see why is out of agenda point that your change in AI behavior has not sense at all in some of them. If some scenarios would enjoy different AI behavior, then you should claim their designers achieve it, instead claim a general change that doesnt fit any wide target.
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
sacredceltic
Posts: 55
Joined: October 20th, 2013, 4:07 pm

Re: Big AI flaw with dead leaders factions

Post by sacredceltic »

@Ravana
No personal attacks please.
oh, repeating what a debater said of himself is a personal attack, now? What is that for a censorship?
Yes, I think most scenarios, precisely because they're based on AI flaws are boring. It's not a personal attack, it's an opinion.
Whenever I mention any flaw, I'm being told that it can't be changed because it's going to ruin these scenarios that are all based on those flaws. The fact is that not everybody finds these scenarios and campaigns interesting (precisely because they're based on flaws) and other people would like to enjoy a better gaming experience while playing multiplayer games against AI or a mix of AI/human players.

If you want Wesnoth to continue to attract interest, both from players and developers, you should better take heed of different opinions, rather than doing all you can to shut them up.
User avatar
Gyra_Solune
Posts: 263
Joined: July 29th, 2015, 5:23 am

Re: Big AI flaw with dead leaders factions

Post by Gyra_Solune »

Programming AI is hard! Major developers with millions of dollars and some of the biggest professionals in the industry still often completely fail to get a computer to act in a realistic way. This is an open-source development with no budget whatsoever outside the infrequent commission and project done largely out of charity, where our programmers are either beginners or people doing this in their spare time.

With that in mind, the priority for developing the AI isn't to have them be properly strategic, it is to have them put up a fight, largely in context of single-player campaigns and survival scenarios. It is such an enormous effort to get them to think on the long scale that it's not worth all the hassle - instead, they are designed to be as good as they can possibly be at a raw offensive. The AI is not programmed to think about winning or losing first - the AI is programmed to survive first and foremost, while moving in the general direction against their enemies. When a side's leader dies, they don't see it as 'okay the units belonging to that side are not as big a threat', they see it as 'there are enemy units - these are the most exposed targets and these are the best odds we have at doing the most damage'. If they aggressively pursue a leaderless side, it's not because they're majorly bugged to still pursue a decapitated enemy, it is because they see the units belonging to that side as being the most exposed. On the flip side, an AI side without a leader is programmed to play more conservatively and opportunistically, both because this is as much as they can do now that they have no new source of allies, and to lessen the impact of an AI recklessly pursuing another AI with minimal benefit.

It would be wonderful if we could get the computer to think on a grand strategic scale! But we already struggle enough with basic tactics - as stated, AI struggles to even understand Zone of Control and time of day, some of the first concepts a human player learns. You can see this even in the design of some of the major factions - Orcs are very flexible and have no outstanding weaknesses while being bulky enough to survive mistakes, while Undead have resistances to most common weaponry and tend to benefit more than others by making big risks and being seemingly recklessly offensive. Both also are more dramatically swayed by time of day due to Orcish Grunts and Dark Adepts attacking with a small number of hard-hitting attacks, and the math for ToD makes the bonuses and maluses more dramatic the higher the base damage is (by contrast, units like the Duelist are barely affected at all since they only get 1 base damage per strike either way, which means the AI struggles to really get how they're used - hence why you rarely see them in campaigns). This comes about in part because these factions were designed from the perspective of being the most common units an AI will control in a single-player campaign. It is not a priority to get AI competitive from a multiplayer perspective since that is a niche scenario - it IS, however, the imperative to make them competent as an enemy side that is designed to put up a fight but ultimately get defeated, since AI are the sole opponents in single-player campaigns and therefore must shine there (do also note that AI almost never has to contend with what to do when an enemy side's leader is dead but their units remain - it's usually several teams of them against one human player).
sacredceltic
Posts: 55
Joined: October 20th, 2013, 4:07 pm

Re: Big AI flaw with dead leaders factions

Post by sacredceltic »

The AI is not programmed to think about winning or losing first - the AI is programmed to survive first and foremost, while moving in the general direction against their enemies. When a side's leader dies, they don't see it as 'okay the units belonging to that side are not as big a threat', they see it as 'there are enemy units
That's indeed the problem.
(do also note that AI almost never has to contend with what to do when an enemy side's leader is dead but their units remain - it's usually several teams of them against one human player).
Sniff. Bye bye Wesnoth!
User avatar
Gyra_Solune
Posts: 263
Joined: July 29th, 2015, 5:23 am

Re: Big AI flaw with dead leaders factions

Post by Gyra_Solune »

I am not sure what you mean by that. The sentiment was made to point out how the big flaw you have mentioned (that AI attacks leaderless units too much) is almost never a situation that happens in campaigns that the AI was designed for (where usually the only opponent they have on the field is you, and if your leader dies it's game over). It is only going to pop up in multiplayer scenario maps, which were designed primarily for human usage.

If there is an algorithm you have in mind for how this ought to be, please do share it. Just keep in mind that when it comes to programming video games, even simple things can be exceedingly complex to execute. Wesnoth is, by no means, a complicated game, in fact one of its strengths is its simplicity and elegance, but with every single version there are bugfixes to be had, adjustments to be made, aspects to be rebalanced, and so on, despite this game being continuously worked on for over a decade. There has been an enormous amount of effort to get the AI to even function as well as it is right now - the changes you propose are of an enormously huge and revolutionary scale that we just do not have the resources to accomplish, barring some incredibly clever and tricksy use of code.
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Big AI flaw with dead leaders factions

Post by Pentarctagon »

I kind of feel like this thread is going in circles.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: Big AI flaw with dead leaders factions

Post by iceiceice »

Wow, this thread got very busy while I was gone.

So, let me say this, sacretceltic, I'm actually quite sympathetic to many of the things that you said. Also some of the things that I said were not phrased in the best way. So let me try to recap and explain what I now take away from this.

The issue is the AI behavior regarding team games in which the leader of some side is dead.
  • Troops from defeated sides usually keep themselves in villages. They attack you only if you come next to them and they assess they're stronger. Otherwise, they leave you alone.
    So the first thing is, this is a behavior of the default AI. But not necessarily a human opponent whose leader has been killed, or a different AI algorithm. But with that in mind let's continue
  • Since the villages they occupy are as much a liability for your remaining actual ennemies with living leaders than for yourself, you should just ignore them and focus on defeating still living leaders. The condition of victory is the defeat of leaders, not of their remaining troops.
    This is true -- in many scenarios, if there are a bunch of immobile units squatting on villages that pose no threat, and you have the opportunity to wipe your enemies out with a quick strike, you should ignore those villages. And you might hope that the AI might play that way.
  • We can't just hack common sense into the AI,



    Maybe not you, but surely somebody else can. It's just a matter of setting goals properly, ie, setting the priority on attacking still living leaders faction's troops (again, I'm not speaking of situations where a dead leader's faction is still allied with a living one, because, of course, in this case, it's the whole alliance that must be taken into account and considered as a unique ennemy)
    Sure so, what you are talking about, would be, I suppose, modifying the "attack" candidate actions routine and just decreasing the attractiveness of attacking units whose leader is already dead. Someone could do that, and it might have the effect you seem to desire.
The thing I'm trying to point out is that, this change would affect a huge number of scenarios. It's not really enough when making AI changes to say "it's common sense that this is often a good idea, so that's what the AI should always do." I mean think about the other example I gave, where the AI always declines to attack a unit that is about to level. It may be that it's *often* a good idea not to attack that unit, but it's certainly not always true -- that's why it's arguably a flaw that that's how it works.

What exactly are the situations where your proposed change would be a good idea?

1. An enemy side has lost its leader
2. That side is controlled by AI.
3. That side is controlled by the default AI, and not some other AI algorithm.
4. It's actually true that the AI wants to end the game quickly and not capture the villages held by the defeated side first. (Which might help it to win.)
5. The AI doesn't HAVE to defeat the units of the defeated side anyways -- maybe because of the layout of the map, those units are stuck in between it and its other enemies. If it refuses to attack those units because its trying to get to their allies first, but there is no path to the allies, the AI may get "stuck" and decide not to attack anything anymore, thus ruining the game.

What I'm trying to point out is, I think this is not really "universal" common sense, rather its just situationally a good idea, one of many possibly concerns. IMO, it's sort of risky from an engineering point of view to start introducing rules that cause the AI not to attack things -- from the programmer's point of view it's a lot easier to ruin a game by forcing the AI not to attack when it could, than from making it attack too often. So while someone like me *could* hack in some kind of parameter like you are saying, I'm not going to do that because I'm not convinced right now that it would work very well or be worth it.

You might say, oh fine but then can't we have some kind of configuration option?

And I guess my answer would be, if that's how we dealt with it every time someone observed a common-sense flaw in the AI, so that we end up with say 5 or 10 different AI options to enable / disable these various patches people made... it's risky from a software point of view because each patch needs to be compatible with all combinations of the others if they are all optional... and testing that and guaranteeing that is likely to be very difficult. And if you have a collection of options like this, it may end up being too confusing for most UMC folks who are supposed to be the beneficiaries of a change like this.

If you want to fork the default AI and maintain your own preferred suite of patches, I mean that's something someone could do.

But I guess the other thing I would say is, look, what you are proposing here is that the default AI should exploit special knowledge of how the default AI plays, when it is playing against itself. And the special knowledge is, once the leader is defeated, the remaining units tend to do nothing. Maybe *that* is the bug here, and not the fact that the AI doesn't know to exploit this bug?

Honestly I would be generally very leery of programming something into the AI like "if I am playing against myself and situation X occurs, then apply the following special rules..." because that is not very nice to a subsequent programmer. What if a subsequent programmer makes a change that changes the entire assumption of this patch, that the AI mostly doesn't do anything once its leader is dead? Then by changing the AI's behavior in one place, he may end up changing it also in this completely different place, through this convoluted path that he wouldn't expect.

So, I don't mean to be dismissive of your idea entirely. I think there was more to this idea than many of the other AI bug reports that I read in the past, and it's indeed plausible that someone could write this patch. Also I do agree that the project is generally too conservative and has too much inertia nowadays. But I still think this idea needs a lot of work, and ultimately, its a lot more work to carefully think through things like this and then code them up than it is to just make up ideas like this based on a few games you played. When you make a proposal like this, you need to anticipate that people will expect you to do a lot of work and make a very strong case especially if your expectation is that other people will do the work of making it happen.

And like many people point out, its probably better to right away frame the discussion as being about a new experimental AI, rather than about fixing a bug in the current AI. Otherwise you just have to expect push-back from people whose addons might be broken by a change like this.

It's possible that I also just didn't understand you as you seem to say, I mean ultimately I'm reiterating what tekelili said here in more detail:
but you still have to convince me about (not that your behavior is better for some scenarios) it is better for any scenario.
So if that's what happened, you're welcome to try again, but I did try to read it quite carefully.
sacredceltic
Posts: 55
Joined: October 20th, 2013, 4:07 pm

Post by sacredceltic »

@iceiceice

Since you carefully took the time to read me. I'll try to re-explain the issue I was raising, as you kindly requested.

Take ANY multiplayer game implying more than 2 sides and more than 1 AI (I'm not speaking of specific scenarios or campaigns, but just random terrains).
Say for instance, we're 3 human sides and 3 AI sides, in a free for all (no alliances of any sort), so there are 6 sides opposing every other.

The behaviour I'm pointing at as being defective and counter-natural is the following, and is one of the MAIN reasons, why humans ALWAYS win against AIs, regardless of the advantages (more gold, a better terrain, ...) you give AIs over human players.

The GENERAL AI behaviour is the following : each time a side is defeated - ie its leader is killed - human or AI, it will still have remaining troops on the field. These remaining troops, as I noticed with standard or Strong or Experimental AI, tend to find the first village and remain in there until they're attacked and killed OR until a weaker unit is at range and they attack it, and, if they succeed, go to the next village to heal, or, if they fail, escape and find some village where to heal.

When it comes to the remaining players with still living leaders, the difference between a human and AI is the following : as a human, I will NEVER waste time chasing the remaining troops of a dead side, because I want to focus on sides I still need to beat, ie: sides with a still-living leader.
Why ?
1) because I need to re-organize my troops in this new configuration (say, before, I had 5 ennemies. Now, 1 is out, I re-organize against the 4 remaining, re-distributing the troops that were formerly engaged against the dead one)
2) because a village occupied by a remaining troop from a dead leader is as much a liability to me as to any of my remaining ennemies. ie, it's of NEUTRAL value.

The ONLY circumstance under which, as a sensible human, I would attack a remaining troop of an already defeated side, would be to to gain a quick level upgrade, but on 2 conditions :
a) my troop about to upgrade cannot hit an ACTUAL REMAINING enemy instead, because it would be more useful to achieve the goal of defeating still-living leaders' troops while upgrading at the same time, rather than just upgrade.
b) the troop I'm going to hit will not end up being stronger than my troop after the attack (they can still upgrade at the same time too!) and able to kill my troop in retaliation.

Outside of these VERY SPECIFIC AND LIMITED circumstances, I would NEVER, as a sensible human, WASTE TIME chasing remaing troops of defeated sides.

However, that's what AI does ALL THE TIME. AI doesn't make a difference between remaining troops of enemy defeated sides and troops of enemy still-living leader. So any human can take advantage of that, and that's what I ALWAYS end up doing (actually, that's why finishing a multiplayer game against AI sides is SO boring) : while AI is busy trying to kill every remaining troop of already defeated sides (which they sometimes much fail to do, because remaining troops often are experienced and ready to upgrade...), I just avoid their troops engaged in that process and focus all my troops on stealing their undefended villages and attacking their leaders. Deprived of their precious troops, already busy with remaining troops of defeated sides, I just chop them down one by one. A sure (and MUCH BORING) win...

Actually, what I do each time, is the following : I avoid fighting until at least one side is already defeated by an AI player, and I aim at the AI side that defeated it, because I know that :
1) it will have paid a dear price to achieve the 1st defeat.
2) it will waste its time trying to clear out the remaining troops of its already defeated enemy, rather than to regroup to defend its leader.

Meanwhile, I attack its leader.
Then I go for the next one... Once I've eliminated the AI players, and having taken most of their villages, I focus on the remaining human players in a position of force.

QED
Post Reply