johntwomey

At Emutex, we create and sell great software to professional companies building solutions. From time to time, we also build proofs of concept, prototypes and demos. We do this to educate, to promote awareness, to enable hobbyists and to demonstrate what we can achieve.

 

John Twomey - CEO.

 

Pacman gaming machine built using the UP Board.

 

In this article I will go through some of the steps I went through to make a replica cocktail table pacman machine using an UP board.

Software

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, 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. 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 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 attempt 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 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. However, 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 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 caused 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:

GRUB_CMDLINE_LINUX=”video=1920x1080@60”

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.

Controls

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 lets me wire up all the buttons and joysticks to one point and connect it 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 that the buttons generate keypresses which correspond to the default keystrokes in MAME. So no extra software is 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 pushbutton 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.

Monitor

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.

Speakers

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.

Cabinet

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.

Paintwork

Once assembled, I primed and painted all exposed panels with black gloss paint. Adding some simple graphics was just 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.

Control Housing

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 underneath 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. I countersunk the screws and filled in the holes with more wood filler. Once dry, I sanded down, primed with PVA and painted it gloss black. Once the paint dried it was simply a case of adding in the controls. This step is very straightforward. Each joystick has four bolts that tighten from underneath and the push buttons are threaded with a bezel that screws down from the top.

 

 

Speakers

emutex pacman mark 4

Controls

emutex pacman mark 12

Power and Adapters

emutex pacman mark 6

 

Completion

Finally it was just a case of connecting everything up and trying it out. And it works great! Next step – build an upright version.

 

Go To Top