Sunday, August 11, 2019

Positive Evaluation Function - Territory AI Help


I am trying to implement some positive evaluation into my game. Let me explain.


I have a series (anywhere from 5 to 25 (might vary)) of circles (three sizes, big medium small). And each player starts with a main circle which gains 1 every turn (like risk the circles gain at different speeds, the big one gains the fastest and the small one gains the slowest). You can use these numbers to take over other circles, if the "enemy" is on this circle it does a risk thing (you fight to see who takes it over, who ever has more wins most of the time, I'm not getting into this logic as it is rather irreverent).


So this is a very basic overview of what occurs, now what I need some help with is how I can create an AI which will look at all available (and taken) circles and determine where it wants to move to. There would be circles closes to it, and circles in the enemies area and circles available and circles taken over. And it would need to determine where to move it's forces too next, and so on and so forth.


So after some research I read a lot about Positive Evaluation, which it takes all possible moves and determines the best one.


So I am wondering if anyone could help me out or give me some direction as to where to go from here. I think what I need to do is take all the circles with any forces on them, throw them into a table/array with the cords of each circle and determine which would be best, then I would need to determine how many forces I want to send and where from.


Help!


ADDITION:


Allow me to explain a bit, http://imm.io/4Xwy see that diagram lets assume the circles are sections of forces, and you gain a new force each "time interval" and lets say I want to take all my forces (I'm pink) the circle directly below me and capture it, well the AI would need look at all available circles and pick for example the big green on in the top right (since big would make more troops and its close to the "main"). I'm assuming what you said would still work? Weighted options?



Answer




I don't think I quite follow your explaination, but if I had to write an AI that evaluated multiple targets I'd do something like this:



  • create a list of all possible targets

  • pass each target to multiple behaviours, each which may return a score

    • for instance a "weak target" behaviour might return a high score if the target is not very well defended

    • a "supply chain" behaviour might reward a high score to targets that are vital links in the opponent's infrastructure



  • add all the scores together


  • attack the target with the highest score


This approach is modular and extendable. You may need to put some work into making it easy for you to tweak at run time the numerous constants you will invariably use in each behaviour.


For bonus brownie points, you could return multiple scores in multiple categories (eg seperate scores for how much of a defensive attack this might be, and how much of an aggressive one). Then you could define a personality of your AI as a series of multipliers to these scores (an aggressive AI might have personality [0.5, 1.5] for instance, to boost aggressive targets and relatively ignore defensive targets). You pick the target with the highest of any type of score.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...