Photon Bunny – My Second DigiPen Game

Go to Photon Bunny’s main page

Photon Bunny is my second game at DigiPen. It is a 2D puzzle platformer based on the properties of light. Check out the main page for the game here.

Posted in Gamedev | Leave a comment

Astrobunny Is Going to PAX 2012 Prime!

Astrobunny, my Freshmen game at DigiPen, is going to PAX Prime 2012! It will be playable at the DigiPen booth as well as in the Free Play area.

This is a video I made for PAX Prime 2012.

Posted in Gamedev | 1 Comment

Reflector – My First DigiJam Game


Play Reflector

View Reflector source
Rusher Game Engine v2.1

Controls:
Move – Arrow Keys
Shield – Z Key

Gameplay:
Use the shield to capture enemy bullets.
Turn off the shield to return enemy fire.
Basically you’re invincible if you keep holding down Z. I’m not going to fix all the bugs. It’s a game jam, after all.

A group of friends of mine at DigiPen addended a lecture given by the president of DigiPen’s Game Engine Architecture Club, Sean Middleditch. He was talking about how we should really focus on making a game for our sophomore year rather than making a super general and powerful game engine with awesome architecture (which we are still going to do anyway). He also demonstrated his successful result of building a feature-complete game in 8 hours. During this process, we are not supposed to care about engine architecture; we just hack things together and make a working game. This is the fastest way to test out prototypes and realize game ideas. Thus, we decided to start our own “DigiPen Game Jam (DigiJam)” and try to build a complete game in one day. Everyone chose a different tool, including Unity, DirectX, and XNA. I chose to program in ActionScript and wanted to test out the next version of Rusher (v2.1). It was a good practice, I spotted several flaws in Rusher’s new interface design and modified along the way as I developed my game.

We picked a random theme for our games, which is “Arcade Game”. It took me 6 hours to finish the entire game, which includes a start screen, a game over screen, a score counter, and complete gameplay. I started taking logs every hour after hour 2:

Hour 3 – Finished enemy bullet behaviors.
Hour 4 – Finished gameplay.
Hour 5 – Tweaked parameters and fixed several crashing bugs.
Hour 6 – Game completed.

It was a very short and intense development session. I felt pretty productive and accomplished. We are definitely doing more DigiJam sessions in the future 🙂

Posted in Gamedev, Rusher | Leave a comment

My Mutex Implementation

There are already lots of well-known and popular libraries out there that provide mutices. But I wanted to try implementing it myself for the sake of just making it. Hey, it’s summer session at DigiPen and I don’t have to work on any school game projects. This means I can do whatever programming exercise I want during this time 🙂

My implementation relies on “Windows.h”, which already provides mutex objects. But hey, it’s summer session! Besides, I actually find my interface design more intuitive and easier to use, so I might end up using it in my next game project.

Below is the interface for the Mutex class. It has a default constructor, a copy constructor and a destructor. It also has an assignment operator. Finally, it defines the very two operations a mutex object has: lock and unlock.

Continue reading

Posted in C/C++ | 1 Comment

Signal System using Delegates

I introduced how to build your own C++ delegates in the previous post. Now I’m going to show you the first practical (and probably the most common) usage of delegates: signal/event systems.

To clarify the terminology, the mapping between the system I’m going to show here and the terms in the Observer Pattern is as follows: a signal object is a subject object, and a delegate that listens to a signal object is an obeserver object that observes a subject object. The basic idea here is that the listeners that are interested in a specific signal object get invoked when the signal object dispatches. This is a very useful pattern in engine design, which can be used to eliminate busy waiting conditions, because the observers are informed passively as opposed to actively querying the subject for new information (this can be wasting CPU cycles if there is no actual data update).

Continue reading

Posted in C/C++ | 3 Comments

Easy C++ Delegates

As I mentioned in my previous post, I was working on delegates for C++.

The first article I read was recommended by one of my programming TAs. The author’s main concern was portability and performance, so he special-cased extensively throughout his code, in order to make sure the code works perfectly fine across multiple compilers while still yielding optimal performance. This resulted in very verbose and convoluted code. I was half way through comprehending all his code and gave up. The article itself, however, is certainly worth reading; it covers in details the difference between function pointers and member pointers and points out why they are not easy (also not too hard) to deal with correctly.

Continue reading

Posted in C/C++, Design Patterns, Programming | 4 Comments

Function Pointers vs Member Function Pointers

My second semester at DigiPen has almost come to an end. For the project of this semester, we are required to write our code in strict C, no fancy C++ stuff like generics and polymorphism. In order to get around this limitation, our team used a technique described in this post to mimic object-orientation in C.

I’m planning on starting building our team’s new game engine early in this summer to prepare for the upcoming fall semester. This time, of course, we’re allowed to write code in C++.

The first thing I’m planning on building is the event system, which is basically a framework with event dispatchers and event listener functions. But things turned out to be more complicated than I thought. In ActionScript, Java, and C#, the only functions we can define are strictly member functions, functions that are defined in a class body. Even the “main” function is simply the constructor of a document class or a public static void function inside a class. So we don’t have to worry about whether an event listener function is a member function or not.

In C++, however, not everything is object-oriented. A function can be an ordinary function defined in global scope or a member function defined in a class (or struct) body. The invocation to both types of functions are different, so we cannot treat them as equal: we cannot assign them to the same type of function pointer. But I want to treat them equally, so that I can register ordinary functions and member functions of the same signature to the same event dispatcher. This leads me to the research of function delegates.

For now, I’m just going to discuss the fundamental difference between ordinary functions and member functions. I’m also going to point out the difference between function pointers versus member function pointers.

Continue reading

Posted in C/C++ | 4 Comments

Object-Oriented Programming Synonyms

This post is written for my classmates at DigiPen.

Most of the class have started learning object-oriented programming really for only two weeks, and the professor uses quite a few synonyms that sound really different but are actually the same things. I thought it is very confusing to many new-comers to OOP, so I felt like writing a post to clarify things up. I’ll just group synonyms of the exact same meaning together:

Continue reading

Posted in Programming | 7 Comments

Object-Oriented Structures in C

This is my second semester at DigiPen. We’re not allowed to build our game in C++ for this semester; instead, we can only use C. That means no function overloading, no polymorphism, no generics, and no operator overloading. However, this does not stop me from trying to mimic object-oriented programming with C. My instructor for the programming class last semester, Elie Abi Chahine, mentioned a book called “Object-Oriented Programming with ANSI C” by Axel-Tobias Schreiner (published in 1993). And that was where I started looking for inspirations.

The book was written almost 20 years ago, and a lot of the sample code is obsolete. After all, now that we have C++ at hands, why would anyone want to mimic object-oriented programming with C? But we have to use C, so I read the book. Half-way through the book, the code started to get ugly. Tons of code that I could not decipher was dedicated to fancy features such as run-time type check and virtual function tables. I decided to stop, because I thought I had learned enough concepts and the second half of the book would be an overkill for our project.

I spent a week trying to work out a feasible design to mimic object-oriented programming with C, and finally I came up with an approach that is simple enough, yet sufficient for our project.

Continue reading

Posted in C/C++, Gamedev | 4 Comments

Astrobunny!

Here it is! Our game project for the first semester at DigiPen. We used a game editor provided by the school called ProjectFUN. I coded in C++.

Download Astrobunny

I basically only used ProjectFUN as a render engine, since I pretty much ported the Easing Equations from ActionScript 3.0, built a tweening engine, created a command framework based on one of my articles, and put together a baby version of Stardust, called StarLite. ProjectFUN provides a built-in physics engine, but I found it’s collision detection system for circles quite buggy, so I implemented one my own.

I built the template levels in the editor, so that we could create new levels just by drag-and-drop. All the planet-orbit linking, orb position correction, initial velocity based on object orientations are all taken care of by my code automatically.

Something very special about this game is the Credits level. We actually made the Credits screen into a fully playable level, where all the information are shown on planets and speech bubbles.

And here’s a dedicated planet to one of my classmates, Justin. He is such an annoying play-tester (i.e. he play-tested a lot, so I couldn’t use my laptop) that I thought he deserved his own planet 🙂

So this is Astrobunny. I really enjoyed making it, and I hope you enjoy Astrobunny’s journey through space. Be sure to check out the awesome Credits level, too!

Posted in Gamedev | 7 Comments