Hi,
in order to make the virtual world a bit more realistic, I often put clothes on the characters in my stories. Now - one downside of static clothing is that you stop looking at them after a while (as developer) and after a playthrough (as player).
In order to make things a bit more interesting I am using a table with pre-defined clothes from which I randomly pick one row (one row contains a full set) when play begins. That’s working out ok but - for the developer - there’s still little variation as you know your tables.
I have been thinking of making it completely random - but then I’d have to ensure that colours would not clash and that the garment made sense. A business blouse with sweatpants would be a tad off. Unfortunately I’m stuck with this in such a way that I never even found a start to code from. But maybe someone out there has done the same or a similar thing or is just so much better at coding in Inform that he or she could help me with a few tips?
Here’s my “how it should work” so far:
We divide the clothes into “classes” first
over-tops: Like a jacket, a coat …
tops: dresses (yes, I think we must see them as tops), sweaters, t-shirts, blouses …
bottoms: shorts, jeans, pants, leggings, skirts …
socks: stockings, socks, pantyhose …
shoes: flats, heels, boots …
For style-matchig we would need some “style compatibility” and some styles …
styles: casual, sportive, formal, …
jeans are casual-style compatible
leggings are casual-style compatible
leggings are sportive-style compatible
Next we would need to define which clothing is compatible to what clothing
jeans are compatible to sweaters
jeans are compatible to t-shirts
jeans are compatible to blouses
…
Next we would have to define colours and define colour compatibility:
colours: red, blue, black, white, brown
Then we’d be in need of some compatibility that is not a sore to the eye:
blue jeans are colour-compatible to white t-shirts
blue jeans are colour-compatible to black t-shirts
blue jeans are colour-compatible to brown t-shirts
black jeans are colour-compatible to white t-shirts
black jeans are colour-compatible to black t-shirts
black jeans are colour-compatible to red t-shirts
…
A more compact form (like a list as jeans are compatible to {t-shirts, sweaters, blouses}) would be GREAT as this would get loooong … well, that’s what extensions are for in case there is no compact way to write this.
As for picking a set of clothes once everything is in place:
(1) Pick a style-compatible top at random (the people have a preferred style)
(2) select a colour for the top at random
(3) select a random style-compatible bottom part
(4) assign the bottom part a compatible colour
(5) continue with socks
(6) continue with shoes
(7) continue with over-top if needed (if it is an outdoor scene)
Things get a bit more complicated as dresses are something special (except for leggings, which should be optional, no other bottom garment is actually compatible) but let’s ignore the special cases for now - exceptions or special handling is easy once the framework is in place - which it is in no way, unfortunately.
Has anyone ever done something like that or has a few hints on how to get started or an idea how to achieve this in a completely different way?