<< Back to Programming Forum   Search

Posts 11 - 30 of 42   <<Prev   1  2  3  Next >>   
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 16:52:23


Norman 
Level 58
Report
Hello

The question is very general and assumes that there is a common understanding about how a WarLight AI is supposed to work what can't be the case. The strength of most game AIs comes from two factors, namely their evaluation function and their ability to look deep into future configurations (mainly minimaxing with lots of optimisations). However a reasonable fast WarLight AI is only capable to look mainly into the current configuration (maybe with some local lookaheads) and the playing strength only comes from superior heuristics.

This explanation shows that two of those card problems are much more difficult than others, namely:
- Blockade Card
- Diplomacy Card
Both of those cards don't affect the current board but the board next turn. If your bot has no explicit understanding about how the board should look like next turn then it's not possible to play those cards effectively.

As for the other cards I don't see the cards as a separate problem to solve but as an integrated part of the other problems that your bot solves. For example with the order prio and order delay you solve the problem of playing those cards together when solving the problem to find a good move order.

Bomb Card
--> Your bot should have a concept about how the opponent deployment looks like. Every bot has such a concept else they couldn't attack their opponent at all. (and if the concept is just that the opponent deploys nowhere,...)

Emergency Blockade Card
--> Your bot should have a concept about where an opponent will attack. As for the Wunderwaffe this will also fit nicely into my task to prevent the opponent from taking a bonus completely over where he then can just play the emergency blockade card when he can't find any other solution.

Gift Card (assume it's on a team)
--> I can think about different situations here, for example: Only gift territories in a bonus that you don't own or in a bonus that's not valuable for you to expand into. Gift then under following circumstances:
1) Gift to a teammate who is completely surrounded by teammates.
2) Gift to a teammate who is facing elimination. A teammate is facing elimination if all his territories are bordering opponents and if the opponents would deploy all against him they could together eliminate him this turn.

Edited 3/10/2016 17:03:37
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 17:12:27

talia_fr0st
Level 59
Report
Diplomacy Cards should be played when there are:

3 players fighting the AI (use on one with projected highest income).
2 players fighting the AI, 1 of which holds a choke point (use on one not controlling choke point).
1 player fighting the AI, before Turn 3
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 18:30:15


ViralGoat 
Level 60
Report
I noticed in games with commanders that the AI does not defend his commander by deploying more, making it very easy to kill its commander. Airlifting the commander away to safety would be a great move! Also, bombing an enemy's commander then attacking it would be nice, but not all the time (so that it doesn't become too predictable)
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 18:50:17


MightySpeck (a Koala) 
Level 60
Report
Well the AI would still deploy, and attack, but you could just say can you gift that to me, and then the AI will redo it's orders so it will gift it to you.
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 20:23:22


ViralGoat 
Level 60
Report
is there a way to give commands or suggestions to the AI through the team chat? That would be amazing: Gift me this, attack this territory, blockade this, etc.
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 21:20:53

wct
Level 56
Report
First off, the AI will never play cards when teamed with a human teammate (just like it works now). So you don't need to worry about an AI taking your cards.

This is actually a real problem sometimes, when your AI team mate won't play cards even though he desperately needs them.

E.g. If I play a single-player game against teams of AIs, I usually include one AI team mate for myself just so I can 'hand over the keys' once I'm dominating all the other AIs, so that I don't have to play the game all the way to elimination just to 'win' it. If I play it right, then my AI team mate will also be dominant and will play the game to the end to clean up all the other AIs to elimination.

But if I'm playing against teams of 3 or 4, and my team is just me and 1 AI, *and* my AI team mate *never* uses a reinforce card for himself, then he will *almost always* be super-duper slow to expand, and will usually be the weakest player in the game after a few turns. On the other hand, I really don't need the cards to beat the AIs, so they are wasted on me.

The end result is that by the time I'm super-dominant and want to end the game, either my team mate is weak, or eliminated, or I had to take extra special care of him to protect him from any other AIs and allow him to expand freely somewhere. Or pump him full of troops for several turns to try to get him caught up to everyone else.

In other words, right when I should be able to watch the game play out to my inevitable victory, I have to either quit it prematurely with a 'loss', or spend several tedious turns trying to 'hand over the keys' to my weakling partner.

If only humans could *force* their AI team mates to play certain cards, or tell them "No, really, it's okay. You use it!"
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 21:42:32


ChrisCMU 
Level 61
Report
- Blockade Card

It should only do safe blockades (not on a territory that borders enemy) as it would not use proper delay tactics to limit risk.


- Diplomacy Card

Maybe proceeding a turn it can take a large bonus (where it needs to divert a majority of income to do so, rather than deploy on borders of enemy.
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 21:42:41


TBest 
Level 60
Report
@wct +1
noobie UI example. If multiple AI's just give a popup similar to that of doing a gift.
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 21:43:25


ChrisCMU 
Level 61
Report
And I agree, the AI should use a gift card when playing with a human (would need rules for that).
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 21:48:54

wct
Level 56
Report
Assume you're facing an AI which is either alone or on a team with other AIs, and they have one of these cards:

- Blockade Card
- Emergency Blockade Card
- Diplomacy Card
- Bomb Card
- Gift Card (assume it's on a team)

I need to try to come up with algorithms to determine when and where to play these cards.

Emergency Blockade would require the AI to model where they predict a big attack will come from in order to be used like more than a defensive Blockade.

You could have the AI use blockades to 'ruin' enemy-controlled bonuses that it can't afford to defend properly. E-blockades could be used this way too, I guess. Actually, that's probably the most straightforward way an AI could use them.

Diplomacy could be played between the AI and its biggest *neighbouring* enemy, especially if it is being overwhelmed by many enemies and can't afford to defend against them all. If the AI has access to the "Actual deployments" statistic, it could use the last few turns to get an estimate of its biggest enemy threat.

On the other hand, if the AI is dominating and can afford to attack a lot, then it should generally not play Diplomacy.

Other uses of Diplomacy such as to prevent access to certain parts of the map, or to force to squabbling weaklings to focus on expansion so that they both are a bigger problem for the AI's bigger enemy (assuming free for all, or many small teams), is probably a much harder thing to get working properly.

One potential problem with Diplomacy cards is that if they are too plentiful you can end up with stalemates where no one can attack anyone.

Bomb card: If the AI can predict where a big deployment will be, that would be a good way to use it. But a very simple heuristic would simply be to play it on the biggest neighbouring enemy stack.

The question of whether to hold on to a card like a Bomb is an instance of a more general problem of when to use cards vs. when to save them.

Also, there may be cases where you want to treat the Bomb as part of a larger 'attack plan', rather than just a separate tool of its own.

Gift Cards could be used either by stronger team-mates to save struggling weaker team mates from extinction, or by weaker team-mates to 'summon' stronger team mates to a heavily contested battle field.

I think they would generally be wasted merely to complete shared bonuses. Although... this would help solve one very annoying behaviour of AI teams, which is that they are especially terrible at resolving shared bonuses, since the bonus needs to be *entirely* empty before they will even *try* taking one of their team-mate's territories. If the minority team mate would simply gift away its territory, then it wouldn't matter if the bonus was empty or not, since Gift always works.

So maybe my first thought is wrong. Maybe it wouldn't be wasted. But generally, the better usage of Gifts is to help weaker team mates in battles or survival by 'teleporting', rather than merely completing a shared bonus.
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 21:56:01


TBest 
Level 60
Report
- Blockade Card
Play only if enemy have a big stack (relative to own stack and income) and there is a chokepoint or will be kicked next turn from an area. Never play if AI believes it has more income and/or armies

- Emergency Blockade Card
Same logic as blockade, but don't require planning ahead.

- Diplomacy Card
Never play. For one it is hard to adapt it to Diplos of different length. (e.g can the AI really plan 10 turns ahead and still be efficient.) Also logically a D card is played on a stronger opponent. Thus AI may end up prolonging the game when it is lost. (So it is not fun to play again) In a team game it is irrelevant whether a human or AI plays the card.

- Bomb Card
Could be, bomb biggest enemy stack, if stack is bigger than own income (+/- rng)? Something simple ought to be doable.

- Gift Card (assume it's on a team)
General rules for gifting is hard, since it heavily depend on map + other settings. (Particularly considering that AI's don't coordinate their orders. So having them close is usually a bad thing)

Edited 3/10/2016 22:05:19
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/11/2016 00:43:01


ps 
Level 61
Report
where are gui and szeweningen wall of text posts when you need them?
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/11/2016 13:51:24

Алексей
Level 62
Report
- Blockade Card
Play only if enemy have a big stack (relative to own stack and income) and there is a chokepoint or will be kicked next turn from an area. Never play if AI believes it has more income and/or armies

Blockading chokepoints is a double edged action. It can benefit your enemy. The only safe way to use blockade card is spoiling a bonus that we are not planning to defend.

- Diplomacy Card
Never play. For one it is hard to adapt it to Diplos of different length. (e.g can the AI really plan 10 turns ahead and still be efficient.) Also logically a D card is played on a stronger opponent. Thus AI may end up prolonging the game when it is lost. (So it is not fun to play again) In a team game it is irrelevant whether a human or AI plays the card.

You are assuming this is a 1v1. Diplo card is valuable when you have more than one enemy.
You do not need to adapt to different lengths. Just Diplo the guy who attacks you most. Not the stronger guy who peacefully stands still.
Prolonging is not an issue if the AI does not use this card 1v1.

- Bomb Card
Could be, bomb biggest enemy stack, if stack is bigger than own income (+/- rng)? Something simple ought to be doable.

No, I guess one income is not big enough to bomb it. Wait till it is twice the income.

- Gift Card (assume it's on a team)
General rules for gifting is hard, since it heavily depend on map + other settings. (Particularly considering that AI's don't coordinate their orders. So having them close is usually a bad thing)

Wrong! AIs can coordinate. There are teammatesOrders in the API and the bot developer can use them to coordinate.
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/11/2016 17:10:35


Norman 
Level 58
Report
Bombing depending on hard income differences make little to zero sense. The more a map is open the less big the stacks will get and you would tell your AI to let it's bonus get broken just because the opponent doesn't have double your income at one of it's borders.
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/11/2016 19:28:28


Erllandur 
Level 56
Report
I would implent the opportunity to "command" an AI for gift-cards
In form of a sending the AI an private Message with "gift *territory-link*"

Or give the AI an Button "Gift-Command" instead of what the players has as "Private Message" to open a window where you can link the territory u wanted your Teammate-AI gift u (something like the blockade-selection-window)
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/12/2016 07:31:22


chuck norris
Level 59
Report
for gift card in a team game: if enemy has more than double the amount of armies the AI has on there border and a teammate isnt fighting anyone, gift a teamate a border (or right behind the border(your choice)
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/12/2016 10:02:07

e2718
Level 59
Report
Since nobody has mentioned this yet:

If you're into machine learning, one thing you could try doing is looking at your database of games and extract features (income difference, value of nearby bonuses, number of neighbors of important spaces, etc.) and try a supervised learning approach to try to predict whether humans would play one of those cards in a given situation. To try to simulate what a "smart human" would do, you might look at only games with highly rated players, or players that won, or something similar. This approach would probably have the most potential for the blockade and gift cards, since those are probably the two most commonly used cards. The nice part about doing it this way is that you can have a fairly complex model for player behavior with relatively little computation time. The drawback is that it's hard to intuitively understand exactly what your program is doing.
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/12/2016 21:07:45


D_M_Dodd
Level 43
Report
No NO NO and NOOOOOOOOOO!!! AIs should not be allowed to use diplomacy cards! THEY WILL ABUSE THEM AND RUIN EVERYTHING!!!!!!!!!!!
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/13/2016 16:34:29

Zahaan Ali
Level 42
Report
After more than 20 replies, I don't think you'll read this one. But still I want to give it a go. While this is in no way complete, I think it might help you classifying different situations.

Gift card
Case 1: All AIs in one team

Situation 1: One member has all territories in a bonus, except 1 which is occupied by team member. You could code it in such a way that in case of low army in that territory, you could make the AI attack that territory, but that would become too complicated.

Situation 2: Member with low army count is against enemy AI, while other member is free with high army count (For coding purposes- how about 2:1 ratio, with difference of armies more than 10). As long as bonus is not being sacrificed, then gift card can be used. It is important that army deployment in that region should be high, if it is next to enemy AI.

Situation 3: Member battling enemy on two fronts while team member is free. one battlefront territory can be gifted with high army to take advantage. This one is a bit dodgy as the situation of it happening is less.

Case 2: AI + Human in one team

Give the human full discretion, including receiving AI territory as gifts

Diplomacy Card

Situation 1: Low army count going against high army count

Situation 2: While battling two enemies simultaneously, and losing 2 successive territories (It is an indication that the AI is unable to cope a 2 on 1 attack)

Blockade Card

Blockade cards are used mostly to close choke points or make one. The important thing to note is that the blockade card is to be used when the player is at a position of disadvantage. To determine this situation of advantage, the following criteria can be used

1) Army count - 2:1 ratio of army count in favor of enemy and player holds a choke point
2) Single territory army strength - If the player is assured of losing a choke point based on current army strength (let us assume the standing army (>10) near the choke point is equal the players army count), then blockade card should be used
3) Multiple fight points against multiple opponents

Choke point can be defined as any territory that is connected to only two territories(and these are not connected to each other). The connecting two territories can also be labelled as choke points


Priority of Card Use

When multiple cards can be used in a situation, it is important to determine priority of use. I would recommend the following list

1) Gift card
2) Diplomacy card
3) Blockade card

The reasoning is based on how the card affects game-play, especially during combat scenario. Gift card allows it, diplomacy stalls it and blockade outright stops it at that moment

I hope this has helped you in any way. I wanted to ask you, how exactly are you coding the algorithms? Which language are you using?
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/13/2016 19:05:39

Fizzer 
Level 64

Warzone Creator
Report
Thanks for all the suggestions -- I read them all.

I have implemented a very basic algorithm for the Diplomacy, Blockade, Bomb, and Sanctions cards. If you want to see the source, it's in the github repo (https://github.com/FizzerWL/WarLight.AI)

If anyone wants to do further work on these, I encourage you to try out your own implementations! See https://www.warlight.net/blog/index.php/2016/02/the-warlight-ai-goes-open-source/ for info on how to get started.
Posts 11 - 30 of 42   <<Prev   1  2  3  Next >>