Simple but complicated (and probably very inefficient) clothing system advice?

Heya all,

I’m pretty new here and pretty new to Inform.

I’ve been playing around with a clothing and exposure system as a practice project to try and get more adept with coding and get more efficient, and because wearing clothes and different exposure systems feel like they’d use a bunch of interesting fundamentals that could be applied elsewhere, and because I like writing clothing and outfit descriptions, and like having the world or player react to their current situation.

I aimed to keep it as simple as possible to actually use while offering a wide array of states.

Standard clothing is simple, I just use Inform’s built-in clothing system. The player can wear a top, bottom, bra, and underwear.

Clothing is a kind of thing.

A top is a kind of thing. A top is a kind of clothing. A top is usually wearable.
Instead of wearing a top when the player is wearing a top (called the wrong top):
		say "[player forename] needs to take off [the wrong top] first.";

A bottom is a kind of thing. A bottom is a kind of clothing. A bottom is usually wearable.
Instead of wearing a bottom when the player is wearing a bottom (called the wrong bottom):
		say "[player forename] needs to take off [the wrong bottom] first.";

A bra is a kind of thing. A bra is a kind of clothing. A bra is usually wearable.
Instead of wearing a bra when the player is wearing a bra (called the wrong bra):
		say "[player forename] needs to take off [the wrong bra] first."
		
Underwear are a kind of thing. Underwear are a kind of clothing. Underwear are usually wearable.
Instead of wearing a Panties when the player is wearing underwear (called the wrong underwear ):
		say "[player forename] needs to take off [the wrong underwear] first."

The two unique articles of clothing are Skirts and Dresses, because it’s possible to wear both a skirt and a dress without underwear, creating a kind of obscured exposure. And because I didn’t want it possible to wear a shirt and a dress at the same time.

A Skirt is a kind of thing. A Skirt is a kind of clothing. A Skirt is a kind of Bottom. A Skirt is usually wearable.
Instead of wearing a Skirt when the player is wearing a Skirt (called the wrong Skirt):
		say "[player forename] needs to take off [the wrong Skirt] first."
		
A dress is a kind of thing. A dress is a kind of clothing. A dress is usually wearable.
Instead of wearing a dress when the player is wearing a dress (called the wrong dress):
		say "[player forename] needs to take off [the wrong dress] first.";
Instead of wearing a skirt when the player is wearing a dress (called the wrong skirt):
		say "[player forename] needs to take off [the wrong skirt] first, she can't wear a skirt and a dress.";		
Instead of wearing a bottom when the player is wearing a dress (called the wrong bottom):
		say "[player forename] needs to take off [the wrong bottom] first, she can't wear that with a dress.";		

The player can also be in multiple states. If the player isn’t wearing anything, they are considered naked. This is by far the easiest state to make and check with and doesn’t need its own state:

Report ClothesCheck:
	if player is wearing clothing:
		say "[player forename] is wearing [a list of things worn by the player].";
	If player is not wearing clothing:
		say "[player forename] isn't wearing anything right now."

I don’t think I should class a player as Uexposed or Lexposed when they’re naked, because then some events might struggle to tell if it should play an Uexposed event or a naked event.

But if a player is only wearing a top, they are considered Lexposed (Lower exposed). If the player is only wearing bottom, they are considered Uexposed (Upper exposed) and if a player is wearing a skirt or dress they get a special Hexposed (Hidden exposed).

A person can be Lexposed. [Lower Exposed]
A person can be Uexposed. [Upper Exposed]
A person can be Hexposed. [Hidden Exposed]

And because an article of clothing could theoretically be exposing in itself, like a ripped shirt, mesh shirt, a loincloth, or some translucent shorts, clothing can be considered exposing. To add further complication, underwear itself might not be considered appropriate and can also be exposing.

Clothing can be UExposing. [Upper Exposing]
Clothing can be LExposing. [Lower Exposing]

In order to check exposure ( this is where I feel there’s inefficiency or tools I’m not using well) I’ve been determining states using a series of If and Else.

Every turn:
	If player is wearing a top:
		If player is wearing a Uexposing top:
			If player is not wearing a bra:
				Now player is Uexposed;
			Else if player is wearing a Uexposing bra:
				Now player is Uexposed;
			Else if player is wearing a bra:
				Now player is not Uexposed;
		Else:
			Now player is not Uexposed;			
	Else if player is not wearing a top:
		If player is not wearing a bra:
			Now player is Uexposed;
		If player is wearing a Uexposed bra:
			Now player is Uexposed;
		Else if player is wearing a bra:
			Now player is not Uexposed.

Pants function the same way but with underwear instead of a bra. The skirt functions differently.

Every turn:
	If player is wearing skirt:
		if player is wearing panties:
			Now player is not Hexposed;
		Else if player is not wearing panties:
			Now player is Hexposed;
			Now player is not Lexposed;
		Else if the player is wearing Hexposing panties:
			Now player is Hexposed;
			Now player is not Lexposed;
	Else if player is not wearing skirt:
		Now player is not Hexposed.

I think that pretty much covers my system, and I’m wondering if anyone has any advice or tips for making something like this more efficient. Huge amounts of If and Else if things don’t seem like the right way to go, considering Inform is more “writerly” than other things. I figure plenty of people have probably made clothing systems and might be able to offer advice for streamlining.

2 Likes

The Recipe Book 9:3 has good examples, see “What Not to Wear”.

1 Like

Agree with Hanon’s recipe book suggestion – not sure anything in there is exactly what you’re looking for, but should be a good mine for inspiration.

In general, as you’ve noticed, you have quite a lot of freedom when you want to model something like this! A few ideas that may or may not your life easier -

Properties like this can be a little tricky to keep in sync with the world; for example, if you change what the character is wearing and then check the exposed state before the every-turn rule fires, you might get the wrong answer. A bit safer to use a definition, as in To decide if the player is lower-exposed:; it’ll be recomputed every time it’s referenced, which may repeat a little work but never gets out of date.

It looks like these rules might not cover the case where we’re wearing a dress and want to put on shorts? (Maybe that’s just not in the excerpt.) The examples tend to use a relation for this sort of thing, so you can ask general questions like “is there anything covering the same part of the body / normally worn at the same layer”.

Right… you mention efficiency in a few places, but I think this readability is the key thing for me; I often find it hard to read through a bunch of nested conditionals like that. (Even in a normal programming language, and Inform makes them even more awkward.) The guide seems to prefer a definition- and relation-heavy style, where you come up with general descriptions that let you manage a wide variety of cases. For example — if you had some concept of which garments go over which body parts, and garments had a property of being ‘modest’ or not, “upper-exposed” might be just: “is the player wearing any modest garment that covers their chest.”

6 Likes

Like Ben said, much of what you’re doing here can be accomplished with putting properties on the clothes and creating adjectives through Definitions.

A garment is a kind of thing.
A garment is usually wearable.
A garment can be hcovering or hexposing.
A garment can be lcovering or lexposing.
A garment can be ucovering or uexposing.
A top is a kind of garment. A top is usually ucovering.
A bottom is a kind of garment. A bottom is usually lcovering.
Undergarment is a kind of garment. Undergarment is usually hcovering.
[etc.]
Definition: a person (called P) is naked rather than clothed if P does not wear anything.
Definition: a person (called P) is hcovered rather than hexposed if P wears an hcovering garment.
[etc.]

(These bits don’t offer any help with tracking what has to go over or under what, of course.)

2 Likes

Well, I came from a country renowned for its taste in dressing and top-notch stylists, and personally I think the issue isn’t exposing, modesty or other puritan values, but that the dress is both elegant and appropriate.

For appropriate, I mean appropriate to the environment. or even appropriate to diverse environment at the same time. (I managed to wear appropriately for both a meeting of extreme leftists and the inauguration of a RC charity whose happened to be in the same day, w/o time for return home for a change… and I get complimented for the look in both environments. and, trust me, isn’t an easy feat even for an Italian…)

I understand that for an anglo-saxon managing and choosing from an Italian’s wardrobe and its variety of clothings for many diverse occasions and circumstances IS an adventure in itself… So, dear Sabine, I deliver you a perfect theme for your liking of writing description of clothing & outfits :wink:

Best regards from Italy,
dott. Piergiorgio.

Usually within the concept of parser adventures, detailed layered clothing usually only comes into play if the game is a period/etiquette drama, something about fashion, or AIF.

1 Like

Some great replies, thanks everyone! I had the feeling I was going to learn some useful new stuff from this thread threat. It’s less about the clothing itself, more about the mechanics that make these systems tick, using this as an example to learn more about Inform 7 and what it’s capable of. I’ll implement and work on these things, and see if I can find ways to do other things with them too.

3 Likes

That’s definitely a good strategy. Often something that is fun to prototype and make work may not be the most fun for a player in the course of an actual game, especially the more finicky and complicated a system is. But learning from such experiments is the way to go!

4 Likes

It occurred to me I’d never actually played a game with a well-implemented clothing system like this, so I dug up Games with exceptional clothing systems - an IFDB Poll

Not a huge number of games there so far, though it’s probably not comprehensive. (Any garment-system connoisseurs reading this thread may wish to add to it!)

4 Likes

I think from a player perspective moving from room to room and taking care of clothing can be a bit of a drag, I have played a game where it was part of the puzzle to dress up and non player characters immediately treat you as if you are a different person.

Perhaps adding a time aspect to it helps, wearing different clothing items on different days along with the location context gives it a bit more playability and fun. That probably is more akin to the player than individual clothing items, but experimenting with that can be useful from the items importance to the game world. But then again I am probably thinking more from an inform6 perspective.

I’ll just note that my Character Portraits extension was designed to implement clothing systems, and the only example is a clothing example. While it was never fully developed, it might be useful reading material for learning to code.