Friday, December 20, 2013

Gingerbread Escape

Its been forever since my last post, since I was pretty lazy and was busy with school work. I have some big updates. The first is a new website design to show off the games I've made. (www.eng.utah.edu/~kray). The second is the latest game I've made: Gingerbread Escape. The game was made in the Student Club Gamecraft which I was one of the lead programmers for. The premise of the game is that you are a gingerbread man running away from a ginger man. It is an endless runner with the main mechanic is that you can run on the ceiling and the ground.


The game was made in 4 weeks time (with about 5 hrs per week) in Gamemaker. Our team comprised of 5 people: 4 programmers and 1 artist. The reason we went with Gamemaker was that 2 of our programmers were just starting out with introductory Computer Science courses and the other programmer and myself were too busy to use a better language. So for one day per week we all got together on a computer and had a 4 - 5 hour code jam making the game. I provided the code for the main mechanics such as physics and movement and helped out with debugging.

The game was fun to make and was well recieved when presenting it to other Gamecraft members and leadership. We then presented the game at the EAE Open House where it was well recieved. Paige Ashyln, producer on Magnetic by Nature, said, "... most fun game here." and was a big hit with the heads of the EAE program, Bob Kessler and Roger Altizer. They liked it so much that they suggested that we release it to the market. At this point we are still deciding if we want to actually release it to the market. Our hesitation is that if we do, we will have to port the code to the Android and IOS platforms and polish the code so that the game looks like it deserves to be on the market. I'll let you know if we do decide to release.

This game was a lot of fun to make, and I am waiting to see what the future of it is. I am also excited to see what else happens next in Gamecraft. I will try my best to keep you updated next semester and to log my progress with future games and hopefully, future classes that present interesting topics.


Tuesday, March 12, 2013

Creating Conversation

I know its been a while since my last post (things have been quite hectic). I'm close to getting an alpha done and I had to change the complete back-end of my game to match up to a new requirement that may or may not change. To get to the possible change, some background info is needed on the first back-end and the one I currently have.

The back-end I am referring to is to simulate conversation flow in a non linear way. In a typical dating sim, conversation is quite linear. You have a selection of choices to either ask the character or respond to (usually 4). There is usually one right answer. If you get the right answer the game continues and another set of choices of either questions or responses until the game is complete. Obviously this is not realistic to reality.

A typical conversation flow in dating sim.

As you can see in the first depth after the intro, each response to the intro can bring up a  different set of questions or responses based upon what question or how you responded. Then each branch delves linearly to a set question/response that must be answered in order to progress. This kind of non-linearity is closer to what a real conversation is and what I hope to simulate when the project is over. 

In order to achieve this non-linearity, a more generic tree must be used. What better than a graph. The way the graph worked is that each Vertex in the graph is a conversation state (QUESTION, ASK, FOLLOW-UP). A QUESTION is a question you ask the character, an ASK is a question the character asks you, and a FOLLOW-UP is a response to your question or to the character question that can lead back to a QUESTION or ASK. 

A graph simulating the Conversation Graph

 Inside each state are several responses the character uses as an edge to either a QUESTION, ASK, or FOLLOW-UP state. It is a directed and weighted graph. The weights are the probability of a certain response being used. If time permits, I would love to create a probabilistic model of a certain result being asked in one situation and by a certain personality type. However, this may or may not go in depending on how much time I have to complete it.

As much as this model worked, and I even created a prototype for it, it didn't simulate the conversation in a way that my team thought was the best way. So we decided to go in a different direction. One of the most common aspects of conversation is that both partners mine for a common topic to talk about and delve deeper into that topic. So we decided to simulate that aspect of conversation. It works much like standard conversation flow above, in which a person "chooses" a topic by asking them a general question about it. It can then go deeper with them asking more personal questions about the topic until they choose to go to another topic, or the topic runs its course and another topic must be chosen.

A Topic Conversation map

Each iteration of each topic is a certain depth of the topic. Iteration 1 being a very general topic for example, "What is your favorite book." and the last iteration being something very specific, "How do you feel about the collected works of William Shakespeare." No matter how deep a person my be in conversation, they still have a chance to get out by asking an iteration 1 question from the other topics. Inside each iteration are a list of questions that the player may ask. Each question is generically similar such that each response in the response list could logically be used to answer any question posed. Once the response is stated, the conversation goes to the next iteration where they may choose to continue the conversation on the topic or move to a different topic.

Obviously this representation does simulate topic conversations, but it is still linear. When coming up with questions to fit this model, our designers found it really hard as they wanted tangents and two different iterations to account for that to add non-linearity. So far nothing has been changed, but if we want to still keep this model, but still add non-linearity, then a combination of the two models needs to be done.

A Hybrid Conversation Flow

Reaching a topic is the same as before, but the going through iterations is not so linear. Each iteration is the same as the old one; the only difference is that each response acts like the response in the graph that it acts as an edge to a new iteration. This time though, not only can a response map to the next iteration, but a different iteration in a different topic allowing the character to change the topic.

Each representation has its own strength and weakness, but I really like the third representation the best since it achieves what we want the best. The only reason I don't throw away my back-end and start anew is the fact that I would have to throw out my back-end and start a new and for the second time. Also, I have a Play-Test this coming Tuesday, so I don't want to have my game in a state of unplayability. Also I would hate to change out the back-end only to find out I need to stick with a previous representation or create a new representation for a completely new set of requirements. All I know is that conversation is tricky. I should post again about which representation I did as well as other aspects of the game (if I don't be lazy for a month again).

Sunday, February 3, 2013

Game Dev II and starting a Tech Demo

Its been a while since I lasted posted, but I have now gone into the full swing of things here in the Spring Semester. This semester, all of my classes are CS (except Game Dev II, but I program in it). Since the beginning of January to now, I just got put into a team of 8 to create an alternative game. We talk it over, and we decided to make a Dating Sim to help people with the social constructs of asking people out. This game will avoid all the cliches of Dating Sims you may have played online. For the first part, the game will not end in sex or anything related to sex. You have the internet for that.

Like last semester, I am the only programmer on my team. There is one other person who does know how to program and will help out where he can, but I have to do the heavy lifting. Normally I would be nervous, but a Dating Sim isn't too hard to program. Plus if I do get overwhelmed, then I do have someone to help me out too. There are somethings that I do want to do in order to make this game more than just your standard Dating Sim. Everyone on my team is researching topics on dating and that includes personality types. What I would like to do is establish a probability tree to the likelihood of a person of a certain personality reacting to questions of another personality. This in itself is complex and 3 months is hardly enough time to get the data to even start on a probability tree. However, I would like to get the ground work started, even if the numbers are a bit crooked, it would be interesting to have probability to your advances even if you are asking the same question that would work on another person. This add a bit of realism to the game and gives me something to do. With this, there isn't a certain path that you can take to get the girl, sometimes a certain girl just isn't that into you and I want this game to show it. What will probably really happen is a really simplistic version of my model. The challenge would be fun though.

With that in mind, I couldn't start the whole Bayesian probability just yet. I had to work on getting the basics of Dating Sim to work. This includes going from place to place (different locations), being able to initiate conversation and have the person ask you a question and having x choices to make on what to say back. These are all button actions and aren't that hard. However I am using Unity which is a lot nicer than Gamemaker. For one Unity is in C# which is one of my favorite languages to use. With that in mind, I am using the free version which is limited with what you can do (a license costs about $1,200). What I needed to do was to make a nice button class that was generic. Unity does have a good button tool that allows great customisation  so I decided to create a wrapper class that would add on to the button to modify it how I needed it to modify based on what it is suppose to do. Then comes the problem with passing in variables. Unity classes are really more scripts in that it adds on to a pre-existing class when you create an object or prefab. So if you need to pass in a value you just create the variable as a global variable and in the editor, you can type in what value you want and experiment with it (even when the game is running which is nice). The problem lies when you want to pass in a variable or another object. The public variables recognize primitives and certain objects (such as GUI, GameObject, etc), but if you created a Linked_List, then it won't recognize that and won't let you pass anything in. Then if you do want to pass something in that is recognized, like an int, then you have to pass in an actual value. For example, I wanted to pass in an x based on the width on the screen which is (Screen.Width), but the editor only accepts certain letters and numbers, so I couldn't even pass in the variable. With that in mind I am searching for a way to pass in variables that way so I can position my buttons in a more precise way than "top-left", "bottom-right", etc.

Since I wanted to get something done, I was able to get buttons that would transport you from place to place with limited precision to where you can place the button. I was listening to some Lord of the Rings music (mostly the theme for the Shire and Rohan) and I decided instead the original placeholders (crappy anime backgrounds), I would have a Lord of the Rings theme and place in locations from that mythology. I then decided to place in what people you would try to hook up with. Since Lord of the Rings isn't known for its diversity, I decided to have the player hit on the Mouth of Sauron, Lord Denethor song of Ecthelion, King Theoden son of Thengel, Bilbo Baggins, and Elrond of Rivendell. Also the locations their from are the background. I just went from there adding in background music that the film had for their area. I wanted to add in dialogue and conversation buttons, but I decided to stop there for the night and carry on. I really want to carry on with this, but my team probably won't let me (I can't blame them either). But at least I'm closer to finishing a tech demo that can be used to showcase what game should be about.

Imagine the calm music of the shire playing in the background



Once you get past the madness, he's really a nice guy

He's single ladies.