Bound debug overlay draw counts to avoid resource crashes - #2105
Bound debug overlay draw counts to avoid resource crashes#2105sunzenshen wants to merge 2 commits into
Conversation
sunzenshen
left a comment
There was a problem hiding this comment.
Stress test demo of 31 bots on a wide open map, while changing between nb_debug modes:
The side effect is that debug draws are rejected near the limit, which causes flickering, but I'd rather have some visibility into something like paths than to not have the option because of a hard crash.
| // Wrap the engine's debug overlay interface and return the pointer game code | ||
| // should use. A NULL input (a dedicated server has no debug overlay) returns | ||
| // NULL, so existing "if ( debugoverlay )" checks keep working. | ||
| IVDebugOverlay *NEO_InstallDebugOverlayBudget( IVDebugOverlay *pReal ); |
There was a problem hiding this comment.
Under the hood, use a proxy pattern to drop draws when the flow of overlay draws is starting to exceed the ConVar defined budget neo_debugoverlay_budget.
| if ( (debugoverlay = NEO_InstallDebugOverlayBudget( (IVDebugOverlay *)appSystemFactory( VDEBUG_OVERLAY_INTERFACE_VERSION, NULL ) )) == NULL ) | ||
| return false; | ||
| #else | ||
| if ( (debugoverlay = (IVDebugOverlay *)appSystemFactory( VDEBUG_OVERLAY_INTERFACE_VERSION, NULL )) == NULL ) |
There was a problem hiding this comment.
My pitch for this approach is that we only need to wrap debugoverlay at a few initialization sites, and we can handle custom changes in the new proxy class.
Rainyan
left a comment
There was a problem hiding this comment.
LGTM, tested with launch arg -maxplayers 32 and cmd neo_bot_quota 32; nb_debug PATH; as in the ntre_engage_ctg example case and can verify this fixes the crash.
Description
In order to prevent the game from crashing when nb_debug is displaying debug overlays for a large number of bots on a large map, bound the number of draw counts that can appear at a time via a ConVar. This has the side effect of causing flickering of alternating debug overlay draws between bots, but the justification is that it's better to see periodically the debug overlays per bot, rather than to not have the options because the game would crash trying to render all debug overlays.
Toolchain
Linked Issues