ALTTP multiplayer demo part 5September 24, 2020
ALTTP multiplayer demo part 5
This video represents a turning point in the development of my work-in-progress multiplayer addition to ALTTP. The remote player is rendered by the (patched) game itself and could be run directly on consoles in the future! Console support would require a supporting app running on a PC connected to a SD2SNES via USB, but this app has not been written yet.
See previous Part 4 at https://www.youtube.com/watch?v=cb5wj2eAlcg
Download nightly builds: https://ift.tt/2G64l3y
NOTE: Game ROMs will never be provided!
I’ve switched from having the rendering of the remote player sprites being done via emulator patches to now being done by the game itself. This was accomplished using ROM patching techniques with custom 65816 assembly routines written to integrate the rendering of the remote player into the game code. This opens the door to future console compatibility but that will require a companion app running on a PC connected to an SD2SNES via USB. That supporting app work has not been attempted yet. Also, patching the game ROM makes the integration story with work like Randomizer or Multiworld a little less clear on how to accomplish but I’m sure a solution can be devised that makes my ROM patch compatible with those.
The multiplayer feature still requires emulator enhancement to run scripts but the scripts now only do the simple work of handling network communications and reading/writing game RAM to exchange data packets. The ROM patch does all the heavy lifting now of rendering the remote player and building/interpreting the data packets.
The “free” sprite slots I chose were $40, $64, and $CB which are some unused rock-looking thing, the animated blob that soldiers turn into after magic-powdering them, and some unused bubble and bubble-burst sprites respectively. I know the blob sprites are actually used by the game but I figure they should be rare enough to not be seen in most play-throughs, speedruns, or races.
At the bottom of the video you can see two debug windows showing the VRAM sprite data for that frame per each emulator instance. If you look closely you can see the remote player’s animations.
Since moving all the rendering and sync work out of the emulator scripts into the ROM itself, I had to remove a lot of features that are now harder to accomplish via ROM code like some extra sprites being synced over. I am also not synchronizing area/room modifications anymore since those are more complex to handle than I originally anticipated and I’m choosing to simplify this multiplayer work to be purely visual on first release. In subsequent releases I’ll maybe add in features that synchronize game state.
We’ve also lost the ability to transmit custom sprite graphics from the remote player to the local player; all sprite graphics are fetched from the local ROM. I have some ideas on how to gain back the custom graphics support but this will have to wait until later.
Also, as a consequence of not having the custom sprite graphics transmitted, this also means that remote player’s sword and shield upgrades will not be visible to the local player. I do have a fix in mind for this but this will be addressed later as well.
WHERE TO FIND IT:
This is all accomplished using my own fork of byuu’s fantastic bsnes emulator. You can find my fork at https://ift.tt/3mOhdfw .
This demo video was rendered using the code from this specific git commit https://ift.tt/2EvheDH (romhack branch)
HOW TO RUN IT:
Run `sudo ifconfig lo0 alias 127.0.0.2 up` to create a loopback alias for 127.0.0.2. This part is necessary otherwise you will encounter errors attempting to run the second instance. This only needs to be done once per boot.
Run `./test.sh alttp-romhack.as` script in a Terminal tab to open instance 1
Run `./test.sh alttp-romhack.as` script in a new Terminal tab to open instance 2 (or in Finder, right-click the app bundle and shift-option-left-click on Open to open a new instance)
The IP address in instance 1 should work as-is so just click Start there.
In instance 2 you’ll want to swap the two values so the Server IP is 127.0.0.2 and the client IP is 127.0.0.1. Click the “Swap” button to do this.
Click Start on both instances and load a saved state or play through the game on both emulators to see both Link avatars on both screens.
via YouTube https://www.youtube.com/watch?v=_MTfXCUXawg