Play
Multi-Player
Coins
Community
Settings
Help
Community   Maps   Forum   Mail   Ladders   Clans   Recent Games
Sign In | Sign Up
<< Back to Programming Forum   

Posts 1 - 30 of 43   1  2  Next >>   
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 07:56:10

Fizzer 
Level 57

WarLight Creator
Report
For WarLight's new AI, I am brainstorming algorithms that could be used to allow it to know when and where to play some types of cards.

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. The assumption is that humans know best, so the AI will defer all cards to them unless it's in a situation where it must play cards to commit.

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.

Does anyone want to provide input at this? You don't need to know how to program -- pesudocode is fine. For example, a simplistic algorithm for the bomb card could be something as basic as this: If an opponent territory has a stack of armies greater than 3x our income, bomb it.
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 08:53:07


Bayern München is the best!
Level 58
Report
Hey,

I'm sorry my question is not about the subject of this thread,but here's my question:
Could the previous AIs use cards with a human teammate?

P.S. Good luck with the algorithms
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 09:22:14

cookie 
Level 64
Report
About bomb card. It can be related to number of turns. Lets say If turn 2 if AI see 12 troops bomb it. But in turn 3 he need to see 15 troops to bomb and turn 4 four 18 troops. Also we can put some luck to his decision. So he will not be predictable.
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 09:51:25


Master Ryiro 
Level 62
Report
for me,conditions for blockade card are:-
1.blockade most preferably on chokepoints
2.no. of armies to be blockaded always greater than 3 times the income that can be gained from the bonus used for blockade for bonuses upto income 6.
3.blockaded armies should be more than
(opponent's stack seen on the border+opponent's or your income+re-enforcement card-1)*(0.6)
for example if your income is 12,opponent's stack is 12(you assume opponent's income is 12 unless you know what it is) and card piece +5 then the blockade should be
(12+12+5-1)*0.6=16.8~17
so blockade should be of atleast 18 armies in that situation
0.6=offensive killrate,this should also vary with the settings,so instead of 0.6 offensive killrate in the algorithm should be better

now when to blockade and when not to-:-
1.if the territory cannot be defended eventually with both players deploying all on the border
2.when there are re-enforcing stacks coming to defend,do not blockade,or make a small bolockade to trick the opponent.
3.if the opponent started in that bonus but cannot complete it in atleast 2 turns,attack the border territory and blockade next turn
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 10:33:22

Hasdrubal
Level 56
Report
If you didn't notice, on some maps AI cannot find front line, so, blockade card is not an option. If AI had larger armies about 4-5 provinces behind front lines, it won't move them, or would move them on random location. Using blockade or Em blockade card by AI may prevent it to exploit good situation.
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 10:40:42


DanWL
Level 61
Report
You should use an Emergency Blockade Card when you know your going to be attacked, but where it'll be affective as well. You want to sevearly reduce the opponents' stack or get rid of it compleatly.

Use when your stack+your non-spreading income)*Abandon %>(Opponent's stack + their visable income+predicted income used spreading).

For example when:
Opponent's stack is 30;
Opponent's visable income is 12;
Predicted opponent's income used for spreading is 3;
Abandon % is 300;
Your stack is 2;
Your non-spreading income is 12.

(5+12)*300%>(30+12+3)
17*300%>45
51>45

Assuming the opponent attacks:
Opponent looses about 35 armies, leaving them with 45-35=10 and the abandoned territory has about 27 armies left. (This assumes pure skill, no luck.)
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 13:12:53

Алексей
Level 60
Report
Blockade Card and Emergency Blockade Card
Use only to spoil bonuses that we can not defend or recapture. I guess AIs will never be good at determining if a choke point is worth blockading.
The number of armies to use is hard to guess - the AI developer will tune it after testing. It is sometimes enough to use 3 armies with 350% blockade to spoil the bonus forever and sometimes dozens of armies do not stop the enemy.
Do not use non-emergency blockade on a territory that borders an enemy.

Diplomacy Card
Use only if there is more than one enemy. Do not use the card if the sum of attacks on us last turn is less than our income. Use on the enemy who has max(sum(armies attacking us last turn)).

Bomb Card
Use on the biggest enemy stack once it has twice your income. There is no point in waiting it to triple. Just bomb and attack. Do not wait for the enemy stack to grow if we have more than one card, bomb this 1 army (if it is the biggest enemy stack) and capture the territory 1v0.

Gift Card
Use if an ally does not border any enemy. Use on a territory in a broken bonus. Use on a territory that does not border an enemy but is 1 territory away from them.
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 16:05:19


MightySpeck (a Koala) 
Level 57
Report
What if we could play a card for our AI (make them blockade something or gift)
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 16:19:11


muddleszoom
Level 58
Report
i think ais should always e able to play a gift just in case you are in danger
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 16:24:03


GeneralPE
Level 56
Report
What if we could play a card for our AI (make them blockade something or gift)


I would like that, but I don't know if it would fly, since your pretty much just playing as one guy then
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/10/2016 16:52:23


Norman 
Level 57
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


tomjh
Level 55
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 57
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 57
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 57
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 60
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 59
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 60
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 59
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 59
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 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

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 57
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


Sverdsønn 
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/11/2016 20:30:36

Semicedevine
Level 59
Report
Pseudocode it shall be then:

If opponent's territory has more than 2x my income and if this territory's stack exceeds all other territories, bomb it

As in, only bomb territory with the most armies?

In a sense, the A.I. sorts opponent territories based on the amount of armies it has and bombs the one with the most. This process repeats for all bomb cards until the A.I. runs out of territories that have more than 2x it's income.

Edited 3/11/2016 20:32:17
How should AIs use Blockade,Gift,Diplomacy,Bomb?: 3/12/2016 07:31:22


chuck norris
Level 58
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 57
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 42
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 40
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?
Posts 1 - 30 of 43   1  2  Next >>   

Contact | About WarLight | Play Risk Online | Multiplayer Strategy Game | Challenge Friends, Win Money | Skill Game | Terms of Service