Godot Engine – Multi-platform 2D and 3D game engine
Go to file
Ignacio Roldán Etcheverry 124fbf95f8 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.
2022-08-22 03:35:59 +02:00
.github Check also GLES3 in CI 2022-08-06 19:12:09 +02:00
core Merge pull request #64334 from YuriSizov/core-bind-property-revert-methods 2022-08-19 20:41:41 +03:00
doc Merge pull request #64170 from YuriSizov/docs-annotations-in-technicolor 2022-08-20 00:57:01 +02:00
drivers Merge pull request #62046 from clayjohn/vertexless-draw 2022-08-20 05:32:28 +02:00
editor Merge pull request #64170 from YuriSizov/docs-annotations-in-technicolor 2022-08-20 00:57:01 +02:00
main Merge pull request #55032 from Calinou/tweak-default-window-size 2022-08-18 23:43:01 +03:00
misc [iOS] Extend iOS plugins to support Swift runtime 2022-08-09 20:20:54 +03:00
modules C#: Move marshaling logic and generated glue to C# 2022-08-22 03:35:59 +02:00
platform Merge pull request #64481 from jamie-pate/master 2022-08-20 13:36:04 +02:00
scene Remove requirement to have vertex positions when creating a mesh. Meshes can now be constructed from an index buffer alone 2022-08-19 14:50:12 -06:00
servers Merge pull request #64110 from Geometror/fix-light-shadow-off 2022-08-20 17:06:03 +02:00
tests Make `property_*_revert` methods multilevel and expose them for scripting 2022-08-18 00:03:53 +03:00
thirdparty Merge pull request #62847 from RandomShaper/upgrade_spirv_reflect 2022-08-06 09:24:53 +02:00
.clang-format Style: Workaround clang-format 14 bug with `Inline` oneliner functions 2022-08-03 12:20:23 +02:00
.clang-tidy Style: Partially apply clang-tidy's `cppcoreguidelines-pro-type-member-init` 2022-05-02 16:28:25 +02:00
.editorconfig Add a simple C# .editorconfig 2021-07-23 17:04:53 -04:00
.gitattributes File: Re-add support to skip CR (`\r`) in `File::get_as_text` 2022-08-01 00:40:35 +02:00
.gitignore HTML5: Run `npm audit fix` 2022-05-25 14:56:43 +02:00
.lgtm.yml Create a basic .lgtm.yml file. 2020-09-03 14:49:14 +01:00
.mailmap Update AUTHORS and DONORS list 2022-07-25 16:27:42 +02:00
AUTHORS.md Update AUTHORS and DONORS list 2022-07-25 16:27:42 +02:00
CHANGELOG.md Merge pull request #56286 from Calinou/changelog-shaders-depth-texture 2022-01-05 10:49:18 +01:00
CONTRIBUTING.md Recommend using GitHub attachments for minimal reproduction projects 2022-02-06 12:33:40 +01:00
COPYRIGHT.txt etcpak: Update to upstream release 1.0 (June 4, 2022) 2022-06-10 12:36:45 +02:00
DONORS.md Update AUTHORS and DONORS list 2022-07-25 16:27:42 +02:00
LICENSE.txt Update copyright statements to 2022 2022-01-03 21:27:34 +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
README.md README updates and improvements, link license page 2021-11-02 02:28:25 +01:00
SConstruct Merge pull request #63919 from Faless/scons/4.x_easy_deps 2022-08-07 16:09:02 +02:00
gles3_builders.py Implement Vector4, Vector4i, Projection 2022-07-23 14:00:01 +02:00
glsl_builders.py Implemented AMD's FSR as a computer shader for upscaling 3D scenes 2021-11-23 14:16:03 -07: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
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_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 Fix jumbled error output when using Windows spawn fix 2022-08-12 08:01:56 +02:00
platform_methods.py Merge python EnvironmentError, IOError and WindowsError into OSError. 2020-09-02 15:58:07 +01:00
version.py Bump version to 4.0-alpha 2022-01-23 00:09:08 +01:00

README.md

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 with 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 the Godot Engine editor

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.

The best way to get in touch with the core engine developers 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.

We also maintain official demos in their own GitHub repository as well as a list of awesome Godot community resources.

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