Need help with Enemy AI

0 favourites
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi there

    I try to create a Enemy AI. I have look diverent Tutorials an look to some samples. But i find only Tutorials where the Enemys walk and jump arround, that Part also works fine. I want to add a Attack and have a lot of Problems with this, trying arround about 3 days....

    Here ist what i have at time:

    https://www.dropbox.com/s/irq3zfg206t0z ... e.png?dl=0

    With 1 Enemy it works fine. But when i set more of them i have at this time a timeout Error. I have try diverent thinks. Either i have a Timeout Problem or the Enemys do crazy things or stucking arround or spawn the "AttackBox" many times...

    Can anyone help me?

    *Sorry for Google English*

  • Can you post the capx ?

    *sometime you can find forum of your langage*

  • Hey, I have a few suggestions, maybe they will help?

    1) Put all of that code under one "for each Biber" condition(and remove the "for each" from each newly created sub-condition, so it's not redundant)

    2) make sure you don't have redundant actions set up (you have 2 different sections set up for the "idle" animation, which may cause an issue)

    Otherwise, I'm with Sirvoid on posting a capx. Best of luck with your work!

  • Thanks 4 answering

    ultrafop

    The Idle double post was a copy and paste mistace. I have deletet it and set all under one "for each" and deleted the other ones. But it still works Buggy....

    Sirvoid

    There is a capx. Ist a little bit big, dont know if it is posible to minimize it.

    https://www.dropbox.com/s/944hm0b5fmffk ... .capx?dl=0

    Edit:

    The Layer "Enemys" is a old try to make a Enemy AI, the Layer "Enemys_AI" is the current.

  • Here you go. I tried to make lots of comments so that you can see why I've made the changes that I did. I also left a bit of "scaffolding" by way of a new variable that you can use to initiate your attack state. I would also switch the state setting (1,2 etc.) to use this variable as you progress, as it will give you more control over the distance at which your enemies will switch to attacking (also, they won't crowd your player).

    https://www.dropbox.com/s/d6jynxbyyweaa ... .capx?dl=0

  • ultrafop

    I have toggle off the "Set Enemy AI 1/2. So i can for testing switching between the AI`s with right or left click.

    When i Trigger the Enemy AI to 3 i have the same creapy stuff i also had. The Enemys spawns a lot of Attack Boxes and sometimes the stuck and do nothing.

  • EDIT:

    Here is a working version with the hitboxes spawning correctly:

    https://www.dropbox.com/s/d6jynxbyyweaa ... .capx?dl=0

    I also recommend looking at this tutorial:

    https://www.dropbox.com/s/ps99suo5g9qa8 ... capx?dl=0t

    I think using the X distance of your enemies can help to make sure that you are having them stop to attack at a nice distance and then re-engage if the player moves too far away.

  • ultrafop

    I also have made a AI with the tutorial you posted. You see rest of it in the layer "Enemys" the Variables of checking distance and AI are missing because i have re organized.

    But always have the same Problems with the meele attack. When there are more than one Enemy the attack will not work. They stucking arround or do other creapy stuff.

  • Is this new capx with the hitboxes built in as a function not working on your end?

  • ultrafop

    Nope, dosent work so. The Enemeys spawns a tons of hitboxes and from time to time they freeze.

  • EDIT:

    hmmm works totally fine over here.

    I should also mention that I removed the original hitbox spawning and so the implementation might be different than you originally intended (If that is the case then I apologize for being so hasty). I noticed that the original one spawned boxes oddly and they would stick around or would only work well for one of your bibers so I gave the boxes a fade behavior(.25 seconds) and spawn them every half a second. If you wanted to spawn them once and then reset their state, you'll just want to adjust that on your end. Let me know if that doesn't fix your issues.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ultrafop

    Sry, i have overlook that you post a new capx. It looks to run fine. I will try to undestood what you have done , dont know what .UID means (will reading some manuals).

    I will add some logic and give you a final feedback.

    Big thanks for help and spending your time!

  • Hi ultrafop

    I have addet some AI to the Enemys. But i have a little trigger problem. The problem ist that the Enemys allways make her AI`s simultaneously. For example when they attack, all the Enemys how attacks at this time attacks at the same time. I have try to make it more variable and Edit like this:

    https://www.dropbox.com/s/psjfghw9nwpwd ... r.png?dl=0

    My idea was to set a random Every X time to trigger them at diferent times to the next AI. But it dosent do so... Do you have any idea why?

    I also have a problem with the spawn AI. But i think its the same trigger problem.

    new capx:

    https://www.dropbox.com/s/yjqgd5f1tdea6 ... .capx?dl=0

  • Hey there, sorry to get back to you late. I'll take a look and see what's going on - likely tomorrow (it's getting late here). I must confess though, that I don't have much of an understanding of German and I'm also unsure off exactly what you're trying to do. I'm thinking that you're having difficulty with choosing between ranged and close attacks?

  • ultrafop

    No the change between range and close attack works fine with the Line of Sight behavior. The problem ist that the AI`s triggering to simultaneously. For example, they have to diferent Meele Attacks. The normal attack and the jump attack, the random change with choose one of them works fine. But the time they have to wait to set the AI is always the same for all Enemys and not diferent for each Enemy. Dont know why.

    Trying to explane:

    The line of sight is near the player. So they have to choose make Meele attack or make jump attack for each. And it will repeate that every random second. Some of the Enemys make jump attack and some of them make meele attack. That works for each one. But all of the Enemys that jump, jump at the same time, and all of them how make a meele attack, make it at the same time. i have addet a wait random time in the same line like they choose which attack them make but they always ceep making it simultaneous.

    It dosent hurry. I`m happy that you help me

    Hope you understand what i mean.

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