If you havenâ€™t yet played Crimson: Steam Pirates, download it today and give it a try.Â Crimson is a turn-based strategy game and swashbuckling adventure that takes place on, above, and below the Caribbean Sea.Â Itâ€™s the first game developed by Harebrained Schemes, the first game published by Bungie Aerospace, and itâ€™s what I personally spent my summer days and nights working on along with the rest of the team at Harebrained Schemes.
Crimson: Steam Pirates and the first 8 missions were released free to play for iPad on September 1st, 2011, with additional mission packs available via in-app purchase for $1.99 that continue the original storyline.Â The game quickly gained the #1 position in the Free App category on iPad in 8 countries.Â It held the #1 Free App slot in the United States for 5 days. Â Itâ€™s still a top 5 iPad Strategy Game in 38 countries.
The Crimson team at Harebrained Schemes is made up of 7 people at its peak, and we had a total development cycle of just 12 weeks.Â We were able to pull this off due to a few key things:
Since the Moai game development platform is free to use with attribution, thereâ€™s no reason that other game studios or indy developers out there couldnâ€™t use the same platform to build a great game in Lua on a tight timeline.
In writing this post, Iâ€™m hoping other developers will get a sense of some of the decisions we made in building Crimson, how we made use of the Moai platform, and whether similar decisions might make sense for your own games.Â If youâ€™d rather just watch a video though, Iâ€™ve got you covered there too. Â Thereâ€™s a video interview with Jordan Weisman (CEO, Harebrained Schemes), Patrick Meehan (Creator of Moai) and yours truly thatâ€™s worth checking out.
Working with Flash content:
One of the funny things about our use of Flash for art production and the look and feel of the different parts of the game experience is that the ship boarding action combat sequences look a lot like Flash animations on screen, but these are actually done programmatically using MOAIEaseDriver to move the art assets around.Â Our art team really didnâ€™t do much tweening in Flash, so when the gameplay called for a Flash-like experience, we built that into the game programmatically instead.
Multi-layer battlefield and rendering:
The battlefield of air, sea, and undersea is done with just three layers.Â Water shimmering effects are done using a combination of a flipbook animation (imported from Flash) and a Moai particle effect attached to the camera.Â The submarines are made to look shallow-submerged and deep-submerged through the application of MOAIShaders (partially transparent simple shaders) to the same art assets used when the submarines are at the surface.Â
The island terrain is made of four layers altogether.Â Thereâ€™s a cost in runtime performance, as it takes 4 passes to render things and the whole map is stored in memory, but this wasnâ€™t a serious bottleneck.Â We thought about moving to a tilemap for the terrain, but decided not to go this route because it worked the way we originally built it and we didnâ€™t have extra time to spare.Â Making the change to tilemaps would have reduced the compute time to one pass and may have become necessary if the game had called for extremely large mission maps.
User interface and controls:
At first Crimson: Steam Pirates used a sub-thread to poll for input events.Â This was fast to code and is a really useful approach for simple games.Â Since Crimson has a mouse-like control system for everything except multi-touch zooming, both mouse clicks and touch events were mapped to the same Lua wrappers and triggered the same gameplay logic in the polling loop.Â
Eventually, as the game grew more complex, we changed to using onTouch events provided by Moai.Â By that point we had dozens of objects on the screen that could receive input and the new event-based code was much cleaner to work with.
Testing on PCs as well as devices
One of the great things about the Crimson control scheme and Moaiâ€™s native hosts for PC and Mac is that from the earliest iterations everyone working on the game could test gameplay on their dev machine (Mac or PC).Â We didnâ€™t have to buy a stable of iPads early in development, or a shiny new Mac for each team member.Â Plus we saved the 2-3 minutes per developer cycle that would have been spent copying the latest code to the iPad to test over and over again.Â
Of course, the iPad was the target release platform for the game, so we put someone on point for game play on the iPad even in the first few weeks.Â Toward the end of the development cycle, we were propping builds to iPads 3-8 times each day for thorough testing.
GUI level editor:
Early in the cycle we decided a graphical level editor would save us a lot of time, and my teammate Gorden Lee built a great one using .Net. Â Our designers used this tool to create and tweak levels at will, had a ready overview of how each level was put together and didnâ€™t even have to deal with the Lua script.
Using Box2D physics for motion and collisions:
In its earliest iterations, Crimson: Steam Pirates used animation splines for animating the motion of the ships, planes and subs. Â But this approach left the game with an unnatural feel for vehicle motion.Â Near the end of the project we decided we needed more natural-looking motion, and had to scrap the initial approach. Â My colleague, Chris Kohnert, came up with a much better solution by using the Box2D physics engine to move vehicles by impulse instead.Â In the final game, all vehicles have polygonal shapes (as do the islands), the motion splines serve as inputs to set impulse and forces on the vehicles, and Box2D handles the collisions.Â It was tricky to write the code to figure out the appropriate forces to apply to move the ships along the spline path dictated by the UI, but it works well. Â To keep the â€śboard game feelâ€ť intact, all the objects are reset to an inert state in the physics engine at the end of each turn and are moved again from scratch the next turn. In order to keep a sense of turn-to-turn momentum based on vehicle motion the previous turn, properties are stored for each object (outside Box 2D) that factor into the UI for setting motion paths and the magnitude of the forces that will be applied for motion in the next turn.
LUA and C++:
We programmed everything in Crimson: Steam Pirates in Lua, except for a bit of C and C++ code to integrate the Facebook and FMOD sound libraries.Â Everything else about the way Crimson plays, runs, and looks is Lua code driving the Moai Platform.Â We love working in Lua because itâ€™s one of the fastest ways to program new features, and we can get more design cycles completed in the same amount of time.Â
A custom Moai host for PC:
Although the reference iOS host was sufficient for the game, we made an enhanced shell for the Mac and Windows PC Moai hosts to let team members snap gameplay screenshots for easy inclusion in the bug tracking system.Â This was a minor extension, but it was super useful for team communication around gameplay issues.
Extending the Moai particle system:
We started using particle effects to animate nice-looking aft wakes behind the ships in the game, but the built-in Moai particle effects supported only a single rotation, and we needed a base rotation and an offset rotation from that baseline.Â So we changed the source code in the Moai particle system to make this extension.Â In the final version of Crimson, all the ships and surfaced submarines have nicely particle-effect-animated aft wakes that render in relation to their motion.
Open source contributions
In addition to the updated particle system, we also extended Moai for easier debugging in the final weeks of game polish and testing.Â The new debugging features included memory tracking and diagnostics for Lua and texture use, Lua object dumps and leak detection.Â The epic win of open source is that we got to make the game just the way we wanted to and create the tools we needed to work efficiently on our own timeline. Â Now, every other Moai game developer has a richer particle system and debugging feature set due to these contributions.Â Weâ€™re looking forward to making use of extensions made by other developers on future titles.
Picking the right partners
A final big reason we were able to develop Crimson as fast as we did and have it succeed to such an extent in the marketplace was our partnership with Bungie and their Aerospace publishing arm.Â Bungie did sound design for the game, tons of testing, and they provided lots of mission and design feedback throughout the process. They were great to work with throughout development and launch, and we really appreciate their support.
Thanks for reading. Â Feel free to post questions or comments here and Iâ€™ll answer them as best I can.