Follow Patrick McCarron on Twitter View Patrick McCarron's LinkedIn profile View Patrick McCarron's Flickr Photo Album View Patrick McCarron's Facebook profile

My Portfolio

Ask me a question

Archive

RSS

Patrick McCarron's
Infinite Shamrock

 

September 22
2012

Making an iOS Powered MAME Arcade Machine

One of the “perks” of being an iPhone application developer has always been an excellent excuse to upgrade to the latest and greatest iPhone. As I write this on Friday I am actually waiting for my iPhone 5 to be delivered. Getting every device is useful and almost a requirement in order to test your applications on it.

But what you do with these devices as time goes on and they become increasingly obsolete? Some people sell them, others hand them down to family, but I typically keep them around for testing as well as nostalgia. They have come in handy over the years for various different things as well, like when I used them for time lapse cameras for the big Chicago snow storm of 2011. But they start to pile up and collect now after five years.


Yes… I may have a problem

Early this year I bought a new CRT monitor for my dedicated Mortal Kombat 2 arcade machine. It needed to be done because of bad burn in, and arcade CRTs are becoming increasingly rarer by the day. The monitor I bought is a Tri-mode monitor that not only supports the standard arcade resolutions (CGA and EGA) but it also supports VGA and comes with a standard VGA connector and adapter for JAMMA pins as well. This got me thinking, maybe I’ll build a MAME machine instead of running all the hardware required to run the five games switchable that I run in it today.

So, when starting to plan the MAME machine my initial plans were to use an older Mac Mini. But when I was putting together what turned out to be a pretty extensive parts list, I got to thinking: "Why can’t I just repurpose an old iOS device for this?"

It turns out, I can and I did…

How did I do it, you may ask? Here’s a breakdown of what I did if you too want to try to do the same with your arcade cabinet.

WHAT YOU’LL NEED

Here is a list of parts you’ll need and some price estimates.

Basically if you have an arcade cabinet with a monitor that’ll display VGA+ signals and an old iPhone like I did, then you can likely do this project for as little as $100.

PART 1: VIDEO

I decided the optimal way to connect the video is to use the Apple iPad VGA adapter which works with any device with an A4 or higher processor. So that means I can use an iPhone 4, iPhone 4S, any iPad and the newest iPod Touch models. You can also use the Apple HDMI cable if your monitor has an HDMI input.


Choose Your Destiny

The video is the most important part, because without it you can’t do the rest of it. So before I did anything I built a simple app to test video modes on my arcade monitor. I found it returns that it supports more resolutions beyond VGA, but in fact it doesn’t. But it successfully works at 640x480 as I found in my testing.


It’s Resolution Baby

For my purposes this solution is more than adequate. A proper MAME setup can also get to the lower CGA or EGA resolutions, but for my monitor being analog it’s best to keep it on one resolution so this is not ideal and still looks great to me.

PART 2: CONTROLS

As far as controls go, this was the one I thought about the most. There are a few options, but even less for non jailbroken iOS devices. So I settled on going with the iCade method of making the iOS software think it’s a Bluetooth keyboard. I did this by… using an iCade.


iCade - The key to this project

I owned an iCade from the first day they were available, it makes for a great iPad stand and also a fun way to play some classic games which are making their way to the platform more and more. But I didn’t want to open it up and ruin it. So I searched online to see what the wiring system looked like, and I was pleasantly surprised to see it uses standard arcade control cherry switches. Which meant, transplanting it’s guts into my arcade machine would be fairly easy.

I opted to buy a second iCade to use for this, because I’d like to make it a permanent fixture in my home. I found one used on eBay for $40 shipped and jumped on it. I’ve also seen others go for as low as $20 at times as well.

So once I got it home I began to pull it apart to take what I needed to transplant to make the iCade work with my existing arcade control panel. Below are a few photos, it’s fairly straight forward and took a matter of minutes so I wont waste words explaining how to take it apart. Keep in mind I did find you’d need a security torx bit to get it open, but these are fairly commonly found at hardware stores now.


iCade Inside Out

Standard Quick Disconnects

No Quick Disconnects, Easily Resolved

iCade’s PCB

PCB plus wiring ready to go
Here is the end result of the iCade transplanted into my arcade control panel.

One downfall with using an iCade is that it’s a one player only device. So my two player capable arcade machine is not being used optimally, no going head to head in Mortal Kombat and no teaming up together in The Simpsons Arcade Game. I am going to look into building a custom Bluetooth controller using an Arduino, or similar, that would work similarly to the iCade but also support two or more players.

PART 3: AUDIO

At first I wasn’t going to do anything for audio. My iPad 3 which I was initially using in the process was quite loud enough that it was as loud as the arcade machine. But when I moved back to the iPhone 4 which will likely be the sole device I use for this, I found it’s speaker quite limiting.

The arcade cabinet is only mono so only had two connections for one speaker to hook up to the iPhone. So I grabbed a few spare headphone and RCA cables I had around, did some cutting and then hooked on two alligator clips which I use to connect to the speaker. Here’s the finished cable.


Made cable long to reach the cabinet speaker wire in the back

It’s all rather simple, if you can hook up arcade controls you can also hook up a speaker.

PART 4: POWER

Power is one of the things that is really an unique to this setup. An iPhone device has very little drain compared to a desktop computer or even the five arcade PCBs that took two PC power supplies to run that had in there. Also the iCade runs off of two AA batteries as well, or an optional power brick. The way I set it all up today actually has no direct power draw from the wall at all. I ripped out the iCade’s battery compartment to keep things simple for now.


Couldn’t find my Dremel, so I used a drill.

The only major issue I have right now is that the VGA adapter blocks the power connector of the iPhone. So when I’m not playing, I keep the iPhone plugged into power. In my testing, iMAME can run for about 2.5 hours on my iPhone 4 without interruption so this is adequate for my purposes but not ideal.


Carefully chosen case for matching red trim

In the future I’ll be researching a way to keep the iPhone powered without blocking the VGA port. Apple’s own HDMI output solved this issue, so it’s possible, but I need to build or hack the existing cable to solve this problem.

PART 5: SOFTWARE

As I said earlier, no jailbreaking is required for my solution. But for others this may be difficult without jailbreaking. The MAME project, and by extension the iMAME4All projects by Seleuco, are all open source so any developer can build them with little work and without jailbreaking.

iOS developers are best to start with lesbird’s iMAME for Xcode, much easier to get up and running from there. I have notice some performance problems with my builds, and I’m looking into that and readying the project for iOS 6. I will likely be releasing that update on this Github project sometime soon now that iOS 6 has been released.

Also if you are not a developer and happened to download the iMAME that was availble on the AppStore like I did, then you don’t need to jailbreak your device. Otherwise if you are jailbroken, both iMAME4All and newer iMAME4iOS are available on Cydia.

It’s important to note that the MAME4All that iMAME4All is based off of a source fork of MAME that is around 10 years old now. It’s done like this because it runs things much faster on older hardware, but suffers because of a lack of compatibility and accuracy. But for most games, it works perfectly fine. Seleuco also ported a newer source build of MAME into the iMAME4iOS project. It needs much beefier hardware to run the games, but has a much greater compatibility. I’ll likely be moving to this build in the future.

THE END RESULT

TO THE FUTURE

I’m also not 100% happy with how iMAME works with the arcade cabinet and the iCade, and this is something I am looking forward to improving since it is open source. I haven’t had the time yet but I have a few ideas. One idea I had is to make a whole new interface, here is a mockup below:

Besides some software, power and possible control enhancements I’ve been wanting to do, there was another idea that was sprung from this project. What if you were to take a third party console arcade stick, toss in an iCade and an iPhone dock. Then using AirPlay Mirroring or the HDMI adapter, you could then turn that arcade stick into a portable arcade machine that hooks up to any modern TV. Why settle for playing these games on your iPad with an iCade, when you can hook it up to your 55” HDTV in your living room?

Now to find some spare time to make a proof of concept of this idea. Lucky for me this is another project where I have all the parts required to see it through.

If you have any questions you can contact me via email or Tumblr’s “Ask me a question” via the links on the right side of the page. I’ll try to get to them in a timely manner to get you on your way.

April 2
2012

How To: Use a Custom Game Center Turn Based Notification Sound

There is one thing I briefly mentioned in my post last week about the Game Center Turn Based APIs that I want to expand on a bit. While currently Game Center’s turn based push messages don’t match your app, there is an undocumented way to make the notification “sound” like you want it. The following method works on iOS 5 and 5.1 currently.

All you need to do is add a single sound file to your application bundle and iOS will automatically play that sound file when a turn/invite notification is sent to the user. The file is GKInvite and the format/extension must be either .caf, .aif or .wav.


An example GKInvite.wav from Words Play

Once this file is in your bundle, the rest will take over automatically. While this is undocumented it wont break your application if Apple changes it in the future. If you want this documented I suggest you file a similar radar to this one by me (rdar://problem/11168479) to get Apple to be more clear and add it to the documentation. Will Apple reject for this use in the future? Lets hope not and hope that the lack of documentation is just an oversight.

Thanks to fellow iOS developer Jason Lust who first posted about this sound on the Apple Dev Forums. Hope this information is helpful for developers out there using Game Center Turn Based APIs.

March 29
2012

Words Play: Reflections on Game Center’s Turn Based APIs

When we at Stand Alone set out to create Words Play we wanted to create a word game with a better user experience than what was out there on iOS already. We wanted it to be faster, more responsive and tailored to iOS as well. Then we added unique features to set us apart like word lookup, turn history, pass and play, achievements and AI play. We felt we could make what we felt was a great well rounded turn by turn word game, and I think we got pretty close to that goal with our latest update that came out this past week where we added a multiplayer chat feature as well as cleaning up the application UX a bit.

Another advantage of being on iOS was Words Play could take advantage of iOS 5’s newest Game Center Turn by Turn APIs. Using these APIs it affords us a game that could be run without needing to run a costly server infrastructure to handle the matchmaking and turn by turn handling. The turn by turn API and its backing server architecture is a nice benefit Apple provides developers of their platform that most other platforms do not even begin to offer. Running a server can be difficult and very costly, and we were happy to see Apple attempt to fill this need with a popular genre of games that run on their platform.

While we continued building the app and getting more intimate with the new Turn Based APIs we found it all very lacking. We feel now that it needs some work to really become a full on replacement for running your own services. From strange usability issues, lack of server data analysis tools, or just plain odd architecture decisions. Below you will find a list of our top issues (with linked bug reports) that we discovered over the past six months as well as a brief description on how that impacted our design. If these issues were to be solved it would dramatically improve Game Center for the better.

The purpose of me bringing up these issues is not to bitch and complain, but to inform other developers and hopefully get some attention to these issues. I actually see the value and potential in Game Center and I want to see Apple improve it. I’d love to see it become a killer-feature for the platform instead of what it is today. So we’re hoping that Apple will make strides to improve these issues in both iOS 6 and the upcoming Mac OS Mountain Lion which brings the Mac Game Center support.


Bug: Game Center turn based games can’t programmatically invite
rdar://11144951 - OpenRadar Link

This is a big one, we find it amazing that inviting or rematching players is not supported still. The API to do it is all there, just doesn’t work at all. There are numerous complaints about this on the Apple Developer Forums and my radar is far from the first, yet the problem still exists and that’s really disappointing. So instead of a simple one button press for a rematch the user is forced to perform just shy of 10 taps to setup a rematch. See the image flow below, this could be much better as the bottom half of the image shows.


Enhancement Request: Fix the Game Center Turn Based menu flow
rdar://11144972 - OpenRadar Link

This is a bit related to the previous bug, but still feel both points are important. The overall flow and design of the Game Center screens is hard to use for users. It’s so hard that we’re currently exploring having adding a first timer tutorial on how to use the menus, and that’s not right. Apple can do better.


Enhancement Request: Allow Filter/Sort for Game Center Turn Based Friend Invite List
rdar://11144995 - OpenRadar Link

Once you get to the list of Game Center friends to invite to a game you are presented with a list of all your friends with no clear indication if they have the game you are also playing. The list should be sorted or allow straight filtered out if they don’t have the game you want to play them in.


Enhancement Request: Game Center Turn Based Notifications should show as game in use
rdar://11145004 - OpenRadar Link

This is almost a bug and an enhancement request, it’s a fine line really. When you get turn based notifications they come across as from Game Center, not the game you are playing, but if you have Game Center turned off in Notification Center then you wont get these notifications at all. We see this a lot with players not sure why they aren’t being told it’s their turn if Words Play is enabled in Notification Center.


Bug: Game Center reporting incorrect dates in lastTurnDate
rdar://10660917 - OpenRadar Link

This one is really unfortunate. We found this bug a while ago, and it still isn’t fixed. Basically in the turn data that Game Center sends back and forth between users there is a lastTurnDate. This date is being set by the DEVICE not the server. So because we can’t trust this date to be accurate, because users can change their devices dates, it’s pretty much useless when comparing if a turn is new or not.


Enhancement Request: Game Center Turn Based Analysis Tool
rdar://11145026 - OpenRadar Link

When debugging game issues with customers it’d be super handy to check the server to see what data a user’s game is passing back and forth. There is no way to do this since Apple owns the servers, but they could provide us an interface to that turn data. We’d love them if they created that tool for us!


Enhancement Request: Game Center should be able to Find Social Network Friends
rdar://11145019 - OpenRadar Link

Let people who have linked Twitter find their Twitter friends on Game Center. And if Apple ever adds Facebook support to the OS, allow Facebook as well. Customers don’t understand why our game doesn’t do this because we can’t do this with Game Center as it stands today.


Enhancement Request: Game Center Message/Chat Functionality
rdar://11145031 - OpenRadar Link

Communicating between Game Center users doesn’t exist, but on most game platforms (Xbox Live, PlayStation Network, Steam, etc) there is a way to send your friends messages. This would be great feature to be built into Game Center as well and I’m sure almost all games would rather run this off of Apple’s infrastructure instead of rolling their own, and this would help spread Game Center adoption across games even more so than Turn by Turn.

October 7
2011
My App On Stage with Steve Jobs

While I’ve never gotten to meet Steve Jobs I am proud to have had my app Shanghai Mahjong icon on screen during Apple’s September of 2008 Special Event. Soon after it began to also appear on many Apple Store fronts world wide. To think Steve Jobs approved of it’s look to be used in these ways always made me proud of my work.

My App On Stage with Steve Jobs

While I’ve never gotten to meet Steve Jobs I am proud to have had my app Shanghai Mahjong icon on screen during Apple’s September of 2008 Special Event. Soon after it began to also appear on many Apple Store fronts world wide. To think Steve Jobs approved of it’s look to be used in these ways always made me proud of my work.

October 5
2011
RIP Steve, Thanks For Everything.



RIP Steve, Thanks For Everything.