Nebular Flux

December 2011|Tags: 3d, flash, game, programming

Nebular flux is a 3D Facebook spaceship piloting game where the goal is to traverse through the randomly generated level as fast as possible. Scores are compared on the Facebook graph API. Heroku was used for hosting the flash canvas app and a small website created using Ruby on Rails. I programmed the game, created the content, and made a Ruby back-end by myself for a fun learning experience.

The game can be played on Facebook, here.

This game procedurally generates smooth non-twisting paths through 3D space by picking segmented curves/arcs randomly from template parameters (including things like radius, # segments, # degrees turned) and then piecing them together aligning them tangentially. After the curve is created I extrude a hexgonal pipe along the path, using a non-twisting extrusion algorithm called the 'Parallel Transport Frame.' This keeps the pipe profiles in alignment and in parallel at each curve point, preventing sudden twisting / flipping. The result is a series of hexagonal profiles as points aligned at each point on the curve. After obtaining all the points of a hexagonal pipe along a path, I then create 3D polygonal rails for each of the corners of the hexagon that extend from one hexagonal profile to the next. Each hexagonal profile also gets a ring of polygonal rails. The result is a transparent prism/ cage-like structure that lets the player see outside into space as they fly through the path.

The collision detection was fairly straight forward. I approximated each segment of the hexagonal pipe to a cylinder. I then only had figure out which cylinder the player was in and do the correct transformations to put the ship into the local frame of the cylinder then doing a simple collision test.

Input for the spaceship was done by simulating a joystick through the mouse. If the player had the mouse in the center of the circle on the HUD, he/she would fly straight. Simulating the joystick this way, the player could turn for as long as needed, without having to physically pick up the mouse over and over.