Design and documentation journal for my interactive fiction (text games); also reviews and other miscellaneous stuff.

Wednesday, November 10, 2010

Automatic Dressing

After a lot of fiddling, I have the foundation of a clothing system I'm pretty happy with.  It's strongly based on "What Not to Wear".  I added a bunch of body parts, in preparation for injury and discomfort work and because it's weird that the PC might be able to examine her thighs, but not her arms.

In short:
- Human is now a subset of person, holding both men and women.  This helps tease out animals from people (obviously), but also makes it easier to assign appropriate body parts.  I don't have current plans to implement extensive body parts for animals, but this leaves the door open. It also leaves the door open for gender-change for the PC.  I'm assuming she's a woman, but making this will make it trivial to change, as well as clearing up some awkward checks.
- Humans have 10 standard issue body parts: head, neck, torso, and a pair each of upper arms, forearms, hands, hips, thighs, calves, and feet.  The upper/lower distinction for legs and arms lets me fiddle with clothing (long-sleeved vs. short-sleeved, pants vs. shorts), which helps a lot with the upcoming work on warmth. 
- Not breaking up the pairs into left/right saves a lot of disambiguation stuff that was making me cry.  If it seems important later, I can handle it internally to the object.
- Most of the relations (overlying/underlying) are similar to the original example.  However, the way layering was set up was not robust and required a lot of delicate testing, and didn't work well with things covering multiple limbs (sleeved stuff especially).
- An article of clothing has a list of numbers, which is usually just one long, indicating where an article goes.  The first number indicates the area of the body, to help diminish confusion for future additions.  The second indicates layers away from the skin.  So, layers on the torso go (theoretically) from 10-19, with 11 being the first layer available to clothes.  I don't think I officially assigned limbs numbers, but the torso is theoretically 10.  So 11 is stuff like bras - skin contacting, tight clothing.  12 would be undershirts, 13 would be shirts, dresses, blouses, or other "normal" wear.  I think the highest layer I have is 18, for coats.  (There's a few empty layers in the middle where I could imagine things going, but didn't want to implement them.)
- There's code to "initialize the clothing layers", run at the beginning of the game, which explicitly details the overlaying relations (now every scarf overlies every neck).  Interestingly, if there's more than one layer involved (every bra overlies every torso, every shirt overlies every bra), but the initial article doesn't have an implemented object, just a kind, weird bugs start popping up - the relations only carry through if there are real, physical objects.
- There's some very basic code to get automatically dressed.
>get dressed
(first taking the black bra)
(first taking the old pair of underwear)
(first taking the black dress)
(first taking the black pair of socks)
(first taking the pair of shoes)
You cast about for underwear and put on the old pair of underwear and the black bra.
You put on the black dress over your underwear.
You slip on a black pair of socks, followed by a pair of shoes.
I am not pleased with the spacing, nor with the command clarifications.  And, uh, the writing itself is not the most stellar description of getting dressed ever to appear in literature.  It's still a step up from:

(first taking the black bra)
You put on the black bra.
(first taking the black dress)
You put on the black dress.
[repeat ad nauseum]
Getting a coherent paragraph when there's a bunch of options is a genuine challenge; I'm not quite sure what to do about it.  Maybe it's the price you pay for convenience.  In good conscience, I can't really *not* give a meta-command for stuff like this. There's some significant tweakage to be done, but the core is pretty solid.

Wish List:
- Automatic dressing when the PC leaves the house.  (Harder, because the PC may have to go to a closet or bedroom or other storage space for clothes, get dressed, and then leave.  Also sort of overrides nudists.)
- Automatic dressing/undressing when the PC sleeps.  (Easy, but more difficult when you're detecting for situations where the PC really oughtn't change to pajamas - say, napping in the hammock or freezing to death because the fire's gone out.)
- Dress for temperature changes: if it's 95F, the PC will wear linen, short sleeves, shorts, etc.  If it's -20, the PC will wear multiple layers in heavier materials.
- Corollary to the above: punish the PC for wearing inappropriate things, via messages or more serious in-game consequences. 
- Outfit appropriateness for cleanliness, wear, etc. - PC should prefer clean clothes in working condition.
- Gender - right now, the player will wear a random outfit in the location.  Some of us don't mind men in skirts, but others might care. 
- Habit.  This would really be the ultimate goal, right?  Watch what the player wears voluntarily, and try to copy that.  Not worth the time sink in clothing, I think, but worth considering how the game might detect player preferences, because it would be awesome elsewhere. 

Immediate goals:
- Materials (cotton, wool, leather) for clothing.
- Consider clothing manufacture, and the randomness vs. customization ratio involved.
- Fix the command clarification lists for getting dressed.

Frivolous self-indulgence:
>embroider dress
(with the scarlet thread)
You embroider the black dress with a bunch of huge triangles.
>embroider shirt
(with the scarlet thread)
You embroider the shirt with a couple running dogs.
 >embroider socks
(with the scarlet thread)
You embroider the black pair of socks with a border of fearsome circles.
... okay, I might need to take another look at which modifiers are applied to shapes.

No comments:

Post a Comment