Friday, February 12, 2010

Rusher Game Framework

I have been very quiet lately. That's because my friends and I are busy preparing for the Creative Game Design Contest held by Gamer. The theme of the contest is "Escape", and that's the only limitation. There's no limit on the game genre and gameplay.

Originally, I was thinking of using PushButton Engine. However, as Ben Garney, the creator of PushButton Engine, points out in the forum, that he is still working on transforming the engine from single-core to multi-core. My game requires a multi-core game engine, so I decided to develop a light-weight component-based experimental game engine myself. This is the advent of Rusher Game Framework. There's no stable build available in the Downloads section, but you can grab the latest revision from the SVN repository. There are two primitive examples available in the "tests" folder.

The name Rusher comes from a character I designed when I was in high school. Here's what Rusher looks like. Rusher is still in alpha, and I think it'll become beta after we release our game.

Since Rusher is component-based, it's rather easy to extend custom functionalities. Rusher already has a built-in Box2D component package, which works with Box2D 2.1a, the latest version. I developed this Box2D package because we're working on a 2D platformer.

Here I'll briefly demonstrate some code snippets for Rusher.

Similar to the Multicore version of PureMVC, each core is referenced by a key. The Engine class servers as the facade of the game framework, pretty much like the Facade class in PureMVC. The getInstance() method is how you get a reference to an engine core.

Instead of providing something like a start() method, I'd prefer make the user call the main loop function manually, just like what I did for Stardust. Each engine core has a reference to a Clock object. The Clock.tick() method must be called repeatedly to keep the engine running. This method can be directly used as an event listener, just like the Emitter.step() method in Stardust.

The Entity class represents a game entity, be it concrete as a character or abstract as a game scene. An entity is consisted of multiple components, each representing a basic module of data or behavior. The ActiveComponent class represents a behavioral component that is to update the entity repeatedly. The ActiveComponent.tick() method is called in each main loop iteration. For this to work, the entity must be added to the engine.

Each component has a name property, so that it can be referenced by name. One entity cannot possess two or more components with the same name. To reference the data (or properties) of a component from another component, the PropertyReference class is used. The concept of the PropertyReference class is actually from PushButton Engine. Referencing components and properties by name is very convenient and flexible. For instance, you can swap a component containing 2D spatial data with another special component with 2D spatial data, which works with Box2D, not interrupting the 2D rendering components which reference the 2D position data by name.

Alright, this is pretty much I can say about Rusher so far. I'll post more details about Rusher once it's matured.

3 comments:

katopz@sleepydesign.com said...

looking fw to this! ;)

Ben Garney said...

Hey Allen!

Rusher looks really cool. Great work!

I have some concerns about the licensing. I posted a thread about them here: http://pushbuttonengine.com/forum/viewtopic.php?f=5&t=633 - could you please take a minute and look it over?

Thanks!
Ben Garney
Lead Programmer
PushButton Engine

CJ Cat said...

Right. I'm sorry I've missed out that part of the license. I've included the PBE license notice and a link to the PBE homepage in Rusher's SVN repository now.