Feature description
I find myself needing to debug continuously changing variables for spikes in behavior. The current tools are good for telling me data on a current frame, but it's difficult to see trends in something like velocity in an object.
A runtime graph would be extremely useful for catching these continuous problems.
Real world example:
In my current project I find myself needing to debug a friction function's output velocity vs what I expect it to do over time. I'd like to type something like DebugDraw2D.set_graph("Y Vel",linear_velocity.y,delta,0,Color.GREEN if velocity.y < max_y else Color.Red,-1) to generate something like this but maybe with the timestamps and values listed more clearly on the margins:
There is a old godot asset library addon called DebugGUI Graph which works similarly, but it requires .NET and my multiplayer project is built around a version of GodotSteam/Netfox which are not compatible with .NET versions of godot, plus I really like using debug_draw specifically as my de-facto reliable debug tool.
Implementation Ideas
I'd like to propose adding
DebugDraw2D.set_graph(key: String, value: float, delta: float, priority: int = 0, point_color:Color = Color(0,0,0,0), duration: float = -1)
It would work similarly to set_text but instead will store [value, delta, point_color] to an internal list before rendering a 2D graph of all values, offset from the previous point by delta, color coded by their point_color. The graph's X/Y extends can be automatically calculated from the current set of points. The graph's text can be sampled from the color of the first point. A DebugDraw2D.clear_graph(key:String) could be provided to reset a graph at runtime, and maybe a limit on the array size can be thrown in for optimization reasons where the oldest points are thrown out.
Feature description
I find myself needing to debug continuously changing variables for spikes in behavior. The current tools are good for telling me data on a current frame, but it's difficult to see trends in something like velocity in an object.
A runtime graph would be extremely useful for catching these continuous problems.
Real world example:
In my current project I find myself needing to debug a friction function's output velocity vs what I expect it to do over time. I'd like to type something like
DebugDraw2D.set_graph("Y Vel",linear_velocity.y,delta,0,Color.GREEN if velocity.y < max_y else Color.Red,-1)to generate something like this but maybe with the timestamps and values listed more clearly on the margins:There is a old godot asset library addon called DebugGUI Graph which works similarly, but it requires .NET and my multiplayer project is built around a version of GodotSteam/Netfox which are not compatible with .NET versions of godot, plus I really like using debug_draw specifically as my de-facto reliable debug tool.
Implementation Ideas
I'd like to propose adding
DebugDraw2D.set_graph(key: String, value: float, delta: float, priority: int = 0, point_color:Color = Color(0,0,0,0), duration: float = -1)It would work similarly to
set_textbut instead will store[value, delta, point_color]to an internal list before rendering a 2D graph of all values, offset from the previous point bydelta, color coded by theirpoint_color. The graph's X/Y extends can be automatically calculated from the current set of points. The graph's text can be sampled from the color of the first point. ADebugDraw2D.clear_graph(key:String)could be provided to reset a graph at runtime, and maybe a limit on the array size can be thrown in for optimization reasons where the oldest points are thrown out.