Stealth, Pathfinding, & object detection

Get help using Construct 2

Post » Mon Apr 15, 2013 10:48 pm

.CAPX: https://www.sugarsync.com/pf/D6025908_4317202_6765580

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").

PreChase
(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.

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

LostChase
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 CPU...at 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)...so 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!Rhindon2013-04-15 22:50:25
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
112
S
20
G
8
Posts: 741
Reputation: 13,636

Post » Tue Apr 16, 2013 1:39 am

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.
[code]
+CharEnemy: ChaseStatus = "IsChasing"
   -> chase phase events

+CharEnemy: ChaseStatus = "LostChase"
   -> lost chase events
[/code]
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Tue Apr 16, 2013 6:49 pm

@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: https://www.sugarsync.com/pf/D6025908_4317202_6767676.)
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
112
S
20
G
8
Posts: 741
Reputation: 13,636

Post » Tue Apr 16, 2013 11:51 pm

Nice one... it works well.
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests