A couple more problems (Involving AI)

For questions about using Classic.

Post » Fri Dec 03, 2010 4:03 am

Hello again. I have decided to make a Pixel Art game to practice more in construct, and I have some problems with the AI of enemy ships.

1. - All ships choose the same Way-point

I don't know how to tell the ships to choose their own way-points and stop being such hogs.

2. - The bullets only come from one of the ships

When the bullet shot from the enemy is created, it only comes from the first created ship, not from the one that want's to shoot me.

3. - I don't know how to change the angle of the enemy ships when they are going left/right (I.e. player)

How would I get the ships to look left when going left? Or vise-versa?

.cap file: http://www.megaupload.com/?d=08UA0ZIY

Please help where possible. :)
B
26
S
7
G
5
Posts: 202
Reputation: 5,235

Post » Fri Dec 03, 2010 6:36 pm

[quote="Phobos002":2qwx0x3j]
1. - All ships choose the same Way-point

I don't know how to tell the ships to choose their own way-points and stop being such hogs.[/quote:2qwx0x3j]

First I thought it was just a matter of maybe putting a For each loop somewhere in there and indeed some of your events didn't look like they were doing the picking quite right, but on further investigation it seems there's something messed up with the RTS behavior. It either just moves the first created object or picks them all it seems in some cases.

One case being doing the action at start of layout:
Recreated it in a simple cap (Start of layout -> RTS move to object Target) and it still only moves 1 instance.

Other than that putting a Delay condition in there seems to break the picking again. It will move all instances... quite annoying.

Well, I hacked your cap a little. Got rid of the Wait object, replaced it with a private variable. Also couldn't use Start of layout for the first move action. That's also fixed by setting that private variable to 0 at start. Guess you'll have to look into it.

[size=150:2qwx0x3j][url:2qwx0x3j]http://dl.dropbox.com/u/2306601/RTSthing.cap[/url:2qwx0x3j][/size:2qwx0x3j]



[quote="Phobos002":2qwx0x3j]2. - The bullets only come from one of the ships

When the bullet shot from the enemy is created, it only comes from the first created ship, not from the one that want's to shoot me.[/quote:2qwx0x3j]

Can't say I'm an expert for this since I haven't used LOS for anything so far. But what I can tell you is that you should spawn your bullets from the object directly. So don't use System create, but try the Spawn object action of the ship sprite itself.

I changed it a bit accordingly. All of the ships are shooting. But for some reason the LOD seems still off. It seems hardly predictable when ships will actually shoot. Somebody else might know how to handle this better, or maybe I'll find out once I fiddle around with it.

[quote="Phobos002":2qwx0x3j]3. - I don't know how to change the angle of the enemy ships when they are going left/right (I.e. player)

How would I get the ships to look left when going left? Or vise-versa?[/quote:2qwx0x3j]

That one is quite easy. You should check "rotate object" under RTS behavior. Then go down to your object's angles and select N angles. Set the number of angles to 2. Be sure to have auto mirror checked too, and you'll have the plane facing left when going left and right when going right. :)
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Fri Dec 03, 2010 7:34 pm

1.
On the AI event sheet change event 4 change "Start of Layout" to "Timer equal to 0" and add a "For each npc_zefi_tier1ship" condition.
[code:2vp89ioj]+ System: Timer is Equal to 0
+ System: For each npc_zefi_tier1ship
+ npc_waypoint_generic: Pick one at random
-> npc_zefi_tier1ship: Move to npc_waypoint_generic
[/code:2vp89ioj]
Also on event 7 remove the "Delay 2000 ms" condition as it causes all the enemy ships to be picked.

2.
The fixes for 1 pretty much fix 2.

3.
What PixelRebirth said.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Sat Dec 04, 2010 1:39 am

Thank you guys so much! This helped a lot. :)
EDIT: Erm, I have a new problem.


Something about the event that makes enemies shoot. Which is important, so I cant just ditch it.

What do?

http://www.megaupload.com/?d=B6RHQIZS
B
26
S
7
G
5
Posts: 202
Reputation: 5,235

Post » Sat Dec 04, 2010 9:17 am

PixelRebirth and R0J0hound already answered your questions, but I don't want to throw it away, maybe you'll use something
http://dl.dropbox.com/u/10457408/Constr ... rogame.cap
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Sun Dec 05, 2010 12:38 am

Uncheck the Application property "Enable Scripting", unless you are using python scripts.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Sun Dec 05, 2010 3:06 pm

[quote="R0J0hound":3amc0vb8]Uncheck the Application property "Enable Scripting", unless you are using python scripts.[/quote:3amc0vb8]

That worked. Thank you! :)
B
26
S
7
G
5
Posts: 202
Reputation: 5,235


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest