An update to the Writing Parser

I have a much bigger update that’s already partially done and on the client, with a lot more content. However, it’s not finished so I wanted to make a post about this one particular update that’s deserving of a post of its own.

The last update for the writing parser was both a rework of clothing and bodyparts. This lead to me being able to update the character generation to allow custom descriptions, and a lot more variation in the verbage that the writing parser outputs so you don’t keep seeing the same descriptions over and over. There’s more detail on those updates at: http://www.playlewd.com/blog/?p=88 and http://www.playlewd.com/blog/?p=72

The other update to it was having the writing parser search for “natural language” to replace, rather than only parsing things that it’s explicitely told to. This made it so someone that makes content just has to write, and it reads it and figures it out for them, rather than them having to put in any sort of code. There’s more on that here: http://www.playlewd.com/blog/?p=94
This new update is an extension of that.

The issue I was running into is that something might not remove a piece of a player character’s clothing entirely. Like say sleeves are rolled up, front of a shirt is torn open, or bottoms are tugged down. And I don’t want someone that’s making content to need to manually mark these changes. I should be able to have the parser able to see clues in the writing that these things happen, and then when it’s time to describe a body part it should know what it’s covered by after those changes.
It’s a really difficult thing to do, but making a computer interpret and output English has been very intriguing for me. I really want to make the writing seem tailored for someone’s character. Though, since I already made everything the writing parser uses object-oriented, implementing the new feature was easy.
The more difficult part was the actual parsing part. The concept is simple, though; it finds a reference to something you could be wearing, then looks in close proximity to find words that indicate something is happening to them, and tries to figure out what exactly. Actually implementing that is, well, really complex.
This basically is done in three steps:

  • Checks for a reference to clothing. Makes sure it’s something that player-character is wearing, and it isn’t written about another character.
  • Isolates the sentence and looks for an adjective there that implies its being moved or removed.
  • Tries to infer whether they’ve being removed entirely, or just exposing one body part, then updates the state of player coverage

There should probably be a fourth step, which would be checking for red flags that seem to imply that things aren’t what they seemed. For now, I can’t really do that, as I don’t have enough writing to create a big enough sample size to find such issues that’d call for that. But that’s what an alpha is for. There’s lots of time to test and refine it.

Bookmark the permalink.