Stealth, Pathfinding, & object detection

0 favourites
  • 4 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • .CAPX:

    Yet another scenario that hopefully I won't lose anyone on while I explain the details in order to better clarify my dilemma...please hang tight; I'll try to make this concise.

    Wrangler provided a tutorial which I have amended previous Event instructions that I had to now follow after. C-7 has also provided help earlier so I'm calling him for some insight, too, if he wouldn't mind. ramones is always a great help. Anyone else who can identify my problem is welcome to chime in, of course. :)

    The gameplay is modeled after your traditional stealth-action, particularly with some "Metal Gear Solid" elements: Normal, Chase, Post-Chase/Caution statuses.

    I'm using three condition statuses to determine how the Enemies (object "CharEnemy") behave depending on their awareness of the Player (object "CharPlayer").


    (When I later get the Events set up,) the Enemies will follow preset patrols, which the Player will have to navigate around or distract with items (a feature not yet added). If the Player does not fall within the Enemy's line of sight (object "VisionCone") and no obstacles (the various wall objects) are in the way (determined by the "LOSobject" object which stretches between the Player and the Enemy instances), then the situation remains normal, or "PreChase". I do not have a group for these conditions as I want them to be readily available to test as conditions change.


    This group is activated when both the LineOfSight and IsPlayerInRange variables test True. To try to prevent Event/Action contradictions, I make sure that the LostChase group remains deactivated (or is otherwise turned off) to prevent the Enemy from randomly wandering around or that it doesn't get confused on how to compute the Pathfinding behavior.

    If during the chase, the Enemy loses sight of the Player somehow, the AlertState variable is set to 9, the LostChase group is activated, and the ChasePhase group is deactivated.


    The Enemy is now set to wander around randomly for about 18 seconds. During this time, it is my goal to allow the ChasePhase to be reactivated if the LineOfSight and IsPlayerInRange conditions become true again. If not, the Enemy (again, when I implement this feature later) will go back to its patrols like normal.

    Basically, the process should look something like this:

    PreChase -->> ChasePhase <<--->> LostChase

    ^-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    As you can see in my comments throughout the Event sheet, I will also have it set to where the Pathfinding behavior for each instance will be on or off to save on the wear-n-tear on the least, that's my intent. I'm wondering, too, if doing so actually affects ALL instances or just the one (as in, while using Pick or the For Each loop) if someone could clue me in if I'm mistaken about that.

    But, when you run the "Layout Level 1" layout, you'll see that the Enemies are awfully lethargic. I did have this working at one point...but apparently I "fixed" it too much. The Enemies don't respond to the test conditions; at best the LOSobject changes color as it should so I at least know that that much is working.

    Can anyone see what I'm missing?

    Thank you!

  • I think the 'CharEnemy: Add obstacle CharEnemy' is stopping them moving as they see themselves as obstacles.

    Also using groups like that won't really work. What if one enemy is in the chase phase and another in the lost phase and another not chasing at all. Which groups do you have active? If one enemy is in the lost phase and it's AlertState goes to 0 then it deactivates the LostChase group and any other enemies in the lost phase are stuck then since the event to lower their AlertState is deactivated.

    Better to just put use the ChaseStatus variable to determine which events should run.

    +CharEnemy: ChaseStatus = "IsChasing"
       -> chase phase events
    +CharEnemy: ChaseStatus = "LostChase"
       -> lost chase events
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ramones - Sir, your awesomeness never ceases to prevail. Thank you! In addition to some rearranging of other Events/Actions (I had some things nested that shouldn't have been), I got it all to work thanks to your suggestion.

    Know what the sad thing is? I actually wondered if that wasn't part of my issue (along with something else...I can't recall what). Go figure, eh?

    Thank you, again!

    (Here's the "finished" work:

  • Nice one... it works well.

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