[ian-reeds-games] Re: helping players to help the AI

  • From: "Allan Thompson" <allan1.thompson@xxxxxxx>
  • To: <ian-reeds-games@xxxxxxxxxxxxx>
  • Date: Mon, 1 Apr 2013 17:58:08 -0400

Hi Ian and Carlos,
If this is what I think it is, then this is very exciting! 
I just wanted to get some clarity on some thing first.

The ai_enemy_within will work just fine, thanks for considering that.

The random selection of skills, where each skill has an equal chance of being 
selected is not part of this, right? I mean a priority list would kind of ruin 
that, so I am assumeing that is  a diffrent and separate flag.

So for Carlos's idea, there is a list of skills, and they recive priority based 
on order, which overrides, so to speak, the hard coded groupings of skills Ian 
has implemented int he game, did I get that right?

so if that is the case, then units would be getting these priority lists, and 
they would perform them based on whatever the map maker wants. 
So in other words, a warrior woudl be given a priority of attacking skills 
first, while a wizard would be given a set of spells first, and a range might 
have ranged attacks first, and a cleric would have healing first, I mean, in a 
general sense. 

Or am I totally getting the wrong idea from this? I am having a hard time 
wrapping my brain around it. I was thinking range was the issue, but I was way 
off, so Sorry Carlos. 
 
al  


al

 
"The truth will set you free"
Jesus Christ of Nazareth 33A.D.
  ----- Original Message ----- 
  From: Ian Reed 
  To: ian-reeds-games@xxxxxxxxxxxxx 
  Sent: Monday, April 01, 2013 4:10 PM
  Subject: [ian-reeds-games] Re: helping players to help the AI


  Carlos, I think this thread is a good idea.

  Let me give some first thoughts.

  I really like your implementation of the first idea.
  I might rename the flag to ai_skill_order or something else.
  The way AI currently works is somewhat like this except that I have 
  predefined the groups based on the type of skill.
  I'm doing this from memory so the order might be slightly off.
  Basically the AI groups skills into these groups.
  move,
  summon,
  heal,
  uncurse
  buff,
  curse,
  tile curse,
  uncurse,
  attack
  defend.
  Then it uses the groups for 2 things:
  1 To determine how to use the skill and whether it is worth using, such 
  as recognizing that a buff should not be cast on a unit who already has 
  the effect that buff grants or recognizing that nobody is missing enough 
  health to warrant healing.
  2 Determining the order in which to use it's skills, for instance 
  favoring healing and buffing over cursing and normal attacks.
  The list above is the order the AI currently uses.

  So the new flag will let you override the order and will add randomness 
  for any skills within the same group and I will need to keep the old 
  logic for whenever you don't specify the new flag.
  One interesting thing to point out here, and you brought it up as a 
  concern, is range and how moving works.
  Currently move skills are always placed at the top of the order.
  But moving is only considered necessary when the AI is not in a position 
  where it can use a skill worth using and then it moves to the nearest 
  point where it can use any of it's skills worth using.
  So it has the range issue you described.
  In Tomb Robber Freddy would move as close as he can to perform any of 
  his actions which would always be pistol before attack.
  And leaving move in the very last group actually works great as long as 
  the AI loops so that it again tries the first group after a successful move.

  Perhaps the additional fix is to change move so that instead of moving 
  to the nearest point that it can use a worthwhile skill it instead goes 
  through the list and tries to move somewhere that it can use skills in 
  the first group containing attack and if it can't move that far in this 
  turn it would then try the second group containing pistol.
  It will take me a while but I'm sure I can make this work, though it may 
  cause some extra thinking on the AI's turn.

  I think there are trade offs here.  The choice is really between 
  favoring the best skill (meaning the skill in the first group) or 
  favoring performing some skill this turn.

  Imagine a different scenario where a unit can heal or attack and starts 
  in a position 1 space away from an enemy and 10 spaces away from a unit 
  that suddenly needs healing.
  It can move 3 spaces in a turn and has this set of flags defined:
  random_skills=heal|attack|move
  In this case, instead of moving one space to use the attack skill he 
  will move 3 spaces toward the unit that needs healing, but will not 
  perform any worthwhile actions this turn.

  So it's really a choice between whether to favor performing some skill 
  this turn or to favor getting closer to performing a first level skill 
  at the cost of sometimes not performing any skill in a turn.

  I guess this could be yet another flag like ai_favor_best_action versus 
  ai_favor_some_action.
  Well, I couldn't find a clear way of describing all that so I hope it 
  made sense.

  Regarding your second item:
  I think this problem is because the AI determines there is no path it 
  can follow to use a skill.
  For instance, if there is one bridge across a river and a ranged AI unit 
  is standing on it then there is no path across the river.
  Then if the ranged AI unit can shoot from where it is then it has no 
  reason to move.
  And 100 melee AI units behind it and far away from the river won't move 
  at all because when they use path finding to determine how to get 
  somewhere they can use their melee attack they find that as the map 
  stands there is no path to where they can use their attack skill.
  Fixing this would be something like determining that if there is no 
  valid path then they should choose a path that at least gets them closer 
  to the enemy.

  For your third item it actually sounds like there is a bug when buffing 
  units who share a tile.
  I'd have to look deeper to know for certain though.

  Allan, I just read your email.
  I think that letting map creators define the skill groups and priorities 
  is a good idea.
  The problem you outlined is a little specific to summoning since the AI 
  considers any empty space to be a good space to use a summon skill 
  whereas you want it to only summon shuttles when it is close to an opponent.
  So I think your idea should actually have a flag on the skill itself 
  such as:
  ai_enemy_within=3
  Then the AI would never use this skill unless it was within 3 tiles of 
  an enemy.
  I think this would blend well with the grouping and randomization of 
  skills you and Carlos brought up.

  Ian Reed

Other related posts: