AI Behaviors not working correctly?

This forum is currently in read-only mode.
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Recently I have been working on a game that is a lot more complex then most of my previous ones, and I have hit a large problem concerning AI behaviors not functioning correctly.

    What I am trying to achieve is a top down space game where there is three factions, Alliance, Pirates and Empire each with at least three different types of ships. I wanted each ship, once it had become into a certain range of an enemy (LOS behavior) to periodically launch fighters, smaller objects with the turret and bullet behavior. I had each races ships entered into a family, "Alliance", "pirates" etc which I was hoping would prevent me having to create events for each ship object. BUT, then when one ship from one family found and enemy and launched its fighters, the rest of the objects in that family also did. I fixed the problem as in the CAP below by having a much more lengthy event sheet with lots of ORs for individual objects, if that makes sense.

    I have posted a CAP below of my game because it has a lot of events that may have caused the problem, and I am hoping someone with more experience with Construct can go through it and explain how to fix the problem. The CAP is my entire game, which has a lot of events and stuff already in it as I wasn't sure how to replicate the problem in a simpler CAP. I have all the events in groups, which should make it easier to navigate. The last two are the ones I am having problems with.

    The current problem is that the Pirate faction ships (rusty coloured, spawn at random planets every 15 seconds) work correctly, they launch fighters and the fighters attack the correct targets, most of the time. But the Alliance ships often do not at all, or launch a fighter that ignores its turret behavior events and flies straight. It all seems very random, sometimes they work and sometimes they dont...

    I hope that wasn't too lengthy, I hope the CAP make sense as there is a fair bit more in the CAP then just the fighter spawning, but that all works correctly. Thanks in advance!

    CAP:

    http://www.mediafire.com/?0g8oeugsx3dj4q9

  • Hmmm, its kinda funny how the Pirates seem to follow strategic plans while the Alliance will strike and bash with it all its got on 1 enemy it finds. You have an interesting game there, however I can't check the CAP for now due to work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Actually, most of that isn't intentional

  • The LOS behavior has been known to be buggy. I was trying to use it in some of the online games and the monsters didn't seem to chase the right players.

    Hopefully, somebody else here had better ideas. Don't have time now, but if I get a chance I'll look at your cap..

  • Maybe use an instant hit bullet behaviour instead, when it hits a solid, destroy it, but if it hits an object you want to track, track the object. If you fire it every 500ms or so it shouldn't slow the game down too much..hopefully.

  • But wouldn't it only fire in a single direction? That would mean they would only detect another ship, say, if it was right in front of the ship? I am not sure if that's what you mean though

    Also, would it happen to have anything to do with families? Maybe Construct gets objects within families when there is multiple instances of them mixed up? Also, to anybody that has looked through the CAP, the Pirate ships work exactly how they should, but the Alliance does not. I find this odd as the events are nearly identical. :S

  • For each object that is within X distance to turret, fire a "check bullet" at it to check if it can see the object, if it can, turn the gun to face the object and start firing real bullets at it.

    Sadly, families could take some of the blame, they're alot better than they were, but still buggy sometimes.

  • I see what you mean, but it still seems to have the same problem, the ship still seems to ignore the other ships sometimes while other times it doesn't... I guess the problem is with families then. Oh well, thanks for the help though!

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