'Teach' the AI to STAND STILL OCCASIONALLY

Pseudocode!

 

Code: c++
  1. if(enemyPower > ourPower && (humanHasRanged != true && humanHasCaster != true)){
  2. lookForDefenseBonus();
  3. sitOnThatBonus();
  4. }
  5. if(weHasRanged != false && enemyHasRanged != true){
  6. lookForDefenseBonus();
  7. sitOnThatBonus();
  8. }
  9. if(ourBestDef < (.5*enemyBestAttack)){
  10. waitForThemToApproach();
  11. }

 

AI needs to know how and when to defend. If it can shoot and the human can't, or if it's outgunned and the human can't shoot, or if it has high attack and low def, it should sit the hell still and wait for the human to approach. Preferably on good terrain so that it won't get massacred. 

Get it to do that and a good chunk of the irritation will evaporate. 

7,629 views 5 replies
Reply #1 Top

and Brad thought there were no good developers left in Michigan... you're hired!

Reply #2 Top

I have little experience with C or C++, but my impression is that things like:

if (enemyPower > ourPower && (humanHasRanged != true && humanHasCaster != true)) {

}

should instead be:

if (enemyPower > ourPower && !(humanHasRanged || humanHasCaster)) {

}

Reply #3 Top

Depends on if you find and's easier to read then or's or not. Personally I prefer this version:

if (enemyPower > ourPower && (!humanHasRanged && !humanHasCaster)) {

}

 

 

:)

Reply #4 Top

Programming! Oh yes, on a sufficiently "high", abstracted level, it's a joy...

Code: c++
  1. if ( enemyIsWinning() == 1 ) {
  2.   doSomethingGodDammiT("likeNow!")
  3.    if ( situation() > BETTER ) {
  4.      setOverallMood( 'Cool, we winning!' )
  5.   } else {
  6.     bitchAndMoan( 'Wtf? Try harder, N00b!' )
  7.  }
  8. }
  9. function doSomethingGodDammiT( param ) {
  10.   ...clever stuff...
  11. }

Reply #5 Top

Edited, nvm.