absolutely must read Ai of DoPW.

If you have a question about the git repository and the code, or if you have code to propose then please post in this forum.
Do not post request here.
Locked
Zethfox
Posts: 3029
Joined: Thu Jun 10, 2010 11:28 pm

absolutely must read Ai of DoPW.

Post by Zethfox »

http://www.wizards.com/magic/magazine/a ... feature/44

just HAD to share this.
*winks at mike* yeah mike, what i discussed with you earlier last week about Ai and seeing into the future :P
mnguyen
Posts: 229
Joined: Thu Apr 29, 2010 4:13 pm

Re: absolutely must read Ai of DoPW.

Post by mnguyen »

yup this does everything i told you about how the ai should behave. If we could strive for this approach it would make the AI much harder to beat.
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: absolutely must read Ai of DoPW.

Post by wololo »

I've been told a while ago that the AI on the xbox 360 for DotP was not as good as the one in Wagic... can't find that comment anymore, and not sure if it's really true :mrgreen:
And we're talking of hardware that is between 10 and 20 times stronger than the PSP...
mnguyen
Posts: 229
Joined: Thu Apr 29, 2010 4:13 pm

Re: absolutely must read Ai of DoPW.

Post by mnguyen »

One thing I'd like to point out though about AI difficulty in general. AI's MUST always play by the same rules as any other player. Otherwise you are breaking the rules. Handicaps are typically done in terms of scoring as in other games like golf, tennis, as well as card games. Why that is important is that as soon as the AI has an advantage over the player that the player can't have, it changes the game. In Wagic, not knowing what a player ( AI or Human) has is key to the game. Never should the AI or player know what the other has outright. Any fore knowledge of this (without prior experience) is essentially cheating. The AI should model what a human player could do. It's advantage is the compute power and instant memory over the player. Note over the course of a game the AI should be able to make intelligent decisions based on what is legally available to it. This article describes exactly that. I believe we should model Wagic's AI in a similar fashion. Notice that nowhere in the article is the AI ever given something that a player can't have. (ie starting with mana in play, knowledge of the players hand, etc) I've had a discussion with Zethfox a while ago about this. This article only strengthens my argument. The AI should/can run different scenarios to determine what is possible. Now the PSP may limits it's ability to do any kind of DFS or BFS type algorithm as suggested in a different thread. But that doesn't mean an alternative doesn't exist. viewtopic.php?f=32&t=2421
One thing that is nice about Wagic's AI is that it is a learning AI. It is adaptive over time and definitely needs work as it is too easy for some to beat and does some "stupid" things. This is largely due to the complexity that is Magic. There are so many possible ways to attack a problem that the AI has not learned or know how to handle. (ie combos, synergies, predictive reasoning) For that matter, even human players don't know how to necessarily either. It'll take time but in order for Wagic's AI to truly stand the test of time, it needs to play like a normal player. No card game that is based on knowledge ever gives away or is given advantages this way. Poker, Blackjack (variation on Poker) the only advantage you can ever be given is by card counting. In Vegas, players are dealt cards face up. Which would seem a counter argument to what I just said, but it really isn't since the dealer is not allowed to use that knowledge to his/her advantage. They must follow rules based on what cards they have in play. (hit on soft 17 or anything below 17 and stay on everything else)

In regards to the handicap for AI based on difficulty, I'd suggest instead of giving the AI lands as the handicap, we alter the starting life points or poison counters of the AI/player or win conditions. This is more along the lines of a true handicap as it doesn't change the rules of the game by giving a player/AI an unfair advantage with starting mana.

Here's one proposal to how to affect the game based on difficulty settings.
"Normal" -> no changes
"Easy" => "AI starts with a lower life count than 20 or the player starts with something higher like 30 ( ie Archenemy does this)
"Hard" => AI has more life points than the player ( 30 vs 20 )
"Evil" => Player starts with 5 poison counters or 10 life points or both.

some variation of these suggestions seems more appropriate as they do not actually alter the game outside of current Magic rules.



--Michael
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: absolutely must read Ai of DoPW.

Post by wololo »

I've seen lots of games were the AI has an unfair advantage and it didn't make the game less fun.
On top of my head; Advanced Wars on the GBA. The last level of each world gives the opponent an extra unit at every turn (imagine if the AI had an extra random creature coming on its battlefield every turn). This doesn't make the game any less fun.

I'm not saying I'm in favor of the AI cheating. But I think the current cheats we have are very minor: difficulty setting, by adding a land into play, is done intentionally by the player who knows what the setting does.
The changes added by Zethfox are minor in that sense imo. Letting the AI get a free mulligan when the AI has been several times beaten by your deck seems fair to me, it helps re-balancing the game.
If/when we can mange to have a competitive AI, then we won't need a difficulty level anymore, the AI should be able to adapt to the player's level.
Zethfox
Posts: 3029
Joined: Thu Jun 10, 2010 11:28 pm

Re: absolutely must read Ai of DoPW.

Post by Zethfox »

just explaining the whys or what i added....
i absolutely 100% wanted to steer as far away from this type of balancing as possible in the main game.
Here's one proposal to how to affect the game based on difficulty settings.
"Normal" -> no changes
"Easy" => "AI starts with a lower life count than 20 or the player starts with something higher like 30 ( ie Archenemy does this)
"Hard" => AI has more life points than the player ( 30 vs 20 )
"Evil" => Player starts with 5 poison counters or 10 life points or both.
giving the Ai a "decent hand" note i said decent because even with the system i added it can still end up with a TERRIBAD hand. the difference is that it will be a bad hand it can actually pay.

i found that when i was stomping ai decks left and right it was because the Ai ended up with a hand that contained no early blockers, no low cast spells, and or no lands.

the Ai wouldnt have anything for the first 6 turned. by turn 8-10 Ai would be dead.

the system i added doesnt go searching for the best cards in the Ais deck however i did think about doing it that way.
it simply gives ai a hand that can actually toss down a blocker, cast something, and put down a land for the first 3 turns.

it is not a game breaking epic cheat.

personally i played with this change for 2 weeks before deciding that this type of change is exactly what wagic needed for our current Ai, it doesnt make it invincable, however i would mention my first draft of it made the Ai decks impossible to beat, i had to tone it down because wololo was against it, i think his exact words were along the lines of "people are already complaining the Ai is too hard, i dont want to make this game impossible for new players to enjoy"

exact numbers, my best decks with a 70% win ratio dropped drop to about 24% win ratio with the first draft. my worst deck had gone from a 40-50% win ratio down to about 5% win ratio.....this was TOO dramatic.

the idea then evolved into what i made now, a decent starting hand for decks listed as "easy" to beat...and a ok hand for "normal" for just a slight increase in Ai...and in hard to beat decks, no bonus at all.


the last thing i want to ever see in wagic is that when i beat a deck 4 times, suddenly that deck has 40 life, and i start with 2 cards and 7 poison counters. this is the very last thing i would ever want for wagic.

also on a side note, please do not confuse the difficulty setting with the difficulty rating of a deck, the setting is set by a player. i told wololo that my opinions of that current "setting" modes with extra lands in play were bottom of the barrel.

the difficulty is the rating given to an Ai deck based on the % of victories that the player had with a given deck. this is where my change activates. not the difficulty setting...

i think i actually suggested to wololo that i commit the change based on the setting at first, but it evolved into a overall change based on rating instead.

as for comparing the 2, wagic is slightly better in some respects, however DotpW does take into account things that wagics current engine cant do of course due to maxmin....over all tho they both suffer slightly from lack of not really being a human, the Ais both dont have a concept of combos, or synergie in thier decks....this is something hopefully in the future we can teach our Ai.
mnguyen
Posts: 229
Joined: Thu Apr 29, 2010 4:13 pm

Re: absolutely must read Ai of DoPW.

Post by mnguyen »

wololo wrote:I've seen lots of games were the AI has an unfair advantage and it didn't make the game less fun.
On top of my head; Advanced Wars on the GBA. The last level of each world gives the opponent an extra unit at every turn (imagine if the AI had an extra random creature coming on its battlefield every turn). This doesn't make the game any less fun.

I'm not saying I'm in favor of the AI cheating. But I think the current cheats we have are very minor: difficulty setting, by adding a land into play, is done intentionally by the player who knows what the setting does.
The changes added by Zethfox are minor in that sense imo. Letting the AI get a free mulligan when the AI has been several times beaten by your deck seems fair to me, it helps re-balancing the game.
If/when we can mange to have a competitive AI, then we won't need a difficulty level anymore, the AI should be able to adapt to the player's level.
I'm not oblivious to those types of advantages. However, that is slightly different because that still isn't changing the game. It adds more creatures/opponents you have to fight b/c the nature of the game is a FPS or strategy type game based on units. It's not really considered a "cheat", but rather a function of difficulty. Making a boss tougher or your weapons weaker is a function of scoring. Not in the sense of points, but in terms of damage. Adding units is unfair, but AW like any other turn-based(?)/real-time(?) strategy game, is scenario based. This is based on some campaign or story right? It's not based on a randomized draw. You can argue that adding a unit per turn is part of the scenario as the opponent has advanced production techniques to be able to bring in a unit each turn. Having not played it I don't know all the semantics. But are these units randomly generated or does each turn bring about a specific unit? I've had my fair share of games that did that type of stuff. After thinking about it some, I don't think they actually violate the rules. As a counter point, think of games like Starcraft or Warcraft, the campaign modes give the AI lots of different advantages, but you don't ever see that in any of the quick match or hot seat modes.

Magic is a knowledge and hand draw based game. It's difficulty is directly related to what knowledge the players have of the board and other player. The amount of mana you have is solely based on your draw. Now if the AI were able to do mulligans (don't know if it is currently possible) then it could mulligan until an "acceptable" hand is drawn like a real player. Unless you are in story or campaign mode where things are scripted or controlled I think these types of advantages are not optimal. I agree that AI isn't all that "smart" yet. Consider other game AIs. To get around a super AI, the programmers put in AIs that are goal oriented. For instance in games like "Colossus" ( a Titan clone. http://colossus.sourceforge.net ), there are a variety of AIs. Each have a distinct personality. We could do the same sort of thing for Wagic. I think this may even give us a way to really improve the AI as we could have AIs that model behaviors defined in many of the Magic articles I've recently come across. "Johnny", "Spike" and "Timmy" like AIs could be programmed. Each could be very distinct and give the game more flavor.

--Mike
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: absolutely must read Ai of DoPW.

Post by wololo »

mnguyen wrote: To get around a super AI, the programmers put in AIs that are goal oriented. For instance in games like "Colossus" ( a Titan clone. http://colossus.sourceforge.net ), there are a variety of AIs. Each have a distinct personality. We could do the same sort of thing for Wagic. I think this may even give us a way to really improve the AI as we could have AIs that model behaviors defined in many of the Magic articles I've recently come across. "Johnny", "Spike" and "Timmy" like AIs could be programmed. Each could be very distinct and give the game more flavor.

--Mike
I'm 100% with you on that.
One of my short term goals is to allow deck creators to influence some of the variables of the AI, in the deck meta data.
Alternatively, which might make more sense, we can create AI "personalities". They have an avatar, and a strategy (again, meta data that influences the algorithm). Then, each AI can play with all decks, but by default we associate a given AI to some specific decks (the way we associate a deck to an avatar now, except the avatar would now become an "ai")...
Locked