Difference between revisions of "ECE497 Project GameSystem"

From eLinux.org
Jump to: navigation, search
Line 87: Line 87:
== User Instructions ==
== User Instructions ==
To run our programs, call them from the shell.  
To run our programs, call them from the shell. Wrapper is called with ./Wrapper, and snake is called with ./snake
== Highlights ==
== Highlights ==

Revision as of 17:12, 14 November 2013

thumb‎ Embedded Linux Class by Mark A. Yoder

Team members: David Savrda Ian Kowalski

GitHub link: https://github.com/kowalsif/GameSystem

Grading Template

I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!

00 Executive Summary
00 Installation Instructions 
00 User Instructions
00 Highlights
00 Theory of Operation
00 Work Breakdown
00 Future Work
00 Conclusions
00 Demo
00 Late
Comments: I'm looking forward to seeing this.

Score:  10/100

(Inline Comment)

Executive Summary

This goal of project is to make the beagleboard into a functional mobile gaming system. The idea is to use emulators, controllers, and a lcd screen to allow the user to play games from multiple systems.

We currently have a working wrapper to interpret gpio button presses and analog inputs as keypresses, and were able to hook up a lcd7cape to the bone successfully. We were additionally able to get an emulator for the sega master system running, but were not able to send inputs to it successfully. To test the wrapper, we have a simple snake game implemented in c using the shell, and it along with the wrapper are available from our github. The emulators we used are available from: https://github.com/bear24rw/

As such, we were unable to get any emulators fully running, and were unable to hook up an xbox 360 controller to the beagle bone black. For more information on our tests, please read the history section below.

Overall we feel that this project should have been doable, given a different distro of linux, as there are projects out there where people have succeeded before us. Overall, we would recommended using a full version of linux as opposed angstrom, specifically gentoo (used by bear24rw as far as we can tell) or ubuntu (has plenty of tested emulators).


As of Oct 26 we have gotten the LCD cape to work perfectly fine with the bone. However there is one important thing to note. Because the cape is an A2, the beaglebone must have a SD card that it can boot off of. This is not a huge issue but it is important to note.

It must be noted that there is no current Angstrom support for the xbox controller, and our attempts to download and install drivers for it have proved unsuccessful. We attempted to download and install xboxdrv-linux-0.8.5, but were unable to get the necessary files on angstrom to run it. As such the current state of the project must be examined. There are 2 paths that are currently open to us the first is to attempt to write a driver for the xbox360 controller to allow us to read from the controller. This path would probably take the remainder of the time allocated for the project, as neither of us know how to do that, and it will probably be quite complicated. The other path is the abandon controlling the emulator with the controller, and focus on getting the emulator up and running, and using a different control scheme. We currently discussing these potential items, and will decide shortly.

Based off of the above, we have decided to stick with our original goal of running emulators on the beagle bone. As such, we will set up our own controller to generate keypresses based off of gpio buttons. Unfortunately, this means we cannot use the lcd cape as it removes our access to gpio buttons. For now we are trying to compile and run bear24w's gamingcape emulators, as they have been installed and run on the beaglebone and run before.

Our attempts to crosscompile the gameboy emulator provided by bear24w have proven unsuccessful, as our versions of linux either will not compile (64 bit does not compile 32 bit easily and our 32 bit is encountering issues with compilers). While we were eventually able to resolve the issues with the compilers allowing us to run the ./configure file. However, during our attempts to make the file we encountered syntax errors meaning the compilers we tried to use were most likely wrong, or libraries were out of date. When attempting to use the provided binary on the beaglebone, we encountered errors with a missing library. Attempts to manually install the library failed, and we were unable to get the emulator running.

The wrapper is currently the most function item on the project. It watches the gpio ports and creates key events when a gpio port receives a signal. The SNES emulator works but requires a joystick to function and will not take input from other sources. The Sega Master system emulator runs but like stated above it does not handle key event correctly rendering the games unplayable.

So after trying 3 different emulators we finally found an emulator that works, but it still has some issue that needs to be overcome. We are currently using a SEGA master system emulator, which as successfully been run. We are currently able to run Phantasy Star, and Ultima IV. However the problem lies in the fact that the emulator does not seem to be processing input events correctly. As of current the emulator can take input from the mouse. Attempts to read the mouse input were successful, however attempting to apply these instructions to keyboard proved unsuccessful.

Unfortunately was have not managed to get any emulators working properly on the Angstrom distributions. As a result we are attempting to set up a Debian flash which according to our research should have better results then the Angstrom distro. The current goal is just to try and get some game/emulator running on the BeagleBone.

Unfortunately our attempts at using another distro have failed, so instead we have set up a simple game of snake in a shell that relies on keyboard inputs, with the gpio wrapper can be used with.


If you have hardware, consider Small Build, Big Execuition for ideas on the final packaging.

Installation Instructions

Download our repository: https://github.com/kowalsif/GameSystem

GPIO_Analog wrapper: This is a simple wrapper designed to read multiple gpio and analog pins, and generate keypresses based off of them. It requires the xdotools library, which you should be able to get with "opkg install xdotool". Before running please ensure analog inputs are enabled, by following these instructions:

beagle$ SLOTS=/sys/devices/bone_capemgr.*/slots beagle$ PINS=/sys/kernel/debug/pinctrl/44e10800.pinmux/pins beagle$ echo cape-bone-iio > $SLOTS

The wrapper can then be run, and will interpret inputs from the gpio pins listed inside, along with ain0 and ain1. Should you choose to edit the wrapper it can be recompiled with the included make file. The program is run with ./Wrapper. Keypresses will be sent to the currently selected window.

Warning!: Since this uses gpio polling, it will interfere with other programs using gpio polling when buttons are pressed

Hardware: 10 GPIO buttons and 2 variable potentiometers. This may be run with less hardware, and the pins are specified in the .c file. (along with pullup or pulldown, although we make no guarantees as to accuracy)

Snake: In order to demonstrate our wrapper we set up a simple game of snake. It can be run by calling ./snake in the directory it is stored in, or remade by calling make. It is controlled by keyboard inputs, and requires enter to be pressed after each button press. This is dealt with automatically in the wrapper. WASD are used for directional controls, and p is pause. CTRL C is used to quit the game.

Hardware: Some means of generating keypresses, be it via our wrapper or a keyboard. Screen for output (note that it can be run properly through ssh)

User Instructions

To run our programs, call them from the shell. Wrapper is called with ./Wrapper, and snake is called with ./snake


Controller Setup[1] Snake Example [2]

Theory of Operation

Our wrapper works by polling gpio inputs and analog inputs, and using the values there to generate keypresses by using the xtools extension for x11. This can be used to generate almost any combination of keypresses. In order to make analog inputs a feasible means of input we very rapidly poll the pins. Then, based on a deadband we decide whether or not to send an output signal. The deadband is hardcoded.

Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.

Work Breakdown

Emulator Research - 5 hours - David

Wrapper Research - 5 hours - Ian

VisualBoy Setup - 8 hours - David/Ian

SNES Setup - 2 hours - David

Sega Master System Setup - 8 hours David/Ian

Doom Emulator Setup - 6 hours David/Ian

Wrapper - 2 hours Ian

Distro Attempts - 6 hours Ian/David

No emulator is running and receiving inputs properly.

Future Work

This project is feasible as their are already successful versions of it out their. It may be feasible for some to try continuing this using a different operating system. Alternately, for the game boy emulator it may be possible to install the missing libminizip.so.1 file using a program similar to alien and manually installing it, as attempts to manually install zlib (which contains minizip) proved unsuccessful. For the sega master system, while the emulator ran we were unable to get it to properly receive inputs, and someone else may be able to track down the bug. Additionally focusing on trying to get different distributions working on the bone may provide a more effective platform for this project.


Overall this project should be feasible, and many of our problems stemmed from our use of angstrom as an operating system. If we were to use a stripped down version of ubuntu or gentoo as our distro, this project would be significantly easier as many of the libraries would be easier to download and install, additionally many emulators have been tested on the os. From our research we where able to find out that most of these emulators where specifically designed for specific distros. This means that tracking down bugs will often be easier.

thumb‎ Embedded Linux Class by Mark A. Yoder