Dynamic clothing, wounds and dirt – Dev Blog 2
Welcome to the second of the weekly blog posts detailing the work that has been done on Fringe Planet this week. Fringe Planet is a harsh and cold environment, and our peons find themselves stranded there, in just the clothes that were on their back. Unfortunately for them, the environment is so harsh, the clothes they are wearing will not only be inadequate to protect them – but the clothes themselves will wear away as time passes.
This week has been focused on this, and various related systems. The first step was to create a set of clothes for the peons and then break down the various slots were a peon can wear clothing.
This system will become more complicated later on (hats, gloves, socks, shoes and scarfs are all on the roadmap) but for now this gives us a great starting point. All these different clothing slots have a depth assigned to them – underwear being the lowest and coats (as they are worn over the top of everything else) has the highest. By creating a texture for each individual clothing item and looking at the depth of each one, it is possible to create a dynamic texture that gives the peon a unique look.
This all happens during run time and is incredibly fast – which means you can actually see when a peon changes an item of clothing, which leads to some very interesting results. With the hastily put together coder art, combining all the trousers/coats/shirts etc; means that there are currently 52,920 unique combinations of clothes. So now we have the peons wearing clothes, what about wear and tear?
Each item of clothing has a damage factor associated with it, the longer a peon wears an item of clothing the more damaged it becomes. The more damaged it becomes, the less heat it holds in, so the peon will get colder quicker. Currently damage values and the text string associated with the damage look like this :
100% | Pristine |
90% | Nearly new |
80% | Slightly worn |
70% | Worn |
60% | Shabby |
50% | Very Shabby |
40% | Damaged |
30% | Very damaged |
20% | Very very damaged |
10% | Almost unwearable |
0% | Unwearable (destroyed) |
Having text describing the damage is fine – but it would be much cooler if the player could see how damaged a clothing item was by glancing at the peon, and plan accordingly. So the next step was to procedurally destroy parts of a clothing items texture, in order to reflect how damaged it was :
So the nice thing about this is as there is a depth associated with each item of clothing, when a bit of clothing degrades you begin to see the layer underneath. As the coat degrades above, you can start to see the trousers as well as the skin of the peon.
Fringe Planet, as mentioned, is a harsh place. And peons will get hurt as well as getting messy from slaughtering things in addition to treating each others wounds. Again, I wanted to reflect this visually on the peon model, so the next step was to add blood splatters to clothes. Each layer of clothing has a variable that indicates how blood soaked it is, and once again, this is generated procedurally:
As can be seen, I’m adding blood to just the undershirt layer here, which means the shirt layer remains clean – in practice what will happen is both the shirt and the undershirt layer will be splatted with blood. This is the start to the blood splatting system, there is a lot more I want to do with it ( locational blood, dripping ) but for now, it’s very easy to see if a peon has been injured or has been coated with blood. Currently the only effect in game of having blood soaked clothes is a mood debuff, but that will change as the simulations get flesh out more.
The penultimate thing that has been added this week are wounds (after all the blood needs to come from somewhere!) – this is in it’s infancy at the moment, but is a fairly awesome proof of concept. Wounds penetrate all layers of clothes, down to the skin and will permanently damage it. Once again, this is procedurally generated. The wound itself will bleed slightly into the layers above it, which leads to some fairly interesting situations.
As can be seen, the wounds rip through everything – with the exception of underwear (this is something I need to give some thought to – realism vs potentially naked peons). When I change the skin toward the end of the GIF, you can see the damage remains on the trousers – this is because the skin reset only applies to the skin layer, the trousers are unaffected by this.
Finally, with all the blood and bits of clothes everywhere, Fringe Planet can be a very dirty place. And this is the last thing I’ve added to this system. Dirt builds up all over the peons, and each layer (including the skin) has a dirtiness associated with it. The dirtier a peon and it’s clothes are, the more unhappy the peon becomes. This builds up over time, and some activities generate dirt faster than others (planting a seed involves a minor amount of dirt increase, mining a block is a much larger amount of dirt increase).
Again, this is just the start of work on this – making dirt spawn in more locational places (hands, feed) is the ultimate goal, but this is a great starting point. I’ve been very happy with this weeks progress and very happy with how all these systems work together to make very distinctive looking peons, as well as providing very rapid visual feedback on to how a peon is fairing – without the need to look at a stats screen.
Thanks for taking your time to read this and please feel free to let me know what you think!
There is a lot more to read about Fringe Planet… why not try: