Friday, July 20, 2018

Building A Parser

Originally Posted: July 30th, 2017

There are two big challenges when it comes to writing a text-based adult game.

(Well... More than two, but I'll just cover two for now.) 

When characters have a lot of variables, it can quickly become a nightmare to write content. Making use of appearance variables can dramatically increase the time it takes to write even a relatively simple scene. Throw in personality variables and it becomes a nightmare. This usually results in either: a. simplistic and/or repetitive scenes, b. scenes that don't seem to take character customization into account, or c. a combination of a and b. 

Erotic writing in general suffers a problem with repetition. When you write about a few specific pieces of anatomy over and over, the word choice can quickly become repetitive. This is true even with effort to try and rotate words. 

For Accidental Woman, the solution is using parser functions. Parser functions help to manage each of these problems. For the first, a parser can turn a variable into a meaningful bit of text. Rather than writing an if/then or switch statements each time you want to describe something, you use a parser function instead. Let's say you have a variable describing how hungry a character is. Because you want to regularly add and subtract hunger, it would be a pain to have the variable be a string. At the same time, if you use an integer or float you have to interpret it when you want to describe hunger in words to the player. By building a parser function, you can simply call the function whenever you want to describe the hunger variable. In Twine Sugarcube, this would look like: "your stomach is <<hunger>>." The parser function reads the $hunger variable, sees that it's 1.4, and outputs "nearly empty". Players will see "your stomach is nearly empty."

You can probably imagine how a parser function can help with repetitiveness. Instead of writing "cock" you type <<cock>> and call the parser to pull up a random word for penis. You can put a whole army of words, and prevent words from being overused. Of course, this won't always be very lyrical, and you can't use it for dialogue, but it works. Even better, you can combine variables together into the description. A parser function called "pussy" can look at variables such as looseness, wetness, and arousal to pump out an appropriate description. This is really helpful when you don't know what the state of the character will be in, as is the case often in games. A passage where an NPC is fingering the PC could be described differently based on the situation when it comes up. This adds some immersion and flow to otherwise disjointed writing in many life sim type games.

By using parser functions, I'll not only be able to add content faster, but I'll be able to add the type of writing found in CYOA style games to the mechanics of a life sim. It'll also make it much easier for contributors to write content as well.

No comments:

The Seedbed Release - v1.31

Update: So all sorts of shit happened, mostly a killer migraine and then discovering this morning that someone using git as...