Gemini Physics Development 1: Continuous Particles

I officially started working on Gemini Physics on the 4th of July.

Why then? The mood was right I suppose. But also because I don’t really care about being social and celebrating yet another arbitrary point in time. People love to be told when and how to celebrate and be happy. I like to have more control than that.

Philosophy aside…

I’ve been trying to make this idea work for some time now, with varying success. I finally sat down and worked out an elegant solution with my day off, and these are the results.

I have always had a minimalistic approach to things. I like doing things in the most efficient way possible. With respect to programming, this translates in to code complexity. I’ve spent quite some time learning the ins and outs of writing simple code, and this shows just how far I have come. Aside from the rendering code, all the physics (including math) you see in the video are written in 350 lines of c++.

The idea is that everything you need to do an accurate 2D physics simulation are: particles, edges, and constraints. The rules for these are are quite simple.

Particles: Move based on their velocity and acceleration

Constraints: Keep particles a certain distance from each other

Edges: Prevent particles from passing through them

With those 3 simple primitives and rules, we can construct an extremely robust and accurate simulation.

We can derive lots of cool features using these rules:

  • Rigid bodies that we’re all used to seeing
  • Soft bodies by changing a single number
  • Arbitrary shapes by changing edge configuration
  • Self intersecting shapes
  • Completely continuous with no tunneling
  • Thin, fast moving, heavy objects simulated no problem

It is a very elegant solution that I’m very happy with. It will make a nice base for Gemini Physics (coming soon to a game near you).

Gemini Physics Development 0: Getting Started

I was going to release the library used in the Gemini Physics Test Bed demo, but I’ve decided to go further than that.

I’m going to start a new engine based around all that I’ve learned over the years, and make it the go-to solution for 2D physics simulation.


Firstly, I just flat out love this stuff. Secondly, indie and mobile games are quickly becoming a very large part of the games market. I’m convinced that the mobile market in particular is going to really soar in the coming years. This means that people are going to want to start making high quality games. Due to interface and hardware limitations, the primary types of games created here are going to be 2D, at least for a while.

People could use one of the many great physics engines out there right now today. But, if I were developing the next hit game, I would want features that simply are not available in any of the current solutions. This is the problem the I want to solve with the introduction of Gemini Physics.

I have already started development, and it’s looking promising. I will post eye candy as I add features to the engine, all the way up to its first release.

Space Invaders Clone in 300 Lines

I was digging through some old stuff from high-school and I found one of the first java games I ever made!

Launch the Applet

I was very efficient back then. The entire game fits in 300 lines of java code!

That said, you can download the source code. I don’t feel like deciphering my previously cryptic ways so there are no comments, but maybe it will be helpful to someone.

G’day mates.

Quadcopter Design

I’ve always wanted to build a quadcopter. I have finally started the design phase. This one is a little more ambitious than most of the hobbyist projects that I’ve seen. I always dream big (but maybe not always best).

Here are my requirements:

  • At least 30 minutes of up-time
  • Automatic take off and safe landing
  • Propeller guards
  • High resolution video camera
  • Video recording to on-board SD card
  • Automatic stability control using accelerometer / gyro / camera
  • Connectivity using blue-tooth and 3G
  • Automatic obstacle avoidance using multiple range sensors
  • Sensor and status feedback to controller
  • Video transmission to controller with automatic quality scaling
  • Programmable with three modes to start with
  • Local control mode:
    • Connected to PC or android over blue-tooth
    • Fly manually with game-pad or touch screen
  • Long range control mode:
    • Connected to PC or android over 3G
    • Fly manually with game-pad or touch screen
  • 3rd person mode
    • Connected to android over blue-tooth
    • Automatically track you as a personal 3rd person camera
    • Manual perspective adjustments

I’ve also started scouting parts. Here is the first pass parts list:

I still need to do a lot more research. Particularly, I need to figure out how much the thing is going to weigh, and make sure that my motors can lift it, and that my batteries will give me the up time that I want. I also need to research propellers, and frame material. I expect this thing will cost at least $500. But, I’ll have an awesome project by the end of it!

I’ll post more updates as I get further in the design process.

Developer Review: Super Mario 3D Land

This is the first entry in a planned series of game reviews from the perspective of a game developer. The review will focus on technical aspects of the game, as well as game-play mechanics. The goal is to provide insight into what works and what doesn’t, in order to make better choices in our own game development.


As is the case with just about every Mario game, the audio is very pleasant on the ears. What this game does very well is the use of audio cues to enhance the player’s immersion. You will hear a neat sound effect for any interaction that takes place. There is a sound effect for almost anything that happens, such as when you run through some bushes, or start to slide down a wall. These let the player know that the event is significant in some way. This subconsciously guides and teaches the player about the rules of the game. Detailed audio cues are a great way to let the player teach himself about the game world.


Considering the hardware that this game runs on, the graphics are surprisingly nice. The use of shadows on important objects like Mario, blocks, and enemies help show height above the ground. The occasional light-map adds additional aesthetic appeal to the world. There is a very generous use of particle systems. These are used all over the place to strengthen significant game-play events and to provide more subconscious guidance. Aesthetics play a role in keeping the player immersed, as well as pressing them forward. If the visuals are pleasant and continuously vary, the player will be interested in seeing what’s next.


At its core, this game is a blend of two types of platformers: the traditional 2D side scrolling (ex. Super Mario World), and the newer 3D type (ex. Super Mario 64). This is a genius blend. What’s great about the original 2D games are the simplicity of the controls. You can move left and right, duck, and jump. That’s about it. The 3D games add an additional dimension, and because the view is free to move around, you need two sets of controls: one to change the view, and one to move (which itself is totally dependent on the camera angle). This game takes the best of both worlds.

A clever camera system allows you to play the game with the precision and simplicity of a 2D platformer, while retaining the large number of new gameplay possibilities that 3D introduces, all without having to manage a camera.

The level design is extremely well done. That said, some people think that the game is too easy. I totally disagree. I feel that the game is very well paced. A level can be completed in just a few minutes, which allows for quick pick-up-and-play. The levels gradually get harder, and after completing all the original worlds, you get to play through again at a much harder level of difficulty.

There are collectibles in each level that are satisfying to find. People love collecting things, and this is the basis for many video games. Some games do this poorly by making them too easy to acquire, having too many, or not giving the collectibles any value. In order to get the player to want to collect the things in your world, you must show them that they are valuable. In this game, the main collectible item (star coins) are used to open new levels, therefor making them very valuable.

Goal Hierarchy

This game makes very good use of what I’ll call a goal hierarchy. Lot’s of things in nature can be viewed hierarchically, and to people it is a universally attractive concept even if the person is not consciously aware of it. At the top of the goal hierarchy, you have to the primary mission, the root of it all, the reason you’re doing everything else. At the bottom, you have the minute details and actions of every step required to reach the top. Here it is applied to Mario:

In Mario, you’re primary goal is to save the princess. It’s what you want to happen by the end of the game. But, in order to save her, you need to beat all 8 worlds. In order to beat each world, you need to beat each of its 8 levels. In order to beat each level, you need to first reach the checkpoint, then the flag. In order to reach the checkpoint, you need to get over that hill. In order to climb the hill, you must first kill the enemies on it. In order to kill each enemy, you need to jump and move right to position Mario correctly.

As you can see from that example, the goals get more and more precise as we go down the tree. How does this apply to Mario being a good game? They have a very balanced, clear tree. Further more, the higher levels of the tree are always visible to the player. What I mean by that is, the player is always shown whats coming up. You’re shown in the beginning that the princess has been captured and that you need to rescue her. You’re then shown a tab for each of the 8 worlds. Then in each world you have an overview of the levels. In each level you can clearly see (by way of the camera) what is coming up. If the player can’t see the upper levels of the tree, he will have little motivation to continue. By balanced I mean that the number of branches at each level is reasonable. There are 8 worlds, 8 levels, and each level can be completed in a few minutes. The player feels not underwhelmed, nor overwhelmed, with things he needs to do to save the princess.

The goal hierarchy is one model for pushing the player forward, without making the player feel forced. He can see what is up ahead all the way to the end goal, with the unknown being the details of the journey, which he cannot see. It’s the unknown that inspires the player to keep playing.


In conclusion, the game did most things right, and very little wrong, for reasons detailed above. But, just to recap:d

  • Great audio and visual cues that help to guide and teach the player about the world
  • Camera system allows for complex 3D gameplay mechanics with simple controls
  • Varied levels make every minute interesting
  • Collectibles are fun to find and are given legitimate value
  • Good use of goal hierarchy to keep the player interested

I hope this will be of help to you. The principals that make a great game are universal, and relate back to human psychology. However, it’s good to see practical examples and good implementations of these principals. It was certainly helpful for me to write this, as it forced me to analyze aspects of the game and relate it to what we like as gamers.


Ahh, I remember the good old days in college when I procrastinated, got to class late, and did just enough to get by…

Wait – all that stuff is still true! THREE MORE CLASSES! Truth be told, I don’t care about the actual degree for many reasons. I’m finishing because I’m trying to train myself to have more self discipline, that way when things come along that I do want, I can work at it without hesitation.

The epitome of my procrastination surfaced last year when I took CMSC498M: Game Programming. You’d think if it was something that I loved doing, that I would put a little more effort into it. But, my laziness never ceases to amaze me. Good thing I can back up my incredible procrastination with some good bursts of intense concentration.

This is Restoration:

It’s the game that I wrote as part of our semester long project for the class. Along the way, we had to present details about our progress. Of course, I was so lazy that I made up details about a game that I wasn’t even working on. This was also supposed to be a team effort. Everyone else was in teams of 2 – 4. I went solo, because its easier to procrastinate if you don’t have others pushing you forward.

Long story short, it was 6 pm the day before the entire project and its write up was due, and I hadn’t even thought about the actual game that I was going to make. At that point, the little voice in my head said: “Start now you lazy dog”. I had learned to trust that little voice, so I sat down and started typing. It took 12 hours, lots of Dr. Pepper and I worked up until the very last minute, but I finished the game.

If college has given me anything, it’s the strategies for learning and getting work done rather than any specific class content. With the internet you can now learn just about anything you want whenever you want. Procrastination can be a very powerful tool if you use it the right way. See how I spun that pathetic story into a positive final message?

The features and such can all be found on the write-up page that went along with the game. You can tell by the awful grammar and general messiness of the writing that I was delirious after lack of sleep, and that I only had 15 minutes to write the page before class started. That said, much of it is total BS (some of it is actually true (not sure which)).

Here is the original write up for the game: Restoration

On that page, you can read about the controls and find the download link at the bottom. There is no readme with legal information, so the legal statements from my previous demos apply.

I have big plans for this one:

  • Remake the game for multiple platforms
  • Improve the graphics
  • Fix bugs
  • Add new gameplay elements
  • Add music and sound effects

As always let me know what you think. It may be hard with this one, but have fun!

Bahamas Pictures

I just got back from Nassau in the Bahamas. I stayed at the beautiful Atlantis resort. I had gotten a Nikon D3100 for Christmas, and this was really the first time I got to take pictures of anything pretty. I’m still learning the ins and outs of photography, but I’m happy with most of the pictures I took.

I learned that low light conditions are very difficult, especially when your target is moving (aka fish).

Here is a selection of some of my favorites:

I really like this one because when I saw him, he reminded me of myself and the journey I face. It was this lone snail, trying to crawl up a giant palm tree. It’s like me trying to build video games and form a successful studio. The snail had a loooong way to go, but I felt his determinism. Thanks for the inspiration, Mr. Snail.

Nikon 2 358

People ask me why I don’t have many pictures with other people in them. It’s because the picture won’t capture the real beauty, unlike nature which is raw and exposed.

Nature is beautiful to me because there is nothing hiding, and it does exactly what it’s supposed to do. It follows simple rules that can be easily understood. People are unique. We have the gift and curse of a higher order of consciousness. It still follows rules, but those rules are enormously complicated. So much so, that some people devote their entire lives to figuring it out. The problem is that it’s something that can grow and evolve a huge amount in a very short amount of time. By the time you think that you’ve figured it out, its completely different.

Growth is what makes the human consciousness so beautiful. Why do you think we all love babies and kids? It’s just too bad that most people choose to stop growing after a time. We should never finish growing up.

Gemini Library

So, I’ve been getting various emails and posts regarding the library / source code for the Gemini Demo.

My plan is to make a separate page / website for Gemini, where I’ll put up the static library for various platforms. I don’t want to release the source code publicly, but I will release it privately with some negotiable licencing terms.

In addition, I will be reviving an old project called GMPhysics. It was a library for a program called GameMaker. The last version of GMPhysics was based off of PhysX (then NovodeX) now owned by NVidia. The upcoming release will be based off of Gemini.

GMPhysics got very popular before I had to leave it to deal with some other life stuff. If you’re interested, here is the original forum post. I almost can’t believe how long ago that was, and how popular the topic has gotten (2,600 replies and 600,000 views)!

I also googled it, and it seems there are even a few youtube videos about it. It’s quite flattering…

I’ll post more (pictures / videos / demos) on the old GMPhysics library soon, and I’ll keep everyone up to date on Gemini.

Gemini Physics Test Bed

Rather than trying to explain it, here is a video with a poorly improvised commentary:

That was made about two years ago. I don’t know why I like making physics engines… That is probably my 5th or so attempt. Before that, I had been working on a project called GMPhysics (which I will post more on later), which was a DLL extension for a program called GameMaker. Today, I’m working on some really awesome physics stuff for my pet project, which I hope I can share with you soon.

GameMaker is actually what got me into programming and game development. Maybe I’ll return to GMPhysics sometime in the future…

Here are some technical details for those that care:

  • Supports rigid bodies, SPH fluid, and particle based granular
  • Iterative constraint solver for collisions
  • Spatial hashing used for everything to prune collisions
  • Narrow-phase collision detection speed is almost shape independent
  • Semi-robust SPH boundary handling
  • Visco-elastic fluid

In the near future, I will probably release the static library so that you can use it in your own application.

I have tested this only on windows 7 (64-bit), but it should work on any version of windows. See the readme for controls, as they are a bit confusing.

Download Here

I hope you get some ideas out of it, and maybe even a little fun. I wonder if I could turn this into a drinking game? Hmm…


Slime Vollyball

I’ll open with a gameplay video. I expect I’ll never agree with those who say books are better than movies…

That’s me playing myself in this little game that I wrote a while back. It’s actually a clone of an old game that I used to play in high-school. It looks slow and laggy, but that’s just the video recorder not keeping up.

I added in the fluid effects to give it some personal touch.
My friend Jef wrote the music and recorded the sound effects:

The total time to make it was probably about a day.

Technical stuff:
It’s written in about 1000 lines of C++ using OpenGL for rendering, and FMOD for audio.
The fluid simulation is based on this paper:

My current plans for this may include:

  • A linux / mac port
  • Improved graphics and bug fixes
  • Online multiplayer
  • An android / iphone app

I have only tested this on windows 7 (64 bit). However, it should work on any version of windows. After downloading, see the readme for controls and other information.

Download Here

Troll away. I love trolls. And goats.

One post at a time