A_CheckLOS, ACS_GetSight

Moderator: GZDoom Developers

User avatar
Skippy
Posts: 695
Joined: Sun Nov 20, 2005 9:57 am
Location: Belfast, NI

A_CheckLOS, ACS_GetSight

Post by Skippy »

Hi everyone,

We already have A_CheckSight, which jumps if no player can see the calling actor. However, far more useful would be an action function which jumps if there is a line-of-sight between the calling actor and its target, or between the calling actor and any actor with a specific TID. For example:

Code: Select all

A_CheckLOS(int TID, int offset)
Jumps the specified amount of states forward if there is a direct line-of-sight between the calling actor and any actor with the specified TID. If TID is 0, the calling actor's current target is used its target.

If called repeatedly in the actor's See state, and when used in conjunction with A_ClearSoundTarget, it could have a number of useful applications.

Sorry, but I'm determined to make my Metal Gear mod :D
Last edited by Skippy on Fri Dec 21, 2007 6:03 am, edited 3 times in total.
User avatar
Shadelight
Posts: 5113
Joined: Fri May 20, 2005 11:16 am
Location: Labrynna

Post by Shadelight »

This sounds like a good idea, except it'll probobly end up with a "[no]" :(
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49143
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

For current target check A_CheckSight.

For TIDs, no. That doesn't make sense in DECORATE's context.
User avatar
Skippy
Posts: 695
Joined: Sun Nov 20, 2005 9:57 am
Location: Belfast, NI

Post by Skippy »

For TIDs, no. That doesn't make sense in DECORATE's context.
Agreed. It's probably far too specific to my needs to warrant inclusion, though it might be better suited to an ACS function.
For current target check A_CheckSight.
I'm not sure what you mean by this. From the Wiki:
Jumps if no player can see this object.
This can be used to make things vanish but ensures that no player will see the event.
This implies that the jump will only occur if the calling actor is outside the player's field of vision. That's not what I'm suggesting; I'm looking for a function that jumps if the calling actor can see its target (not necessarily the player, and not the other way round). Unless there's a functionality to A_CheckSight that isn't documented in the Wiki, that won't help me I'm afraid.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49143
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Sorry. I constantly make that mistake. Reopened. ;)
User avatar
Skippy
Posts: 695
Joined: Sun Nov 20, 2005 9:57 am
Location: Belfast, NI

Post by Skippy »

Thanks for that. I really think this would be a useful addition, especially when combined with other key action functions like A_ClearSoundTarget, A_Give/TakeInventory, Thing_Hate and Thing_SetGoal, as well as some canny ACS scripting to control 'alert levels' and the like. :wink:
User avatar
Skippy
Posts: 695
Joined: Sun Nov 20, 2005 9:57 am
Location: Belfast, NI

Post by Skippy »

Sorry for the mega--bump, but seeing as there's been a whole slew of feature suggestions added recently, I was hoping this one could be looked at again. From what I can tell the relevant checking routines are right there in the code alrady so it should be a realtively simple addition (please correct me if I'm wrong! 8-)). I also have a couple of other closely-related suggestions which I don't think warrant a separate thread, so I'll put them here.

ACS: CheckSight

Code: Select all

CheckSight(int tid1, int tid2)

Returns TRUE if there is a clear line-of-sight between any actors with TID of tid1 and any with TID of tid2.
My second suggestion is an additonal actor property for DECORATE: FOV (int angle). This property would determine the width of the angle in front of the actor within which they can see targets. The default would be 180, which appears to be the standard logic for enemies (as any time you venture further than level with them in their peripheral vision, they wake up). Values of, say, 30 would mean that enemies would only detect targets moving directly in front of them, and a value of 360 would be equivalent to setting the +LOOKSALLAROUND flag (cf the Archvile).

The three things I have suggested - DECORATE action function, DECORATE actor property, and ACS function - would with clever use open up many new possibilities for adding enhanced intelligence to enemies, and would also facilitate many new environmental features such as security cameras (in conjuntion with a looping SetActorAngle script, for example) and Half-Life style sentry guns. Your consideration is much appreciated.
User avatar
Risen
Posts: 5263
Joined: Thu Jan 08, 2004 1:02 pm
Location: N44°30' W073°05'

Post by Risen »

Bump, yes, but I can't find any way to do what I want without a line-of-sight check.
I could probably manage if it were in Decorate, but ACS is preferred for my application.
User avatar
Skippy
Posts: 695
Joined: Sun Nov 20, 2005 9:57 am
Location: Belfast, NI

Post by Skippy »

Considering the length of time this has gone unanswered, I wouldn't hold your breath. At this point I'd settle for the ACS CheckSight function alone, as I fear the field-of-view stuff would require a major rewrite of the monster AI. :cry:
User avatar
Risen
Posts: 5263
Joined: Thu Jan 08, 2004 1:02 pm
Location: N44°30' W073°05'

Post by Risen »

It's best to have one suggestion per thread, so I'm not going to comment on the FOV stuff. That should be discussed elsewhere.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49143
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_CheckLOS, ACS_GetSight

Post by Graf Zahl »

added
User avatar
Skippy
Posts: 695
Joined: Sun Nov 20, 2005 9:57 am
Location: Belfast, NI

Re: A_CheckLOS, ACS_GetSight

Post by Skippy »

Wow, incredible - thanks Graf! You're on a real killing spree today... :D

Could you explain usage please?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49143
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_CheckLOS, ACS_GetSight

Post by Graf Zahl »

A_JumpIfTargetInSight(state)


It makes no sense to use tids anywhere in here so it only checks the target of the calling actor. That's also the reason why this won't be added to ACS.
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends

Re: A_CheckLOS, ACS_GetSight

Post by XutaWoo »

What's the difference between this and A_JumpIfTargetInLOS?
Gez
 
 
Posts: 17924
Joined: Fri Jul 06, 2007 3:22 pm

Re: A_CheckLOS, ACS_GetSight

Post by Gez »

[wiki]A_JumpIfTargetInSight[/wiki] jumps if the calling actor can see its target (the target is in sight).

The other function suggestion would jump if the calling actor can be seen by its target. That's the difference between "target in sight" and "in target's sight". :P

And finally, there is [wiki]A_CheckSight[/wiki] which jumps if the calling actor can be seen by any player.

Return to “Closed Feature Suggestions [GZDoom]”