The local multiplayer saga, ep 4
If you happen to remember the previous episode, you'd know I'd ran into an issue caused by short CMD frames, as melonDS was erroneously replying to these with long replies. In that situation, the hardware skips the reply and sends a default empty reply, and I had yet to implement that feature properly.

So I did.

Except I still had data loss problems and random hangs in Pictochat.

I ran several hardware tests to make sure I wasn't missing any detail of this feature, and all seemed correct.

So I turned to debugging Pictochat. I noticed that when the client was getting stuck, it just stopped sending reply frames entirely. I backtracked and backtracked to find out why it was doing that, and finally found the cause. It was quite stupid.

Basically, when the DS sends a reply frame, it marks the previously sent frame by changing the first byte of its header to 0x01. All fine and dandy. melonDS of course does the same thing.

Except that when I added support for substituting a frame with a default-empty frame, I copypasted some code without paying enough attention to what it did. And that code was setting the internal reply frame address to zero, which caused the above frame header manipulation to fail unless the previous frame happened to be at address zero (basically, the beginning of the wifi RAM).

Oops.

After fixing this oversight, I was rewarded with a perfectly stable and smooth connection. No hiccups, no data loss, no hanging. I didn't even see the host try to retransmit any frames.

Finally, I did it. Stable local multiplayer communication.

There's still quite some work before this can be released, though.

For one, I'd like to implement some more features of the wifi hardware. Especially those related to error handling, so if we ever need more lax sync which could incur some data loss, we could let the game deal with it properly.

There are also some issues to iron out with the sync mechanism. Said mechanism is still more or less a proof of concept, it is currently hardcoded for two players and doesn't really fail gracefully if someone leaves the game abruptly. And of course, I also need to implement faster IPC. With the current setup, NSMB multiplayer runs at ~20FPS, which is nice if you enjoy slideshows, but not very playable.

We would also need to integrate multiplayer support more cleanly into melonDS. Maybe we should just go for supporting multiple consoles inside the same melonDS instance.

Stay tuned!
Jay says:
Aug 18th 2022
Those little updates are so cool to follow, makes me wanna visit the site everyday. Thanks again for your amazing work.
keisui says:
Aug 18th 2022
this is seriously exciting news
mrjfilippo says:
Aug 18th 2022
The prospect of a multiplayer emulator is what first brought me to MelonDS. Successful or not, interesting work!
Arcanus says:
Aug 18th 2022
I am interested to see where this goes. Do you have any idea if local multiplayer could connect to different devices? For example, could an instance being run on MelonDS connect to a DSi or DS in the nearby proximity? Or do you believe that is outside of the scope of the emulator entirely?

It would be nice to finally be able to legitimately do trade evolutions and multiplayer features in the mainline DS Pokemon games regardless.
keisui says:
Aug 18th 2022
@Arcanus i feel like the extent of this would be just connecting to other computers , like someone and their friends both playing in different rooms on different computers on the same wifi , although connecting to a real ds would be cool as hell , being able to play games with friends who dont have a ds would be great
SIGMA says:
Aug 18th 2022
@keisui I don't know if it's likely but what would be even more amazing is being to play people over the internet as well.
Dan lee says:
Aug 18th 2022
Hola o hi soy de Perú, hablo español y siempre me interesó mucho su proyecto y me gustaría saber cuándo saldrá el multijugador local porque siempre tuve la ilusión de jugar pokemon con mi hermano.

Gracias sigan haciendo un buen trabajo.
keisui says:
Aug 18th 2022
@SIGMA now that would be seriously amazing , especially for showing your friends from across the country or world a game thats better when played multiplayer
Gael says:
Aug 19th 2022
Thanks for your work! Me and my friends have been following your updates for a while and it makes us very excited to be able to play multiplayer. Do you know if games like "Dragon Quest IX" or "Final Fantasy Christal Chronicles" will work like pictochat does?
Guest says:
Aug 19th 2022
I'm curious, with the current work being put in the Linux kernel for real-time, would if be feasible in the future to allow MelonDS to connect to real hardware when running in real-time mode?
fintogive says:
Aug 20th 2022
we just need some dragon ball z ending music with every one of these new updates and this willbe even more satisfying that it already is :P i love reading these new reports. it lets us in to the mind thats making this possible :P keep up the great work!
Post a comment
Name:
DO NOT TOUCH