Gaming in Streamlit: Added Controller Support & Dynamic Platform Gimmicks!

Hi Streamlit Community! :waving_hand:

I’ve been pushing the boundaries of what’s possible with Streamlit by building a game, and I just rolled out a major update!

While Streamlit is known for data dashboards, I wanted to explore its potential for real-time interactivity. In this version, I’ve focused on expanding input methods and level design.

:video_game: What’s New:
Full Controller Support: You can now play using a gamepad! Implementing this was a fun challenge in handling external inputs within the Streamlit lifecycle.

Dynamic “Moving Floor” Gimmicks: Added new stage elements like moving platforms. This adds a layer of timing and spatial logic that you don’t usually see in standard web apps.

:hammer_and_wrench: Technical Highlights:

  • Hardware Input System: I implemented a custom input handler within the JavaScript layer using the Web Gamepad API (navigator.getGamepads()). This allows for zero-latency switching between keyboard and physical controllers by normalizing stick thresholds and button states directly in the browser.

  • Client-Side Physics: To bypass Streamlit’s typical rerun latency, the game engine and physics (including the new moving platforms) run entirely in the frontend. This ensures a smooth 60fps experience that feels more like a native game than a web dashboard.

  • State Management: Leveraging st.components.v1.html to bridge this high-speed JS engine into the Streamlit layout while keeping the overall app structure clean and reactive.

App URL: [https://hyper-cow-jump.streamlit.app/\]
GitHub: [https://github.com/sevasu77/hyper-cow-jump\]

2026-03-0314-16-41-ezgif.com-video-to-gif-converter

Check out the “Moving Floor” in action and let me know what you think! :cow::fire:

1 Like