Godot 4's --headless is not the same as Godot 3's --no-window (it can't render in the backend)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mgamsby


I’m migrating from Godot 3 to Godot 4 and everything is going well, except one thing.

I used to add the command-line --no-window so that I didn’t have any window.

Using --headless in Godot 4 doesn’t show the window either, and that part is fine.

My issue

But the issue arises because I still want the rendering to be done.
Because I have a script that is passing the image (in _process(delta)) (using tree.root.get_viewport().get_texture().get_image()).

I tested and it works fine with the window.

But with --headless, the rendering server is now “Dummy”, so I don’t have any image.

What I tried

Also, I don’t even get the _process(delta), or even the _physics_process(delta) callbacks.

I tried a few things, but it seems like you can’t hide the main window (I might have lived with a glitch making the window show and hide after the splash screen, but I can’t even do that).

I tried the solution from this post: https://forum.godotengine.org/141103/normal-rendering-without-game-window-for-ai-training?show=141103#q141103

But it doesn’t work, because I don’t even get the _physics_process(delta) callback, and I tried everywhere I could (for example _ready()), but then it didn’t work because as I mentioned above, it says it can’t render with the Dummy rendering server.

So I tried changing the rendering server, but any rendering server has a window.

So I guess my question is

Can I have a rendering server without a window in Godot 4?

Or it could be

Can I make the render of a viewport without the rendering server?
With a GDExtension perhaps?

Or it could (also) be

Can I make a custom rendering server that’s exactly the same as Vulkan (for example), but just doesn’t have a window?