Tuesday, May 13, 2014

On the topic of AI

Hi everybody!

The last few days have been very stressful, as I have to study quite a lot at the moment. Since I don't find the time to (really) work at the Project currently, I try to at least plan as much as I can and figure out how to solve some issues.

One of them being the AI of the Units. Some of the questions I came up with:

  • Should the player have a possibility to set what the unit(s) should do? ie.:
    • Patrol - Attack bypassing units
    • Defend - Attack if you get attacked
    • Run - Run away if attacked
    • Hide - Run away if enemy comes close
  • If not, should the Unit have a way to decide? ie.
    • Attack bypassing units if you are stronger
    • Defend, but don't attack if you are a bit weaker
    • Run if you are attacked and the enemy is way stronger
  • Or should they all just react the same way everytime? ie.
    • Just freaking attack enemies if you see them!
  • Furthermore: What if I'm currently going somewhere? ie.
    • Player sends Unit to some point. On the way there it encounters enemies. What now?
      • March on
      • Attack them immediatly
      • Attack them if they attack me
  • What if you have friendly units nearby? Should they help you attack?
And these are not even all the things that come to my mind. Do you have any suggestions?
My idea would be something like this:

  • If you are send somewhere, don't attack units you encounter on your way. Just keep going, even if they attack you.
  • If you are in idle-mode, do not attack enemy units unless they attack you, or they attack friendly units or buildings nearby.
  • If you are attacked:
    • Enemy is weaker: Attack
    • Enemy is the same: Attack
    • Enemy is a bit stronger: Attack
    • Enemy is way stronger AND you are alone: Run
    • Enemy is way stronger AND there are friendly units in idle-mode nearby: Attack
  • If nearby friendly units are attacked:
    • Attack!
I'm not quite sure yet if this will be the way it turns out, but we will see about that. Currently, all units that are able to fight (Warrior, Archer, Hero) behave like this:

  • Idle: Attack enemy on sight
  • Going somewhere: Go there first, if you switch to idle, well, the above.
Which is a bit too less in my eyes.

Please, if you have any ideas, leave them in the comments below, I'd highly appreciate them!

No comments:

Post a Comment