Line-of-sight Behavior problem

Bugs will be moved here once resolved.

Post » Wed Mar 16, 2016 10:13 am

Problem Description
Line-of-sight behavior behaves differently from what stated in Official C2 Manual.
In short: if you have a “Target” sprite in the LOS of your “Shooter” sprite (i.e. it is “within range, within the cone of view, and with no obstacles in the way of a straight line between the two objects”), and then you simply add the Solid behavior to the Target without changing anything else, the Target results no longer to be in Shooter’s LOS.

Attach a Capx
The attached capx tries to show a simple case in which this maybe a not negligible issue.
https://www.dropbox.com/s/mkgx11qygtmgvs9/LOS%20bug.capx?dl=0

Description of Capx
The player's sprite (grey tank) must shoot at incoming enemy vehicles (green tanks & halftracks – only the tanks have Solid behavior). To aim at a given vehicle the player must turn its sprite towards it moving the mouse; the capx then checks if that vehicle is in Player’s LOS and therefore eligible as a target. If yes, the target itself is highlighted.

Steps to Reproduce Bug
  • Step 1 Try to select every enemy vehicle as a target pointing the player’s tank towards it.

Observed Result
Only the halftracks are eligible as target (i.e. highlighted when aimed at); the tanks, despite the fact are exactly in the same visibility conditions than halftracks, are not.

Expected Result
Since the conditions to have a clear LOS between two sprites (Player and enemy) are fulfilled by all the enemy vehicles *, any vehicle should be eligible as a target * and highlighted when aimed at (i.e., any vehicle should be in player’s LOS).
*: Exception: the halftrack behind the tank

Affected Browsers
  • Chrome (v. 48.0.2564.116 m (64 bit)): YES
  • FireFox: don’t know
  • Internet Explorer (v. 11.0.9600): YES

Operating System and Service Pack
Windows 7 Pro, 64 bit – SP 1

Construct 2 Version ID
v.224, 64 bit
B
34
S
4
G
1
Posts: 41
Reputation: 1,851

Post » Wed Mar 16, 2016 3:14 pm

Somehow it looks very logical to me.

LOS will see all objects in sight, unless blocked by a solid (or a custom object)

In your CAP it sees all Incorporeals except the one blocked by the solid vehicle.
It also dont see the vehicles that block theirselfs by beeing solid.

You need a second condition to see those.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Mar 16, 2016 5:31 pm

So, an object may (but only sometimes) block the LOS to itself...? sound quite odd to me... ;) can't figure a single case in which this makes sense. Anyway, the manual IMHO clearly speaks of Solid objects *between* the objects, and say absolutely nothing regarding the *target* . We should, therefore, at least modify the manual adding to the LOS conditions another one regarfing target properties... 8-)
B
34
S
4
G
1
Posts: 41
Reputation: 1,851

Post » Wed Mar 16, 2016 8:39 pm

I must be missing something, i dont see a 'sometimes' happen. Plz explain ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Mar 17, 2016 12:02 pm

Sorry, I mis-explained, I intended for "sometimes" that the object may change its status switching Solid on or off, the times he switches off is visible and the times he switches on it's no longer.
B
34
S
4
G
1
Posts: 41
Reputation: 1,851

Post » Thu Mar 17, 2016 12:32 pm

Ok, anyway, no problem, really - I try to explain my needs, maybe someone can help (see my example capx):

1. My player must have a clear LOS to every object he is actually spotting (i.e. to any vehicle of the first row), as happens in the real world. To achieve this, no object can be Solid or defined as “Obstacle” by events. Strange, but... ok.
2. Objects hiding behind the “big cats” in the first row must be out of player’s LOS, as they are covered (think of infantry hiding behind tanks). Again, nothing strange here, this happens in real world too. But if the green tanks are neither Solid nor defined as Obstacles they are (correctly) “transparent” to player’s LOS.

It's perfectly possible there is a simple workaround, but at the moment I’m not able to see it…. :(
B
34
S
4
G
1
Posts: 41
Reputation: 1,851

Post » Thu Mar 17, 2016 2:56 pm

I would do it this way:

https://
drive.google.com/open?id=0B1SSuCVV8v74ZGJVNG5UMGVjenM

Not pretending that this is the best solution.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Mar 17, 2016 4:25 pm

Very kind of you, thank you so much. So was necessary to write a couple lines of code, to run every tick, to have the Behavior perform in a logical way in this case.
Problem solved. Thanks again.
B
34
S
4
G
1
Posts: 41
Reputation: 1,851

Post » Thu Mar 17, 2016 4:47 pm

Well. Imagine you have some walls, floors and enemys hiding behind them. The walls and floors are solid and are needed that way for, by instance, a platform behaviour.

Would you like the walls and floors to be included in the picklist generated by a LOS condition ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Mar 18, 2016 9:05 am

You're right if the game is a "not-so-realistic" platformer. But if (as in my case) the game is "realistic", the answer is yes - since I can perfectly see the wall, I want the possibility to elige it as my target, and perhaps smash it with a cannonball... :D
Of course I understand these are just my needs, and for dozens of developers they are different... this is ok, but again (and for the last time ;) ) the manual does not mewntion at alla the targets properties, and one may assume that ANY type of object is ekligible at target.

Ciao
B
34
S
4
G
1
Posts: 41
Reputation: 1,851

Next

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 5 guests