How do I make good AI?

0 favourites
  • 2 posts
From the Asset Store
Setup and ready for your art, animations and story. Viral Storybook App Template.
  • Im working on a top down shooter game, and Ive been experimenting with the enemy AI for quite some time now. I really need to move on in my project so I was wondering if anyone on here could lay out their take on how I could acheive convincing combat AI.

    There are 5 enemies each round, as well as 4 allys.

    Things that are imperitive to the AI are is knowing when it is appropraite to pursuite or run away from a target. Things like breaking LoS could warrant pursuiting. And running out of ammo would warrant running away from target.

    Id also like enemies to change positions after firing a burst. A relitive position where the enemy can still see and engadge its target (up to 500 pixels from the target) would be ideal

    Any help is greatly appreciated :)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Conceptually ai is simple. have the ai decide what to do and then proceed to do it. Then either when it finishes or it's interrupted it decides what to do again. It can be complex as you like. Simplest would be to to pursue or flee depending on if it has ammo. More complex would be to keep track of the things it was interrupted from doing and try to resume them later, which gives a bit more nuance to the illusion of intelligence.

    The second part is to smoothly switch from one state to another. steering behaviors could give smoother results as it can be jarring if things suddenly change direction.

    Here's one example. The two ai's collect the closest rock then moves to the other and throws the rock at them. Also they try to roughly avoid flying rocks. Mast of the mess it to make it less perfect to make it more interesting.

    dropbox.com/s/pgzp5et61mncq6y/failed_ai_test.capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)