GetLOS

Post » Sun Jan 25, 2015 1:10 am

Hello all (and QQuix in particular).

I'm opening this thread to discuss GetLOS. How it normally works, what SDR does with it, and whether or not there can possibly be any improvement via an OBSE plug-in. To brush up on what's known and some of the discussion points, you can read about it here: http://cs.elderscrolls.com/index.php?title=GetLOS

In my SDR mod (shameless plug) LOS is essential and gets used all the time as part of the detection process.

SDR uses it's own method for calculating what I call "true LOS". It's not 100% perfect, and I am hoping someday that someone will be able to hack the .exe with OBSE and figure out a way of replacing the current function with something better.

Here's what SDR does differently:

- While Oblivion has a fixed field of view for line of sight (+/- 95 degrees), SDR gives creatures and people different fov values - up to +/- 180 degrees.

- SDR uses the GetHeadingAngle function to determine if the target is within the new fov of the observer. This is particular important when dealing with the player's perspective when the camera is in 3rd person mode. It means that if the target is not within the playerrefs fov, even if the camera can see it and normally return the LOS to be true, SDR will reverse it to false since technically it's not within the player's actual field of view (vs. the camera).

- It's fairly easy to confirm any LOS that falls within the typical +/- 95 degrees (this seems to be hardcoded), however, in order to determine if someone has line of sight within a wider field of view, I have to call a second check to see if the target has LOS of the observer. So basically if the target is within the field of view of the observer, but beyond the +/- 95 degrees, if the target has LOS of the observer, it is assumed the observer has LOS of the target. This only works if the target is looking towards the observer and the observer falls within the +/- 95 degrees. If the target has their back to the observer and is looking in another direction, it will result in a false negative - SDR will think that the Observer does not have LOS of the target, even though technically they should.

So basically, SDR uses get LOS all the time. One thing QQuix mentioned in the discussion page was that it's possible there is a bug will it will just fail if it gets called too many times within the same frame, possibly even by different scripts/mods. I'm hoping he stops by and reads this and expands more on his findings.

Regarding the hack, what I would love to create is something along the lines of "ref.sdrGetLOS target" which will automatically take into account the calling references unique field of view range. But instead of using a reverse GetLOS call, it will actually use proper Ray Casting to determine LOS.

I'm looking forward to folks' thoughts on the subject.

User avatar
Marie
 
Posts: 3405
Joined: Thu Jun 29, 2006 12:05 am

Post » Sun Jan 25, 2015 8:12 am

As Scrubs discovered in the discussion page, the game cache the LOS for actors and use that. I wonder why does it breaks after a certain point.

I have a theory: maybe if you move an actor or object around in a frame and use GetLOS to test it, the game need to recalculate the LOS everytime and, if repeated many times, eventually the game "get tired" and refuse to recalculate it again, giving a constant false return. So, maybe the tests made by QQuix trigger the bug because the script was moving the object and GetLOS it many times.

Could you try repeating the QQuix test by calling GetLOS many times in a frame, but without moving any actors/objects around?

User avatar
Inol Wakhid
 
Posts: 3403
Joined: Wed Jun 27, 2007 5:47 am

Post » Sun Jan 25, 2015 7:49 am

That's a really good point and very good idea. I have some ideas on how to test this.

User avatar
Margarita Diaz
 
Posts: 3511
Joined: Sun Aug 12, 2007 2:01 pm


Return to IV - Oblivion