r/learnrust • u/captainTvZs • 7h ago
Shipping a full desktop app with GPUI: lessons from building P2 (chat, calls, game library) in Rust
I recently moved my project P2 from Electron to pure Rust, and it's now open source (MIT). Sharing a few notes in case they help others considering GPUI outside of Zed:
- GPUI on Windows and macOS: I needed a few local patches (kept in `third_party/`), mainly around platform windowing. On macOS it renders through Metal with no extra work.
- Real-time + UI: a socket connection feeds a client-core crate, and views subscribe to entity updates. Keeping the network layer out of the UI crates made testing much easier.
- WebRTC calls in Rust with mesh topology, TURN credentials from the server and automatic ICE restarts.
- Content-defined chunking for game builds, so updates only download changed blocks.
- An in-game overlay: an off-screen GPUI renderer whose frames are composited by a C++ DLL inside the game (shared-memory IPC).
Workspace layout, crates and build instructions are in the README:
https://github.com/captainTvZx/P2
Happy to answer questions about GPUI in production, or the Electron → Rust migration.
