clearscope on Actor.checkSight() and Actor.isVisible()

These are not rejected - but are not considered highly important right now.

Moderator: GZDoom Developers

User avatar
Gutawer
Posts: 469
Joined: Sat Apr 16, 2016 6:01 am
Preferred Pronouns: She/Her

clearscope on Actor.checkSight() and Actor.isVisible()

Post by Gutawer »

I need to check if a monster can see the player in renderOverlay to determine whether to render some stuff, but right now, checkSight and isVisible are play-scope only so I can't do this. It doesn't seem that making these clearscope should be harmful, as they are just checking line of sight between two actors, so it'd be nice if this could be done.
Kotti
Posts: 86
Joined: Tue Dec 27, 2016 4:08 am

Re: clearscope on Actor.checkSight() and Actor.isVisible()

Post by Kotti »

I don't think this is possible. P_CheckSight contains calls to a random number generator which would go out of sync when being called from the UI.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Re: clearscope on Actor.checkSight() and Actor.isVisible()

Post by Marisa the Magician »

wait why the heck does checksight have rng calls?

Edit: god damn it marisa
Last edited by Marisa the Magician on Wed Feb 28, 2018 5:57 pm, edited 1 time in total.
User avatar
phantombeta
Posts: 2119
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: clearscope on Actor.checkSight() and Actor.isVisible()

Post by phantombeta »

@Marisa

Code: Select all

	if ((flags & SF_IGNOREVISIBILITY) == 0 && ((t2->renderflags & RF_INVISIBLE) || !t2->RenderStyle.IsVisible(t2->Alpha)))
	{ // small chance of an attack being made anyway
		if ((bglobal.m_Thinking ? pr_botchecksight() : pr_checksight()) > 50)
		{
			res = false;
			goto done;
		}
	}
For some reason, it does this.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Re: clearscope on Actor.checkSight() and Actor.isVisible()

Post by Marisa the Magician »

This Marisa feels the urge to fix the problem another Marisa has caused.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49183
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: clearscope on Actor.checkSight() and Actor.isVisible()

Post by Graf Zahl »

Sorry, but RNG issue aside, CheckSight cannot be made clearscope before we do not have a clearer picture of how this will be represented on the client side in a C/S environment, as this runs on the full set of play data and would necessitate making a full copy of it each frame - and that's too big a can of worms in the current state.
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine

Re: clearscope on Actor.checkSight() and Actor.isVisible()

Post by ZZYZX »

For client we should implement renderer-based ui-scope IsVisible. IMO
That should work both for C/S and current P2P networking.
User avatar
Rachael
Posts: 13793
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: clearscope on Actor.checkSight() and Actor.isVisible()

Post by Rachael »

How is that going to be implemented without being too costly?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49183
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: clearscope on Actor.checkSight() and Actor.isVisible()

Post by Graf Zahl »

Not at all, that's how. I won't make any decisions here before we have at least a rough picture how C/S will have its data laid out.
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine

Re: clearscope on Actor.checkSight() and Actor.isVisible()

Post by ZZYZX »

Rachael wrote:How is that going to be implemented without being too costly?
With renderer reporting what was drawn? I mean, that info is already stored (the renderer collects actors for rendering before actually doing it). And it can be a flag or something similar to what I said about checking sight for particles by marking sectors rendered in the last frame by the renderer.

Once the renderer somehow marks the actors with an unique id of the frame drawn (validcount) then there's almost no overhead and the visibility check can be done using simple int comparison (including portals, camtexs, skyboxes...)

And @Graf this approach has nothing to do with networking because I doubt that the data about rendered actors is going to be absent from the client. (or that clientside scripts are going to be absent from the client)
Both makes zero sense.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49183
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: clearscope on Actor.checkSight() and Actor.isVisible()

Post by Graf Zahl »

That doesn't work because sprites are processed by sector, i.e., only a single subsector needs to be visible for a sprite in the containing sector to be run through the renderer.
That data is totally useless for analysis. You'd get far too many false positives.

Return to “On Hold Suggestions”