Godot-proposals: Add headless / server mode support to all platforms as a DisplayServer

Created on 2 Jun 2020  路  3Comments  路  Source: godotengine/godot-proposals

Describe the project you are working on:
The Godot Engine ;)

Describe the problem or limitation you are having in your project:
Historically, Godot's headless (no window/no rendering) platform was only supported on Linux/*BSD via the platform=server port, which was basically a copy of platform=x11 with some changes to allow headless use. It was then extended to also support macOS, albeit still via platform=server (so the same platform code actually covers two platforms).

On Windows, only a --no-window flag is provided to avoid showing a window, but it's not a proper headless mode.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
The hacky server platform should go away, as maintaining a custom platform port for this purpose is overkill.

Now that we split OS from DisplayServer in the master branch, we can implement a headless DisplayServer backend that could be used on all support platform ports (notably Windows, but in theory also Android, iOS, etc.).

Moreover, as this would be registered as an additional DisplayServer backend, it would no longer be necessary to have a custom binary for headless (CI/CD) and server workflows, as the native editor and template builds for the host platforms could be used, with a command line switch to disable window creation and rendering (and possibly automatic fallback on real headless systems that do not support the graphical DisplayServer implementations).

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
We currently have a "Dummy" rasterizer and texture loader implemented in https://github.com/godotengine/godot/tree/master/drivers/dummy for the server platform.

It should be modified to be paired to a headless DisplayServer implementation (possibly implementations if there are platform-specific requirements to handle) that can be enabled on Linux, macOS and Windows via the --display-driver switch (possibly other platforms later on if deemed relevant and technically possible).

The platform/server code should be removed.

Help welcome to flesh out this proposal with more technical details on the implementation. (CC @Faless)

Replaces and supersedes https://github.com/godotengine/godot/issues/11389.

If this enhancement will not be used often, can it be worked around with a few lines of script?:
No.

Is there a reason why this should be core and not an add-on in the asset library?:
This is about platform code, which is core.

porting

Most helpful comment

BTW, whoever implements this gets the privilege to git rm -rf platform/server :)
That's 758 deletions(-) (meh, less than I thought), but still good to take (well, remove ;)).

All 3 comments

Moreover, as this would be registered as an additional DisplayServer backend, it would no longer be necessary to have a custom binary for headless (CI/CD) and server workflows, as the native editor and template builds for the host platforms could be used, with a command line switch to disable window creation and rendering (and possibly automatic fallback on real headless systems that do not support the graphical DisplayServer implementations).

Sounds good, but is it possible to dlopen() X11 libraries to sidestep the requirement to install them on a server?

@Calinou You don't want to do lazy loading by hand (and sadly, ld-linux has no -znolazyload like solaris). Best you can do is external tool that generates dlopen()/dlsym() wrapper library thus simulating MSVC late binding feature.

BTW, whoever implements this gets the privilege to git rm -rf platform/server :)
That's 758 deletions(-) (meh, less than I thought), but still good to take (well, remove ;)).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rainlizard picture rainlizard  路  3Comments

PLyczkowski picture PLyczkowski  路  3Comments

davthedev picture davthedev  路  3Comments

arkology picture arkology  路  3Comments

wijat picture wijat  路  3Comments