Hey guys,
Some of you might have heard of MAME (Multi Arcade Machine Emulator). Basically, it lets you play arcade games dating back from pong (or maybe even earlier) to arcade games circa 2006. The volume of games supported by mame is massive, and includes some consoles (notably, Super Nintendo).
There's a program called Kaillera that allows you to play MAME games online with your friends, but it has some drawbacks:
-It only works for windows
-It uses UDP and does not gracefully handle dropped packets. The games will desync and become frustrating for all players if a packet is dropped
-It isn't open source
So I decided to write my own network wrapper around MAME. ClientServerMAME supports any number of players (6-player X-Men anybody?), performs a complete game sync every 5 seconds to eliminate desync, works on any OS that MAME supports and even between OS's (I have been able to play a game between a windows 7 box and an ubuntu machine), and is completely open source (
http://github.com/MisterTea/ClientServerMAME ).
I've tested it myself using traffic controller to simulate internet lag, but I haven't tried playing any games on the net yet. Please let me know how it works and what the latency is like (not noticeable, unplayably laggy, etc.). What follows is the instructions for getting it up and running on windows (linux and intel osx versions are coming):
1) Find one or more friends (this can be the hardest part)
2) Both of you get the rom you are going to play and ClientServerMAME from here:
http://www.underworldhockeyclub.com/ClientServerMAME/ClientServerMAME_v0_1_Win32.zip3) Decide who is going to be the server
4) The person who is the server needs to make sure that TCP port 5805 is open and points to their IP. This will probably require port forwarding or something like that. Most games have this issue, so you can find info on it on the internet if you need help.
5) The server needs to tell everyone else his IP address or hostname
6) Have the server start the game like this:
mamesdl.exe (rom) -server
7) Have the clients connect like this (make sure you fill in (rom) and (hostname) with real values):
mamesdl.exe (rom) -client -hostname (hostname)
8) Everyone uses player 1 controls on their own machine. ClientServerMAME currently does not support having more than one player at a single computer, and all other player inputs are ignored.
9) There isn't much in the way of error handling at this point, so don't do anything stupid like try to run a different rom on the client as the server or try to load a rom while you are in the middle of another game or it will crash hard.
Let me know what you think. My plan is to pass this out to some friends and play some beat-em-ups, but if people find it useful I will add more features like having servers report to a master server so people can host public games.
Comments
Oh that reminds me, the games must support save states. At this point, almost every game does, but there are still some exceptions.
I'm currently using TCP because I didn't want to add UDP issues to the mix of things to debug, but I will switch to UDP once this version has been tested some. Unless you are playing street fighter II turbo or trying to play a game between the US and Europe, UDP is overkill anyways. I'll need people to test the current implementation and give me feedback to know more.
http://github.com/MisterTea/ClientServerMAME/downloads
So far I still have some bugs to fix. The biggest one is that the server uses blocking writes, so the 3rd/4th/... players get screwed as far as ping since it sends to the 2nd player before them. I'm going to have to change it to async writes for more than 2 player games.
Another bug is that it uses TCP and waits for all packets to come in, so if someone is dropping packets, it slows everyone down.
I've tested MAME with a few arcade games and MESS with a few snes games and it seems to work ok, but planning on playing more over the weekend.
To use ClientServerMESS:
Server:
messsdl.exe (system) -server -cart (full path to rom)
Client:
messsdl.exe (system) -client -hostname (hostname) -cart (full path to rom)
NOTE: You need both tcp and udp port 5805 forwarded for this to work.
Example:
messsdl.exe snes -server -cart "c:\Roms\SNES\FinalFight3.smc"
messsdl.exe snes -client 123.123.123.123 -cart "c:\Roms\SNES\FinalFight3.smc"
EDIT: To play MESS, you need to download the BIOS for whatever system you are using. You can find it with a google search.
We played SmashTV and Super Contra with 2 players, and WWF Wrestlefest with 4 players, ran smooth. I think that this version is ready for prime time.
There are still some TODOs but they are mostly cosmetic:
-Compress the initial game state when a client first conencts
-Work inside of the MAME UI or a mame frontend so you don't have to use command line options
-Have a way to list what IPs are connected and playing
Anyways, been playing arcade games until 3am, I'd say it's time for bed :-P
I posted ClientServerMESS on the ClientServerMAME downloads page, and posted linux binaries (mac is still coming, but giving me trouble).
I played some super mario kart last night and it worked fine except for me doing terrible and getting my ass kicked in battle mode for 3 hours. We decided to start posting some youtube vids to show how to get it running in case the instructions aren't clear enough, I'll let you guys know when the vids are up.
Version 0.6 of ClientServerMAME and ClientServerMESS are out on windows. There's a bug in the SNES emulator that causes the video to freeze on clients on startup, but after a few seconds, the video unfreezes. Also, if you go into mode7, the video unfreezes. I have a post on the MESS forums so hopefully it well get resolved. This version also has fixes for NES
Played double dragon 2 tonight, went well other than a few screens were glitched on my computer but fine on my friends' comp.
/played them both at the arcade during his formative years.
-Support for the native mame/mess build systems. This fixes several bugs and adds support for OS/X
-Fixed issues with compression of large save states
-Fixes for NES and SNES save states. There are still glitches, but most games are playable
-Gracefully exit upon network failure
-Changed makefiles to support creation of debian packages (added "make install" feature)
You can find the code and binaries (windows, linux, mac) here:
http://github.com/MisterTea/ClientServerMAME/downloads
I've been continuing to release updates and improve the netcode. I also released a video with step-by-step instructions on how to set it up and play.
You can check it out here: http://www.youtube.com/watch?v=be1_3Lp0xq0