Virtualx Game Engine. Forked from Godot 3.6
Find a 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
.clang-format
.clang-tidy
.editorconfig
.gitattributes
.gitignore
.lgtm.yml
.mailmap
AUTHORS.md
CHANGELOG.md
CONTRIBUTING.md
COPYRIGHT.txt
DONORS.md
gles3_builders.py
glsl_builders.py
icon.png
icon.svg
icon_outlined.png
icon_outlined.svg
LICENSE.txt
logo.png
logo.svg
LOGO_LICENSE.md
logo_outlined.png
logo_outlined.svg
methods.py Fix jumbled error output when using Windows spawn fix 2022-08-12 08:01:56 +02:00
platform_methods.py
README.md
SConstruct Merge pull request #63919 from Faless/scons/4.x_easy_deps 2022-08-07 16:09:02 +02:00
version.py

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