Wednesday, November 14, 2012

Starting Again

Oops! Realized I forgot to update my blog on Monday, so here it goes for this week:

I've been given two options for "goals to achieve by the beta review". One is having a graphical component up and running in Adapt, and the other seems to be "get to where I was in the Alpha, but with extendable emotions and actions."

I'm leaning towards the second option, though I'm not sure if it's for the right reasons. The first reason is that I've already started implementing the new version of the code based on my notes from last week, so I'm already on my way to having that implemented. Another reason I want to pursue this implementation in place of graphics is that having my notes from last week implemented is a huge step towards writing the storytelling A.I., since it will incorporate action importance into the simulation and allow for a way to distinguish between plot points, subplots, and extraneous data.

On the other hand, I worry that a big reason why I'd prefer the second option is just that I'm avoiding doing graphics. I've never used Unity before, and I think fear of the unknown might be causing me to put the Adapt implementation on the backburner. If that's the case, maybe I should familiarize myself with Adapt now, just to take myself out of my comfort zone and figure out the one part of this project that I'm still unsure of.

I've e-mailed Aline, and am waiting to hear her thoughts on what the next best step is. In the meantime, I'll continue working on my implementation of extendable interactions, as I've been doing.

Tuesday, November 6, 2012

Restructuring

I received an e-mail from Aline after my last blog post saying that extendable actions and emotions should be a much higher priority than I give them credit for. Unfortunately, I can't implement them with the code that I've written thus far, so I'm going to have to start writing a new implementation from scratch (using most of the concepts I've already come up with in this blog).

I've been giving a lot of thought to how one might make actions and emotions extendable. After all, "fighting" couldn't possibly have the same results as "flirting". Actions that affect emotions, like yelling and kissing, are fine, but what about actions like killing, that result in someone's death?

I decided there need to be a certain number of actions - like "dying" - that need to be hard coded into the program, but that the emotions and actions will be able to access in certain ways. The program, as I need to implement it now, will accept a text file that lists the number of emotions in the simulation and the number of actions in the simulation. Following the number of emotions will be the names of emotions found in the character, which will automatically be added to each character. Emotions will now be a class of their own, with a name and a value. This will be a good time to specify emotions between individuals... I can make another class for the full emotional spectrum, filled with emotions determined by the text file. Each character can have just one at first, simulating the code I have working right now, but then it will be relatively easy to create a hashmap linking character keys to emotional spectrums for each character, allowing every character to feel differently about every other character. I'll probably have to update the algorithms slightly to include baseline emotions, since when Person 1 makes Person 2 mad, they will be angry at Person 1 and not Person 3, but will still be in a bad mood around Person 3.

Actions are trickier. After the number of actions, I'll have a list of file names of text files for actions that need to be implemented in the game. Actions will be created as their own classes now as well. I think the way I'll need to implement them is cycling through all of the actions that exist in game, plug in the emotions of the characters and have each action spit out a separate (slightly randomized) probability. Then, the highest probability is the action that takes effect for that turn.

The action text file (and, by extension, the action class) will need a name for the action, a list of all the emotions that effect it, whether it is an action that requires an interaction partner, and what the ideal emotional distribution would be for said action to start off. (For instance, Fighting would probably be 100% Anger, but maybe playful insults are 25% anger 75% love). The closer to this distribution the character has, the more likely it will be to perform said action. Finally, we need the effect that the action has on others. This will be another list of emotions: -.25 Love; 2 Hate would decrease love 25% and double hate values. Finally, there would be a list of built-in-software actions that the character performs on themselves as part of the action if it successfully completes and a list of ones they can perform on their interaction partner. These are actions that really need to be hard coded into the program, but can be included in these extendable actions. These are actions like "seek interaction partner," "stop interaction," "kill," and others that I still need to think up (next week I'll attempt a list of these built in fundamental actions, in addition to starting this implementation). Continuing last week's thoughts on the storytelling A.I., this is where we'd include an Action Importance Value (AIV) to weigh how important the performance of this action is to a narrative structure. Finally, we'll need an indication of how this action will look. In a graphics based system, this line would be a reference to an animation that would play along with the action, but since ADAPT won't have any animations that match my actions for now I'll just keep them Strings that contain language like "flirted with" or "attacked", so the end result is floating text over the characters' heads that read "Person 1 attacked Person 2".

I'm pretty sure that this implementation will work. And what's more, I think it'll be genuinely easy to build on and extend out. I'm fairly excited about this new direction, even if it means more or less starting over.