For this Tuesday’s update I want to give you some insight as to how add new features into the game, with a real world example. The example is “Different Colored Stuff.” Imagine the Comfy Bed that’s currently in the game. It’s a brown bed with a blue sheet on it.
Of course, it would be fantastic if you could customize the color of that bed. In fact, here are some great modding projects that already add some color support to the game: Colors Mod by Chimeforest, Tool for re-coloring models.
Because of the interest and enthusiasm by Chimeforest and the rest of you guys, we are now taking a much closer look at how to fully support colors in the game. Here’s our process.
Scoping the Feature
The first step is to think about how the player will interact with the game feature. Here’s roughly how Chimeforest’s color system works, which sounds just peachy to us.
- 1 bolt of cloth + 1 red dye = 1 red bolt of cloth
- 1 red bolt of cloth + 1 mean bed = Comfy bed with a red cover.
Super cool, but there’s just one problem, and that’s the explosion of recipes for each color of thread and cloth. Ideally we want just one recipe for “thread” which optionally takes a dye as an ingredient. So, we’re going to add a few additional requirements to the feature.
- Resources can define a color palette
- Crafted objects inherit palettes from their ingredients
- Models are re-colored according to their inherited palettes
The idea here is that we can have just one “Comfy Bed” recipe, and the model will automatically change based on whether the bed was made with red cloth or blue cloth or mauve cloth.
Ok, so at this point we know how we want the feature to behave. Now we need to figure out how to build it!
Writing the Development Spec
At this point we will all sit together in a room and hash out how we will code up the feature. We capture those thoughts in a development spec. The purpose of the spec is to roughly describe the structure of the data and code that will implement the features. We do this for several reasons:
- So everyone on the team understands how the feature will work. So anyone can more easily contribute to the code once it’s written.
- To give everyone a chance to voice their input. Different team members have different specialties (AI, design, UI, etc), and will at times make important improvements to the original idea.
- So we don’t forget what we actually decided.
There are all different methods for writing development specs. At Team Radiant we try to make our specs as concise as possible, and leave the small implementation details up to the developer who will be coding up the feature.
Here is our actual spec for coloring objects in Stonehearth (typos and all). Note that we won’t start implementation on this for a while yet, but when we do this describes how the feature will work.
Link to the Stonehearth Color Table Spec