From Body Language to Sleuthhounds
December 14, 2018
Part of my work on the Sleuthhounds: Cruise game this past week has been on integrating in the interview system I developed in Body Language, my recent game for Ludum Dare 43. When I developed the system for Ludum Dare it was under the time constraint of having only three days to work on it (and what with one thing and another, I was only able to spend 35 hours on it across those three days). Between building the mechanics, drawing the graphics, and writing the story…well, let’s just say more than a few corners were cut during development.
Bringing the interview system over from Body Language was a bit more involved than I’d expected. That was all down to cleaning up the various time saving shortcuts that I took to finish that game for Ludum Dare. At any rate, I now have the same body language system implemented in Cruise with one or two under-the-cover improvements picked up along the way.
In addition to bringing over the necessary coding, I also brought along and updated a spreadsheet that I developed for Ludum Dare. The thing with the interviews is that, from an implementation point of view, they have a lot of repetition in them as far as suspects are concerned. When the player asks a suspect a question and the suspect responds several things always happen:
- The suspect says at least one line of dialog.
- For that line of dialog the suspect’s eyes are set to look in a particular direction.
- For that line of dialog the suspect’s posture is set to a certain stance.
These different attributes are all always set for each line of dialog the suspect says. The particulars of them may change, for example one line of dialog may have the suspect looking left and another may have them looking right, but they are all always there.
To simplify things on the coding side, I created a procedure with a prototype something like this:
DialogSayWait(<agent name>, <dialog line>, <eye direction>, <posture>)
Calling this routine causes the specified agent to say the passed in line of dialog, set the agent to look in the specified direction, and gives them the indicated posture. The script routine then waits until the dialog line has been said in its entirety (or the player clicks to bypass the line).
The bulk of the gameplay in Body Language is carried out through dialog lines so most of the scripting involved calling DialogSayWait() over and over again for all the different lines of dialog the game features. To speed up the process I took advantage of Excel to do some of the coding for me.
Excel has a nice “concatenate” function which can be used to append various text strings together into one string. By placing each of the four parameters to the DialogSayWait function into separate columns in the spreadsheet, I was able to create a conctatenate based formula that created the necessary scripting lines with all the values already filled in. It was then just a matter of copying the resultant concatenated string from the Excel spreadsheet over to the appropriate game scripts. It saved me a huge amount of time doing that and I knew that spreadsheet would be valuable for Cruise as well. Of course, I had to adapt things for Cruise a bit as it supports a few more attributes when a line of dialog is said such as the type of bubble text appears in (e.g. speech bubble, thought bubble) and it allows for lip-sync data and audio files to be associated with the actual text dialog line.
In actuality, the spreadsheet was the second step in getting the dialog lines into the game. Due to how Excel works it’s not the greatest for if you want to edit strings of text that you’ve already typed in. My process actually started in Word where I created a table that mirrored the columns that I wanted in Excel. Word allowed me to edit the lines of dialog very quickly, making tweaks and corrections easily. Once I was satisfied the dialog was, if not good, at least reasonable, I copied it from there to Excel. The concatenate formula did its magic and I copied the results from Excel to my game scripts. That process was much faster than if I had to manually type all the DialogSayWait() calls right in the game scripts themselves.
Overall I’m quite pleased with how the interview system integrated into Sleuthhounds: Cruise. There are a few more things I want to tweak following my Ludum Dare experience and then I’ll need to do some playtesting of the system. During Ludum Dare, I ran out of time towards the end so didn’t have sufficient time to test everything. The system will likely evolve a bit more but I think it’s at a good starting point right now.