0 Favourites

enemy AI individual

  • I have a two enemies with one event sheet but i cannot manage to make them behave like separated individual AI. I use 'For each' and also give the enemy instance variables but it's not working.

    Any suggestions?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • AI is a complex field as you know doubt are aware by now....

    Could you please clarify your question a little better..

    The enemies you speak of are instanced objects of the same entity yes?

    If you want complex AI behaviours you often need to create variables that control or influence the behaviour first in some way

    like a cascading flow chart..

    for example...having only one enemy attack if its close to the player is suitable for some games but not others or for other enemy types

    like a hive mind enemy

    to create specific actions you need to discuss what specific actions you wish to work on ...

    AI is a vast field of interconnected functions that affect and attribute to events in real time...

    its rarely as simple as adding a singular feature

    its about flowchart conditions that lead up to other events

    An Example AI flowchart would be

    Has Enemy detected player? yes/no

    if it did detect the player ..how did it detect player (method)

    if enemy has detected player what should it do next

    (pursue player or flee or some other action?)(Deterministic function)

    once deterministic function is calculated ( which can be done on a sliding table or scale based on values affected elsewhere)

    proceed with action every few seconds rather than every tick

    ( this allows realistic adjustment of actions that the player could respond to)

    So basically its a complex series of feedback mechanisms that you create

    idle default mode-> alert mode-> attack mode-> return to default mode or continue attack mode-> defeat modes must be catered for also

    building ai is probably the most advanced work you will ever do for a game...but try to break it down into understandably sub routines or feedback loops to make sense of it

    Using the above example

    you may restrict only enemy instances that are within a certain "distance" to the player by adding a subroutine that does something like

    CONDITIONS-->

    FOR EACH (enemy)

    SYSTEM--> compare two variables--> player.x, player.y, enemy.x,enemy.y is less than 100 pixels

    ACTION--> Enemy(Find PATH to Player.x,player.y)

          

    understanding the basics of flow charts and actions will help you write better AI routines...

    but they are no different than any other programming when you get down to it

    try to think of it like a PARTICLE system

    you set the basic characteristics up but each entity has random or specific feedback affected rules that determine its behaviour

    you must as a programmer allow for each possible feedback behaviour other wise your AI will get stuck in loops and be unable to change its own behaviour..

    if you posted your AI routines I could go over it for you if you like..

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Enemy Tank AI
36 3,594
Neo1000's avatar
Neo1000
Unread hot topic
35 2,125
Frap1K's avatar
Frap1K
Unread hot topic
34 7,828
farflamex's avatar
farflamex