xOBSE icon indicating copy to clipboard operation
xOBSE copied to clipboard

GetHighActors return too few elements

Open llde opened this issue 9 years ago • 7 comments

llde avatar Jul 13 '16 21:07 llde

A couple of months ago I noticed it doesn't return dead actors, but presumed it was like that by design. Does it fail to return other actors as well?

claustromaniac avatar Aug 02 '16 00:08 claustromaniac

Dead Actors have no more any processing level, so it's normal. I actually don't know. I didn't dig into the issue. (Maybe there is no actual issue and the function is doing what is supposed to do)

llde avatar Aug 02 '16 12:08 llde

The issue has been reported by Saebel. I recall he made some tests and reported the commands GetFirstRer/GetNextRef returns some actors in high process the command GetHighActors doesn't. I sent him a message to ask for details.

Forlini91 avatar Aug 02 '16 12:08 Forlini91

@llde : I thought the same when I tested it, that's why I presumed it was intentionally that way. But then I tested GetProcessLevel on a freshly killed actor and guess what? It returned 0 (high processing). Does that mean I found a bug in GetProcessLevel, or does GetProcessLevel return 0 simply because I called it on an invalid target?

Maybe dead actors happened to influence the results of Saebel's tests without him noticing that fact?

Edit: I'll probably test these things myself later if I can spare the time.

claustromaniac avatar Aug 02 '16 18:08 claustromaniac

I ran some quick tests and it seems my previous assumptions were wrong. It turns out GetHighActors does return dead actors, and GetProcessLevel returns 0 for dead actors too (when appropriate).

My test plugin includes a global variable (TestCellDepth) that is meant as a way to quickly change the GetFirstRef function's cell depth parameter in-game. Setting that global to 3 and casting the test spell confirms the results of Saebel's tests. After three extensive tests I've come to the conclusion that GetHighActors does indeed return less elements than it should.

TEST GetHighActors vs GetProcessLevel.zip

claustromaniac avatar Aug 02 '16 21:08 claustromaniac

By looking at the OBSE code it seems GetHighActors doesn't directly search for the active actors, but simply gets the list of actors in high process contained in an object ActorsProcessManager. Now, OBSE doesn't instantiate this class, but reads an existing instance at location 0x00B3BD00 and tries to rebuild it in GameProcess.h. This means ActorsProcessManager is a vanilla class (so, not an OBSE class), and the list of high actors is maintained by the game itself.

If all this analysis is correct, then the code in GetHighActors is fine, and if this list of actors in high process doesn't contains all them, it means the vanilla game itself doesn't put them all in the list. Maybe there's a valid reason or maybe it's only a bug.

Forlini91 avatar Aug 03 '16 21:08 Forlini91

If you're right and the code in GetHighActors is fine as it is (and it certainly looks that way), then improving it would likely make it a slower function, beating a significant part of its own purpose in the process. That sucks.

I wonder if the same happens with GetMediumHighActors and GetLowActors...

claustromaniac avatar Aug 20 '16 03:08 claustromaniac