Views: 6,702,298 Homepage | Main | Rules/FAQ | Memberlist | Active users | Last posts | Calendar | Stats | Online users | Search 03-29-24 05:30 AM
Guest:

0 users reading How do I do multiplayer? | 1 bot

Main - General - How do I do multiplayer? Hide post layouts | New reply


Videogamer555
Posted on 09-08-18 04:40 AM Link | #661
I see there is only one setting relating to network multiplayer, and it says "Wifi: bind socket to any address". There's no setting in the emulator that lets me connect to any other running emulators. Please tell me how to use this feature. I want to have 2 instances of the emulator running on my PC, and establish a link between them, so that I can play multiplayer games.

Arisotura
Posted on 09-08-18 10:23 AM Link | #662
Posted by Videogamer555
I want to have 2 instances of the emulator running on my PC, and establish a link between them, so that I can play multiplayer games.

that's how it works. just run two instances, the games should find eachother and connect without having to do much more.

that being said, it might or might not work-- not all games work.

____________________
Kuribo64

Videogamer555
Posted on 09-09-18 01:03 AM Link | #663
Posted by StapleButter
that's how it works. just run two instances, the games should find eachother and connect without having to do much more.

that being said, it might or might not work-- not all games work.


I've not found anything it works on, other than Pictochat (which comes built-in to the BIOS). I've even tried Metroid Prime Hunters. I tried both LAN modes with Metroid Prime Hunters, which are Singlecartridge and Multicartridge.

In single cartridge mode, one system runs the game, while the other system remains in the BIOS, and you need to click the download button. Once the download has finished, the game should start. However in the emulator I have found that the download never completes. It remains indefinitely in the "downloading" state.

In multi cartridge mode, both systems have a copy of the cartridge, and both are running the game. One system initiates a multiplayer match, and then the other system connects to that match. At least that's how it is supposed to work. However, in the emulator I found that the second system keeps getting disconnected, even before the match can start.

Every time the connection fails, I've discovered it corrupts firmare.bin, and I need to delete the old file and replace it with a new working copy.


There are several things that could pose a connection problem. One is that both instances of the emulator share the same firmware file. The second problem is that both instances of the emulator share the same save file (which has the same name as the ROM, but with a .sav file extension instead of .nds). To attempt to fix both of these problems, I created 2 separate copies of the emulator and the ROM, then in the BIOS boot on each I edited the settings to give each copy of the emulator a different username in the firmware. After that, I deleted all the save files, and restarted both emulators. I booted the game in one emulator from one copy of the ROM, and in the other copy of the emulator I booted the game from the other copy of the ROM. I thought that would fix it, but it didn't. I'm sure that this is part of the total fix that needs to be done, but something else clearly also needs to be done.

Here's the final step, but I can't do it myself, since I don't have access to the emulator's source code, and this fix must be done in the emulator's programming. I believe each instance of the emulator must be able to bind to a different port, and also each instance of the emulator must be able to set the remote port for the connection in the settings menu. For example, if one copy of the emulator is on port 1111 and the other copy of the emulator is on port 2222, the copy of the emulator on port 1111 must have its remote port set to 2222, and the copy of the emulator on port 2222 must have its remote port set to 1111. But right now, such functionality is not even present in the emulator. I can't set either the bound port or the destination port. I hope this fix can be added to the emulator quite soon, because I think this will be the key in making the multiplayer work correctly.

In fact, it's amazing that even Pictochat works, or that the emulator doesn't crash completely. The reason is, because the way it works right now, all instances of the emulator bind to the same port. I discovered that by using the utility program Curr Ports, which shows the ports that programs are currently using on the computer. And what it showed, should have not even been possible. It showed both instances of Melon DS bound to the same port on the same loopback adapter (127.0.0.1). As far as I know, that violates how networking is supposed to work, and in every other program I've used this causes the program to pop up an error message (if correct error handling is used) or to outright CRASH (if correct error handling isn't used). In all cases, the Windows API call used to establish the port binding, should fail on the second instance of the program, and not bind to that port, and therefore not show up in a listing of ports currently in use by the software.

The fact that not only was there no error or crash, but that both port bindings actually appeared to work perfectly (which they should NOT have done), suggests this isn't using standard Windows API networking functions, but rather some kind of hack. I still have no idea how it works, but depending on a hack to make your program run is a BAD IDEA. Two reasons for this. 1 If the glitch that was exploited by the hack is ever patched, it won't work anymore. 2 There's no guaranty that the hack itself is a stable way of accessing network functionality, and it certainly violates networking protocol, so its exact behavior shouldn't be trusted as reliable. That may also be part of the problem that prevents the 2 instances of the emulator from connecting properly, because the network functionality itself appears to be based on some kind of hack.

A correctly implemented networking functionality in your program, would include at least 3 values in the settings (local port, remote port, remote address), or possibly 4 values (also including the local address to set which network adapter you want to bind to).

Arisotura
Posted on 09-09-18 02:08 PM (rev. 3 of 09-10-18 12:08 PM) Link | #664
https://github.com/StapleButter/melonDS/blob/master/src/libui_sdl/Platform.cpp#L181

it's not a hack, the 'all instances using the same port' bit is how it's meant to work. the idea is that all running instances can participate into multiplayer games without requiring emu-side config. that being said, you brought to my attention that the multicast implementation there is flawed. nah, we're doing broadcast and that's fine

that being said, I'm still pretty sure most of the issues with wifi connection are due to the incomplete emulation of the DS wifi device, esp. its multiplayer features. and also the insane rates at which data frames are sent during multiplayer. to give you an idea: this blog post describes well how the shito works.

____________________
Kuribo64

Videogamer555
Posted on 09-14-18 06:10 AM (rev. 2 of 09-14-18 06:11 AM) Link | #669
Posted by StapleButter
https://github.com/StapleButter/melonDS/blob/master/src/libui_sdl/Platform.cpp#L181

it's not a hack, the 'all instances using the same port' bit is how it's meant to work. the idea is that all running instances can participate into multiplayer games without requiring emu-side config. that being said, you brought to my attention that the multicast implementation there is flawed. nah, we're doing broadcast and that's fine

that being said, I'm still pretty sure most of the issues with wifi connection are due to the incomplete emulation of the DS wifi device, esp. its multiplayer features. and also the insane rates at which data frames are sent during multiplayer. to give you an idea: this blog post describes well how the shito works.


Very interesting. However, making it so you can't set a destination IP address also makes it so it cannot communicate between computers. This limits it to running 2 copies of the emulator on the same PC, and not allowing a LAN connection between PCs.

As for multicast if that's what you are trying, as you said in your post, I see what the problem is there. Multicast is only designed to work on a specific group of addresses, known as "multicast addresses". The addresss that are used in this emulator are not a multicast addresses. It's either 127.0.0.1 (localhost) or 0.0.0.0 (all addresses), depending on how the emulator's network setting is configured. I think for multicast to work correctly, the address it's bound to must be explicitly a multicast address. I think these are like 224.0.0.1 or something like that.

DickWad
Posted on 04-09-20 08:40 PM Link | #1624
I've tried to use this to trade and evolve pokemon and it jsut crashes the instant i enter the union room, I think i'm doing something wrong.
Can someone give me a step by step process on how to use local multiplayer?

squeegily
Posted on 04-11-20 09:50 AM (rev. 2 of 04-11-20 09:52 AM) Link | #1629
Posted by Videogamer555
However, making it so you can't set a destination IP address also makes it so it cannot communicate between computers. This limits it to running 2 copies of the emulator on the same PC, and not allowing a LAN connection between PCs.

It's broadcast, not multicast (the previous post was edited to correct)—most consumer routers allow arbitrary broadcast traffic on/within the LAN.

Which is to say that, it does work between computers (firewalls permitting), and it's only 2-emus-1-pc that you might even need to change the configuration.

(That said, though: as a design choice—doesn't it seem reasonable for the out-of-the-box setting to be "any"? After all, a DS is physically broadcasting to any device in proximity; from there, restricting it to a particular IP/interface sounds like advanced/nonstandard behaviour worthy of changing a setting, no?)

junipea
Posted on 07-06-20 05:24 PM Link | #2026
I tried playing with my brother wifi multiplayer mario kart ds, and it totally worked! His pc is a bit slow so he would have a bit of lag and also a bit delayed sometimes but it worked pretty much flawless. One problem is that every time we play we have to do the whole setup again, which is a bit annoying but totally worth it.

Rayyan
Posted on 07-06-20 05:35 PM (rev. 3 of 07-07-20 11:04 AM) Link | #2027

Posted by Videogamer555
Every time the connection fails, I've discovered it corrupts firmare.bin, and I need to delete the old file and replace it with a new working copy.

Looks like you have those old hacked dumps.

EDIT: Whoops, this is quite an old thread.

____________________

How to write an emulator
1. throw code to be emulated somewhere
2. make memory system that allows accessing that code
3. emulate CPU
4. have fun implementing all the other hardware
-- Arisotura, Tuesday 5th January 2021, 22:00:17

Saizo7
Posted on 07-28-20 06:02 AM Link | #2123
Posted by DickWad
I've tried to use this to trade and evolve pokemon and it jsut crashes the instant i enter the union room, I think i'm doing something wrong.
Can someone give me a step by step process on how to use local multiplayer?

This happens to me too. The 2nd Melonds instance closes the second I enter the Union Room. I am using the latest version with the slirp branch merged.

SIGMA
Posted on 07-28-20 09:03 AM Link | #2124
Posted by Saizo7
This happens to me too. The 2nd Melonds instance closes the second I enter the Union Room. I am using the latest version with the slirp branch merged.

I have a different issue altogether. When using the latest build from the master branch which has recently had libslirp merged into it, I can't find myself at all when hosting two instances of melonDS.

It works absolutely fine with older versions of the emulator like 0.8.1, but not the with the latest builds from github.

metcalcon
(post deleted) #4145


Main - General - How do I do multiplayer? Hide post layouts | New reply

Page rendered in 0.039 seconds. (2048KB of memory used)
MySQL - queries: 29, rows: 100/100, time: 0.013 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2018-07-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.