godot-docs icon indicating copy to clipboard operation
godot-docs copied to clipboard

Document design goals of godot-cpp and common pitfalls that new users have

Open dsnopek opened this issue 1 year ago • 0 comments

There are a number of things we end up having to re-explain frequently with godot-cpp, and it would be nice to have a documentation page that explains the design goals of godot-cpp (and explains common pitfalls) so we can link to it, rather than writing a new explanation each time.

These include:

  • That one of the core design goals of godot-cpp is to have the same API (as much as is possible) as Godot modules, so we won't add new APIs to godot-cpp unless they are also added to Godot. Of course, we already have a number of API differences, but we're working on slowly fixing those, and adding new API differences would be counter productive
  • memnew() and Ref<T> need to be used when instantiating any Godot classes - plain C++ new or allocating them on the stack will not work. (This is also mentioned in https://github.com/godotengine/godot-docs/issues/8126)
  • You can't use Godot types as global variables (if they are not allocated later on the heap). This is because they will be created before GDExtension has been initialized

Creating this issue so contributors can take on this task if they'd like :-)

dsnopek avatar Nov 12 '24 17:11 dsnopek