
15th Dec 2010 - Apologies to anyone who's had trouble reaching this page, it was unexpectedly picked up by a number of popular web sites which resulted in over 860,000 hits within a 48 hour period. Should be all fixed now. Thanks for all the interesting comments and discussions across the web about it, it's been educational and entertaining :)
The Day MAME Saved My A**
Ask any game developer and they'll tell you that publishers are the scum of the earth. It's never a question of "if" the publisher screws you, it's "when". During my 15 years as a developer I have seen publishers pull every dirty trick imaginable, from telling the dev team of a certain AAA title to remove all the black kids from the game ("it hurts sales in Germany") to informing a small studio that they were only going to pay half what they owed for work already completed, and then only if the studio signs a legal waiver first (knowing full well that because of late payments the studio would be out of business long before it reached court). This story is not about publishers, but it is about the kinds of situations that publishers create and the lengths that we developers are often forced to go to in order to clean up the messes they leave us with.
The project in question was a nightmare from day one. There were multiple studios involved, multiple contracts had been broken and several teams had simply walked away and washed their hands of the whole thing. We had signed a contract to do some mobile ports of some old Midway arcade titles for a publisher who was subcontracting us on behalf of a much larger publisher. The contract with our publisher stated that they would obtain the original source code from Midway, hand it over to us at the start of the project and we would deliver working alpha, beta and release versions on certain dates.

We signed the contract and immediately got to work on our titles. As it turned out there were many problems with this contract, but one of the more serious ones was that the publisher was missing the source code and assets for one title in particular: SpyHunter. In the weeks that followed the publisher assured us that they were around somewhere and everything would be taken care of in due course. One week before alpha we heard back: they didn't have them, and wouldn't be able to get them in time. SpyHunter had been included in the contract because the suits at the top assumed they could deliver given the fact that they had already released a port to one of the major consoles. When we looked closer into this we discovered that the "port" team had actually written an emulator for that console (based on MAME btw) and simply used it to run a hacked version of the original ROM image which they'd downloaded from a warez site.
Oh.
Running an emulator wasn't an option on a low-end mobile, but the publisher insisted that we had signed a contract, and that with-or-without assets we were expected to deliver the alpha version on time....which at this point was a week later. If we didn't, not only would they withhold all payments due for work we'd already done but they would also cancel all other projects, which would have inevitably meant letting all our staff go. I had one week to somehow create a convincing version of SpyHunter without any of the source code or game assets. The way I saw it there were four problems that needed to be solved: the AI, the graphics assets, the sound assets and the map data.
AI wasn't too much of a problem, by simply looking at the game I was able to hack together some code in a few hours to roughly copy the behaviour of the various objects in game. It wasn't 100% perfect but the publisher was more concerned with the visual look of the game. I don't think they ever played the original version much so we got away with that one pretty easy.
Graphics were a bit more of a problem as there was no way our artist could have created replacement art assets in a few days. This was where MAME first came to the rescue...the version we had downloaded to play the game had a sprite page viewer that displayed all the tiles used by the game. They changed occasionally as the game progressed, but with some trial and error (and judiscious use of the PrtScn button) I managed to get a complete set of graphics for the port. They needed to be scaled down for our target platform, and this required some Photoshop magic to make sure that the tiles didn't bleed into each other, but the end result was perfect.


Originally I thought that sound was going to be a real problem. Our target platform couldn't play music, but we still needed a way of getting the effects. MAME didn't have a sound effect exporter so it looked like I might have to resort to trial and error poking around the ROM. Fortunately it never came to that, a quick web search returned the page of a SpyHunter fan who had extracted the sound effects himself and put up WAV files on his web page. These weren't recordings, these were rips. Raw, ADPCM uncompressed WAV files, perfect digital reconstructions of the original assets. A quick check with our publisher's legal department confirmed that yes, we were fully entitled to use these in our port. Personally I wanted to give the guy a game credit or at least send him a download code for a free copy of our game or something once it came out in return for all the work he saved us. The publisher refused....their legal team were already writing up a cease-and-desist letter ordering him to remove the assets from his fan page.

And that left the map data. The publisher insisted that the map be a perfect replica of the original, with all the right tiles in all the right places. Given enough time I could have reversed engineered the ROM and reconstructed it that way, but with only a day or two left I had to come up with something fast. The idea I came up with was so utterly absurd that even I was surprised it worked so well. The first thing I did was write an application that searched for the MAME window and then sat in the background taking a constant stream of screenshots which it saved to disk. I then had the best game player in the office play SpyHunter for about 10 minutes, using MAME's built-in cheats so that he never died. A second utility then post-processed these files and stitched them together using a simple pixel-match algorithm to create a continuous image. A third utility then scanned over this image and again applied a simple pixel-match against the tiles in the sprite page that we had exported eariler. What I was left with was a partially reconstructed version of the original SpyHunter map array. I say partially because many of the tiles were missing: if a car or explosion effect etc was present on screen then the pixel-match algorithm would fail and the tiles in that part of the map would be left blank. Most of the action happened on the road where it was easy to fill in missing tiles, for the rest I had our guy play the MAME version a few more times, merging the data sets for each pass. When all was said and done there were only about 20 or so tiles missing from the entire game, at which point it was trivial to go through and add them manually using the MAME screen-shots as reference. The end-result was a 18x1538 array of tile indices representing a perfect reconstruction of the original map data.
Publishers would have people believe that MAME and the emulation scene is the root of all evil, that it promotes piracy and ultimately hurts the poor, starving developers slaving away on the game. Not only is this claim patently false, it ignores the fact that many developers use things like MAME, mod chips, and homebrew development utilities to help us overcome the day-to-day frustrations caused by the people behind the real problems in our industry.
Liked this story? Leave a comment....
21/02/2011Ryan
Great article, also a great game, loved it in the arcade - but mostly I used to play Spyhunter for hours on the Commodore 64!
"The publisher refused....their legal team were already writing up a cease-and-desist letter ordering him to remove the assets from his fan page." - how is that for gratitude!?
02/02/2011pEz
This is one of the best things I've read in a while. Fantastic work on using a MAME ROM to gather your missing data, truly inspirational :)
24/12/2010alex
Nice that you made it work. Publishers sounds like a nightmare
15/12/2010MarkF
I think the licensing issue might be covered by the last section of the "Common Questions" on the license page:
"Q. Can I use a PC running MAME to replace a real arcade PCB?
A: In order to do this you would have to use a copy of the original ROMs, which would require obtaining permission from the original manufacturer....If you sell your game later you must sell it without MAME included." That suggests that this type of commercial use is within the licensing restrictions provided you have permission to use the ROM and don't ship MAME itself.
Bear in mind though that this incident happened quite a long time ago. The version of MAME we were using was one of the old DOS ones and the license may have been less restrictive at the time.
15/12/2010ett
Jason: I can see how one might read the license that way, however, it may be read another way: "Redistributions [of the MAME code or any derivative works] may not be sold, nor may they be used in a commercial product or activity." The 'redistribution' they downloaded (the binary could also be considered a 'derivative work') was used in the 'commercial activity' of ripping sprites, which they were being (partially) paid for. I'm impressed with their cleverness, and realize they were just doing that they had to, but it seems legally questionable at best.
15/12/2010Kaz
Very nice to see a gamedeveloper taking the "resourcefull" way, and not being let down by adversity! real nice problem solving there.
15/12/2010nasmorn
As a fellow game developer I am in awe if the inventiveness and practical thinking that you put into this. I know how little a week is to get anything done.
15/12/2010T*Q
This should be submitted to game developer mag! Way to beat the odds with a typical asinine request from a publisher. I've been on both sides so can definitely relate. Kudos.
13/12/2010elend
Thanks for sharing. Very interesting read.
13/12/2010Dimiter "malkia" Stanev
I had similar experience with Metal Gear Solid port for the PC.
We did not have the source to the midi/mod library playing the music (they were composed of short samples).
Instead we found .wav files of all music tracks on one of the fan-page sites. We even found the samples to a lot of our sounds. We simply grabbed and used them instead
13/12/2010Zerto
Wow, impressive!
13/12/2010Lynchpin
That's some McGuyver level quick thinking there! Emulators have been a helpful tool and I once did that map thing with a game called Rings of Power to reconstruct it's insanely large world map, and convert the tiles into byte values.
Good job, though!
13/12/2010Jason
123: The MAME license refers to the use of the MAME source code and derivative works, the point of it is to stop things like arcade operators using MAME in a commercial cab. This case was different, as MAME was used to extract the original assets. It's a grey area at best, but probably within their legal right given that the developers of MAME don't own the copyrights to the title in question.
13/12/2010jas
nice going mate, hard work should pay more. only if there was an option to take the publishers to court for never providing the original source code.
12/12/2010123
Sad to say you might have been breaking the MAME license. Depending on how you define redistribution and commercial activity.
http://mamedev.org/legal.html
12/12/2010Cal
great story!
12/12/2010Ben Ritchie
Awesome story dude.. makes me want to go and make some big quotes for publishing houses and give them crap mame rips ;)
12/12/2010stan
you're a fucking hero.
12/12/2010Ben
Awesome story :)
Back a long time ago I ran EmuHQ.com along with Peter, and big supporter of emulation. So many games are not lost because of the hard work of emulator authors!
12/12/2010Kel
@Alex, that's all very well and good, but that line at register 3 isn't going to ring itself up.
12/12/2010Alex
@Anon,
your first line (after @Alex obviously) perfectly described this article, duh.
@Matt, no, you are, and these guys are. The article said the contract included they'd receive the resources required, when they didn't receive that, the breach of the contract on the publisher's side. Unless the contract didn't say all this in which case they were morons to sign it in the first place. But anyway, the end result is, they delivered, they got paid, the publisher got the game, and the customers got the shaft. Yes, I totally hope developers like this keep making ports like this, so true! Anyway, bye, fanboys (of people you don't even know, gotta love the internet) and idiots alike.
12/12/2010tpp
Ever worked with that publisher again?
That's some f***ed up stuff.
12/12/2010⬡
I know many developers even for modern consoles use modchips, hacks, and flash cartridges - all the same tools pirates use - to test their games on off-the-shelf consoles because they can't afford enough dev kits for everyone.
12/12/2010Anon
Hopefully the chap who was served the takedown will never know why they found him. Copyright truly can set up some unpleasant scenarios.
12/12/2010Anon
@Alex
Hey look! someone complaining on the internet!
I suppose you would have done a better job given the time and resources available?
12/12/2010Helm
Somehow Alex misses the point. How can you port something when you're not given the source code? You can't, and if they didn't get this done then they would have probably gotten dropped for someone who could come up with something that probably wouldn't even be nearly as close. It's a business and people need to make money.
Good story, Mr. Feldman, thanks for sharing.
12/12/2010Matt
Really interesting read! Great work!
@Alex:
You're a moron. A god damned moron. Did you not read the guy was pinned to the floor by his nuts? That there was no other choice besides losing his entire company because the suits above him screwed him over on contract?
You should seriously keep your damn mouth shut next time you think about opening it.
12/12/2010Don't Get Others Into Trouble
"The publisher refused....their legal team were already writing up a cease-and-desist letter ordering him to remove the assets from his fan page."
Next time, just give credit without asking.
12/12/2010Ryan McGrath
You get insane props for your final trick. I'm surprised that even came *close* to working. ;)
12/12/2010Alex
So you're among those "developers" who do the infamous shoddy "ports" of classic titles that actually don't feel anything like the original because you thought your poor result was good enough to get past the suits that pay you? And you blame them? What a joke. Go indie if the publishers are so evil and you have actual talent and design sense beyond hacks like what you just described here. This is now more plausible than ever and proven by many, many indies out there (not just the "famous" like 2D Boy, Notch or Blow, you don't need to be the best and richest indie to prove it is viable). Otherwise, keep being the code monkey hack you deserve to be.
12/12/2010alphabot
that was an entertaining read. thanks for sharing.
12/12/2010Eagius
Great idea using gameplay and pixel mapping to create tiles! How many hours did you work that week?! :D
12/12/2010wanana nombaba
I wonder if it might not be helpful to the game dev community to go a step further. Specifically, to create a MAME site where all the ROM images are 'de-constructed' into usable game assets such as sprites, tile map arrays, game play mechanics, AI algorithms, etc. These could then be indexed and categorized further for reference.
Such a site would of course exist in a legal grey area, to be charitable, but would certainly be an incredible educational boon to those younglings learning the dark arts of game design and programming.
12/12/2010germanguy
to remove all the black kids from the game (because "it hurts sales in Germany") is total bullshit.
12/12/2010Kungfu
@onedayitwillmake
Same here. Came from ycombinator as well. I'm just glad I'm not a game developer. I would love doing the work, but hate working for the man because of situations like this. But that's pretty awesome what you did.
12/12/2010Kristian Hermansen
Love the hack! :D
12/12/2010tom
ycombinator sucks
this article rules
12/12/2010onedayitwillmake
I haven't read a more interest article in a long long time! :)
Btw you made ycombinator!
