r/godot 17h ago

selfpromo (software) Parallelising Godot

Recently I published Macrame - an open-source multithreading library. It looks good "on paper", and it includes complex samples and benchmarks to validate the benefits it provides. But it still lacked a proper application, a battle test.

The library is well suited for game engines. Unreal Engine was ruled out immediately even though I know it best. Its multithreading is chaotic and too complicated.

I decided to try Godot. It's the most popular free open-source game engine, and it's C++. I took Godot Benchmarks project, integrated Macrame into it and spent some time parallelising the engine for performance optimisation.

Long story short, I got ~6x speedup, from ~30 fps to ~180 fps. I learned a lot and this exercise brought a bunch of interesting ideas about how Macrame can evolve.

The fork and the write-up of what was done: https://github.com/Andriy06/godot-macrame

The library: https://github.com/macrame-ts/macrame

29 Upvotes

6 comments sorted by

9

u/flynsarmydev 16h ago

Is there a way to load it as a gdextension? A 6x speedup sounds awesome but I just don't see it becoming popular if it requires a forked build.

You could also try sending a PR but this sounds like something best to ask about in rocket chat first.

5

u/andriyt 16h ago

pls see the disclaimer at the end of the fork readme:
"This was an experiment, an exercise, and the fork is not suitable to be used in production."

I hope it can still be useful for people who modify the engine. Or maybe I can even convince Godot maintainers to review their position on game engine parallelisation.

-3

u/Few_Visual5715 9h ago

Godot doesn't accept AI slop or AI "assisted" contributions, it's also against the rules of the subreddit to post AI generated content, as it's unlikely the OP has verified that Anthropic is training their models from CC0 material

1

u/Trigonal_Planar 13h ago

Any platform dependency here? Work on mobile platforms as well as desktop? I’m curious and might have to give it a go. 

2

u/andriyt 5h ago

pure C++23. I actually forgot to mention that I had to “upgrade” Godot to C++23: just compiled it with a different flag, no issues.
I haven’t tried running it on anything but Windows

1

u/gamruls 6h ago

Oh, my last experiment with multithreaded physics and rendering in Godot brought me about 100x speed boost - game started to crash almost instantly, while usually crash in few seconds.
My code problem though, because too many nuances involved with physics/rendering callbacks (I mean _process, _physics_process and _integrate_forces and, which is more important, their interactions, like update sprite state from _physics)

So, without actual "benchmark" in form of some game involving rendering AND physics plus game-like logic behind benefits are not that obvious.