# Switching to Godot 4

**URL:** https://forum.revolutionarygamesstudio.com/t/switching-to-godot-4/986
**Category:** Meta
**Created:** [February 10, 2023, 3:22am UTC](https://forum.revolutionarygamesstudio.com/t/switching-to-godot-4/986 "2023-02-10T03:22:11Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![84634E1A607A](https://thrivedevforum-cdn.b-cdn.net/user_avatar/forum.revolutionarygamesstudio.com/84634e1a607a/32/1766_2.png) [@84634E1A607A](https://forum.revolutionarygamesstudio.com/u/84634E1A607A)
#### Post date: [February 10, 2023, 3:22am UTC](https://forum.revolutionarygamesstudio.com/t/switching-to-godot-4/986/1 "2023-02-10T03:22:12Z")

</div>

### How come this post

Godot 4 has its first [release candidate](https://godotengine.org/article/release-candidate-godot-4-0-rc-1/) on Feb, 8, 2023. I downloaded it and experimented with Godot 4 these days. I tried to convert Thrive to Godot 4 as well but failed (Or stuck, to be concise).

I’d like to list Pros and Cons of switching to Godot 4 here (and list some actions needed) for discussion, and aid anyone who wants to switch Thrive to Godot 4 (or 4.1 or anything).

### Overview

I got 2400+ errors after using builtin Godot project converter. Some scene related things are also broken.

### Cool features provided by Godot 4

#### No need for NodePath!!!

Godot 4 supports exporting GodotObject, so there is no longer a need for all those NodePath, Nullable checks and Disposals.

![Code](https://cdn.discordapp.com/attachments/464846992720396288/1073427395278807101/image.png) ![Editor](https://cdn.discordapp.com/attachments/464846992720396288/1073427395572404264/image.png)

#### No more unhandled exceptions

Godot now handles any user-unhandled exception for us, the game will not crash due to our fault. Instead, it will print an error:

```CSharp
ERROR: System.NullReferenceException: Object reference not set to an instance of an object.
   at Main.DialogOpenRequested() in /home/ajax/TestGodot4/Main.cs:line 24
   at Main.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in /home/ajax/TestGodot4/Godot.SourceGenerators/Godot.SourceGenerators.ScriptMethodsGenerator/Main_ScriptMethods.generated.cs:line 34
   at Godot.Bridge.CSharpInstanceBridge.Call(IntPtr godotObjectGCHandle, godot_string_name* method, godot_variant** args, Int32 argCount, godot_variant_call_error* refCallError, godot_variant* ret) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs:line 24
   at: godotsharp_pusherror (modules/mono/glue/runtime_interop.cpp:1303)

```

#### C# action implementations

Godot added C# action implementations to signals, making all Node-derived classes partial. Now we can use `Button.Pressed += Handler` to connect to signals (Also this is now the recommended way); However, they removed signal bindings when connecting signals from C# and altered binding format, from `Node.Connect(sig, obj, fun, binding, mode)` to `Node.Connect(sig, tgt, mode)` where `tgt = (obj, fun)` . So bindings have to be moved to calls.

#### Autowrap to all Dialogs

Now autowrap function is moved from WindowDialog to Window (now the hierarchy is `Popup <- Window <- Viewport <- Node` and `AcceptDialog <- Window <- Viewport <- Node`), so the major part of CustomDialog is now redaudant.

### Difficulties to convert to Godot 4

#### Joybad rework

There’re MASSIVE changes to the Joy-pad controls, from `JoystickBlaBla` to `JoyAxis` _and_ `JoyButton`, so someone very familiar to joypad has to rework this part.

#### \_Process rework

`_Process(float delta)` goes to `_Process(double delta)`, generating numerous type conversions.

#### Tween rework

Tween is no longer `Node` so tween usage should be reconsidered.

#### Signal rework

No connect-time signal binding anymore. (Mentioned above)

EDIT: From [https://github.com/godotengine/godot-proposals/issues/387](https://github.com/godotengine/godot-proposals/issues/387)

> conversion of `connect()` to the new syntax? `other.connect("signal", target, "method", [binds])` becomes `other.signal.connect(target.method).bind(binds)`. This is handled in my converter, but the official one handles connections in a different way (which works), so it’s ok too

EDIT 2: It’s BRILLIANT! No proxy anymore (maybe)

```auto
control.Connect("focus_entered", GUICommon.Instance, nameof(GUICommon.ProxyFocusForward)),
            new Array(control));

```

goes to

```auto
control.FocusEntered += control.ForwardFocusToNext;

```

#### Popup rework

Due to the fact that Popup is no longer CanvasItem, it has no Draw calls. Many custom Popups need to be reworked.

#### Project conversion errors

We may need to choose a good project converter to avoid renaming all `Path` to `Path3D`, all `Remove` to `RemoveAt`…

#### Scene errors

AFAIK thrive\_theme.tres is not converted properly. e.g. Button styleboxes are missing.

#### Other changes

- ColorPicker is completely reworked too  

- Dotnet nullable updates

- Added Vector2I (\<int, int\>) for controls (more type conversions)

- File and Directory reworks (this looks good)

### Personal thoughts

It will be pretty hard to switch to Godot 4. However, GUI programming will be benefitted a lot because I think Godot 4’s C# logic is more native and clear.

---

<div class="post-metadata">

### Author: ![Kasterisk](https://thrivedevforum-cdn.b-cdn.net/user_avatar/forum.revolutionarygamesstudio.com/kasterisk/32/2621_2.png) [@Kasterisk](https://forum.revolutionarygamesstudio.com/u/Kasterisk)
#### Post date: [February 10, 2023, 3:32am UTC](https://forum.revolutionarygamesstudio.com/t/switching-to-godot-4/986/2 "2023-02-10T03:32:00Z")

</div>

I’d like to see the difference in performance, whether it’s faster or slower once you do get this running.

---

<div class="post-metadata">

### Author: ![84634E1A607A](https://thrivedevforum-cdn.b-cdn.net/user_avatar/forum.revolutionarygamesstudio.com/84634e1a607a/32/1766_2.png) [@84634E1A607A](https://forum.revolutionarygamesstudio.com/u/84634E1A607A)
#### Post date: [February 10, 2023, 3:34am UTC](https://forum.revolutionarygamesstudio.com/t/switching-to-godot-4/986/3 "2023-02-10T03:34:42Z")

</div>

I doubt whether I can get this running because I still have 200+ errors in the codebase and a huge amount of scenes that are broken or may be broken. Plus, I’m running out of time (spring semester is approaching)

Maybe you can quickly make some rough small projects so that I can easily convert them and test the performance impact.

---

<div class="post-metadata">

### Author: ![Kasterisk](https://thrivedevforum-cdn.b-cdn.net/user_avatar/forum.revolutionarygamesstudio.com/kasterisk/32/2621_2.png) [@Kasterisk](https://forum.revolutionarygamesstudio.com/u/Kasterisk)
#### Post date: [February 10, 2023, 3:40am UTC](https://forum.revolutionarygamesstudio.com/t/switching-to-godot-4/986/4 "2023-02-10T03:40:49Z")

</div>

> [@84634E1A607A](#):
>
> Maybe you can quickly make some rough small projects so that I can easily convert them and test the performance impact.

That wouldn’t reflect the actual results a project as large such as Thrive may possibly get.

> [@84634E1A607A](#):
>
> I doubt whether I can get this running because I still have 200+ errors in the codebase and a huge amount of scenes that are broken or may be broken. Plus, I’m running out of time (spring semester is approaching)

Take your time, this is not urgent.

---

<div class="post-metadata">

### Author: ![hhyyrylainen](https://thrivedevforum-cdn.b-cdn.net/user_avatar/forum.revolutionarygamesstudio.com/hhyyrylainen/32/2243_2.png) [@hhyyrylainen](https://forum.revolutionarygamesstudio.com/u/hhyyrylainen)
#### Post date: [February 10, 2023, 7:42am UTC](https://forum.revolutionarygamesstudio.com/t/switching-to-godot-4/986/5 "2023-02-10T07:42:18Z")

</div>

Very cool stuff coming in Godot 4. Sadly there are really big blocking bugs regarding opening on wrong monitor and not being able to change DPI when moving a window to a different monitor that I experienced. I’ve reported those to Godot but the issues have not been solved ([56340](https://github.com/godotengine/godot/issues/56340) and [56341](https://github.com/godotengine/godot/issues/56341)). Which means that it’ll probably be closer to 4.1 or even later before we can switch once the most serious 4.x new bugs have been fixed.

With those links I just found out we actually have a tracking issue in our repo about this:

> <https://github.com/Revolutionary-Games/Thrive/issues/2998>
>
> Even though Godot 4.0 is not out as a stable version yet, I'm opening this issue… to remind of things that need doing in Thrive to prepare.
> 
> Engine bugs I'm going to require to be fixed before we can switch to 4.0:
> \- \[\] https://github.com/godotengine/godot/issues/56340
> \- \[\] https://github.com/godotengine/godot/issues/56341
> \- \[\] https://github.com/godotengine/godot/issues/65866 (discovered through: https://github.com/chickensoft-games/GameTemplate/issues/1)
> \- \[x\] The godot older (non-vulkan) fallback renderer needs to have the 3D support finished for it
> \- \[x\] Testing Godot 4 on a Windows 7 machine and with integrated graphics to confirm older hardware compatibility is ready in Godot 4
> \- \[\] https://github.com/godotengine/godot/pull/56014 getting that merged to the engine would be really nice to no longer have to make our releases with an engine fork
> \- \[\] DevBuilds will need to keep working (the tool for those will need at least some changes: https://github.com/hhyyrylainen/GodotPckTool/issues/33)
> \- \[\] https://github.com/godotengine/godot/issues/73515
> 
> Some notes for when we need to do the conversion:
> \- x11 renamed in godot 4.0 to linuxbsd

> [@84634E1A607A](#):
>
> Godot now handles any user-unhandled exception for us, the game will not crash due to our fault. Instead, it will print an error:

This is actually a downgrade for us as we specifically print the instructions to report a bug to us on unhandled exceptions. So I _really_ hope that there’s a way to turn this off.

> [@84634E1A607A](#):
>
> However, they removed signal bindings when connecting signals from C# and altered binding format, from `Node.Connect(sig, obj, fun, binding, mode)` to `Node.Connect(sig, tgt, mode)` where `tgt = (obj, fun)` . So bindings have to be moved to calls.

Can you clarify how this looks? I find it a bit hard to imagine how this impacts us based on just this description.

---

<div class="post-metadata">

### Author: ![hhyyrylainen](https://thrivedevforum-cdn.b-cdn.net/user_avatar/forum.revolutionarygamesstudio.com/hhyyrylainen/32/2243_2.png) [@hhyyrylainen](https://forum.revolutionarygamesstudio.com/u/hhyyrylainen)
#### Post date: [March 14, 2024, 1:09pm UTC](https://forum.revolutionarygamesstudio.com/t/switching-to-godot-4/986/6 "2024-03-14T13:09:05Z")

</div>

Update on this:

> [@Thrive now uses Godot 4](https://forum.revolutionarygamesstudio.com/t/thrive-now-uses-godot-4/1091):
>
> It is finally here, Thrive now uses Godot 4. I’ve just merged the code to master branch switching the Godot version. However as this is a huge change, I could not make it all at once. So while Thrive now basically works, there’s still a lot of issues and warnings from Godot to solve. This means that anyone working on Thrive locally should now go and download Godot 4.2 (it seems that maybe 4.2.2 RC1 is required to successfully import Thrive). Also if you have opened Thrive in Godot 3, you need …
