Go to file
Ignacio Roldán Etcheverry 483071716e C#: Move marshaling logic and generated glue to C#
We will be progressively moving most code to C#.
The plan is to only use Mono's embedding APIs to set things at launch.
This will make it much easier to later support CoreCLR too which
doesn't have rich embedding APIs.

Additionally the code in C# is more maintainable and makes it easier
to implement new features, e.g.: runtime codegen which we could use to
avoid using reflection for marshaling everytime a field, property or
method is accessed.

SOME NOTES ON INTEROP

We make the same assumptions as GDNative about the size of the Godot
structures we use. We take it a bit further by also assuming the layout
of fields in some cases, which is riskier but let's us squeeze out some
performance by avoiding unnecessary managed to native calls.

Code that deals with native structs is less safe than before as there's
no RAII and copy constructors in C#. It's like using the GDNative C API
directly. One has to take special care to free values they own.
Perhaps we could use roslyn analyzers to check this, but I don't know
any that uses attributes to determine what's owned or borrowed.

As to why we maily use pointers for native structs instead of ref/out:
- AFAIK (and confirmed with a benchmark) ref/out are pinned
  during P/Invoke calls and that has a cost.
- Native struct fields can't be ref/out in the first place.
- A `using` local can't be passed as ref/out, only `in`. Calling a
  method or property on an `in` value makes a silent copy, so we want
  to avoid `in`.

REGARDING THE BUILD SYSTEM

There's no longer a `mono_glue=yes/no` SCons options. We no longer
need to build with `mono_glue=no`, generate the glue and then build
again with `mono_glue=yes`. We build only once and generate the glue
(which is in C# now).
However, SCons no longer builds the C# projects for us. Instead one
must run `build_assemblies.py`, e.g.:
```sh
%godot_src_root%/modules/mono/build_scripts/build_assemblies.py \
        --godot-output-dir=%godot_src_root%/bin \
        --godot-target=release_debug`
```
We could turn this into a custom build target, but I don't know how
to do that with SCons (it's possible with Meson).

OTHER NOTES

Most of the moved code doesn't follow the C# naming convention and
still has the word Mono in the names despite no longer dealing with
Mono's embedding APIs. This is just temporary while transitioning,
to make it easier to understand what was moved where.
2021-08-20 10:24:56 +02:00
.github Fix github actions cache server being down failing builds 2021-08-18 21:58:54 +01:00
core Fix capsule height/radius setters with linked properties 2021-08-19 10:31:19 -07:00
doc Improvements to SpotLight3D and OmniLight3D's shadows 2021-08-19 13:46:51 +02:00
drivers Fixes to mobile renderer 2021-08-17 13:52:06 -03:00
editor Merge pull request #51583 from nekomatata/capsule-height-radius-setters 2021-08-19 20:48:54 +02:00
main Add project setting for agile input event flushing 2021-08-13 11:45:50 +02:00
misc [Headless] Add --headless switch (no rendering, no audio). 2021-08-03 17:45:50 +02:00
modules C#: Move marshaling logic and generated glue to C# 2021-08-20 10:24:56 +02:00
platform HTML5: Handle GODOT_VERSION_STATUS env var in @GODOT_VERSION@ 2021-08-19 15:01:30 +02:00
scene Merge pull request #51881 from KoBeWi/zz__iinnddeexx 2021-08-19 21:30:10 +02:00
servers Improvements to SpotLight3D and OmniLight3D's shadows 2021-08-19 13:46:51 +02:00
tests Merge pull request #51787 from akien-mga/string-num-fix-default-decimals 2021-08-18 09:31:34 +02:00
thirdparty Upgrade spirv-reflect 2021-08-14 15:12:07 +02:00
.clang-format Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2020-05-14 16:54:55 +02:00
.clang-tidy Style: Enforce braces around if blocks and loops 2020-05-14 21:57:34 +02:00
.editorconfig Add a simple C# .editorconfig 2021-07-23 17:04:53 -04:00
.gitattributes Mark *.tza files as binary in .gitattributes for old Git versions 2020-05-12 09:49:19 +02:00
.gitignore gitignore: Ignore Kate swap files 2021-01-27 01:07:57 +03:00
.lgtm.yml Create a basic .lgtm.yml file. 2020-09-03 14:49:14 +01:00
.mailmap Update AUTHORS and DONORS list 2021-08-13 11:45:08 +02:00
AUTHORS.md Update AUTHORS and DONORS list 2021-08-13 11:45:08 +02:00
CHANGELOG.md Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
CONTRIBUTING.md Link to Godot Contributors Chat instead of IRC 2021-03-05 22:32:48 +01:00
COPYRIGHT.txt Upgrade Vulkan memory allocator 2021-08-13 00:05:41 +02:00
DONORS.md Update AUTHORS and DONORS list 2021-08-13 11:45:08 +02:00
glsl_builders.py RenderingServer reorganization 2020-12-04 18:39:46 -03:00
icon.png Remove two very slightly displaced duplicate vertices on Gobot's face 2020-12-11 07:05:54 +01:00
icon.svg Remove two very slightly displaced duplicate vertices on Gobot's face 2020-12-11 07:05:54 +01:00
icon_outlined.png Add an outlined version of logo.png and icon.png and put it in README.md 2020-12-14 06:42:51 +01:00
icon_outlined.svg Add an outlined version of logo.png and icon.png and put it in README.md 2020-12-14 06:42:51 +01:00
LICENSE.txt Update copyright statements to 2021 2021-01-01 20:19:21 +01:00
logo.png Remove two very slightly displaced duplicate vertices on Gobot's face 2020-12-11 07:05:54 +01:00
logo.svg Remove two very slightly displaced duplicate vertices on Gobot's face 2020-12-11 07:05:54 +01:00
LOGO_LICENSE.md Relicense Godot logo from CC-BY-3.0 to CC-BY-4.0 2020-12-03 14:30:06 +01:00
logo_outlined.png Add an outlined version of logo.png and icon.png and put it in README.md 2020-12-14 06:42:51 +01:00
logo_outlined.svg Add an outlined version of logo.png and icon.png and put it in README.md 2020-12-14 06:42:51 +01:00
methods.py SCons: Fix potential error when pruning cache on CI 2021-08-18 22:19:51 +02:00
platform_methods.py Merge python EnvironmentError, IOError and WindowsError into OSError. 2020-09-02 15:58:07 +01:00
README.md Merge pull request #44359 from Riteo/logo-outline 2021-05-09 14:01:05 +02:00
SConstruct Use "volk" instead of statically linked Vulkan loader. 2021-08-12 14:25:15 +03:00
version.py Update copyright statements to 2021 2021-01-01 20:19:21 +01:00

Godot Engine

Godot Engine logo

2D and 3D cross-platform game engine

Godot Engine is a feature-packed, cross-platform game engine to create 2D and 3D games from a unified interface. It provides a comprehensive set of common tools, so that users can focus on making games without having to reinvent the wheel. Games can be exported in one click to a number of platforms, including the major desktop platforms (Linux, macOS, Windows), mobile platforms (Android, iOS), as well as Web-based platforms (HTML5) and consoles.

Free, open source and community-driven

Godot is completely free and open source under the very permissive MIT license. No strings attached, no royalties, nothing. The users' games are theirs, down to the last line of engine code. Godot's development is fully independent and community-driven, empowering users to help shape their engine to match their expectations. It is supported by the Software Freedom Conservancy not-for-profit.

Before being open sourced in February 2014, Godot had been developed by Juan Linietsky and Ariel Manzur (both still maintaining the project) for several years as an in-house engine, used to publish several work-for-hire titles.

Screenshot of a 3D scene in Godot Engine

Getting the engine

Binary downloads

Official binaries for the Godot editor and the export templates can be found on the homepage.

Compiling from source

See the official docs for compilation instructions for every supported platform.

Community and contributing

Godot is not only an engine but an ever-growing community of users and engine developers. The main community channels are listed on the homepage.

To get in touch with the engine developers, the best way is to join the Godot Contributors Chat.

To get started contributing to the project, see the contributing guide.

Documentation and demos

The official documentation is hosted on ReadTheDocs. It is maintained by the Godot community in its own GitHub repository.

The class reference is also accessible from the Godot editor.

The official demos are maintained in their own GitHub repository as well.

There are also a number of other learning resources provided by the community, such as text and video tutorials, demos, etc. Consult the community channels for more information.

Code Triagers Badge Translate on Weblate Total alerts on LGTM TODOs