Intelligent Space Fight

Get help using Construct 2

Post » Mon Jan 21, 2013 7:32 pm

Hi guys,

I'm trying to set up a layout which allows 2 ships to be controlled by AI, and move realistically around the layout. I have a very basic movement set up, and the ships are "intelligent" enough to avoid leaving the layout, but it's not anywhere near perfect.

Ideally, I'd like to use the physics behaviour, but I have more control with the Custom Movement. If the ships approach the edge of the level, they slam on the brakes. I can turn on physics dampening, but I don't get the same results.

Space Ships

Does anybody have any advice on how I can improve the movement. I'd like the ships to automatically avoid one another, but try to get close enough to shoot each other. Very hard. Much easier in my head I have a good idea for that though, but I'd rather get the movement a bit more intelligent.

Any advice is appreciated.

@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 929
Reputation: 9,356

Post » Mon Jan 21, 2013 9:35 pm

Why are you making movement based off attraction to an arbitrary point? This isn't how space physics works at all. Are you aiming for realistic space physics? If you are, remember there is no (well, negligible) damping in space. Thrusters should be the only thing that can change the ship's direction. Think Asteroids.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Mon Jan 21, 2013 9:40 pm

Yeah, I can create the movement if I control it, but m intention is to create asteroids movement but AI controlled. I also can't stop the ships leaving the layout unless I apply dampening.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 929
Reputation: 9,356

Post » Tue Jan 22, 2013 9:49 pm

Hi guys,

I've updated the movement so that it is physics based, and tidied up the movement a little. It's very difficult trying to make this intelligent. At the moment, the red ship isn't set up to fight, just fly around.

Problems so far:

1) The red ship will activate thrusters on the side when he's turning. Problem is, one or the other is always on, as he's always rotating, however slight it might be.

2)I can not figure out how to have the zoom show all objects on screen if I decide to add others at a later date. I can handle 2, but that's it.

Any help or advice appreciated.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 929
Reputation: 9,356

Post » Tue Jan 22, 2013 10:16 pm

Why not just use the bullet behavior?
Then to keep objects from going off screen you could do a distance() comparison from the center of the screen, and have the ships turn their angles if the distance is grater than the width, or height divided by 2.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249


Return to How do I....?

Who is online

Users browsing this forum: Radulepy and 6 guests

cron