Hi all. Apologies if this question would be better suited for a different section of the forums.
I have been asked to start creating a custom debug display that is basically an enhanced version of the existing stat/budget console commands, preferably A) Implemented as a plugin with minimal/no changes to base engine code, and B) using ImGui for display.
Basically, a lighter-weight alternative to running full Unreal Insights analysis, which can just sit in a corner of the screen during gameplay and display grouped categories/hierarchy of timings, little color-coded bar graphs of how over/under budget various timings are, etc. For now, at least, this would piggy-back off existing counters, with the option to add more later.
I’ve been investigating how this could be implemented, and the first obvious option would be to hook into the stats system directly. The plugin can call StatsPrimaryEnableAdd/Subtract() when the display is enabled/disabled, and hook into Stats.NewFrameDelegate to slurp up the data it needs for the display. Two potential issues have arisen, though:
-
This limits us to counters defined through the Stats system, and not anything that’s only defined through the Trace APIs. I have found mention elsewhere online that Stats will continue be be deprecated in favor of Trace over time, so it would be nice to be future-proof there.
-
The main stats system is disabled in Test build configurations unless FORCE_USE_STATS is defined, so without that, this display would only work in Debug and Development builds.
It seems like there could be an alternative approach here, which would be to hook in to the Trace system directly and have the new display enable stats.namedevents while active to grab all of the values. However, it is less clear to me how I would hook myself in to access the trace data stream in this case. Is there a method to access that data stream locally? Or would I need to make a network connection back to whatever instance of UnrealTraceServer.exe is active (potentially on a different machine) and access the data that way? If so, any direction toward relevant docs/code samples/existing examples to build off of would be appreciated.
If necessary, we can probably live with using the Stats interface here, and either turn on FORCE_USE_STATS or limit the feature to Development builds. If that can be avoided, though, all the better.
Thanks!