We created a racing game and as part of a university project we are trying to make the car race with machine learning. We therefore get the image with "get_viewport().get_texture().get_data()" and then feed it to a python script which controls the neural network. This works really well in production on my pc with MXLinux. We now want to create a windowless version of our project to run it on the university supercomputer with CentOS and without X11 support. We tried running our project with the headless version of Godot but ".get_data()" then returns null unfortunately. Exporting the project with the headless version spawns a window again and prevents us from running it without X11. We also unfortunately cannot make use of xvfb.. We appreciate all help we can get on this:)
I haven't tried it, but I think the headless version may strip out some of the windowing/rendering portions of the engine. It is used more for calculations, such as running a server in a multiplayer game and stuff like that.
Hi cybereality, thank you for your answer. We had the same thought and were therefore wondering if there is a possibility to simply create a normal export but without X11?
No, I don't believe so. Can you use an X11 dummy emulator or something like that?
This is a current limitation of the headless platform, which cannot read texture data. This was done to limit memory usage as loading texture data is rarely needed on a game server.
As a workaround, yYou could convert your image data to a 2D array instead of relying on the Texture class, so that it can be read even in a headless export. See also https://github.com/godotengine/godot/issues/57067 and https://github.com/godotengine/godot-proposals/issues/2756.