Saturday, March 23, 2013

The Votes Are In

After taking some advice from Aline, I've decided to try to make a "playable" version of my code, where you control a character walking around a 3D world in which story is created in real time. So far I've implemented a character that you can control yourself (in terms of walking around), and my next step is creating character interactions. I need some sort of menu screen that will let you choose the action you wish to take when talking to someone. I have no idea how to do that in Unity yet. I've been doing some research, but so far I haven't been able to figure out how to do it myself. I haven't been trying too long yet, though. The next step after that is making a way to ask characters about their past interactions, so you can get other people's stories (what just happened to them) besides just your own, and learn about why someone might be acting the way they are.

I'm optimistic about finishing this in time for the beta. If I can, I might either try to implement the "story cuts" technique of having the program show you what it deems important through cutting, or else rework a version of the code and the action/config files so that you have a genuine story to play through (a soap opera, a murder mystery, etc), which seems like relatively little work and probably would make the demonstration much more enjoyable.

Thursday, March 14, 2013

Back From Break and Phase 2

When I left for break I had just presented a nearly working version of my program in Unity. This week has been about tying up loose edges. The big project this week was making it so that the characters stopped and interacted in a way that wasn't instantaneous. That's been completed - I'm currently working on adding in animations that play when the characters are interacting based on the action (the action txt file has a line for animation file to be played). After that, I want to reimplement death (my characters can no longer die) and flesh out some more actions and emotions for testing purposes. That should take me through the weekend.

My big question now is what to work on next (Aline, if you're reading this, I'd appreciate your input). My two options are:

  • Dynamic camera that "cuts" to the most interesting part of the scene
or 
  • Interactive game where you control the "main" character and the story is generated around you as you play.
That'll determine what I spend next week doing and what my priorities will be going into the beta and final presentation. I hopefully will have time to do both, but both won't exist within the same version of my code (it doesn't make much sense to be cutting away from a player controlled character, after all). I can think of a number of pros and cons for both, but I'm currently leaning towards the dynamic camera first and interactive game second. It will probably take less time to do the dynamic camera, meaning I'd still have time to try the game, and it's more in keeping with my original goal - making a program that knows how to present the story.

Sunday, March 3, 2013

Screenshots Galore!

Characters have their names floating over their heads until they've had an interaction. Afterwards, their most recent interaction phrase (this character ______ another character) displays over their heads. Characters can have names specified in the config file (Montswana) or can be auto generated (Character 1, 2, 3, etc). Characters walk on random paths until they get close to another character.
Once close enough to another character, the two become "interaction partners" and plot courses towards each other.

Once interaction partners are within an interaction distance, they will stop until one of their actions exits out of the conversation. This will usually happen instantaneously at the moment, as all actions take only a tiny fraction of a second to complete, and so entire interactions are simulated in under a second. 


Whew!

Where to begin?

Following a meeting with Aline where she helped me through most of my biggest problems, all the pieces started falling into place one by one. First I got scene loading working, so that various characters loaded into the scene from the config file. Then I got actions and emotions back up and running, and defined the character object script so that it's more or less the same as the character class from the text based version of my code.

Once I got characters into the scene and walking around, I created a line of text above their heads and attached a script so that they follow the characters and always point towards the camera. I rigged up a script so that the number keys 1-9 correspond to characters 1-9 (technically characters 0-8), and 0 resets the camera so that it isn't attached to anyone. Eventually I will have the opportunity to "cut" using the camera from interesting scene to interesting scene.

Next I got character interactions back online, so that characters could interact with each other based on the config file (I still need to tweak the config file so that there are more interesting directions that conversations can go - right now positive gets more positive and negative gets more negative, without anything like "accidental insult" or the conversation getting dull or conversation ending actions that occur without extreme emotional settings). I made it so that characters find other characters that aren't interacting and walk to each other. Then I re-implemented actions, so that characters could have their interactions and then break away from each other. This made the characters end their interactions, but because they were nearest to the people they just interacted with, they would just start another interaction with those people. So I added a variable to keep track of past partners, so that partners wouldn't repeat (since you would never have a conversation with someone, end it out of boredom or frustration, and immediately start a new one with the same person). I made it so the text above characters' heads displays the action that they are implementing (the action lines from the text based version proved helpful here). I noticed two problems here - there was bunching occurring, where characters would walk to each other and eventually wind up in a cluster in the middle. The other issue was that there was no random wandering - characters just walked to the closest characters to them, interacted, then found the next closest and walked there. I tried to fix both these problems by having characters wander to random points on the screen and only "notice" each other - walk up to each other - if two unoccupied characters get within a certain radius of each other. When that happens, they lock on to one another and walk up to each other as before.

Some immediate next steps: there is still a bit of bunching going on, mostly I think because character interactions are instantaneous. Characters meet with each other and then bounce off. The actions need to have a time interval that they take. Right now, the interaction loop cycles through and implements different actions so that each character performs dozens in under a second, and then they go their separate ways. I need to try to condense this (each consecutive action gets folded into the previous one, each uninteresting action gets suppressed) so that we actually see the actions going on onscreen. After that, I need make it so that actions have corresponding animations (their config files currently have a spot for animation names, but I need to actually implement the code that takes those names and plays the animation). This will be relatively straightforward... Aline already taught me how to do that.

I anticipate things moving a lot faster from here on in. Now that I've got a solid understanding of how Unity works (and more importantly, a solid framework to build off of), it should be a matter of implementing feature by feature (for instance, I still need to reimplement death in the Unity file).

After this there are many ways I can go. My primary target is still turning this into a playable game, though Aline and Norm gave me a number of other targets I can try to meet along the way. One of these is having characters remember past interactions that they can "recall" upon request. In a game I could then ask someone "what did you just do?" and they'll recount their story to me in a complex way that factors in how long ago the action was performed and what its importance value was.

I'll post screenshots soon of what the project looks like right now.