Planet Billiards

One part of my Computer Games studies was dedicated to understanding video game physics engines, a common part of modern video games – they’re vital to creating engaging and tangible interactivity with a virtual space. The main goal of this module was to create a fully fledged physics-based game, and to that end I developed the game Planet Billiards. Check out the demo video below:

Development

Short gif showing Planet Billiards in action
Planet Billiards being played – note the effect of the central sun on the orbiting bodies!

Developed using Java and the jBox2D physics engine, the game is a unique twist on classic snooker/pool (with a few cues taken from golf, pun very much intended) – rather than playing on a standard table, you play the game in a miniature and very active solar system.

The aim of the game is to knock all the orbiting planets into the sun at the centre of the solar system before a timer runs out, by launching a “cue moon” that can only be fired from the edge of the system. By carefully aiming at the moving planets their orbits can be interrupted, potentially creating a cascade of planets knocking into each other and sending them flying around and into the sun. Points are gained for each planet “potted”, for emptying the system in fewer moves, for clearing a system closer to the timer running out, and at the end of three systems a final score is given.

It’s not as easy as you might think – due to the nature of the simulated Newtonian physics there are some interesting quirks to the movement: planets and the cue moon move in circular paths which the player has to account for when aiming a shot, a planet knocked can stabilise into a new orbit without hitting the sun (thus wasting a shot), planets closer to the sun move faster to stay in orbit and thus can be surprisingly hard to hit, and much more!

Code snippet
Small snippet of code containing part of the Newtonian physics calculation

As mentioned, the game was programmed in Java using jBox2D as the base physics engine. The programming was very in-depth; while jBox2D provided the basic collision and movement it had to be modified to enable Newtonian physics (objects with mass attract each other, even between planets if they are close enough). 

This was a very rewarding game to develop, in spite of its apparent simplicity. It taught me not only about the nature of physics engines and how they can be used and modified to create unique gameplay loops, but also enabled me to learn how to program a game without the use of a traditional game engine and instead purely using Java and third-party frameworks. The game itself was also excellently received, with testers and alike all enjoying its unique spin on the classic game of snooker.