Jump to content

Most efficient way to scan all actors around the player?


Recommended Posts

6 hours ago, RaidersClamoring said:

Well that is the job of the engine, to process loads of data. Starving threads is bad design. Of course you shouldn't be able to fry an egg on the cpu, but that is mostly due to communication between cpu and gpu. Iterating through a collection of 200 or so actors in their capacity of some script should take less than a microsecond. Are the hash-keys we know as RefIDs and FormIDs effectively random or do they contain any actual enum/flag-like information? If they are random then thats horrible design and could explain poor performance in these scenarios. When they keys don't "mean" anything, you have to look everywhere. 😕 Alas, I am backseat driving. Which is fun.

BGS uses their own CRC32 implementation, BSCRC32 for the pointer handles.

(In Starfield handles are also held in the form data structure somewhere near the FormID and the player's handle became 0x1 🙂 ).

 

Problem usually arises when the engine has to process too many data on the main thread which can result in micro stutters or even freezes.

By the way, there's an INI setting fStoryTellerQuestFindTime:General (2 by default) which I'm not certain what it does but it seems to be some kind of failsafe time for the Story Manager to find/initialize a quest. Might worth checking it with bEnableStoryManagerLogging:General = true, maybe it has some effect on performance but I don't know..

 

Yes, executing condition functions shouldn't be an issue. I remember I once attached a logger to one of the native condition functions, I think it was GetOffersServicesNow, and it logged thousands of calls within a few minutes in vanilla but there wasn't any stutter. Also when one creates a perk with perk entry Activate "Replace Default", upon hovering the cursor over an activatable object, the perk entry "spams" the code with constant reevaluation requests for the condition field. Attaching a perk fragment script to a Replace Default Activate perk entry causes a huge script lag but the engine is able to handle the load without issues. Constructing extra data for large number of references on the other hand can cause lags.

Edit: I meant the perk entry Run Immediatelly, not Replace Default.

Link to comment
Share on other sites

  • 3 weeks later...
On 7/6/2024 at 8:12 PM, SKKmods said:

Whilst we dont have much (well, any) info on CreationEngine, we do know that spherical object/collider searches or spherecasting are "expensive" in Unity and Unreal  (from building AI perception & awareness models)  so can make an inference.

Ever tried picking up and moving around a power radiator with a huge radius in workshop?
The lag can be ginormous.

Behind the scenes, a havoc sphere with <radiation radius> is used to find suitable receivers to power.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...