3
\$\begingroup\$

I am developing a game in XNA and am trying to create an effective AI for the enemy and friendly spaceships but am having a hard time keeping the game effective without disadvantaging one side or the other (deliberately). My current setup is as follows:

  1. Ship targets enemy based on proximity.
  2. Ship changes direction and moves toward target, firing when in range. Ship fires single repeater weapon in the forward direction.
  3. Ship will not change direction when closer than certain distance from enemy.
  4. If you are directly following and shooting at a ship, the ship does not attempt to evade fire. (consequence of #3)
  5. All ships have similar firepower.

I am trying to improve this system and am willing to rewrite if necessary. Most of the ships end up flying around each other, shooting but never hitting. I have thought of several ideas to improve it:

  1. Once health drops significantly, ship will boost away from firing ship.
  2. Some ships are randomly chosen to be equipped with torpedoes (maybe add aft firing?).
  3. Make ships more wary of attacking cruisers (they tend to die quickly when attacking).

Does anyone have any other suggestions as to improve the AI of the ships? Does anyone have a completely different system of doing this?

\$\endgroup\$
8
  • \$\begingroup\$ you have sea or space ships? I think that the sea, but you used the word "flying" \$\endgroup\$
    – user62425
    Nov 10, 2015 at 13:48
  • \$\begingroup\$ Spaceships. I edited the question to make it more clear. \$\endgroup\$ Nov 10, 2015 at 21:12
  • \$\begingroup\$ You're looking for improvements, but it's not clear what is the issue at hand? Is it Most of the ships end up flying around each other, shooting but never hitting.? If it's the case, it's not clear that the suggestions you've added try to solve it... \$\endgroup\$
    – Vaillancourt
    Nov 10, 2015 at 21:16
  • \$\begingroup\$ Which is one reason why I am thinking of rewriting it completely, and wanted to know if anyone had made an effective system for enemy AI. \$\endgroup\$ Nov 10, 2015 at 21:17
  • \$\begingroup\$ If your ships flying one around another, and you dont want they do that, so do not order them to do so. Huh? And only AI system I know is Minecraft AI system, but I think it's totally enough for begin. \$\endgroup\$
    – user62425
    Nov 10, 2015 at 21:28

1 Answer 1

2
\$\begingroup\$

Basic AI Steering Behaviours

  • Seek (steer towards target, and accelerate)
  • Flee (steer away from target, and accelerate)

Smarter ai steering behaviours:

  • Pursue (steer towards target's destination [position+velocity*amt])
  • Evade (steer away from target's destination [position+velocity*amt] )
  • Approach (steer towards target, but slow down once within a certain distance, and try to stay in that radius)

Even Smarter ai steering behaviours:

  • Evade Projectiles (Either evade their current position, or their destination)

Other ai behaviours

  • Shoot at Target's Destination
  • Flocking
  • Pathfollowing (set a specific path to follow with repeat or ping pong effects)
  • Pathfinding (find path from one spot to another; A* is fun)
  • Formations
  • Wander (if not doing anything, choose a destination, and go there)
  • Idle (Wait for a new command)

AI Decision Handling

  • Target Aggro
  • Target Tank
  • Target Player
  • Target Weakest
  • Flee or Evade if low health

AI Balancing

  • Update in Intervals (Make new decision once per second, 2 seconds, every tick, etc)
  • Awareness (Make multiple attention/awareness radii. Only react to certain objects within specific radii)
\$\endgroup\$
1
  • \$\begingroup\$ Thanks a bunch! What was really key for me was to only make decisions in intervals, not every tick. Thanks! \$\endgroup\$ Nov 30, 2015 at 15:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .