Games - Work & Education - Films & Stories - Misc. Programming
About Me - Résumé - Code Samples - Blog - Contact



Development Blog

Cosmoteer is perhaps best described as a cross between SimCity and Star Trek. It is a spaceship simulator in which you build spaceships SimCity-style by placing individual parts onto a square grid in almost any shape or configuration you can imagine. You then fly around a small galaxy, battle other ships to earn money, and use that money further improve your own ship.

Ship design in Cosmoteer is deep and strategic, not merely aesthetic, thanks to authentic simulations of ship flight, ship-to-ship combat, and crew.

Ship flight is physically simulated in 2D, meaning that it matters how you choose to place and orient your ship's thrusters. For example, thrusters positioned near the center of mass are good for forward flight, whereas thrusters positioned away from the center are better at turning but need to be counter-balanced by thrusters on the opposite side. Thrusters orientated to the sides will make your ship better at strafing, and thrusters pointing forward will help your ship decelerate.

Ship-vs-ship combat is also physically simulated. Whether and where a shot hits the enemy depends not on a die roll but on the physics of the projectile itself. Damage is recorded "part-by-part", meaning that individual systems can be destroyed and entire ships can be sawed in half. In practice, this means you have to think about protecting the most important parts of your ship (such as the Reactor and Control Room), how you protect your most powerful weapons (with shields and armor), and how your ship is shaped.

Most ship systems must be operated by one or more people, and supplies such as ammunition and power batteries must also be carried throughout the ship by its crew. Since your cannons can only shoot as fast as they receive ammo, and your shields only recharge as fast as they receive power, you must think strategically about your ship's interior layout and traffic patterns so that the crew don't get congested in tight corridors or have to travel overly long distances. You also need to think about how your ship may function after it's taken battle damage -- a destroyed corridor may cut off access between a cannon and its ammunition, effectively rendering that weapon useless. But on the flip side, you can also use such weaknesses in the enemy ships to your advantage, hamstringing them without having to destroy their heavily-armored weapons.

Programming Cosmoteer has proven to be a great challenge with several very significant programming hurdles:

  1. Since ships move with realistic physics and the player can place rocket engines anywhere he likes, I invented an algorithm that intelligently determines the "activation level" of each rocket given the player's current and desired locations.
  2. I wanted parts of ships to be individually damaged and destroyed, meaning that it is very common for a heavily-damaged ship to break apart into multiple pieces. This meant that not only did I have implement a localized damage system integrated into the physics system, but that this system needed to detect when a ship has split apart into what are essentially several smaller ships.
  3. Since ship crews are largely autonomous, a robust pathfinding system needed to be developed. Not only does the pathfinding need to gracefully handle changing ship layouts as parts are destroyed, but it also needs to route around congested areas of the ship. The algorithm that handles routing around congestion is inspired partially by ant colonies in which individual ants layer scented trails for other ants to follow. I turn this idea upside down by having people on board the ships lay down a "virtual scent" that dissuades others from taking the same route.