Orders from the Command Bunker #1 - RetroArch Netplay (PC-to-PC)
For the inaugural 'Orders from the Command Bunker' blog, I have chosen to write about a topic that I find very dear to my nostalgia-laden heart. More specifically, I am referring to netplay, where two or more parties can play a nearly endless library of classic games via the web, in real-time, absolutely free. Not only is netplay an amazing feature of the emulation scene, but, in my experience, it is also perplexingly a criminally under-utilized and un-advertised functionality. That's a real shame too, as it's great fun to play these retro games with a friend (or several friends), especially if your friends are no longer always available for a traditional couch co-op session. While the experience is not perfect, it is still very playable, and you could certainly do a hell of the lot worse for the price.
My preferred program for netplay is RetroArch, which basically is a super emulator that is comprised of other, smaller emulators, known as 'cores'. Why do I use this specific program vs. another? In a nutshell, it has the best performance, widest-supported library, and reliability compared to all other methods. If you have a Raspberry Pi, you should already be vaguely familiar with the program. The reason for this program's netplay superiority is its architecture, such that it uses save states amongst all parties to re-calibrate (aka sync) their session together. You'll experience/witness the save states as slight jumps during gameplay, but rest assured you want them as they keep you from losing a connection with your party. Additionally, as is my understanding, netplay via RetroArch is not platform-specific, meaning friends using Windows can play with friends using Apple and Linux operating systems.
So, are you interested? If so, read on.
First, let's get some basic vocabulary out of the way to avoid unnecessary confusion:
Host: This person/PC will act as the server for the netplay session. Typically, the Host will be 'Player 1' once the actual netplay session has commenced. This person has the most prep work to do before the netplay session, but honestly, none of the required actions are too difficult, and only have to be done once, assuming your routing addresses remain consistent. Only 1 person has to be designated as the Host.
Client: This person/PC will be connecting to the Host/Server. This user (or users) has almost no prep work to conduct prior to the netplay session. Clients are typically 'Player 2', 'Player 3', and so on during the actual netplay session.
Part A: Host's Duties
As previously-mentioned, the Host is required to do the majority of the preparatory work prior to attempting a netplay session.
Step 1: Locate the IPv4 IP Address of the computer/device you intend to use for netplay. If you don't know this value, do the following:
Step 1A: On a PC, go to your search box and type, 'cmd' (do not include the parentheses). Once selected, this will bring up a command prompt.
Step 1B: Type 'ipconfig' and look for the device's IPv4 address. It should be something like 123.456.7.890. This the simply the address your router has assigned to your device from within your firewall. Write this number down and proceed to the next step.
Step 2: Add a Port Forwarding Rule to Router's Firewall.
Now that you know the internal IP address of your netplay device, you need to add a rule to your router to allow connections from the outside world to bypass your firewall and be routed/pushed to your internal, IPv4 address (i.e. the Host's netplay device). Depending on your ISP and router, the menus used in this specific step can vary.
Step 2A: Log into your router via your favorite internet browser and find an option to create/add a port forwarding rule to your firewall. Your router typically has a wizard to guide you through this process, but again, your rule should be something like this:
'port---internet protocol traffic----internal IPv4 routing address'
Let's go over this step in greater detail:
Port: Think of this as the access point or hole that will allow the outside traffic to bypass your firewall. The default port for RetroArch is '55435'. You may leave this as-is, or change it to any other value you want. Just keep in mind, you'll have to share this number with your Client(s), so write it down.
Internet Protocol Traffic: This is basically the way in which data will be shared amongst the Host and Client(s). Your options are 'UDP', 'TCP' or, 'Both'. I recommend you set it to the 'Both' option, thus covering all of your bases.
Internal IPv4 Address: This is internal IP address your router has assigned to your computer. You'll remember you obtained this number in Step 1.
Here's an example of the completed port forwarding rule for your information:
Once saved, you can log out of your router and proceed to Step 3.
Step 3: Download RetroArch, extract the .7z archive, and run the application. Once started, you can simply close the program via the ESC key. Why did we kill the program so fast? We had to run the application so that it could generate a configuration file (i.e. retroarch.cfg). Once this file has been generated, open it with the text editor of your choice, such as Notepad or Notepad +.
Step 3A: Note there's a lot of content in this file, most of which you should not modify. To quickly jump to the fields you need to tweak, use a search box via the 'Control+F' button combination. The specific fields/values I want you to modify are as follows:
netplay_ip_port = "55435" (Note modifying this field/value may be optional, assuming you didn't opt to use a different port as outlined in Step 2A. If you did use a custom port, simply update the value that is listed within the double-quotations. Whatever value you ultimately decide to go with, you'll have to provide this information to your Client(s), so keep this information handy.
netplay_nickname = "" (Note that by default, there is no name/value listed between the double-quotations marks. This name will be visible to your Client(s) when connecting to one another. While optional, this can be a fun exercise, so have at it. Unlike Xbox Live, you can change your gamertag as often as you want, for free too).
Once done, simply save the configuration file and proceed to the final step.
Step 4: Determine your Router's Public IP Address.
Your Public IP Address is more or less similar to the mailing address of your house, except it exists on the internet. To determine your Public IP, simply open an internet browser and query, 'what's my ip?'. Write this number down and then share it with your Client(s), along with the port you used when creating your port forwarding rule as outlined in Step 2. At this time, the Host's preparatory work is done.
Part B: Client's Duties
As a the Client, your preparatory work is very limited. Since you will be connecting to the Host, you can skip all of the port-forwarding steps and simply obtain the emulator.
Step 1: Download RetroArch, extract the .7z archive, and run the application. Once started, you can simply close the program via the ESC key. Why did we kill the program so fast? We had to run the application so that it could generate a configuration file (i.e. retroarch.cfg). Once this file has been generated, open it with the text editor of your choice, such as Notepad or Notepad +.
Step 1A: Note there's a lot of content in this file, most of which you should not modify. To quickly jump to the fields you need to tweak, use a search box via the 'Control+F' button combination. The specific fields/values I want you to modify are as follows:
netplay_ip_port = "55435" (Note modifying this field/value may be optional, assuming the Host didn't opt to use a different port. The Host should be able to confirm if any changes are needed for this field/value.)
netplay_nickname = ""(Note that by default, there is no name/value listed between the double-quotations marks. This name will be visible to your Host and fellow Clients when connecting to one another. While optional, this can be a fun exercise, so have at it. Unlike Xbox Live, you can change your gamertag as often as you want, for free too).
netplay_ip_address = "" (Note the Host should have provided you with his/her Public IP Address. Simply add his/her Public IP Address in between the double-quotations marks. Do not confuse the Public IP Address with the internal IPv4 Address as they are not the same. Also, keep in mind that occasionally, the Host's Public IP Address may change. Should you have difficulty connecting to the Host, have him/her confirm their Public IP Address hasn't changed. If it has, simply update the field and save the configuration file.
That's it for the Client. Please proceed to Part C.
Part C - Actual Netplay
Now that the homework is out of the way, you can now start a netplay session.
Step 1: Fire up RetroArch and if not already done so, download an appropriate core. Keep in mind, a 'core' is basically a port of an emulator. Based on my testing, I can confirm the following systems are netplay-compatible:
Arcade (via Final Burn Alpha)
Simply download cores related to these systems and proceed with the attempt. Should the actual connection fail, try using a different core as not all cores are created equal, nor are they all netplay-compatible.
Step 2: Once a netplay-compatible core has been loaded, proceed with loading some relevant content for that core (i.e. a rom) and then launch it.
Step 3: Once loaded, the Host needs to bring up the RetroArch menu via the F1 key and navigate to the 'Quick Menu > Netplay > Start Netplay Host' option. You'll know if it worked as the game will resume and wait for Client connection(s).
Step 4: Once the Host has started the netplay session, the Client(s) may now connect to the Host. If you jump the gun and attempt to connect to the Host before he/she completes Steps 3, your session will fail, and may even result in RetroArch crashing. Assuming you are using an external chat program, such as Skype, simply coordinate with your Host when it is safe to proceed with the Client connection(s). Start your game as normal, then bring up the RetroArch menu via the F1 key, and go to 'Quick Menu > Netplay > Connect to Netplay Host' option. If you are playing with multiple Clients, the order in which they connect to the Host will determine their assignment as 'Player 2', 'Player 3', and so on. You'll know if the connection was successful because RetroArch will usually crash within the first 3 seconds of the attempt. If the connection worked, you should see the screen log a message that each Client has been assigned a player number and announce his/her gamertag. Enjoy.
Part D: Troubleshooting
Q1: As the client, I am always getting a 'Failure to Connect' error message. What am I doing wrong?
A1: Netplay is finicky. My first recommendation is to confirm the Host's port forwarding rule is accurate, where the port specified in RetroArch's configuration file is the same as what is listed in the Host's router. Also, keep in mind that if your computer/device is hooked up to an ethernet cable vs. wifi, it's local IPv4 address will be different, meaning your port forwarding rule could be inaccurate. Next, I'd confirm the Host's Public IP Address hasn't changed, which can happen without warning by your ISP, assuming you are not paying to have a static IP. Finally, I'd look into confirming the content and cores you are attempting to netplay are identical as this is required. Meaning the Host and all Clients must be using the same version of RetroArch, the same core (and version of said core), and the same rom (to include the file size, checksum, and name). Given this need for consistency, it is highly recommended all netplay parties obtain their roms from the same source, nor should they update their cores without coordinating with the rest of the party as well.
Q2: Netplay is jumpy.
A2: As I told you before, netplay isn't perfect, but then again, it shouldn't be overly jumpy either. Try connecting all parties via ethernet vs. wifi. Failing that, try stopping all non-essential programs that may be concurrently running while attempting to netplay. In my own experience as the Host, I am able to netplay with 3 other people, 2 of which are in different timezones than myself, with little to no issue.
Q3: I cannot get a specific core to work in netplay.
A3: Not all cores are netplay-compatible. PC Engine (aka Turbo Grafx 16) is an example of a system that I cannot get a netplay connection with, regardless of rom used or core. Same goes with MAME .78 unfortunately. Take that with a grain of salt though, as you can still play literally thousands of games via the web from the NES, SNES, Genesis, Master System, and Final Burn Alpha catalogs. From sports, to shooters, to brawlers, and racers, the options you have at your fingertips, for free no less, are damn near unlimited.
Q4: Can you use cheats in netplay?
A4: Believe it or not, yes. Unlike other emulators, RetroArch does allow for the Host to activate cheat codes for some cores, making said codes usable to both the Host and his/her Client(s). Examples of systems that allow cheats across all parties include, NES, Genesis, SNES , and Neo Geo bios cheats (during gameplay, hold A+B+C+tap Start). This is a great option for difficult co-op games, such as Contra 3 on SNES.
Q5: This blog is about PC-to-PC netplay. Can I netplay with my Raspberry Pi instead?
A5: Short answer - Yes. Long Answer - Yes, but performance is really sub-par compared to the PC-to-PC method, to the point that I don't recommend it. Sorry.
Q6: Can I netplay 3 and 4-player games with the SNES9x core?
A6: You sure can. Make sure the Host sets his 'Quick Menu > Controls > User 2 Device Type' value to 'Multitap', thus allowing for 3 and 4-player simultaneous netplay. This is great for multiplayer Bomberman and NBA Jam sessions.
Emulate This is not endorsed or affiliated with RetroArch, Libretro, The Raspberry Pi Foundation, or RetroPie. We are simply fans and provided this guidance without consent or compensation from the above parties.