How to Code a Rhythm Game

So you want to program a rhythm game but you don’t know exactly how to begin? Well, during the development process of my rhythm-based mini-game, Funkbot3000, I learned a few things about creating a rhythm game that might be valuable for anyone looking to code one of their own.

In games that use rhythm as its core mechanic, the most important aspect is detecting if the user executes a certain action in the correct position in time. For example, in games such as DDR, the user must step on positional arrows at certain intervals in the musical sequence in order for the game to register the input as a successful action.

In this post, I will depart some knowledge that I learned while creating a rhythm game that will hopefully help you in your journey of making a beat-tastic love adventure!

 

Edward Sharpe & The Magnetic Zeroes

Recently, I’ve been really groovin’ to the music of Edward Sharpe & The Magnetic Zeroes. They are a really unique bunch that sound as if they were all baptised in the waters of 1960s hippie-dom. Their music is incredibly rich and dynamic: one part Beatles (late Sgt. Peppers era), one part Arcade Fire, mix in some Alberta Cross and Johnny Cash on acid. Each song on their album is unique and their range and breadth is exceptionally eclectic.

I absolutely love everything about this musical band of gypsies — their terrificly interesting back story, their profuse “family” of musicians, their unique sounding music, and most importantly, their simple formula for happiness.

The band is led by a Alex Ebert, who was formerly the vocalist for the indie-punk group Ima Robot. During that time which Ebert considers his “dark era”, he was a cynical alcoholic who was spiraling into a drug-laden mental obscurity. Desperate to be someone else, he breaks up the band and checks himself into Alcoholics Anonymous. During his stay, Alex writes several pages about a messianic figure named Edward Sharpe who is “sent down to Earth to heal and save mankind”.

After his release, he acquires an used school bus and forms a band which centers around the ideals of the fictional messiah, Edward Sharpe. Alex Ebert becomes an embodiment of the messiah and their group roams from city to city like a traveling Woodstock. They are truly a living testament to the golden era of the 60s when bands thought of themselves as families and concerts were an unbridled whirlpool of hippie love-joy.

I am planning to go with some friends to see them live on July 5th at the Palladium in Dallas. I am quite excited and I hope they exude as much happiness and joy as they sound in their albums.

[ Video: Live on Letterman ]

Flowing Leaves

Introducing: Wasabi

While eating sushi with my wonderful girlfriend last week, I came up with this little simulation game involving a man and his struggling sushi bar. The game is called Wasabi and it’s a bastard child of two of my greatly-liked genres: farming sims and platformers.

So I’ve been furiously coding away in my underwater lab. And now, I feel that Wasabi is at a good state in which it can be released out to the public in hopes to receive some critically delicious feedback.

I consider the game to be in alpha right now, which means it still needs alot of balancing and tweaking to do to make the fun truly shine like a star!!!

Anyhow, I hope you enjoy my interpretation of how the sushi business works in the real-world. I tried to be as accurate as possible. Also, feel free to leave me some feedback in any colour you like.

[ Play Wasabi ]

Dr. Dog

Over the weekend, I went to see the band Dr. Dog at the Loft @ Dallas. If you haven’t heard of them, they are a psychedelic mix between The Beatles and the Beach Boys, plus more. They have an awesome stage presence and were a blast to see live. For those who have never listened to their music, I highly recommend you slam in to it.

Funkbot 3000 Finished!

After several weeks of hard work, I am proud to say that I have finished my (mini-) game, Funkbot 3000. It all started as an experiment to develop a Flash game with rhythm-based mechanics and ended up as a silly mini-game where you must build a robot with the power of lovefunk and soul.

It has been a fun experience. And during the development process, Funkbot has been features on several sites:

However, there are still some desyncing issues if you start doing something else while in the game (like browsing the web). Not exactly sure how to fix that, but if you stay in the game from start to finish, the music and the beat should be in sync.

Anyhow, it is time to move on to bigger and more delicious things. Hope y’all enjoy!

[ Play Funkbot3000 ]

Actionscript 3 – Singleton

The Singleton design pattern is popular method that is used quite ubiquitously in software engineering. Sometimes, it is appropriate to have only one instance of a class. For example, the window manager, sprite manager, and filesystems are all good examples of classes that would neatly follow the singleton paradigm (since you only need one of them in your application). Singletons are extremely useful when you have exactly one instance of an object that requires global access.

In C++ code, one would derive singleton classes from a singletons template. Doing this prevents the coder from polluting your global space with nasty variables. (Also, the compiler does not guarantee the order that globals or statics are instantiated.)

Although Actionscript does not have templating functionality like C++, you can still make your desired class a singleton by simply adding a few functions:

package com.example
{
	public class SpriteManager
	{
		public function SpriteManager()
		{;}
 
		// Singleton methods
		//
		private static var _instance:SpriteManager = null;
		public static function CreateInst():void { _instance = new SpriteManager(); }
		public static function Get():SpriteManager { return _instance; }
		public static function InstExists():Boolean { return _instance != null; }
		public static function DestroyInst():void { _instance = null; }
	}
 
}

As you can see, you use a private static var _instance to hold the single instance of the class. The CreateInst() function creates a the single instance of that particular class:

SpriteManager.CreateInst();

You access the class by calling Get(). For example, if I wanted to fetch the instance of the SpriteManager, I call:

var manager:SpriteManager = SpriteManager.Get();

And there you go, a simple Actionscript 3 singleton class for the win. And on a related matter, there is a Playboy bunny named Sasha Singleton.


© Copyright 2010 Illogic Tree | "Modicus Remix" by Zidalgo | Log in