Best way to add a clothing system to a game

Hey everyone,

I have been trying to design a clothing system for my game using the Spine Scene tool in Defold. It is not critical to the point where the game will not function without it. But I think it could be something good to include to make the game feel more polished.

The current way I have been thinking of implementing it is to create a base layer or “skin layer” where all the basic animations are played. On top of this I would have several additional spine layers that correspond to different clothing parts such as “hat”, “shirt”, etc. They would reuse the animations from the skin layer but only have the corresponding piece of clothing on it. I would use the “skin” of the item to change what is what on the character. I would trigger animations for everything at the same time to make it all feel like it is one system working together.

I know this system will take a ton of work, so before I get into it, I wanted to get some initial questions out so I don’t waist tons of time.

My question are:

  1. Does anyone have any experience creating a system like this?
  2. Is this a practical way of doing this or is there a better solution I haven’t thought of?
  3. Can I change specific skins on a spine model or is it an all-or-nothing sort of system? Like can I swap out different eye colors for one another if I had to or would I need to change the entire skin?

Thanks in advance!

Hey,
you may change a specific slot in Spine model, so, yes, you can swap ‘parts’ of model as you wish and combine slots from different skins.

Something like this I’ve used in my game for dressing the mouse (https://dragosha.com/hamster/):

....
-- table with pairs "slot, skin"
clothing  = {
...
 niceboots  =  {{ slot = "right_leg", skin="nameofskincontainsniceboots"}, {slot = "left_leg", skin="nameofskincontainsniceboots"}}
...
}

...
local baseskin = "knight"
spine.set_skin(spinemodel, baseskin)
for i, gear in pairs(clothing ) do
  for __,v in ipairs(gear) do
      spine.set_skin(spinemodel, v.skin, v.slot)
  end
end

So, model has one animated skeleton, base skins (knight, mage, thief, etc.) and skins with ‘parts’ (where the skin contains clothing parts in any combination, you mapping it to things in the Lua table, one thing can link to few slots, left and rigth boots for example). If you want to have 10 swords in game, 8 shirts and 5 hat you should create 10 ‘parts’ skin.

6 Likes

Thanks for answering my question!

I know this is a super old thread but did you use Dragon Bones or Spine as the tool for your game?

Spine

1 Like