-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split C++ (godot-cpp) and GDExtension system info into separate categ…
…ories, children of Scripting.
- Loading branch information
Showing
16 changed files
with
215 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
.. _doc_about_godot_cpp: | ||
|
||
About godot-cpp | ||
=============== | ||
|
||
`godot-cpp <https://github.com/godotengine/godot-cpp>`__ are the official C++ GDExtension bindings, maintained | ||
as part of the Godot project. | ||
|
||
godot-cpp is built with the :ref:`GDExtension system <doc_gdextension>`, which allows access to Godot in almost the | ||
same way as :ref:`modules <doc_custom_modules_in_cpp>`: A lot of `engine code <https://github.com/godotengine/godot>`__ | ||
can be used in your godot-cpp project almost exactly as it is. | ||
|
||
In particular, godot-cpp has access to all functions that :ref:`GDScript <doc_gdscript>` and :ref:`C# <doc_c_sharp>` | ||
have, and additional access to a few more for fast low-level access of data, or deeper integration with Godot. | ||
|
||
Differences between godot-cpp and C++ modules | ||
----------------------------------------------- | ||
|
||
You can use both `godot-cpp <https://github.com/godotengine/godot-cpp>`__ | ||
and :ref:`C++ modules <doc_custom_modules_in_cpp>` to run C or C++ code in a Godot project. | ||
|
||
They also both allow you to integrate third-party libraries into Godot. The one | ||
you should choose depends on your needs. | ||
|
||
.. warning:: | ||
|
||
godot-cpp is currently *experimental*, which means that we may | ||
break compatibility in order to fix major bugs or include critical features. | ||
|
||
|
||
Advantages of godot-cpp | ||
~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Unlike modules, godot-cpp (and GDExtensions, in general) don't require | ||
compiling the engine's source code, making it easier to distribute your work. | ||
It gives you access to most of the API available to GDScript and C#, allowing | ||
you to code game logic with full control regarding performance. It's ideal if | ||
you need high-performance code you'd like to distribute as an add-on in the | ||
:ref:`asset library <doc_what_is_assetlib>`. | ||
|
||
Also: | ||
|
||
- You can use the same compiled godot-cpp library in the editor and exported | ||
project. With C++ modules, you have to recompile all the export templates you | ||
plan to use if you require its functionality at runtime. | ||
- godot-cpp only requires you to compile your library, not the whole engine. | ||
That's unlike C++ modules, which are statically compiled into the engine. | ||
Every time you change a module, you need to recompile the engine. Even with | ||
incremental builds, this process is slower than using godot-cpp. | ||
|
||
Advantages of C++ modules | ||
~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
We recommend :ref:`C++ modules <doc_custom_modules_in_cpp>` in cases where | ||
godot-cpp (or another GDExtension system) isn't enough: | ||
|
||
- C++ modules provide deeper integration into the engine. GDExtension's access | ||
is not as deep as static modules. | ||
- You can use C++ modules to provide additional features in a project without | ||
carrying native library files around. This extends to exported projects. | ||
|
||
.. note:: | ||
|
||
If you notice that specific systems are not accessible via godot-cpp | ||
but are via custom modules, feel free to open an issue on the | ||
`godot-cpp repository <https://github.com/godotengine/godot-cpp>`__ | ||
to discuss implementation options for exposing the missing functionality. | ||
|
||
.. _doc_what_is_gdextension_version_compatibility: | ||
|
||
Version compatibility | ||
--------------------- | ||
|
||
Usually, GDExtensions targeting an earlier version of Godot will work in later | ||
minor versions, but not vice-versa. For example, a GDExtension targeting Godot 4.2 | ||
should work just fine in Godot 4.3, but one targeting Godot 4.3 won't work in Godot 4.2. | ||
|
||
For this reason, when creating GDExtensions, you may want to target the lowest version of | ||
Godot that has the features you need, *not* the most recent version of Godot. This can | ||
save you from needing to create multiple builds for different versions of Godot. | ||
|
||
However, GDExtension is currently *experimental*, which means that we may | ||
break compatibility in order to fix major bugs or include critical features. | ||
For example, GDExtensions created for Godot 4.0 aren't compatible with Godot | ||
4.1 (see :ref:`updating_your_gdextension_for_godot_4_1`). | ||
|
||
GDExtensions are also only compatible with engine builds that use the same | ||
level of floating-point precision the extension was compiled for. This means | ||
that if you use an engine build with double-precision floats, the extension must | ||
also be compiled for double-precision floats and use an ``extension_api.json`` | ||
file generated by your custom engine build. See :ref:`doc_large_world_coordinates` | ||
for details. | ||
|
||
Generally speaking, if you build a custom version of Godot, you should generate an | ||
``extension_api.json`` from it for your GDExtensions, because it may have some differences | ||
from official Godot builds. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
:allow_comments: False | ||
|
||
.. _doc_godot_cpp: | ||
|
||
C++ (godot-cpp) | ||
=============== | ||
|
||
This section documents `godot-cpp <https://github.com/godotengine/godot-cpp>`__, | ||
the official C++ GDExtension bindings maintained as part of the Godot project. | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
:name: toc-tutorials-godot-cpp | ||
|
||
about_godot_cpp | ||
gdextension_cpp_example | ||
gdextension_docs_system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
:allow_comments: False | ||
|
||
GDExtension | ||
=========== | ||
.. _doc_gdextension: | ||
|
||
The GDExtension system | ||
====================== | ||
|
||
**GDExtension** is a Godot-specific technology that lets the engine interact with | ||
native `shared libraries <https://en.wikipedia.org/wiki/Library_(computing)#Shared_libraries>`__ | ||
at runtime. You can use it to run native code without compiling it with the engine. | ||
|
||
.. note:: GDExtension is *not* a scripting language and has no relation to | ||
:ref:`GDScript <doc_gdscript>`. | ||
|
||
This section describes how GDExtension works, and is generally aimed at people wanting to make a GDExtension from | ||
scratch, for example to create language bindings. If you want to use existing language bindings, please refer to other | ||
articles instead, such as the articles about :ref:`C++ (godot-cpp) <doc_godot_cpp>` or one of the | ||
:ref:`community-made ones <doc_what_is_gdnative_third_party_bindings>`. | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
:name: toc-tutorials-gdnative | ||
:name: toc-tutorials-gdextension | ||
|
||
what_is_gdextension | ||
gdextension_cpp_example | ||
gdextension_c_example | ||
gdextension_file | ||
gdextension_docs_system | ||
gdextension_c_example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.