One Night Stand: Part 6
Home
My Stuff
Resources
Links
Contact Me
Welcome back to our increasingly complicated quest to write a simple game.  So far we haven’t said anything about clothing.  Is she wearing any?  Is the player?  As I mentioned earlier in the tutorial, there are many ways to handle this.  You could just leave things as they stand, letting the player assume that the clothes are just taken care of behind the scenes.  Many games use this approach and there is nothing wrong with it in and of itself.  However, having the added dimension of clothing can really add a new level to your game so it is certainly worth considering.

I said that the method I was recommending in this tutorial was a simple dressed/not dressed approach.  This gives many of the benefits of having clothes without a lot of the headaches that come from having every piece of clothing be a separate object.  To refresh you memory, this would give every character two possible states.  They would either be completely dressed, or completely nude.  It does mean a bit more work when it comes to writing descriptions but not nearly as much as when you start getting into layered clothing systems.  For this system to work correctly there are four main things that you need to consider.

  1. You need a way to track whether the person is clothed or not.
  2. You need a way to change the person’s state of clothing.
  3. You need a way to keep the player and other character from running around naked when and where they aren’t supposed to.
  4. You need to adjust the descriptions of people, body parts, and actions to reflect whether or not the person is wearing clothes.

Sounds easy right?  No, I didn’t think so.  However, most of it is not nearly as complicated as it might sound.  Let’s take each of them in order and see how it works out.

Tracking Nakedness

The first one is easy.  We have already seen several examples of how to do something like this.  All you need to do is set up a property that applies to all the people in the game.

A person can be unclothed or clothed.

The order you write them is important here.  Remember that when you define a simple either/or property like the one above, the one listed last will be the default.  In this case, that means that all characters (including the PC) will start out clothed, which is probably what you want.

That’s all you have to do to create the means of tracking whether or not someone is naked.  Unfortunately, there is more work to do since, at the moment, it does absolutely nothing.  So let us continue.

Getting Naked

One of the benefits to handling clothing in this way is that it allows us easy control over changing the dressed state of the player and other characters.  We can dress and undress anyone we wish, at any time we wish, by simply adding something like the following to any rule we write.

Now the player is unclothed.
Now Lisa is clothed.

However, if we do want to give the player the control of when exactly to get naked we can do it in several different ways.  The simplest (by far) is to have a single command and have it undress both the player and all other characters in the room at once.

Stripping is an action applying to nothing.  Understand "strip" or "undress" as stripping.

Check Stripping:
    If the player is unclothed, say "You're already naked." instead.

Carry Out Stripping:
    Now the player is unclothed;
    If the player can see someone (called the target) begin;
        Now the target is unclothed;
    end if.

Report Stripping:
    say "Everybody's naked, Oh Yeah!"

Here I included the check, carry out, and report rules that give the general handling for what happens when the player types “strip”.  I included these to show how you could actually make it work this way, although with this particular action, the general handling is probably not something that you will usually want.  Instead of the rules above, it is probably better to use the before and instead of rules like we did for the sexual actions, something like this.

Before stripping:
    If the player is unclothed, say "You're already naked." instead.

Instead of stripping:
    say "You start removing your clothes and Lisa quickly follows suit.";
    Now the player is unclothed;
    Now Lisa is unclothed.

You could then go on and put conditions on the rules just like you did with the others so that the responses vary depending on the time, location, or whatever.  Writing the action for dressing would be handled in the exact same way except that, of course, it would change the people to “clothed” instead of “unclothed.”  One thing to keep in mind if you use this approach is that you need to be sure to tell the player what the commands are.  Otherwise, frustration will ensue when they try removing their own and other characters clothes only to find that the clothing itself does not actually exist.  You can do this either in the introduction or preferably an “about” or “help” section that can be reached through the game.  Including a readme file is a good idea but there is no guarantee that it will always accompany the game when it is downloaded in the future so having the information in game as well is best.  Obviously, this goes for any other pertinent information that you want the player to be aware of.

You want to be careful when writing rules like this since the instead of rule above will print out the message and strip Lisa even if she is not in the room.  If it is possible to be in a different room than Lisa you might want to get a bit fancier and write something like this.

Instead of stripping:
    If the player can see Lisa begin;
        say "You start removing your clothes and Lisa quickly follows suit.";
        Now the player is unclothed;
        Now Lisa is unclothed;
    Otherwise;
        Say “You’re the only one here and you want to get naked?  Where’s the fun in that?”;
    End if.

We haven’t really talked about the whole “if...begin...otherwise...end if” thing and it is something that you will be using often enough that I think it might be worth pausing to take a look at it.  “Begin” and “End” are bookends surrounding a condition we want to test for.  In general and at its most basic, here is the form.

If [some condition] begin;
    [what we want to happen];
end if.

Which basically means that what we want to happen will only happen if the condition that we have included is true.  This condition can be just about anything we want it to be so we have quite a bit of control here.  If the condition we put isn’t true then it does nothing.  This might be just what we want or, like our example above, we might want something else to happen; that’s when we need to bring in otherwise.  The form you use is very important.

If [some condition] begin;
    [This happens if the condition is true];
otherwise;
    [This happens if the condition is false];
end if.

Note that otherwise gets a whole line to itself with its own semicolon and that it is within the begin and end bookmarks.  Of course you don’t have to use it at all.  Let’s say that we have a ball that can be one of several different colors.  We could just write two separate rules but that can get a bit cumbersome.  In fact, if there are only two options and you just want a single thing to happen in each case then you can shorten it even more like this.

Instead of examining the ball:
    If the ball is red, say “The ball is red.”;
    Otherwise say “The ball is not red.”

Notice that there is no begin and end here and otherwise is part of a complete separate line.  This is the only time this will work.  In more complicated cases you will have to use the longer form.  If you want to test for more than two things you can use “otherwise if” like this.

Instead of examining the ball:
    If the ball is red begin;
        Say “The ball is red.”;
    Otherwise if the ball is blue;
        Say “The ball is blue.”;
    Otherwise if the ball is green;
        Say “The ball is green.”;
    End if.

In this case, no matter how many “otherwise ifs” you put in, they are all between begin and end and the game will test for each of them in turn until it finds one that is true.  This all might seem a bit complicated at the moment but after you use it a time or two it becomes pretty easy.  Now, back to our regularly scheduled programming.


Limiting Nakedness

So you don’t what the PC to be able to run around naked the whole time?  Whatever, it’s your game.  Actually, this is something that a lot of games (especially early ones) forget about.  It’s amusing (at best) to be able to remove your clothes at the beginning of a game and walk around naked the whole time without anyone ever taking any notice of it.  Of course, you could write a whole series of responses for how the other characters react to the player’s nakedness at different times but a much easier solution is just to make sure they can’t get into the situation to begin with.

If you’ve been following along with the rest of this tutorial then you can probably already see some ways to handle this but here are a few examples of how you might use our new actions and property to control when and where the player can get naked.

In the mock game that we have been setting up, the player must first repair Lisa’s computer before he can get to the good stuff.  It seems more than reasonable to not let him get naked until this happens as well.  To test for this, probably the easiest thing to use is another before rule.

Before stripping:
    If the computer is broken, say "Hey, keep you mind on your work.  Pleanty of time for that later." instead.

There are many, many ways to handle this and I won’t be going into nearly all of them here, but as another example, let’s say we want to limit stripping to a certain room rather than a certain time.  Not a problem.

Before stripping:
    If the location is not the bedroom, say "This really isn't the place to be stripping down is it?" instead.

And in fact, you could use both of the rules above if you wished.  Or even better, put them together into one rule using what we learned in the last section.  You just have to be a bit careful with the order you write them.  In the above two cases, if the player is in the office and the computer is broken then both conditions are true so which does the program use?  Whichever is first in your code.

Ok, so now we have the player and Lisa naked in the bedroom but as of yet, there is nothing to keep him from wandering around the house naked.  We have made it so that he can’t actually undress anywhere else, but after he has, there are no limits on where he can go.  We can put restrictions on this using our clothed/unclothed property.  For example:

Before going south from the bedroom:
    If the player is unclothed, say “You really shouldn’t go wandering around the house naked.” Instead.

In the text game that I made available on my website there is a small discussion about the difference between “going ... FROM...” and “going ... IN...”.  This is an example of where you might use the former.  Check that discussion if you want to know what the difference is.

I could give more examples here but I think by now you should be getting the idea.  Manipulating just that one action and property gives you quite a bit of control over things and we now have enough information to revisit our sex scene and make sure things work ok there.

Naked Or Not?

Now that you have a way to track whether or not everyone is naked and a way for them to change back and forth, what does that do to the sexual commands you have been working on?  One option would be to just restrict the tasks so that they could not be done unless the participants were already naked, but that is probably not the best (and definitely not the most fun) way to handle it.

Certainly it doesn’t make much sense to do some of the tasks while still clothed.  Actually having sex, for example, would be very difficult.  Of course, even that’s possible.  Say that the girl is wearing a skirt, you could just lift it up and on you go.  Unfortunately, to do that you are talking about a much, much more complicated clothing system so for our purposes here we’ll just say that actual penetration is out.  Also, as far as licking and sucking go, for the most part doing these through clothes isn’t much fun (fluff in the mouth you know).  Although I have played games that let you do it and in the right situation, it can be pretty hot so maybe that one is borderline.  What is not borderline is rubbing.  There is no reason in the world that you could not rub whatever body part you wanted through whatever clothing happens to be there.  This is certainly where it usually starts in real life so implementing it in our game seems like a natural step.

It should be pretty straightforward (in general) how to do this by now.  Using the if/begin/otherwise/end stuff we just learned about along with our new clothed/unclothed property should allow you to take control of the situation.  The first thing to do is probably to handle attempts by the player to fuck while still clothed.  At its simplest, you could just write something like this:

Before fucking:
    If the player is clothed, say “Not while you’re dressed you don’t.” instead.

A couple of things about this.  First, if you remember when we put in the restriction to not let the player try sexual things until the computer was fixed we used the “being sexual” term.  Since “fucking” is more specific than “being sexual” it will override the first one and only display the above.  This may not be what you want so you need to be a bit careful here.  I can think of a couple of ways around it but it is a bit much to explain here so the simplest (if more verbose) way is probably to just get rid of the “being sexual” thing in this case and restrict the individual actions.  You could then use a single rule to keep all the restriction together and make it clearer using if/otherwise.  The second thing to remember is that if you are using multiple responses for various tasks then the player attempting to fuck her while clothed will count as an attempt even though nothing happens.  You can get more specific with this (and every other) command by making your rules, for example, “before fucking Lisa,” “before fucking Lisa in the bedroom,” or whatever.  Third, -- oops, did I say a couple of things?  Well, I meant three, yeah three things.  Anyhow, third, notice that we test to see if the player is clothed.  How we have it set up at the moment, it is not possible for the player to be clothed while Lisa is unclothed.  If this were possible we would need to be a bit more careful here.  As far as licking/sucking goes, you can either do it the same as above, or in the same way we handle rubbing below, depending on which way you’re going.

If you are only planning on having a single response for rubbing a certain body part when clothed and another single command for rubbing it while unclothed then this is very easy to handle.  I’m sure you don’t need me to spell it out for you but here it is anyway.

Instead of rubbing Lisa’s tits:
    If Lisa is clothed, say “You rub her tits through her shirt.”;
    Otherwise say “You rub her bare tits.”

And that’s it, just write up similar rules for rubbing the other body parts and you’re all set.  If you are planning on having multiple responses then you’re going to have to do some tweaking to get everything to work right.  I haven’t said anything about kissing yet.  There is really no particular reason why the responses to kissing need to be any different if the girl is clothed or not since her clothing will normally not extend to her lips.  However, you could write different responses as above if you wished, perhaps mentioning what the player’s (or the NPC’s) hands are doing while they are kissing.  One thing you do want to be careful about is not to mention states of dress in the responses unless you are taking control of that.  What I mean is that the response shouldn’t mention the player rubbing her bare breasts if it is ever possible to see that command while she is still dressed.

The last thing we need to talk about is the description of the NPC and body parts.  I saved this for last because it needs to be handled slightly differently than the others.  There are actually a couple of ways to do this.  Remember that the was we describe a person is like this:

The description of Lisa is “A perky little blonde with a love of life and sex.”

“The description of Lisa” is not a rule and therefore, we cannot use the same techniques that we have been using.  However, we can, if we wish, use the if/otherwise conditions in the description itself.

The description of Lisa is “[if Lisa is clothed]Lisa is wearing stuff.[otherwise]Lisa is naked.”

So then if the player examined Lisa while she was clothed he would get “Lisa is wearing stuff” and if she was unclothed, “Lisa is naked.”  Notice that there are no spaces between the brackets and the regular text.  Strange things can happen if you don’t follow this pattern.  At any rate, this works ok but while I use conditions like this for small segments, I personally find it a bit annoying to have long, alternate sections of text in one description.  This is a matter of personal taste and the above will work fine if you want to use it.  The other way to do it would be to write Lisa’s description like this:

The description of Lisa is “[Lisa’s Description]”

In this case we are using a text substitution for the entire description.  It doesn’t matter what you call it as long as it is something unique.  What this does is allows us to write a rule in the more traditional pattern that we learned above.  We just have to tell the program what to say when it goes to describe Lisa.

To say Lisa’s Description:
    If Lisa is clothed, say “Lisa is wearing stuff.”;
    Otherwise say “Lisa is naked.”

Either way will work and which you use is up to you.  Describing her body parts would be handled the same way.

And that’s about it.  You can see that adding a clothing system is going to increase the work load but doing it this way will keep the work to a minimum.  The next step up would be to allow the player and other characters to dress and undress individually.  This is more complicated, both in the way you would set up the commands and because you would then need to keep track of who is naked at any given time and adjust the rules accordingly.  Of course the pinnacle of clothing systems, layered clothing, is the most complicated of all and I really don’t recommend you attempt it with your first game, but ultimately that is, of course, up to you.

Well, I’ve said this a couple of different times but next month is going to be the last segment of this tutorial.  We’ll talk about conversation and a couple of odds and ends and call it good.  This has already run on longer than I had intended it to but I hope some of the information has been helpful.  As always, if you have any question or comments, or you would like additional help with your game, feel free to contact me at purpledragon.aif AT gmail DOT com.  Thanks for reading and until next month, work hard, have fun, and think dirty thoughts.

Go To Part 7
Home | My Stuff | Resources | Links | Contact Me