limboai icon indicating copy to clipboard operation
limboai copied to clipboard

[TRACKER] State of GDExtension support

Open limbonaut opened this issue 1 year ago • 8 comments

Goal

  • Port to GDExtension in such a way that it would be possible to compile the same codebase as either an engine module or an extension.
  • Build GDExtension artifacts using GitHub workflows in addition to custom editor artifacts.
  • User Projects should not require porting when switched from module to GDExtension.

Status

Implemented and merged, with unresolved issues documented below.

Progress

  • [x] Core
    • [x] Blackboard
    • [x] BT Tasks
      • [x] Composite
      • [x] Decorator
      • [x] Scene
      • [x] Blackboard
    • [x] BTPlayer
    • [x] LimboUtility
    • [x] LimboTaskDb
    • [x] LimboStringNames
    • [x] State Machine
      • [x] LimboState
      • [x] LimboHSM
      • [x] BTState
  • [x] Editor
    • [x] ActionBanner
    • [x] TaskTree
    • [x] TaskPalette
    • [x] ModeSwitchButton
    • [x] LimboAI editor & plugin
    • [x] Icons
  • [x] Debugger
    • [x] Behavior tree view
    • [x] Debugger plugin
    • [x] Data classes
    • [x] Debugger bottom pane
  • [x] Additional tasks
    • [x] Add SConstruct and .gdextension to source control
    • [x] Fix TaskPalette on "Refresh" crash
    • [x] Fix ERROR: Condition "_instance_bindings != nullptr && _instance_bindings[0].binding != nullptr" is true.
    • [x] Fix crash when requesting documentation page
    • [x] Use common source for editor config file
    • [x] Fix: Weird name showing on the tasks
    • [x] Fix: BB params convert to "Wrapped..."
    • [x] Fix: Create script template not working
    • [x] Fix: Comments not getting custom styling & dialog
    • [x] Fix: User tasks not showing in the Task Palette
    • [x] Fix: User icons are not showing in the task palette
    • [x] Check resources reloading for potential issues
    • [x] Fix: Shortcuts not working
  • [x] Verify
    • [x] Compiles
    • [x] Launches
    • [x] Can run demo project
    • [x] Test core functionality
    • [x] Test editor functionality
    • [x] Test debugger
    • [x] Test on the production
  • [x] Documentation
    • [x] Create sphinx project
    • [x] Set up readthedocs
    • [x] Link to documentation in the code
    • [x] Convert documentation pages from the GitHub
    • [x] Add minimal task example
    • [x] Fix introduction to BT
    • [x] Landing page
    • [x] Using GDExtension, limitations & setup
    • [x] Link to documentation pages in the README
  • [x] Integrate
    • [x] Create a script to update icons in .gdextension
    • [x] Fix module build errors
    • [x] Create a script to set up new dev environment for GDExtension
    • [x] Create GHA build workflow for GDExtension for desktop platforms
    • [x] Call GDExtension builds in the "All Builds" workflow
  • [ ] Unresolved
    • [x] Documentation: Waiting for PR https://github.com/godotengine/godot/pull/83747
    • [ ] Documentation tooltips: No way of getting documentation data from the editor.
    • [x] Proper GD virtual methods when this functionality becomes available.
    • [ ] BBParam editor property: Waiting for https://github.com/godotengine/godot-proposals/issues/8908
    • [ ] Shortcut for opening debugger

limbonaut avatar Nov 06 '23 14:11 limbonaut

GDExtension Issues

  • get_script_instance() is missing; no workaround? See next bullet.
  • GDVIRTUAL_* are not implemented in GDExtension: it seems there is no way to bind virtual methods that can be implemented by scripts.
    • ClassDB::add_virtual_method is also missing...
    • Related issues:
      • https://github.com/godotengine/godot-cpp/issues/910
      • https://github.com/godotengine/godot-cpp/issues/1072
      • https://github.com/godotengine/godot-cpp/issues/1199
      • https://github.com/godotengine/godot/issues/82267
    • Workaround is to use call() in both C++ and GDScript. Very unintuitive. Besides, methods are not actually marked as virtual in the docs, which causes a warning that, by default, is treated as an error.
  • https://github.com/godotengine/godot-cpp/issues/1348
  • EditorHelp is not exposed, particularly EditorHelp::get_doc_data, which makes it hard to implement documentation tooltips.
  • Class documentation is not possible. But there is a PR: https://github.com/godotengine/godot/pull/83747
  • Core inspector property editors are not available in the API:
    • https://github.com/godotengine/godot-proposals/issues/8908
    • https://github.com/godotengine/godot-proposals/issues/7010
    • https://github.com/godotengine/godot-proposals/issues/1761

limbonaut avatar Dec 15 '23 23:12 limbonaut

Binding virtual method is now available in godot-cpp, will this complete gdextension version's missing features?

ODtian avatar Mar 13 '24 13:03 ODtian

Binding virtual method is now available in godot-cpp, will this complete gdextension version's missing features?

It's definitely one of the most missing bits in GDExtension, and I'm really glad that virtual methods are coming. Since it is only available in 4.3 branch, and because LimboAI targets the most recent stable release (4.2.x currently), it might take a while before support lands in LimboAI. I assume it should come along with v1.1 or v1.2, and close to first 4.3 RC or beta3. It depends on Godot 4.3 release date.

Alas, it's not the last missing feature:

  • Currently, we also depend on inspector editors to provide a customized property editor for BBParam resources. They are not exposed in the API (see https://github.com/godotengine/godot-proposals/issues/8908).
  • There is no way to grab class documentation in the Godot API. While the documentation support is coming in 4.3, the working bits of the documentation system are not exposed in the API. We use those bits to show documentation tooltips.

limbonaut avatar Mar 13 '24 15:03 limbonaut

why no plugin.cfg file? I find the list of plugins with their current version and the ability to enable/disable them helpful in the godot editor.

tkuebler avatar Apr 03 '24 21:04 tkuebler

why no plugin.cfg file? I find the list of plugins with their current version and the ability to enable/disable them helpful in the godot editor.

Is that even possible? It's a native C++ editor plugin, developed as an engine module first, and ported to GDExtension. AFAIK plugin.cfg is for GDScript editor plugins. :shrug:

limbonaut avatar Apr 04 '24 12:04 limbonaut

why no plugin.cfg file? I find the list of plugins with their current version and the ability to enable/disable them helpful in the godot editor.

Is that even possible? It's a native C++ editor plugin, developed as an engine module first, and ported to GDExtension. AFAIK plugin.cfg is for GDScript editor plugins. 🤷

Ah, that explains a lot about the plugins that aren't showing up, I did not know that. Thanks!

However, I added a plugin.cfg to limboai before I asked and it shows up in the plugins list with version, etc - the enable/disable doesn't work though. ( I didn't read through the plugin docs first though, sorry). Seems to me native editors plugins should also have that, but without the ability to enable/disable without a reboot? ( although that would be great as well) but that is a godot issue that I'll have to think through, look at the plugin arch and maybe propose/submit a solution to if I care enough ( I probably don't).

So how do I know what version is installed? Seems like a VERSION.txt file or something similar at the root of the plugin would be very useful.

Coming from the unity package manager ( and a lot of similar managed plugin frameworks in a lot of software ) Godot is a bit of a shock. Not having reviews/ratings in the asset 'store' is understandable, but not knowing what version of plugin you have installed is not.

BTW - thanks for LimboAI - so far it's been flawless and easy to use. :D

tkuebler avatar Apr 04 '24 15:04 tkuebler

Godot Engine has a bunch of plugins in the core: they are not visible in that list as well, and you can't disable them. LimboAI is like some of those internal plugins, and so are some other GDExtension addons. It's somewhat confusing terminology in Godot, plugins and addons. And I agree with that GDExtension addons should also have some kind of manifest file for the Asset Library, and it should be visible in the UI with some update mechanism. A new asset store is in development for Godot. Maybe it'll have a better UX.

So how do I know what version is installed? Seems like a VERSION.txt file or something similar at the root of the plugin would be very useful.

Yeah, only engine builds have versions visible inside the editor, but for GDExtension it's not there. Ideally, such functionality needs to be automatic, or I'll simply forget to update it. I've got some versioning working using git tags in GitHub workflows. What I can do is save that info to a file for the GDExtension build. That's a good idea.

limbonaut avatar Apr 04 '24 19:04 limbonaut

Well done fixing virtual methods in cd0bc8e.

monxa avatar Sep 04 '24 10:09 monxa