In the last couple years, the Game Dev Club at San Jose State University have created a few working arcade cabinets. The arcade cabinets are pretty much wooden shells that contain regular computers and monitors inside them. The joysticks are connected to the computer through a USB-interface.
The purpose of the arcade cabinets is to showcase student-made games. All the games on the Game Dev Club arcade cabinets are developed, designed, and composed by students at SJSU.
Even a game worked on by yours truly is on the arcade cabinets.
The Arcade Launcher
The launcher is what glues all the games on the arcade cabinet together. It is the screen you see when you scroll through the games. It is the what you use to start a game up.
The first launcher, applesauce, was created by Kristopher Windsor and was written in Basic. It allowed the user to scroll through games and launch them. Although it fulfilled the basic needs of a launcher, it was a tad bit buggy, kept minimizing, and would often require the operator to restart the machine.
The second launcher was created by Matt Hoffman using the Unity engine. It had 3D models of the arcade button controls, music, and an overall great interface. It was a well-crafted launcher, however it ran into a few problems of its own. Since the launcher was running on a game engine, other games suffered from framerate issues while the launcher was running. The launcher also had the issue of displaying on top of games.
The Third Launcher
In my sophomore year at SJSU, I was given the opportunity of developing the third iteration of the arcade launcher. The third launcher employs a monitoring method to determine if a game has been launched and then minimizes the launcher window. The launcher also has the extra abilities of collecting data and switching genres.
By monitoring when a game has launched and when it has exited, the launcher is able to collect play-count and play-time data and output it into a JSON file. A static HTML page is supplied that loads the JSON file and displays it as a pi-chart.
Check out the data that Rubaiyat Shatner collected at Rockage 4.0!
There are many different arcade cabinets that have been built with different themes. To reflect those themes, the games are grouped into matching genres. The launcher allows the operator of the arcade cabinets to select and define the genres they want for a specific cabinet.
Games that aren't designed for the arcade cabinets or are using legacy controls have Joy2Key bindings that remap the joystick keys. The launcher will activate those Joy2Key bindings based on what game has just launched.
The launcher monitors if a game executable has successfuly launched or if it has just closed. When it detects that a game has launched then it minimizes itself to allow the game to properly render. When the game has closed, the launcher opens back up.
The launcher has two methods of monitoring processes.
The first method of monitoring involves polling. It makes a request to the operating system for a list of all running executables, and matches it with the game executable name. It does this check every second. It is slow but is the most stable way of monitoring a game.
The second method doesn't actually monitor the game at all. It launches the game as a subprocess. This is the fastest way of detecting when the process has started and when it has ended since it gets a message direct from the operating system.
However, the second method doesn't work for certain games. Games using Game Maker create a helper executable that unzips its assets and launches a new process which has the actual game in it. The second method can only monitor the helper executable, which closes right after the actual game starts. This same problem creates a minor inconvenience for the first method, as the operator needs to specify that they want to monitor the actual game executable and not the helper executable.
The CSS and animations are done using LESS
The launcher application itself uses node-webkit / NW.js. NW.js allows developers to create standalone applications using web technologies. NW.js is a gutted web-browser. I call it a "gutted" web-browser because it's essentially still a web-browser but without extensions, address bars, and security.
NW.js allows me to create a webpage for the display and use node.js modules to launch and manage processes. NW.js also allows me to read and write to any files I want, which I use to save data collected.
Developing the arcade launcher was a great way for me to learn how to use node-webkit and it even introduced me to CSS3 animations. It was my first time animating elements on a webpage.
Even though the code is messy and was written while I was still in my self-taught programmer mindset, I can say that it is one of my coolest projects. I love going back to my old code and looking at all the different and unique methods I used for doing certain things, it reminds me of how much I've grown as a programmer.
I was also able to get into a couple shows and festivals using the launcher as my ticket! As long as I'm available to do some quick maintanence on the launcher, I've been able to travel wherever the cabinets go.