derkork / godot-statecharts

A state charts extension for Godot 4
MIT License
734 stars 35 forks source link

Add Beehave Style Integrated Debugger UI #48

Closed meticoeus closed 8 months ago

meticoeus commented 10 months ago

The StateChartDebugger Node is useful for debugging a single statechart at a time but feels less than ideal when trying to debug startcharts for multiple scenes at once as it seems to require resizing each debug control node so they don't overlap for each debugger you want to see at once.

BeeHave has a very nice debug interface that is added as a tab in the Godot Debugger UI that lets you view each of the active behavior trees in the current scene. godot-statecharts could do something similar by taking the existing StateChartDebugger UI and auto registering each statechart into a Godot debugger interface tab with a list to pick which statechart to view the debug ui for. BeeHave adds an auto-loaded global script to handle the debug registration in the root behavior tree node.

Great library. I felt like I could finally get a handle on how to use statecharts/FSMs with the node based approach compared to relatively cumbersome (for non trivial charts) libraries like XState for javascript.

derkork commented 10 months ago

I'll check out how they do it in beehave, sounds like an interesting extension. I still like to have the abilitiy to inspect stuff in game though, so maybe the in-game debugger could also be enhanced to allow you to select one of the currently running state charts.

meticoeus commented 10 months ago

I also like the in game debugger for debugging the current statechart I'm working on. I think having both would be useful as the editor debugger would give you access to everything without having to make any changes to the scene trees while the in-game debugger is useful for focusing on debugging a particular statechart.

derkork commented 9 months ago

Ok we're getting somewhere:

image

Still needs a lot of polishing, but it works in general.

SirPigeonz commented 9 months ago

Nice this will be very helpful for folks with 2 monitor settup!

It's also much more convinient to just select checkbox in the inspector, to add/remove your state chart monitored list and switch between debugging them in one place (like in Beehave) without modifing the scene tree :)

Thx fort this!

derkork commented 9 months ago

image

So this is a bit nicer. I'm still not super-happy with the tree on the left. You somehow need to pick a state chart but the tree is very noisy looking. Any idea on how this could look nicer?

derkork commented 9 months ago

I have pushed a branch, in case you want to try it out.. https://github.com/derkork/godot-statecharts/tree/in-editor-debugger

derkork commented 8 months ago

Okay, so I've improved the implementation, we now also get the history in the editor and we have the same settings for ignoring parts of the history.

image image

The whole thing is opt-in now so the debugger only shows charts that have been marked for tracking in the editor.

image

Once you reach a certain amount of state charts the amount of debug data gets really big, at which point the editor will be unhappy...

image

I'm not sure if this can be helped. I'm already culling messages whenever possible but when you have a thousand state charts in the game it will more or less try to send a thousand messages per frame when they are all busy doing something.

derkork commented 8 months ago

I have released the current state of implementation as 0.10.0 and submitted it to the asset library. It may not be perfect but I think it is in a usable state now. Please give it a spin and let me know if there are issues. Thanks!