The vast complexity found in the latest version of Kerbal Space Program is the result of the team’s willingness to throw out the hard work they’d previously done and start again.
The space exploration simulation invites players to build and fly rockets and other types of craft. The allure of the game comes from the simple mechanic used for building. Simply pick a piece, move it to the right position and it snaps into place. Players are given a clean slate, a collection of parts and an entire universe to explore.
The initial development was incredibly fast, and the code was buggy. Technical artist Chad Jenkins, in a presentation at this year’s Game Developer’s Conference, says that the team came to a crossroads in their development around the time they were invited to be part of the Steam marketplace in 2013.
"The game was, in some ways, an experiment," Jenkins said, referring to its origins as a side project for a Mexican marketing company. "We were not sure if it would succeed or not. And really the next update could have been the last. We didn’t really do a lot of planning ahead."
While preparing the game for sales through Steam they found they were spending just as much time fixing buggy code as they were creating new content. Something had to give. They decided to take the simplest elements of the game, the actual rocket components themselves, and rebuild them from scratch.
The solution the team settled on was what they call a "modular design." Individual ship components, like engines, were broken down into their essential functions. Instead of creating a unique, complex set of code for each type of component, they instead programmed each of the essential functions the component would perform and bundled those functions, or modules, together.
"We focused on breaking down all of our systems into smaller chunks," Jenkins said. "For instance … a discrete object that you can place in the game we broke down to just a visual model, its basic attachment module, physics and how the destruction and persistence is handled.
"So it became in essence just a container. And, more importantly, it had a list of modules, which is the code that we would attach to them."
With a 3D model and a few modules it was easy to create a solid fuel rocket. When they added a module to allow fuel to flow into and out of the engine, the team had a liquid fuel rocket. Add another module to detect the presence of oxygen in the atmosphere, and they had made a jet engine. The team found they could build the code for the game much the same way that their players built rockets while playing the game, by cobbling together assets from a common pool of modules.
Their modular design approach allowed the team to rocket past their tiny list of 15 unique ship components to now over 170. The programming methodology was so successful that they’ve implemented it throughout their game, including the animation system. Jenkins said it has enabled their designers to be more productive, and has allowed their community to build thousands of mods essentially on their own.
Jenkins says that the modular design approach is still paying dividends for KSP’s growth. When NASA asked to partner with them to promote their bold mission to capture an asteroid and bring it into earth orbit, the team found they had already created most of the modules needed to make the expansion pack possible.
"The really great thing is that we only had to add a little extra code," Jenkins told Polygon. "We had to add a module for the actual grappler to grab onto [the asteroid], but the rest of it has been mostly … upgrading systems to make sure that [players] can rendezvous with the asteroid.
"It really wasn’t too bad. Most of what we needed was there. We just kind of polished it up and put it together."
Jenkins says that his Monday GDC talk, the first for KSP, held special meaning for him and the rest of his team.
"When we first came to GDC we had kind of been developing in a cave," Jenkins said. "We came to GDC wide-eyed. … We didn’t really kind of feel like we belonged almost. We were kind of outsiders.
"This time around it’s like … we’re real game developers now."
Kerbal Space Program was awarded an honorable mention for the Seumas McNally Grand Prize in the 2014 Independent Games Festival. You can learn more about the formation of the team, and their partnership with NASA, in our feature.