Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish multiplayer support #248

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from

Conversation

BernardoGomesNegri
Copy link

Allow multiplayer for more than 2 players by adding options to change MAC addresses and relevant documentation. Also add warning to not use VPNs or tunnels as well as copyright notices.
Changing MAC addresses can be done either through libretro usernames or dropping a text file on the "system" folder. Deriving MAC addresses from usernames is done with compiler-independent algorithms to guarantee portability.
Note that trying to run 3 instances of melonDS DS was too much for my CPU (on software renderer) and the game lagged too much that disconnects were frequent. I'd recommend using at least a second device to test 3 players so the CPU doesn't get overwhelmed trying to deal with both multiplayer and rendering.
With direct mode, things are a bit confusing as the DS thinks it's sending frames with a certain MAC address, but it's actually using your computer's MAC address instead. However, since direct mode is about Internet connection, it all works fine.
Should fix issues #246 #247 and #225

@JesseTG JesseTG self-assigned this Dec 29, 2024
@JesseTG JesseTG self-requested a review December 29, 2024 20:36
@JesseTG
Copy link
Owner

JesseTG commented Dec 30, 2024

Thank you so much! This week I'll do a code review and test it personally, then I'll get back to you with any notes I have.

@JesseTG JesseTG added bug Something isn't working lan For issues related to LAN-based netplay. (No, VPNs won't work. It really has to be a LAN.) labels Dec 30, 2024
Copy link
Owner

@JesseTG JesseTG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! There are some changes I'd like you to make. Once you do, I'll test the changes and get back to you with any additional feedback I have.

CHANGELOG.md Outdated Show resolved Hide resolved
LanMultiplayer.md Show resolved Hide resolved

Now, the Nintendo DS local Wi-Fi isn't the normal Wi-Fi in your house, it is a [mesh network that uses specialized hardware](https://melonds.kuribo64.net/comments.php?id=25). This means that games expect extremely low latency, which is achievable between two consoles directly connected with special hardware, but harder to achieve with two computers with a router in-between, and simply **impossible** to achieve through the Internet. **LAN multiplayer does not work through the Internet and neither with VPNs or tunnels such as Hamachi**. This is not something that can be fixed easily. **The only way to use emulated LAN Multiplayer is on an actual, low latency LAN connection**.

The latency requirements are so extreme that even in LAN, you might still have issues. If your sibling is watching Netflix and using the same router, it won't work. If the router is too far away, it won't work. If the router does not have a powerful enough CPU, it won't work. The recommended way to use the emulated Wi-Fi LAN connection is with a wired LAN connection between the computers.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests you've conducted so far...have they been in this kind of environment? When I tested your last PR, I did so with two Ethernet-connected devices on the same switch. Same network, but I don't think the packets have to go all the way to the router and back.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial tests were in localhost, with two instances of RetroArch on the same computer. When I confirmed that the basics were working, I tested extensively in a connection between my desktop computer (wired) and my phone (wireless, very close to router).
It worked but disconnects sometimes happened. Should I update this to say that the only way it works is with a wired connection?

LanMultiplayer.md Outdated Show resolved Hide resolved
src/libretro/config/constants.cpp Outdated Show resolved Hide resolved
src/libretro/config/constants.cpp Show resolved Hide resolved
src/libretro/config/definitions/network.hpp Show resolved Hide resolved
src/libretro/config/definitions/network.hpp Outdated Show resolved Hide resolved
Copy link
Owner

@JesseTG JesseTG Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right, I've finally gotten around to adding the docs page for melonDS DS, and it's live! Could you move this writeup to that doc page? This link will take you directly to the in-browser editor for that file.

I do ask that you mark the ensuing PR (in the docs repo, not this one) as a draft until 1.2.0 is released, at which point I'll have it merged. Otherwise a hapless player may see this writeup go live before the functionality is ready, then get confused and upset when they don't see it in the core.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like me to remove the write-up in the repository?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please.

@JesseTG
Copy link
Owner

JesseTG commented Jan 7, 2025

Looks good to me (minus some minor notes I just left), but before I merge this I'd like to build and test it myself. I should have a chance to do that tomorrow.

I'd also like to fix an unrelated bug in the build pipeline itself -- it turns out that PRs are being built against the wrong commit, and I didn't notice until I gave some poor bastard (what I thought was) a build of this PR to test!

Thanks for your hard work and your patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lan For issues related to LAN-based netplay. (No, VPNs won't work. It really has to be a LAN.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants