Guest User

MKLive on Steamdeck recipe

a guest
Nov 3rd, 2026
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.79 KB | None | 0 0
  1. Recipe: Native two-kart driving on a Steam Deck
  2. Recipe by Seth Robinson
  3. Tested on an original LCD Steam Deck
  4.  
  5. Build a native Linux free-driving app for two Mario Kart Live: Home Circuit karts,
  6. with simultaneous cameras, pairing and controller setup. This describes a working
  7. private prototype. Give this recipe to your AI, have it inspect the public projects
  8. below, then implement each milestone. Keep a build log and pin working revisions.
  9.  
  10. 1. Start from the existing interoperability work.
  11.  
  12. OpenKart SDK [1], by Sam Edwards (CFSworks) and contributors, supplies the kart
  13. communication and pairing foundation. mk-live [2], by xmrius, supplies a Linux/
  14. Steam Deck implementation, browser cockpit, deployment work and a useful camera
  15. transport parser. Study its video_worker.py; the two video paths are not
  16. interchangeable. Follow upstream setup documentation, including patched hostapd
  17. [3], and preserve MIT/BSD notices when adapting code. Obtain dependencies from
  18. their projects. This recipe supplies no private code, firmware, authentication
  19. material or pairing data. Switchbrew [4] provides protocol background.
  20.  
  21. 2. Prove one kart works before building the interface.
  22.  
  23. Start with one charged kart, Ethernet development access and the Deck's built-in
  24. controls. Inspect the actual Wi-Fi chipset, driver and AP-mode support. Testing
  25. used an original LCD Steam Deck and its built-in RTL8822CE Wi-Fi. The OLED model
  26. has different wireless hardware and has not been tested with this setup; other
  27. models and adapters also need separate testing. Establish pairing and continuously
  28. changing video with the upstream stack. Make Wi-Fi a temporary kart access point:
  29. ordinary networking stays the boot default, returns on exit, and has a
  30. crash-recovery command. Develop over Ethernet. If association succeeds but
  31. networking stalls, investigate DHCP. Our setup needed DHCP replies delivered by
  32. Ethernet unicast with an IPv4 broadcast destination; ordinary alternatives failed.
  33.  
  34. 3. Separate the native interface from the protocol service.
  35.  
  36. Use C++20, SDL2, SDL_ttf, FFmpeg/libavcodec and libqrencode for the window, input,
  37. video decoding, text and QR display. Retain an OpenKart-derived Python service
  38. for kart communication and radio management. Replace the browser frontend with
  39. a private local Unix socket carrying bounded status messages, compressed H.264
  40. frames and control commands. Run the UI without root; isolate privileged network
  41. operations. Porting that service to C++ is not a proven latency improvement. Sample input
  42. independently of video, send controls around 30 Hz, and give each kart its own
  43. stream state and input deadline.
  44.  
  45. 4. Make the first video feed correct, then add the second.
  46.  
  47. Keep transport reassembly, decoding and display scheduling separate. Start from
  48. mk-live's parser, validate payload boundaries, and retain startup frames so setup
  49. does not lose the initial keyframe. Decode H.264 directly. A rising frame counter
  50. does not prove the picture is changing: test movement, corruption and missing
  51. keyframes. Add the second kart with its own assembler, decoder and bounded
  52. presentation queue. Decode reference frames promptly; optionally
  53. delay display by 0, 33 or 67 ms, defaulting to 33 ms, to smooth bursts. Never
  54. buffer driving commands. Reset/recover only the affected camera, keep decoders
  55. alive across menus, and do not restart the Wi-Fi access point for video pacing.
  56. Recovery may still wait for a keyframe; do not promise firmware will produce one.
  57.  
  58. 5. Make controller ownership explicit and persistent.
  59.  
  60. Use analog steering, trigger throttle/reverse and a full-throttle button. Support
  61. separate gamepads, Deck plus an external pad, and an optional duel mode
  62. where one controller's sticks drive different karts. Offer steering-only or
  63. steering-plus-throttle sticks and separate acceleration/reverse buttons. In
  64. Controllers, let Start assign the pressed pad to the selected kart, replacing its
  65. old owner; show model names and distinguish identical pads.
  66. Steam Input can hide physical names behind virtual gamepads; SDL's Steam support
  67. [5] is a useful reference. Save mode, assignments, swaps and stick options using
  68. available stable identity, not temporary SDL instance IDs. Ambiguous matches need
  69. explicit reassignment. Require neutral controls after reconnect or reassignment.
  70. From Drive, Start on any pad, including an unassigned Deck, opens the menu. Menus/focus
  71. loss stop both karts; disconnects, stale input or IPC loss must stop affected
  72. driving. One-player full screen must park the hidden kart.
  73.  
  74. 6. Pairing and status should describe what actually happened.
  75.  
  76. Offer a large, high-contrast QR with an intact quiet zone. Immediately distinguish
  77. scanning, joining, saved/reconnecting and connected. Persist successful pairing
  78. before reconnection; an offline kart should not require another scan. Explicit
  79. replacement forgets only the selected kart. Preserve the shared main-network
  80. identity. Battery telemetry reports four bars, not precise percentages: use
  81. segmented graphics and distinguish unknown/stale readings from empty.
  82.  
  83. 7. Package, diagnose and test incrementally.
  84.  
  85. Use CMake/Ninja and optionally a container toolchain; keep large builds on the
  86. Deck's data partition. Add the native app to Steam with its Gamepad layout and
  87. verify analog input in Gaming Mode. Offer side-by-side, stacked and one-player
  88. views. Optional local diagnostics should provide app-framebuffer screenshots,
  89. per-kart counters, bounded traces and graceful quit/restart through a private
  90. socket. Default them off and allow build-time removal. Use virtual pads and
  91. moving-video fixtures before supervised kart tests. Check saved settings,
  92. hotplug, neutral rearming and independent inputs.
  93.  
  94. What was actually verified
  95.  
  96. Both karts paired and ran together; Deck duel, camera layouts and Deck plus Xbox
  97. driving worked. Deck plus a USB-wired Xbox worked well in the physical test.
  98. Two Bluetooth Xbox controllers assigned correctly, but play quality was poor;
  99. other Bluetooth tests showed substantial camera loss on this setup. Start with
  100. wired controls when diagnosing camera problems. Do not infer transport from
  101. Steam's virtual USB devices. Reconnection can take time. Broad adapter support,
  102. every disconnect/recovery combination and measured camera-to-screen latency
  103. remain unverified. This recipe is a starting point, not a turnkey installer.
  104.  
  105. Public sources and credits
  106.  
  107. [1] OpenKart SDK: https://github.com/OpenKart-SDK/openkart
  108. [2] mk-live: https://github.com/xmrius/mk-live
  109. [3] OpenKart hostapd patches: https://github.com/OpenKart-SDK/hostapd
  110. Upstream hostapd, Jouni Malinen and contributors: https://w1.fi/hostapd/
  111. [4] Switchbrew research: https://switchbrew.org/wiki/Mario_Kart_Live:_Home_Circuit
  112. [5] SDL Steam controller reference: https://github.com/libsdl-org/SDL/blob/SDL2/src/joystick/SDL_steam_virtual_gamepad.c
  113.  
Advertisement
Add Comment
Please, Sign In to add comment