[Major Feature] True headless execution without X11/GPU dependencies #157
Labels
No Label
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Blocks
Reference: john/McRogueFace#157
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem Statement
McRogueFace cannot execute on servers without X11, even with
--headlessmode. The current headless implementation avoids creating a window but still requires the full graphics stack:This prevents use cases like:
Root Cause Analysis
SFML's architecture is the fundamental blocker.
sf::RenderTexture::create()unconditionally initializes an OpenGL context, which on Linux requires X11 libraries and a display.Current Dependencies
From
CMakeLists.txt:sfml-graphics(requires OpenGL)sfml-window(requires X11/udev on Linux)sfml-system(no graphics deps - safe)sfml-audio(already disabled in headless)OpenGL::GL(required by ImGui-SFML)SFML Type Pervasiveness
sf::types across codebaseUIDrawable::render(sf::Vector2f, sf::RenderTarget&)sf::Vector2f,sf::Color,sf::FloatRect,sf::Font,sf::TextureRequirements
Potential Approaches
Option A: Software Rasterizer Backend
Replace OpenGL with a CPU-based renderer (Cairo, Skia, or custom).
Pros:
Cons:
Option B: Conditional Compilation (Dual Binary)
Build two versions:
mcrogueface(full) andmcrogueface-headless(minimal).Pros:
Cons:
Option C: Abstract Renderer Interface + Pluggable Backends
Create
RenderBackendabstraction with multiple implementations:SFMLBackend- current behavior (requires X11)SoftwareBackend- CPU rendering (no X11)NullBackend- no rendering (fastest, no screenshots)Pros:
Cons:
Option D: Offscreen Mesa/OSMesa
Use Mesa's software OpenGL implementation.
Pros:
Cons:
Option E: Wait for SFML 3.x
SFML 3.0 may have better headless support.
Pros:
Cons:
Recommended Path
Option C (Abstract Renderer) with Option A (Software Rasterizer) as the headless backend.
This is the most future-proof approach but also the largest undertaking. It would:
RenderTargetinterface (or wrapper around sf::RenderTarget)SoftwareRendererusing a library like:HeadlessRendererpathwayScope Estimate
This is a Major Feature requiring:
Not suitable for near-term v1.0 timeline. Should be planned as a post-1.0 enhancement or parallel long-term effort.
Workaround (Current)
For immediate needs, use virtual framebuffer:
Or in Docker:
Related
src/HeadlessRenderer.h/cpp)References
Note: libtcod-headless Already Exists
The project already maintains a fork of libtcod without SDL dependencies: https://github.com/jmccardle/libtcod-headless
This means libtcod is not a blocker for true headless execution. The dependency situation is simpler than initially assessed:
SFML is the sole blocker. The renderer abstraction work is the critical path for headless support.
This also has implications for future WASM/Emscripten builds — libtcod-headless should cross-compile cleanly without SDL concerns.