Skip to content

Instantly share code, notes, and snippets.

View reduz's full-sized avatar

Juan Linietsky reduz

View GitHub Profile
View godot_binding_system_explained.md

During the past days, this great article by Sam Pruden has been making the rounds around the gamedev community. While the article provides an in-depth analysis, its a bit easy to miss the point and exert the wrong conclusions from it. As such, and in many cases, users unfamiliar with Godot internals have used it points such as following:

  • Godot C# support is inefficient
  • Godot API and binding system is designed around GDScript
  • Godot is not production ready

In this brief article, I will shed a bit more light about how the Godot binding system works and some detail on the Godot

@reduz
reduz / structs.cpp
Created July 19, 2023 12:29
Godot Struct Low Level Proposal
View structs.cpp
// The idea of this proposal is that we can solve these following problems:
//* Add struct support to GDScript (this has some user demand, given classes are quite heavy resource wise)
//* Add limited struct support to the Godot API, so we avoid exposing things as dictionaries in the API, which are unfriendly (no code completion, no doc)
//* As a plus, have a way to have optimized, flat memory arrays of these structs. this allows much higher performance in GDScript when dealing with thousands of elements (as in, bullet hell). We know we can use multimesh to accelerate drawing (or the new APIs in Godot 3 for drawing which are more optimized), but storing logical data for processing all these is still inefficient cache wise.
//In GDScript, structs should look very simple:
struct MyStruct:
var a : String
@reduz
reduz / structs.cpp
Created July 19, 2023 11:49
Godot Struct Low Level Proposal
View structs.cpp
// Implementation in Array
// ArrayPrivate needs to be changed:
class ArrayPrivate {
public:
SafeRefCount refcount;
Vector<Variant> array;
Variant *read_only = nullptr; // If enabled, a pointer is used to a temporary value that is used to return read-only values.
ContainerTypeValidate typed;
@reduz
reduz / gist:6bd1a4922f68cf4e4bd14c19612343f2
Created July 19, 2023 11:49
Godot Struct Low Level Proposal
View gist:6bd1a4922f68cf4e4bd14c19612343f2
// Implementation in Array
// ArrayPrivate needs to be changed:
class ArrayPrivate {
public:
SafeRefCount refcount;
Vector<Variant> array;
Variant *read_only = nullptr; // If enabled, a pointer is used to a temporary value that is used to return read-only values.
ContainerTypeValidate typed;
View api4.json
This file has been truncated, but you can view the full file.
{
"header": {
"version_major": 4,
"version_minor": 0,
"version_patch": 0,
"version_status": "dev",
"version_build": "custom_build",
"version_full_name": "Godot Engine v4.0.dev.custom_build"
},
View api3.json
This file has been truncated, but you can view the full file.
{
"header": {
"version_major": 4,
"version_minor": 0,
"version_patch": 0,
"version_status": "dev",
"version_build": "custom_build",
"version_full_name": "Godot Engine v4.0.dev.custom_build"
},
View api2.json
This file has been truncated, but you can view the full file.
{
"header": {
"version_major": 4,
"version_minor": 0,
"version_patch": 0,
"version_status": "dev",
"version_build": "custom_build",
"version_full_name": "Godot Engine v4.0.dev.custom_build"
},
@reduz
reduz / api.json
Created June 19, 2021 23:05
New Godot API dump text format for native extensions
View api.json
This file has been truncated, but you can view the full file.
{
"header": {
"version_major": 4,
"version_minor": 0,
"version_patch": 0,
"version_status": "dev",
"version_build": "custom_build",
"version_full_name": "Godot Engine v4.0.dev.custom_build"
},
"global_constants": [
View api.json
This file has been truncated, but you can view the full file.
{
"header": {
"version_major": 4,
"version_minor": 0,
"version_patch": 0,
"version_status": "dev",
"version_build": "custom_build",
"version_full_name": "Godot Engine v4.0.dev.custom_build"
},