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.