Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BTInspector singleton, an in-game tool for visualizing BTs #81

Open
limbonaut opened this issue Mar 24, 2024 · 3 comments
Open

Add BTInspector singleton, an in-game tool for visualizing BTs #81

limbonaut opened this issue Mar 24, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@limbonaut
Copy link
Owner

Easy to use in-game behavior tree inspector, that would allow choosing a running BT instance.

  • Intended to be used as an in-game tool.
  • Taps into debugger to display a list of currently active BT instances.
  • As easy to use as a GDScript one-liner BTInspector.show().
  • Allow specifying which instance to display from code: BTInspector.inspect(bt_player.get_tree_instance()).
  • As a plus, allow registering/unregistering instances with the debugger for custom player implementations.
  • Using Window would allow moving the inspector view around, or popping it out in its own detached window.
  • Should only be included in debug/tools builds.
@limbonaut limbonaut added the enhancement New feature or request label Mar 24, 2024
@Rubonnek
Copy link
Contributor

Rubonnek commented May 27, 2024

It seems to me BTInspector could be an external resource instead.

I already have a similar-ish BTInspector implementation in GDScript. It doesn't tap into the debugger and uses it's own implementation for an in-game scene tree. I've only tested this against the master branch of Godot and using LimboAI as a module. Not sure if it works with Godot 4.2.

Press F2 to bring it up: demo.zip

The user must find the BTPlayer node in the scene tree viewer in order to populate the BTView.

demo.mp4

I've been wanting to rewrite my implementation as a module for PankuConsole but it doesn't have a scene tree viewer -- I was planning to use that to implement a PankuModule to view the BTPlayers.

@limbonaut
Copy link
Owner Author

I guess, by external resource you don't mean godot Resource, right? Tapping into debugger is mentioned by me from a practical perspective - the LimboAI debugger already knows about nodes that own BT instances (both BTPlayer and BTState). So you wouldn't need a SceneTree viewer then, or that data can be used to build a specialized viewer control. Would be nice to rework that registering mechanism to encompass also custom player implementations, either by providing an API to register running instances or perhaps encapsulate it using the BehaviorTree.instantiate func instead. Currently, the in-editor debugger only shows nodes that are explicitly registered with it (BTPlayer and BTState do that in DEBUG_ENABLED builds).

@Rubonnek
Copy link
Contributor

I guess, by external resource you don't mean godot Resource, right?

Right, I should've said plugin.

Tapping into debugger is mentioned by me from a practical perspective - the LimboAI debugger already knows about nodes that own BT instances (both BTPlayer and BTState).

I see, I forgot about BTState being able to hold BTs. Tapping into the debugger makes more sense than I initially thought. For a second there I figured BTInspector on release builds would be a nice to have in case some memory corruption affects the BTs, but now I think it's not worth the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants