[request] expose player id to netplay, ala WASM4's NETPLAY register
So, I was looking into ways to do a pokemon-esque battle game in TIC-80, and I spotted an interesting option from the WASM-4 docs. https://wasm4.org/docs/guides/multiplayer/
WASM-4 exposes the state of netplay to the cart via the NETPLAY memory register.
Reading this register is not required to implement netplay, but it can be used to implement advanced features such as non-shared screen multiplayer:
// If netplay is active if (*NETPLAY & 0b100) { int playerIdx = *NETPLAY & 0b011; // Render the game from playerIdx's perspective // ... }
basically, a single serializable game state is shared by all players, but each client's "player id" is exposed to it, so the game can selectively render unique menus or other information for that client. could we get this in TIC-80?
of course, a true pokemon-like would also need a way to merge data from two separate save files into a single shared netplay state, but maybe that's a separate problem?
We could have something similar in TIC-80, but it would be much more difficult to implement due to the abundance of clients for different platforms (win, linux, mac, web, ...). Whereas WASM4 only has one client on the web that works through WebRTC. Also, it might be possible to use some kind of cross-platform WebRTC library, for example, https://github.com/paullouisageneau/libdatachannel. This issue needs to be explored...
Honestly, if it only works in one place, i'd want it to work in Retroarch. There aren't a lot of emulators with link support and this would be a cool alternative.