Singing Rabbits

Singing Rabbits, a game for the 'require sound' assignment by Jeff Carlson. Code help: cplusplus.com, gpwiki.org, "C++ In A Nutshell" (O'Reilly Media, Inc., 2003 ed.), others as indicated in code comments. Testing: Owen Durni.

Goal

I wanted to allow the player to make music on an elementary level and combine visual and audio cues.

Method

The player must chase a randomly spawning, randomly moving target around the play area. Depending on which "quadrant" the target (rabbit) is in, relative to the player (imagine a 2d coordinate plane where the player is the origin), a different sawtooth tone is played. The tones that were chosen create a 2nd-inversion major triad with scale degree 6 added; this ensures that as the rabbit moves around the player, the tones change in a melodically pleasant manner (by 21st century standards).

I briefly considered allowing for microphone input in order to achieve my "make music" goal; I wanted the player to hum into the microphone to create tones. This posed two problems, though; not everyone can hold a musical pitch, and microphone input on my local machine setup was not well supported.

Novelty

While the idea of an obnoxious rabbit comes from Super Mario 64, adding sound to a "hot and cold" activity creates an interesting link between what the player sees and what the player hears. The player has to combine what both senses are reporting in a clear way, which doesn't usually happen (strongly) in modern games.

Results

At times, the game generates some interesting sound patterns, and it was interesting creating strategies for catching the rabbit. Since the intervals between the 4 tones are always the same, clever listeners have an advantage in catching as many rabbits as possible. The moving fences also decrease boredom by letting the player take risks (but not expensive risks, as the player is a bit faster than the fences).

The rabbit could make use of some basic AI (to avoid the problem of the RNG forcing the rabbit to run straight into the player, or to punish good play by always running away from the player). Even a perfectly skilled player could get unlucky, and thus get a low score.

Another variant might be to encourage the player to generate all 4 tones (which would create more interesting music) by perhaps drawing a circle of some kind around the rabbit.