Those of us who grow up in the golden age of arcade video games in the 80’s remember fondly how fascinated we were with games like space invaders, pacman and defender. Well, the good news is modern SBCs like the UP board are fully capable of emulating these classic games at a fraction of the cost of buying an original. I will go through some of the steps I went through to make a replica cocktail table pacman machine using an UP board.
Here is a full list of materials, items and tools I needed to create this pacman gaming machine:
- ubilinux™ software
- UP Board
- I-PAC 2 Board
- Game controls (ultimarc.com)
- CAT5 cable
- Old LCD monitor
- 18mm plywood
- 2.1 speakers
- Sheet of 12mm MDF
- Table saw
- HDMI to VGA and audio adapter
- Black gloss paint
- Blue, yellow and white spray paint
- Wood filler
- PVA glue
- Sand paper
The main piece of software for classic arcade games is an excellent package called MAME, or Multiple Arcade Machine Emulator. This package is freely available and installing it is as easy as typingapt-get install mame
sudo apt-get install -y mame on either ubilinux or Ubuntu.
Now while MAME does an excellent job emulating the original arcade games, you still need to supply a ROM image for MAME to run. These are not freely available as they are in many cases are still under copyright of the companies that originally wrote them. If you search the internet though you can find places where these ROMs can be downloaded from. But once you have managed to get hold of ROM file images for your favourite classic game, you can just copy the files into /usr/games/mame/roms and when you run MAME you will get a menu listing the installed games.
Software Setup and Autostart
If you just want to play the games, then the easiest thing to do is just launch MAME from your X window manager. MAME will detect that it is running under X and use whatever graphics mode is being used by your desktop. You can run with the “-maximize” flag to get it to run full screen.
For me, I wanted to create a turnkey system that starts straight into MAME as soon as it is powered on. I didn’t want to have any keyboard or mouse, so logging into an X session wasn’t an option. Of course it is possible to get a window manager to automatically log in a user and run an application, but it seems like overkill to me to use a window manager just to create an environment to run graphics from the 1980s. Another option is to run MAME from the command line. If you do this, then MAME will use “SDL” or Simple Directmedia Layer. SDL is a library designed to give direct low level access to audio and graphics hardware and it works well when SDL apps are launched directly from a text console. Support for SDL used to be through a separate project called SDLMAME but this has been merged into the MAME main codebase now so just the standard MAME package is all you need.
The first step in getting a text console system is to disable the X system from starting. ubilinux uses the lightdm window manager. My first try at disabling this was to run “update-rc lightdm remove”. This command removes the command to start lightdm from each of the runlevel startup directories, but when I rebooted, I was again presented with the lightdm graphical login screen. It turns out that another step is required and so I entered the command:
sudo systemctl set-default multi-user.target
This did successfully disable the graphical login and once I rebooted, I had a text only login console as needed to use SDL.
While building the initial test setup, I used a 4k Philips TV as a monitor. The UP board is the first SBC I have used that can drive a 4k display so I am primarily using it just because I can! Unfortunately though, running an unaccelerated bitmap rendering at 3840x2160 turned out to be too slow to run some games. The default rendering in /etc/mame/mame.ini is “soft” which uses software to render bitmaps, which is going to be slow. I looked into using OpenGL and using the “mesa” package which provides OpenGL on linux. Unfortunately, this also uses X, so in my case this would be no improvement. I know this isn’t going to be a problem with the actual monitor I plan to use for the cabinet, since that monitor is not capable of anything close to 4k resolution, but the slowness was annoying me so I looked into how to fix it.
After some research, I found that the ubilinux kernel supports “KMS” (Kernel Mode Setting). Using this, I added “video=1920x1080@60” to the boot line. This forces Linux to use a lower resolution than the best provided by the monitor. The parameter specifies horizontal resolution of 1920, vertical of 1080 and refresh rate of 60Hz, which is still quite a high resolution, and certainly far higher than what is needed to play games that only need 240x320 or similar, but it did the trick. I did try lower resolutions, such as 800x600, but this cause MAME to hang. I didn’t investigate why, that can be an exercise for another day. Of course, when making this change, it is not recommended to edit grub.cfg directly so instead I edited /etc/default/grub as follows:
sudo vim /etc/default/grub
And append the kernel command line options to the GRUB_CMDLINE_LINUX variable as follows:
The final step was to setup MAME to start automatically. The easiest way to do this was to add a line to /etc/rc.local. I invoke MAME from the rc.local file using the command:
sudo vim /etc/rc.local
And add this line before exit 0:
/usr/games/mame –-maximize –-ror
The options –maximise and –ror are to run full screen and rotated right respectively. The rotate right is to run games in the portrait orientation I used to mount my monitor.
Once all that is done, configure grub and reboot:
sudo update-grub && sudo reboot
And your UP board should boot straight into MAME.
I bought all the game controls from Ultimarc (www.ultimarc.com). The interface to the UP board is through the I-PAC 2 board. This handy little board let me wire up all the buttons and joysticks to one point and connect to the UP board using USB. The really nice part about this board is that it presents itself as a keyboard HID device to ubilinux. And even nicer again is the buttons generate keypresses which correspond to the default keystrokes in MAME. So no extra software required and no configuration changes are needed. It just works.
The joysticks are the “Mag Stik” models which are 4-8 way switchable joysticks. I went for the ball top to give a more authentic pacman machine feel. The buttons are simple gold leaf push-button switches. The joysticks and switches are wired directly to the I-PAC 2 board using good old CAT5 cable. In retrospect I really should have spent a few extra euro and bought a pre-made wiring harness but what I have works fine.
The monitor is an old LCD that nobody wanted because it isn’t widescreen. But that suits fine for a gaming cabinet. I broke off the plastic surrounding and discarded the buttons and stand until I was just left with a bare screen. I screwed together some cuts of 18mm plywood and cut slots to carry the screen as you can see here.
For audio, I used a cheap set of 2.1 speakers that I had lying around. I also used some plywood cutouts to hold the left and right speakers. The “subwoofer” can just lie loosely inside the frame.
The cabinet consists mainly of cuts from a single sheet of 12mm MDF. Using some more plywood as a frame, I just attached panels at both sides and at the front, back and bottom. I used a table saw for the straight edges and a jigsaw for the cutouts and rounded corners. I also used a router to round off the edges of the top panel. The side panels are screwed to the frame while the top frame is hinged to allow me to open it.
Power and adapters
Various elements need mains power in the cabinet. The UP board needs a 5V supply. The monitor has its own DC adapter and so does the 2.1 speaker set. I used a strip connector as a power distribution block and mounted a mains power socket and power switch from Maplin to the cabinet as well. One of the power supplies was a wall wart so I just broke off its' housing to get its' leads into the strip connector.
I also needed to use a HDMI to VGA and audio adapter. Because the
monitor I used was old, it didn’t have a HDMI (or even a DVI) input. But adapters are cheap and readily available. The one I used also has an audio jack output.
Once assembled I primed and painted all exposed panels with black gloss paint. Adding some simple graphics was a case of making some cardboard cutouts and using some cheap yellow, white and blue spray paint from Aldi. I used a CD as the template for pacman and the centre of the CD for the dots.
The boxes for the joystick and buttons were a bit more intricate. The joysticks can be subject to quite a lot of force from enthusiastic game players so it is important that they are well bolted down. The “blind hole” fittings also from ultimarc are very good and solid. They are mounted from underneath. After fitting the receptacles from the underneath of the MDF, I filled the top drill holes with woodfiller and sanded it flat to hide them. I cut out holes for 5 buttons to the right of the joystick and also a start button to the left. I have defender in mind which has five button controls, fire, thrust, hyperspace and smart bomb and of course, reverse, beside the joystick. Maybe there are other games that need even more buttons, but I’m fine with five. Just putting one start button means having one start button on each side of the cabinet. In hindsight it might have made more sense to put the two buttons together on one side but this arrangement works fine for me. I made two of these of course, one for each side. All drilling and cutting done from the top to keep the edges clean.
I then mounted the MDF to some more plywood and used screws to hold the lot together as you can see from the pictures.
I then countersunk the screws and filled in the holes with more wood filler.
Once dry, I sanded down, primed with PVA and painted gloss black.
Once the paint dried it was simply a case of adding in the controls.
This step is very straightforward. The joysticks each have four bolts that tighten from underneath and the push buttons are threaded with a bezel that screws down from on top.
Finally it was just a case of connecting everything up and trying it out. And it works great! Next step – build an upright version.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.