Astrobunny ProjectFUN Prototype

Astrobunny is my term project at DigiPen for this semester. We’re building the game with the game engine provided by the school, DigiPen ProjectFUN.

It’s a 2D top-down space-themed puzzle game, where the player controls a bunny in a spaceship that can jump from planet orbit to orbit.

Continue reading

Posted in Gamedev | Leave a comment

Rusher 2 – Renderer2D

Go to Rusher 2 project homepage
Rusher 2 tutorial list
View Renderer2D example
Example source

There is a built-in 2D camera-layer-based renderer system in Rusher 2, which is based on the 2D renderer in Rusher and the rendering system in DigiPen ProjectFUN. You have other options than this, however. As you have already seen, you can implement your own 2D renderer like the DisplayObjectUpdater system in previous examples.

Cameras & Layers

The Renderer2D system models the scene as a camera, a HUD (heads-up display), and layers. The HUD is a sprite you can add display objects to that will be displayed on top of the entire scene and will not be distorted whatsoever. This is useful for displaying HUD elements such as character health, timer, and scores. Layers, on the other hand, will be displaced, rotated, scaled according to their relative position to the camera.

The Renderer2D system uses right-handed coordinate system, meaning the positive z axis is pointing into the screen. The camera’s z position would be its negative focal length. Any layer having a z value smaller than the negative focal length would not be visible, since it is “behind” the camera. The position of every layer is updated every frame according to its relative position to the camera, which you may make use of to create a parallax effect. In addition, setting the Layer.usePerspectiveScale property of a layer to true makes it scale according to the perspective projection equation:

//(x, y, z) is the point to be projected
(projectedX, projectedY) = (x, y) * (focalLength / (z - cameraZ));

Continue reading

Posted in Rusher | 1 Comment

Rusher 2 – State Machine

Go to Rusher 2 project homepage
Rusher 2 tutorial list
View State Machine example
Example source

This tutorial introduces the StateMachine system in Rusher 2.

States and State Machines

In Rusher 2, the StateMachine class is used as a component class, where its subclass StateSystem is a state machine system that can be added to a game engine. No matter you’re using a state machine component or a state machine system, the State class can be extended and used in both cases.

The Command class defines the following methods (not all are listed):

public function onSet():void;
public function getEnterCommand():Command;
public function getExitCommand():Command;
public function update(dt:Number):void;
protected final function goto(state:State):void;

Continue reading

Posted in Rusher | Leave a comment

Rusher 2 – Composite Commands

Go to Rusher 2 project homepage
Rusher 2 tutorial list
View Composite Commands example
Example source

The previous command tutorial covered the basics of simple command executions in Rusher 2. Here I’m going to show you how to make use of on of the two composite commands, the SerialCommand.

Basically, a serial command does what its name suggests: it executes its subcommands in series, one after another. This heavily depends on the Command.onComplete signal dispatched when the Command.complete() method is invoked. Whenever the command’s job is complete, remember to invoke the Command.complete() method; otherwise, things may not work out as you expect.

There is two way of adding subcommands to a serial command. First, pass in commands as constructor arguments in the order desired. Second, use the inherited CompositeCommand.append() method to dynamically add subcommands in the order you’d like.

The example in this tutorial is going to be based on the previous command example. We’re only going to alter the EntityCreator system.

Continue reading

Posted in Rusher | Leave a comment

Rusher 2 – Commands

Go to Rusher 2 project homepage
Rusher 2 tutorial list
View Commands example

This tutorial will be a short and easy one, since it’s based on the Keybaord example in the previous tutorial.

The CommandManager System

Rusher 2 has a built-in command manager system, which is automatically added to the BasicEngine. What is a command? It’s basically an object with encapsulated actions. In this way, it’s very easy to customly build your own commands and have them executed through a central system, the command manager system.

For more information on commands, you may refer to my tutorials on ActiveTuts+: Thinking in Commands part 1 and part 2.

If you have read about the Thinking in Commands tutorials and are excited about the serial and parallel commands, then you’ll get even more excited to know that Rusher 2 has them! Rusher 2 has a fully integrated command manager system that can execute serial and parallel commands in addition to simple commands. It’s okay if you have no idea what a serial and parallel command are. I’ll cover those special type of composite commands in later tutorials.

First thing’s first. Let’s have a quick flashback on what we have done in the KeyController component class in the previous tutorial.

Continue reading

Posted in Rusher | Leave a comment

Rusher 2 – Getting Started

Go to Rusher 2 project homepage
Rusher 2 tutorial list
View Cursor example
View Keyboard example
Example source

In this tutorial I’ll show you how to put together two minimalistic games, or two very simple applications in particular, one with mouse control, and one with keyboard control.

Extending The Engine

First, you’ll need to extend either the Engine class or BasicEngine class. The Engine class is the most abstract game engine, without any systems added to it. The BasicEngine extends the Engine class and already has some basic systems added to it, including the Clock system, the Mouse system, and the Keyboard system (not all of the added systems are listed here).

You override the addSystem() method and add new systems here. The system manager is passed in as an argument for you to add systems to. Here we add two systems to the engine, which we will write later. The DisplayObjectUpdater is the system that updates every entity’s view with their position data, although we’ll pretty much create only one entity in this example. The EntityCreator system gives our game a “kick start” by creating an entity and adding several components to it.

Our document class looks like this. It passes a sprite to the engine constructor, where the sprite is intended to be the main container.

public class Main extends Sprite
{
    public function Main() 
    {
        var canvas:Sprite = new Sprite();
        addChild(canvas);
        
        var engine:IEngine = new CursorExampleEngine(canvas);
        engine.start(stage);
    }
}

Continue reading

Posted in Rusher | Leave a comment

Rusher 2 – Introduction

Go to Rusher 2 project homepage
Rusher 2 tutorial list

Here I’ll give a very brief introduction to Rusher 2, my next version of my component-based game engine for ActionScript 3.0.

Component-Based Game Engine

First off, what is a component-based game engine? In a component-based game engine, everything, literally everything, from physical information to AI behavior are represented as individual component. The most elemental unit in a component-based game engine is an entity, say the hero character, an enemy, or a collectable object in the game world. Each entity can have multiple components attached to it, fulfilling the entity’s logical purpose in the game. For instance, a hero character controlled by a player in the game can have: a physical data component, which contains the current position of the character; a view component, which holds a reference to a display object representing the appearance of the character in the game; and a controller component, which listens to player input from the player (keyboard, mouse, etc.) and then updates the physical data component by altering its underlying coordinate data.

Continue reading

Posted in Rusher | 5 Comments

Redesigning Rusher

The current version of Rusher was based on the component-based architecture of PushButton Engine. I’ve used Rusher with a couple of personal experiments, and I soon found out the fact that Rusher is simply “too fat”. Too much code is required to build even a simple game; lots of code was dedicated to reference passing and maintenance. I couldn’t find a way to solve this, so I kind of stopped working with Rusher at all for quite a while.

Lately I stumbled upon Richard Lord‘s Asteroids example based on the Ember game framework. The classes in the engine are very loosely coupled with the use of SwiftSuspenders, a Dependency Injection library. SwiftSuspenders makes use of the reflective nature of ActionScript 3.0 and enables developers to easily create loosely coupled classes. SwiftSuspenders is most famous for its use in Robotlegs, a Model-View-Controller framework.

Continue reading

Posted in Rusher | Leave a comment

Some Thoughts on Bunnyhill Interface Design

I’ve gone through my first three weeks at DigiPen, and I finally have some time to cuddle with FlashDevelop once again.

I’ve decided to rewrite Bunnyhill from scratch. It’s been months since my last revision; lots of updates have been added to the latest Flash Player 11, and I’ve got some new ideas. So I think reworking Bunnyhill all over would be the best and fastest approach.

I’m keeping the scene graph structure, and I aim to simplify the initialization and set-up of a Bunnyhill canvas:

var canvas:Canvas =
	new Canvas
	(
		stage,
		antiAliasLevel,
		useDepthAndStencilBuffers
	);

Continue reading

Posted in Programming | Leave a comment

Settled in Redmond

It’s been two weeks since I got here in Redmond, a little city next to Seattle, and more importantly, where the Microsoft HQ is located, and EVEN more important, where DigiPen is located. I found out that people here normally would refer to DigiPen as “The Nintendo School”, since the school president & founder, Claude Comair, is also the co-founder of Nintendo America.

My cousin works at Microsoft, and he lives only 5 minutes away from my place, so it’s quite convenient for use to meet. Actually, he’s helped me out on so much things that would have taken me probably over a month to finish. I’ve got all my furniture from IKEA, all the electronics I need from Costco, and all the groceries from Quality Food Center (QFC). Initially my place at Veloce Apartments was completely empty. I spent my first week assembling all my furniture with my girlfriend, and we spent the second week going to Seattle downtown (Pike Place Market, Seattle Aquarium, Space Needle, Experience Music Project / Sci-Fi Museum) and Woodland Park Zoo. Later on she had to fly to Michigan for her master study. Now I feel so alone 🙁

Continue reading

Posted in Uncategorized | 1 Comment