web.pyΒΆ
Part of Bloom.
1"""
2Bloom: play in your browser via video streaming.
3
4The server renders the game with Vulkan and streams JPEG frames to the browser
5over WebSocket; touch input maps to the same left-click the desktop build uses.
6
7Run:
8 uv run python examples/demos/bloom/web.py
9
10Then open http://localhost:8080 in any modern browser.
11"""
12
13import argparse
14
15from app import BloomApp
16
17from simvx.graphics import App
18from simvx.graphics.streaming import StreamingServer
19
20
21def main():
22 parser = argparse.ArgumentParser(description="Bloom: web streaming")
23 parser.add_argument("--port", type=int, default=8080, help="Server port")
24 parser.add_argument("--host", type=str, default="0.0.0.0", help="Server host")
25 parser.add_argument("--backend", type=str, default=None, choices=["glfw", "sdl3"], help="Windowing backend")
26 args = parser.parse_args()
27
28 server = StreamingServer(host=args.host, port=args.port)
29 app = App(width=900, height=700, title="Bloom", backend=args.backend)
30 print(f"Starting Bloom at http://localhost:{args.port}")
31 app.run_streaming(BloomApp(), server)
32
33
34if __name__ == "__main__":
35 main()