Complex AI, Dynamic Aim within Range

Get help using Construct 2

Post » Sun Jul 22, 2012 5:53 pm



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

http://dl.dropbox.com/u/65622728/AI%20Help.capx
Quick Link to above



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 workErndog2k2012-07-22 23:11:51
B
27
S
11
G
1
Posts: 246
Reputation: 5,048

Post » Tue Jul 24, 2012 6:17 pm

EDIT

I thought impossible, looks like Nothing impossible. Erndog2k2012-07-25 02:18:22
B
27
S
11
G
1
Posts: 246
Reputation: 5,048

Post » Tue Jul 24, 2012 6:31 pm

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.Nimtrix2012-07-24 18:40:33
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Tue Jul 24, 2012 6:55 pm

@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.
Erndog2k2012-07-24 21:25:21
B
27
S
11
G
1
Posts: 246
Reputation: 5,048

Post » Tue Jul 24, 2012 8:13 pm

Well, that took a while.

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.Nimtrix2012-07-24 20:16:37
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Tue Jul 24, 2012 8:59 pm

[QUOTE=Nimtrix] Well, that took a while.

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.[/QUOTE]

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.
Erndog2k2012-07-24 21:16:54
B
27
S
11
G
1
Posts: 246
Reputation: 5,048

Post » Wed Jul 25, 2012 4:01 pm

@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.
B
27
S
11
G
1
Posts: 246
Reputation: 5,048

Post » Wed Jul 25, 2012 4:06 pm

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)
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Wed Jul 25, 2012 5:02 pm

[QUOTE=Nimtrix] 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)[/QUOTE]

@Nimtrix

AI_DynamicAimWithinRangePlusDeath

I figured it out thxErndog2k2012-07-25 17:32:46
B
27
S
11
G
1
Posts: 246
Reputation: 5,048

Post » Thu Jul 26, 2012 1:34 am

[QUOTE=Erndog2k]I figured it out thx[/QUOTE]

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.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Next

Return to How do I....?

Who is online

Users browsing this forum: Radulepy and 7 guests