NetPlay 🌐
Description
Build Netpay support using https://peerjs.com/ (WebRTC) and the support for serial data transfer #19 (closed).
Implementation
It will be tricky to overcome the limitation on the 60Hz event loop to allow fast data transfers in the order of 65Khz.
The CPU cycles are computed in chunks, making it challenging to handle serial communication efficiently.
Solution
Dual local Game Boy execution
I can send all the input from the other play and run a parallel simulation of the execution locally, keeping two "local" instances of the Game Boy running together.
I need to stream the actuators (input) of both systems to each other - it can be a good idea to handle the input with a certain amount of delay.
Time sync is also crucial to make sure things can work effectively.
Items to think about:
-
Compression of system state (probably requires external lib - or RLE + Huffman implemented in Rust) -
Fast capture and restore of system state (re-use save state) -
Time sync -
Multiple instance management (UI for SDL and web to handle multiple Gameboy screens)