Posts Tagged game

Accordion Hero

Last weekend, I spent some time making a prototype Accordion Hero that uses live input from a microphone, does Fourier analysis to determine the keys, and uses this to control the video game. The beauty of this is that you can use your own instrument and try to learn while playing a game.

http://www.youtube.com/watch?v=dm4Kv_-Sen0

The version is just a prototype. While debugging the audio input, I used Audacity (which has a beautiful set of frequency analysis tools). These were helpful in determining if it was possible. I ended up using the tools for the spectral analysis from Audacity (they have an internal FFT that is pretty lightweight and saves linking to some other external library, e.g., fftw3). Also, the portaudio library is great for getting audio input across several platforms. I used it without a hitch for linux, mac, and cross-compiled windows. I’m a fan!

Common issues include a bit of lag, and some noticeable bugs where it says you played a note before you played it (this is actually a minor issue that is easy to resolve).

I spent some of today building the windows version:
AccordionHero.zip
the windows version has some problems (namely, it crashes on exit). Use the .bat script to run. It may be missing mingw.dll (should be easy to find on the web).

And a mac version:
AccordionHero-mac.zip
I am not sure I have packaged all of the dependencies. Again, run with the .sh file. You may have to use dylib-bundler (or the other mac tool to rename the libraries reference by the binary).

I didn’t spend much time tweaking for different systems. You will have to make sure that the audio level on your input is high enough. Use the ‘f’ key in the program to bring up the frequency spectrum. This should have a horizontal bar across it. This is the threshold, below which everything is ignored. Use the .bat/.sh script to adjust this file (the vertical scale is roughly -90 to 0, the default threshold is -65 DB).

I have only tested this with the Accordion, but it should work with other instruments. Use the ‘f’ key to find the frequencies of your instrument. Edit the notes.txt file (which serves as calibration).

Here are some screenshots of the very lame gameplay:
ahero-3ahero-2ahero-1

, , ,

No Comments

Legacy

I finally got around to pulling out some old code for test apps that I had written some years ago.

Arkanoid

First one is arkanoid (break-out):

I miss living with my parents and working at a dead end job. It gave me motivation to work on little things like this. At the time I believe I was in my third year of my undergrad degree and it was either Christmas holidays or spring break. I had just finished spraining my thumb to the point where it had dislocated and the bone came through the skin. I started working on this gem and probably only spent maybe a day or two on it. Obviously never finished but it still may be fun to play. Download the windows binary (doesn’t work in wine) and try it out.

Bomberman

Next on the list is of course Bomberman. I still have some hidden obsession with bomberman. In this case, I totally ripped off the icons for the bomberman from the game, but I remember creating the textures for the fire (and most likely the board). This piece of work features randomly generated levels, partial multi-player support, mp3 player support (not sure how to use it anymore, using fmod sound). And of course some crappy AI. When I started this project (some time in the summer of 2002), I was interested in the AI for the game. The method I implemented used a strategy where the agent keeps track of the utility of places where a bomb will explode and ignores these positions while trying to break as many bricks. He is not much of an opponent as his primary goal is to destroy the bricks, but it was fun playing around with nonetheless. Thanks to Nathan Matthews for making a title screen:

See some of the screenshots below. If you try it out, make sure that you select player1 as keyboard1 and player2 as AI. Use ‘a’, ‘w’, ‘s’, and ‘d’ to move the player; ‘z’ to drop bombs, and ‘x’ to kick/detonate when you have a special.

Pacman

Not too much interesting with this one. Sounds real, I guess. The textures of the tiles are dependent on the underlying board, which is kind of neat I guess. The space key will chomp through the walls, so you can see what I mean. I can’t remember exactly when this project was concieved, but I would have to guess around christmas time.

,

No Comments

tile world

Contract work. A simple environment (search the web) for agents to learn in.

The core functionality was implemented, but to my knowledge no learning agents were actually implemented in the environment.

More details, and potentially source to come.

No Comments

Bomerman 4k

Yep, looks pretty crappy. It isn’t that easy to make a game fit into 4096 bytes. I thought it was easier, but once you set up a region to draw and get your keyboard input you really don’t have much space to work with. Not to mention the overhead from extra files in the jar-file nor the extra space taken by having multiple classes.

There are some real contenders for these types of games up at Java unlimited, which hosts a 4k game contest.

Executable (bomb.jar)
Source Code

,

No Comments

GT Racer

GT Racer demo, openGL.
I finally found the time to do some updates and get a windows binary available. The zip file is large (mostly due to uncompressed sound and models). There are lots of things that still need fixing:

  • Graphics
  • Multiplayer
  • A couple more little things to make single player complete
  • A lot of code fixing

Oh well. At least it is up here in case anyone wants to test it out.

The controls are ‘w’ for push (currently you can push as much as you want), middle button for controlling front ski, and flicks of the right button for backflips and spinning. There are some keys bound to the tricks (I think ‘e’ ‘f’, ‘z’ and ‘c’, or ‘q’ or something). ‘a’ and ‘d’ may be bound to dropping flags (my crappy level editor).

Oh yeah, the directory it unpacks to is a huge freakin’ mess, and the program crashes when you close the window. All in good time my friend…

,

No Comments

tetris08

Back in 2004, Keith Yerex and I played a game of who can write tetris the fastest on a flight from Toronto to Edmonton.

I dont remember who won, and I dont have the source anymore, but it was a good way to kill time.

On a recent trip to Atlanta for a conference, I played a solitaire version of write tetris fast; this is the result. I spent some more time during the evenings on that trip adding some crude AI that takes the history into account.

Executables and source to come.

,

No Comments