0 Favourites

Complex AI, Dynamic Aim within Range

  • <img src="smileys/smiley1.gif" border="0" align="middle">

    I am having alot of trouble getting my Ai to work just right, I've got alot done just theres some performance and bug issues I cant figure out. I provided a few comments in there to help with figuring out what does what quicker.

    Here's my Capx

    dl.dropbox.com/u/65622728/AI%20Help.capx

    Quick Link to above

    <img src="smileys/smiley1.gif" border="0" align="middle"> <img src="smileys/smiley1.gif" border="0" align="middle"> <img src="smileys/smiley1.gif" border="0" align="middle"> <img src="smileys/smiley1.gif" border="0" align="middle"> <img src="smileys/smiley1.gif" border="0" align="middle">

    issues

    Arm wont destroy when player out of range

    Arm wont mirror properly

    when enemy's are shooting at player performance drops

    on left side Ai gun wont go above 200 degrees but on right it wont work

  • EDIT

    I thought impossible, looks like Nothing impossible. <img src="smileys/smiley17.gif" border="0" align="middle" />

  • There's just too much, it's very hard to navigate through for an outsider, it could take us hours just to figure out what you've done.

    If you can make an example with JUST the AI, no unnecessary particles and animations etc, just keeping it simple, I can see if I can help you.

    Also, more comments and groups to seperate different parts of the code and to help us understand what you're trying to do.

    But I don't have time to figure out every last thing that happens in that .capx, and I'm guessing that's why no one else has answered either.

    Edit: Or, you could explain to me *everything* you want the AI to do, and we can start from scratch.

  • Nimtrix

    Sorry I'll explain everything ok.....

    1: Enemies Must walk when player out of range.

    2: Enemies must be able to aim dynamically up and down,

    within 90 degrees roughly, so they dont aim to far down and to far up.

    3: Since it will effect performance I want the enemies to spawn the arm used to aim at player. (Edit) not needed.

    4: the arm needs to destroy immediately after player out of range, of certain enemies but stay spawned on another if in range still. (Edit)not needed.

    5: that arm needs to mirror properly wen enemy is aiming mirrored.

    6: Enemies need to know if player on left or right side, and turn accordingly

    I think that's about it, lol. The Capx should give a rough example of what I want.

    Good luck I'm stumped.

  • Well, that took a while. <img src="smileys/smiley17.gif" border="0" align="middle">

    AI_DynamicAimWithinRange.capx (r99)

    Anyways, I think it's pretty stable. I haven't commented a lot, but just ask if there's something you don't understand.

    Edit: Oh, I didn't bother with destroying the arms, I don't think there's much to gain there to be honest. Would probably be more performance-heavy if you spawned and deleted them all the time than if you just leave them. You can do that yourself though if you want.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Well, that took a while. <img src="smileys/smiley17.gif" border="0" align="middle">

    AI_DynamicAimWithinRange.capx (r99)

    Anyways, I think it's pretty stable. I haven't commented a lot, but just ask if there's something you don't understand.

    Edit: Oh, I didn't bother with destroying the arms, I don't think there's much to gain there to be honest. Would probably be more performance-heavy if you spawned and deleted them all the time than if you just leave them. You can do that yourself though if you want.

    Pardon my language but No F'n Way lol, You are my Hero. It works so good. I'll comment back if I cant understand something. I think you should up it to Examples also.

    Thank you so much.

  • Nimtrix

    Hi thanks again for this, I have one problem tho I cannot figure out how to delete individually the objects on the Army Guy Enemy, Once enemy health reaches zero from collision with gunshots. If I destroy it clears all off the screen.

  • Hmm, make sure it's under one of the "For each" loops, so every enemy gets checked individually.

    PS: don't forget do delete the objects linked to the enemy or you'll run into some problems. (arm and anglehelper)

  • Hmm, make sure it's under one of the "For each" loops, so every enemy gets checked individually.

    PS: don't forget do delete the objects linked to the enemy or you'll run into some problems. (arm and anglehelper)

    Nimtrix

    AI_DynamicAimWithinRangePlusDeath

    I figured it out thx

  • I figured it out thx

    Great. By the way, I just updated the example, got rid of the anglehelper sprite after I discovered the anglediff expression. (Thanks to Yann)

    It's a bit cleaner now, reduced the amount of events, might want to update your game. <img src="smileys/smiley2.gif" border="0" align="middle" />

  • > I figured it out thx

    Great. By the way, I just updated the example, got rid of the anglehelper sprite after I discovered the anglediff expression. (Thanks to Yann)

    It's a bit cleaner now, reduced the amount of events, might want to update your game. <img src="smileys/smiley2.gif" border="0" align="middle" />

    oh yeah; very nice work, and thank Yann for me. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • I'm looking for this exact thing, unfortunately I can't open your capx. Is it possible to save this in an r95 format? I'm reluctant to try out the beta r99 release, since I'm just learning the program.

  • chasethomas - don't be reluctant, get the beta release, it's fine.

    And worth it to see recent capx - especially for learning.

    Expecting members to downgrade so they can resave is a bit much.

  • Ok cool I'll give it a shot- yeah I wasn't expecting a downgrade... didn't know if there was an option to save as for an older version.

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