Artificial inteligence for soldiers

Get help using Construct 2

Post » Sat Jan 18, 2014 7:30 am

Hi everyone,
I again =)

I'm trying to make one A.I. that attacks all enemies in its path. The problem is that the soldiers behave equals. I wanted them to behave individually. Can anyone give me a little help?

Demo

CAPX

Thank you all
B
25
S
4
G
2
Posts: 99
Reputation: 2,498

Post » Sat Jan 18, 2014 9:55 am

You can prevent this by using the "system for each" condition.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Jan 18, 2014 10:03 am

It would also probably be better to use the timer behaviour instead of the sytem every x seconds in this case.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Jan 18, 2014 3:50 pm

I do not understand. I am already using 'for every x seconds' condition

    
B
25
S
4
G
2
Posts: 99
Reputation: 2,498

Post » Sat Jan 18, 2014 4:00 pm

I think I said use the timer behaviour instead of every x seconds.

every x seconds will be the same for all hero's because it's counted from layout start.
Timer behaviour will make sure each hero has it's own time.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Jan 18, 2014 4:37 pm

I understood. But I've no idea how make a timer for each 'hero'.
B
25
S
4
G
2
Posts: 99
Reputation: 2,498

Post » Sat Jan 18, 2014 4:42 pm

you can put a behavior 'Timer' in each 'hero'
B
139
S
26
G
21
Posts: 520
Reputation: 25,307

Post » Sat Jan 18, 2014 6:01 pm

Wow, I did not know existed this behavior. Now I've to learn how it works.
B
25
S
4
G
2
Posts: 99
Reputation: 2,498

Post » Sat Jan 18, 2014 6:43 pm

I changed to 'timer', but they (the heroes) do not attack.

B
25
S
4
G
2
Posts: 99
Reputation: 2,498

Post » Sat Jan 18, 2014 9:14 pm

As a generic response. Good AI is darn difficult to make, even those huge budget AAA games often have quite bad AI characters that quite often do more harm than good. So, any easy/simple answer that would work on all situations ain't likely to be found.

Addendum: For this particular case.

I am not 100% sure what kind of game you are making.. so this my advice may indeed be totally useless to you.

For starters I would consider making the scene grid and turn based, that way it would be easier to be sure that the heros and enemies would not stomp atop of each other and also all players on the field do their movements and attacks in manageable fashion.

If you want them to have pixel (or sub-pixel) positioning, you'll need to define whom the characters want to attack? Perhaps the weakest enemy, or the closest or spice up with some randomness?. Also you'll must be sure that the characters won't get stuck (if movement fails)...

Oh. I got the nasty feeling, there should be at least I more tutorial of this AI. Joannak2014-01-18 21:47:35
Need help? Upload .capx file with your question.
B
16
S
4
G
2
Posts: 233
Reputation: 2,560

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000, kriand, NN81 and 6 guests