Intelligent Space Fight

0 favourites
  • 5 posts
From the Asset Store
10 Loopable Tracks, 4 Musical Stems, 5 Event Stingers, and 43 Sound Effects.
  • 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 <img src="smileys/smiley36.gif" border="0" align="middle"> I have a good idea for that though, but I'd rather get the movement a bit more intelligent.

    Any advice is appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

  • 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.

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