godotengine / godotengine/godot-docs

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

Open
#10,254 0 comments 0 reactions 0 assignees View on GitHub
enhancement topic:gdextension
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

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` 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 :-)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.