No More GDC Austin

Well, not the usual GDC Austin, at least. It seems that GDC has decided to reformulate (and rename) the former GDC Austin as GDC Online, which is now geared towards “connected games including casual, MMOs, virtual worlds, and social networking games.” So instead of a smaller version of the more general GDC, it’s now focusing primarily on online games.

I’m disappointed, but I think I can understand the move. I really liked having a smaller, more accessible GDC than the big one in San Francisco. It probably makes more sense to have a meeting that focuses on a particular area of game development, rather than just another “mini” GDC, especially with the rise of other conferences and meetings like PAX and IndieCade, both of which are around the same time in the fall.

I have no particular interest in the topics of GDC Online, so that’s a conference I won’t be attending. I’ll miss having GDC Austin to look forward to, but perhaps that will just free me up for the other conferences.

Posted in indie games, miscellaneous | 2 Comments

Adventures with NPCs Redux: Lucca

Here we resume our efforts to bring our NPCs to life, beginning with bits and pieces of text from the IF version of Vespers and ending with a modeled, animated, and voice-acted 3D character. Last time I discussed the development of Constantin, the large hulking monk with a short temper. This time I relate the development of Lucca, who had some interesting and unique challenges of his own.

Lucca was going to be a tough character to convincingly recreate. He’s the youngest member of the monastery, a teenager who recently joined the order. He’s very attached to Matteo, one of the monastery’s father figures, and is generally an emotional character during the course of the game. Again, we didn’t have a lot of text to go on initially aside from a short description:

The youngest of those who remain, Lucca joined the monastery only a few short months ago. The son of a count, he had never seen death before the arrival of the plague. It haunts him.

After some discussion between myself and Jason Devlin (the author), we decided we wanted Lucca to have pale skin (maybe slightly paler than the rest), blue eyes, and delicate facial features; probably quite frail overall with a slight build and thin face. We presented these ideas to N.R. Bharathae, our lead artist, who came up with his concept for Lucca.

Figure 1. Lucca (with Matteo) concept sketch.

This looked like a perfect starting point. Using this, N.R. designed Lucca’s 3D model and then applied some of his slick textures. As with the others, we were going for a more realistic appearance for our characters. N.R. did a great job with him.

Figure 2. Lucca textures.

Figure 3. The Lucca model.

During this time, we continued in our task of finding and recording a voice actor for the part. Matching a voice for a young man would not be as difficult as for some other parts, but the real challenge was finding someone who could play the part convincingly, given that Lucca expresses a great deal of tearful emotion during the game. Fortunately, we were able to find Christopher LeCluyse.

Christopher is a veteran of the stage, both acting and singing. Not only that, he also has expertise in medieval literature, and was able to help out with some little-known facts and inconsistencies in our story. For instance, Christopher pointed out to us that, during the time period of our game (ca. 1300-1400), pews did not yet exist in churches — only choir stalls. So we were able to make that adjustment in our storyline and setting.

Figure 4. Christopher and Lucca.

“Christopher LeCluyse (Lucca) brings to Vespers twenty years of professional vocal training and performance and a doctorate in medieval language and literature. He sings regularly with a variety of choral and early music groups and has appeared on recordings with Conspirare. Chris is also a professor of English and writing center director at Westminster College in Salt Lake City.” — C.L.

Finally, there’s the work of our animators. Lucca presented a different kind of challenge than the previous characters, because we wanted to try something a little more complex with the way he idles. At the beginning of the game, Lucca is first seen running into Matteo’s room in the dormitory, where he then scrabbles frantically at the ground, trying to unearth one of the stones in the floor:

Matteo's Room
This room is small: the same as all the others. A bed is pushed up against one wall, opposite the door to the north.

Lucca scrabbles frantically at the ground, his blood staining the stones.

>EXAMINE GROUND
Lucca scrabbles at the stone, trying desperately to unearth it from all sides.

>TALK TO LUCCA
"Why do you dig, Lucca?" you ask.

"Matteo is hiding something. I just know it's under here."

>AGAIN
"Why do you think that?" The blood pours from his fingers.

"I just know," he sobs. "He scrapes around here at night."

>AGAIN
"Leave me alone," he blubbers through the tear-laden mucus that streams from his nose.

>ASK LUCCA ABOUT MATTEO
"He knows something, but he won't tell me," he sobs more heavily for a moment. "He tells me nothing anymore."

My thought was to have Lucca idle using a cyclic sequence, showing him repeatedly scraping at the stone in the floor. But playing this sequence over and over again, without any alteration, would quickly get old and not look very professional. My thought was to try and break the monotony by including a few additional idle sequences played at random points during the cyclic sequence — one trying to pull up the stone, one showing him rubbing his bloody hands, and another showing him wiping the tears from his eyes. That means four idle sequences — one cyclic and three non-cyclic. All need to be designed using the root position as a launching point for any speech animations called from player interaction:

Figure 5. Modifications to the usual animation flow sequence to accomodate additional idle sequences.

What the hell does all that mean? Basically, only that each sequence — whether it’s an idle sequence or speech sequence — has to start and finish in the root position to maintain consistency. The thing we need to keep in mind is that speech can be triggered during the cyclic idle sequence or during one of the other idle sequences and to account for that. Once a speech animation is finished, we always return to the cyclic idle sequence and start again. It can look a little robotic at times, but overall I think it works well.

Here is the text portion of the game given above, as we developed it in 3D with animation and sound. This is from an older video on Google.

Figure 6. Lucca in action.

So that’s how we went through the process of developing Lucca from a text character in an interactive fiction game into a 3D animated and speaking NPC model — a nice combination of writing, modeling, texturing, animating, and voice work. Next time I’ll introduce Ignatius, one of the more mysterious and suspicious characters in the game.

Posted in 3D/if, Vespers, characters in games | Leave a comment

Not Your Mother’s Integrated Graphics

One of the things I noticed when I posted the request for beta testers is that a number of interested people didn’t quite have the system specs I believed were needed to run the game smoothly – namely, a dedicated graphics card with a decent amount of video RAM. Systems with integrated graphics chips, at least in my mind, have not traditionally handled fairly intensive 3D games very well, hence the decision to exclude those systems, at least at the start.

That, and I didn’t have access to a decent system with an integrated graphics chip to test the game. That has now changed.

I’ve been wanting to upgrade my little server box for a while now, and with Apple’s recent tax-free sales event, I decided to make the leap and bought myself a tax-free Mac Mini. It’s a bottom-of-the-line model, although the specs have reached the point where they begin to put my old G5 desktop to shame: 2.26GHz Intel Core 2 Duo with an NVIDIA GeForce 9400M graphics chip. It’s a sweet little machine, with more than enough power for my server needs. Plus, it’s just an amazing piece of technologic design. It’s incredibly compact, and it is absolutely, positively silent. No fan noise, no hard drive clicking. I can hardly believe the thing is powered on. I love the little bugger.

But surely there’s no way it could handle the hulking behemoth that is Vespers.

Naturally, this is the first thing I wanted to try once I got the sucker booted up and organized. Doubtless, once the opening sequence started, the frame rate would freeze up and I’d struggle just to quit the application.

Quite the contrary, actually. For the most part, the game seemed to run at least as smoothly – if not better – than my old desktop with the fancy schmancy dedicated ATI graphics card. Frame rates in many cases exceeded what I was getting on the older machine.

A few caveats: I was running the game at a very small screen resolution, and it did struggle off and on during the early stages of play. I’m not sure if that was related to loading the massive pile of textures into memory (which, on the Mini, the chip shares with the main memory) or just from ongoing background processes, but after a couple of minutes of play all the lag disappeared and it ran about as smoothly as I’ve seen it anywhere.

I’ll have to do some retesting and profiling to see what’s going on, but the results are pretty encouraging. Apparently, integrated graphics chips have come a long way since I last checked.

So if you’re one of those who is still interested in testing, and you have a (relatively recent) system that uses an integrated graphics chip, let me know and we’ll see how things go.

Posted in Vespers | 3 Comments

Adventures with NPCs Redux: Constantin

We continue on with our efforts to bring our NPCs to life, beginning with bits and pieces of text from the IF version of Vespers and ending with a modeled, animated, and voice-acted 3D character. Last time I discussed the development of Matteo, the oldest monk at the monastery; the second character we tackled was Constantin, who had some interesting and unique challenges of his own.

We started out with a very general picture of Constantin; he’s middle-aged, a handyman around the monastery (he was a former blacksmith), and a notably large man with a short temper. Again, we didn’t have a lot of text to go on initially aside from a short description (which was actually removed from the game prior to the final release):

An enormous, hulking man, Constantin is taking the lack of food worse than the rest of the brothers. The former blacksmith has taken to religious life quite well and has assumed the responsibilities of almoner and cellarer since those two brothers died.

After some discussion between myself and Jason Devlin (the author), we decided we wanted Constantin to look extremely large, but not quite like a giant; not fat, but certainly heavy and imposing. We presented these ideas to N.R. Bharathae, our lead artist, who came up with his concept for Matteo.

Constantin concept art.

Seemed just right to me. With this as his starting point, N.R. designed Constantin’s 3D model and then applied some slick textures. As before, we were going for a more realistic appearance for our characters, and N.R. came through for us again.

Constantin textures.

Constantin starts out the game sitting on a chair in his room, skinning a hare with his knife. So to get him ready for the game, we had to outfit him with the appropriate objects.

The Constantin model.

While N.R. was working on this, we also had the task of finding and recording a voice actor for the part. Trying to match a voice to a character like Constantin was not easy; we needed an actor who could really fit the part of a large, short-tempered man with an appropriately deep voice. The man we found to play the part was Jason Nacey.

Jason didn’t have any real experience with voice acting prior to this, but he had been exposed to it through the work of his father. It was actually his father who heard about our voice auditions, and who passed the information along to Jason. Although it seemed a little awkward at first, Jason ended up doing a great job, and I think his voice fits the part perfectly. Here’s a shot of Jason alongside Constantin, followed by a short bio he wrote.

Jason and Constantin.

“I have always been fascinated by a voice actors’ ability to create a story by the sound, inflection, and timber of their voice. I often spend time driving my wife and 5 kids around in our minivan. We ordered our latest van with a DVD player for the kids. Without the benefit of video on long drives, I am able to really tune into the actors voices, and in this way I really became a student of the professionals like Nathan Lane (Lion King), Jason Lee (The Incredibles) and John Ratzenberger (what hasn’t he done?!) to name a few. I have thought for a long time that to be able to take on that challenge would be fun and exciting. It was from my father that I first heard about the auditions for the voice parts for Vespers. Having had no previous experience with any formal voice acting, I went to the audition with no thought of actually landing a part, but I was very excited to just try and maybe, afterwards, be able to get constructive criticism on how I could improve my abilities. I was extremely nervous for the audition, and almost called and canceled so that I would perhaps save myself serious embarrassment. I finally resolved that everyone there would be strangers, and if I was going to stink up the place – dammit – I was going to it LOUDLY! I was elated to find out that I was chosen for the part of Constantin. And I look forward to many more opportunities to have this much fun again.” — Jason Nacey

Finally, there’s the work of our animators. We were still familiarizing ourselves with Torque’s animation system while working on Constantin, so it took us some time to work out the kinks to produce what we wanted. Unlike Matteo, we wanted Constantin to play a looping idle animation; as mentioned above, when first encountered, Constantin is sitting in his room skinning a hare with his knife. So we needed a system where we could play this looping animation continuously, while also offering us the ability to choose one of two things for his speech animations: (a) interrupt the idle sequence to play a full body sequence in response, or (b) continue the looping idle sequence while playing a mouth/head animation on top of it.

To do this, we designed it so that some speech animations are full body animations (played with setActionThread), while others are blend animations (played with playThread). Then we set up our Sequence Manager to recognize which was which, and when it needed to to stop the idle animation before playing a speech animation.

As an example, here is a short portion taken from the text version of Vespers, with the player’s commands in bold caps:

Constantin’s Room
Constantin is one of the few brothers with anything in his room besides a bed. A few tools lay next to the door in the northwest; remnants of his life as a blacksmith. A smell lingers here: a sour smell.

Brother Constantin sits on the bed, a young hare dangling from his hand. His knife moves swiftly.

>TALK TO CONSTANTIN
“What do you have there, Constantin?” you ask, leaning forward.

“Something to eat,” he grunts.

>AGAIN
“Is there no food left in the cellar?”  He flinches slightly.

“No. There is nothing in the cellar.”

>AGAIN
“Well, be sure to tell us when you are finished. We are all hungry.”

“I will.”

>ASK CONSTANTIN ABOUT CELLAR
“What?” he startles. “I’ll get around to taking the lock off. There’s no food left down there
anyway.” His eyes darken as they meet yours. “There’s no reason to go down there anymore.”

And here is the same portion of the game, as we developed it in 3D with animation and sound:

Hopefully that gives you all some idea how we went through the process of developing Constantin from a character in an interactive fiction game into a 3D animated and speaking NPC model. The final result, I think, is a nice combination of writing, modeling, texturing, animating, and voice work, the combined work of a group of really dedicated and talented people. Next time I’ll introduce Lucca, the youngest member of the monastery and a character with challenges of his own.

Posted in 3D/if, Vespers, characters in games | 3 Comments

IndieCade Submissions Open; Panic Ensues

Another year, another indie game festival deadline.

IndieCade, the International Festival of Independent Games that takes place each year in the fall, is now open for submissions for the 2010 event. The deadline for submissions is June 1st, which means we have less than two months to whip Vespers into shape — or at least into enough shape that it doesn’t embarrass itself in the weight room.

I’ve never been to the event, but a number of notable games have been recognized the past couple of years during the festival. Last year’s finalists included Brenda Braithwaite’s Train, Tale of Tale’s The Path, Hemisphere Games’s Osmos, and even an IF game, Jim Munroe’s Everybody Dies. In 2008, Amanita Design’s beautiful Machinarium was the Aesthetics winner, while Jason Roher’s Gravitation took the Jury Award. So I think it’s safe to say that IndieCade has done a nice job in the recent past picking up where SlamDance left off and establishing itself as a major festival for indie game designers.

It appears that IndieCade tries to distinguish itself from other festivals by focusing on art, creativity, and expression, which I find appealing. I’m not sure how well Vespers fits the bill, but it’s worth a shot.

The main reason this is even under discussion is because IndieCade encourages the submission of works-in-progress. My goal has always been to complete Act I through the first cutscene as a demo, so this would (presumably) qualify as the entry. I doubt it’s enough to make a strong impression on a panel of judges, but that’s what I got and that’s the hand I’m playing, assuming I can even get a seat at the table.

Two months is not a lot of time, though. We still have to finish implementing Cecilia, which is no small task, and then get the cutscene working. On top of that are the hordes of smaller tasks that I’ve never addressed. And the testing. Oh dear heaven, the testing.

So that’s where I’m at. The IndieCade submission deadline came and went last year and I never really got close to submitting. I don’t want to see that happen again.

To start with, I’m looking for a handful of people interested in doing some testing. I suppose this still qualifies as alpha testing, but perhaps as things progress we’ll eventually start to think of it as “demo beta testing” at some point. What I’m really looking for are people who can put a concentrated effort into testing different aspects of the game (which I will describe and emphasize privately later) and providing regular, useful feedback, including detailed descriptions of any bugs or problems. While I haven’t worked out minimum specs yet, the game is currently only for Macs or PCs with dedicated graphics cards – no integrated graphics processors. If you’d like to help us reach our first goal, let me know by either responding here or by e-mailing (use the Contact Me form at the top of the page).

Let the games begin!

Posted in indie game competitions, indie games | 4 Comments

Adventures with NPCs Redux: Matteo

Things have been moving forward lately with our NPC development, which has been a very gratifying experience. Watching a character go from a text description to a fully animated and speaking NPC model is something else. And as we move from one character to the next, incorporating each into the game, the whole project really starts to come to life. It sure as hell beats plugging away night after night on the nuances of text parsing.

It takes a lot of steps to go from point A to point B, and a number of people to make it happen, so I thought it might be interesting to review the procedure we went through for each NPC in the game. Vespers has six NPCs: five brothers and one village girl. This way, we can introduce each character while providing a little insight into our development process.

Matteo was the first character we tackled, mostly because he has the smallest part in the game. In the text version of the game, however, there are very few detailed descriptions of the characters, so we didn’t have a lot to go on initially. The one passage in the game that gives some background on his character (which, interestingly, was later removed for the final release) went as follows:

“Ah, Matteo. He was one of the first. Although he is a few years your senior, he remains obedient and helpful. He loves Saint Cuthbert’s, almost as much as you. The loss of the brothers has been especially hard for him. He was as much a father to them as any priest.”

So we began with an older, gentle, fatherly figure, and after some discussion with Jason Devlin (the author), we also decided on a person who is shorter and overweight. We presented this to N.R. Bharathae, our lead artist, who came up with his concept for Matteo.

Matteo concept sketch.

Once we had a good starting point, N.R. set to creating and revising the 3D model, and then applying the textures. We were going for a more realistic appearance to our models and, needless to say, we were very excited with the results.

The Matteo model.

The textures for Matteo's face.

While this was going on, I was also working hard on the voice recordings. After a long process of auditions, I went through the difficult tasks of preparing the scripts, setting up and performing the recording sessions, and then splicing and editing each of the lines into separate WAV and OGG files.

Fortunately, we were able to get a really talented actor, Alan Meyer, to do the voice work for Matteo. I asked each of our voice actors for a head shot, since I thought it would be cool to see each of them beside their final in-game NPC model. Here’s a shot of Alan alongside Matteo, along with a short bio he wrote.

Alan and Matteo. I can see the resemblance.

“As a voice actor, Alan Meyer enjoyed playing a role in Vespers tremendously. During his three decade acting career Alan has appeared in dozens of plays and films. He taught theater and video production classes at Bonneville High, in Ogden, Utah, for over fifteen years. His website Speakingpart.com features his voice acting demos and current resume.”

Finally, bringing him to life was our animator, Shawn Hall. Shawn was new to the Torque system of animation (as was I, of course), so it took us a little while to work out the kinks and the best workflow process. But once we were both comfortable with it, he was able to really breathe life into the model. It’s not easy to show here, but Shawn did a great job with a lot of the little details, including blinking, eyebrow movement, and even some lip sync. We ended up using mostly full body animations for Matteo (unlike some of the other NPCs), since we found little need for additional blend animations. (Shawn has since moved on from the project, but this was all the animation Matteo would need in the game.)

The final result, I think, is a great combination of writing, modeling, texturing, animating, and voice work, the combined work of a small group of really dedicated and talented people. Cue the brief video, for those interested (and sorry for the poor quality – if you watch it at 480p it’s slightly better):

Hopefully that gives you all some idea how we went through the process of developing Matteo from a character in an interactive fiction game into a 3D animated and speaking NPC model. Next time I’ll introduce Constantin, who presented a series of challenges of his own.

Posted in Vespers, characters in games | 1 Comment

Looking Back, Looking Ahead

We’ve been making some good progress lately on Cecilia, the last of the six NPCs to be implemented in the game, so I thought this would be a good opportunity to bring back the old NPC introductions. This was something I started a long time ago — well before starting this blog, back when I was blogging only on GarageGames. The idea was to write an introduction to each of the characters in the game, showing their development from concept drawing to a fully modeled, animated, and voice-acted 3D NPC. I got through the first two characters, Matteo and Constantin, fairly early on. But as animation problems surfaced (and resurfaced), work slowed down. I was able to get to Lucca and Ignatius eventually, but that was about it. I did finally get Drogo implemented after a long delay, but never did get around to his introduction.

At last, all six characters have been implemented, so I can complete that bit of unfinished business and give Drogo and Cecilia the introductions they’ve been pestering me about.

Instead of just doing those two, and because the earlier introductions were just so damn long ago, I thought it would be a good idea to bring back the entire set and start from the beginning again, with Matteo. Then, at last, we can have all six presented in sequence, as originally planned.

Some of the information is a bit outdated, and as such I may do a wee bit of editing, but for the most part I’ll just present the older ones as is before finally getting to the recent ones. It’s just one way to introduce each of the characters while providing a little bit of insight into our development process.

I hope you’ll enjoy it!

Posted in Vespers, characters in games | Leave a comment

End of March Vespers Update (or, How To Drop A Girl)

March comes, March goes. Lion, lamb, all the usual stuff.

March is always a busy month, what with GDC and sundry work-related conferences and travels. And this year, of course, there was PAX East. Man, how I wanted to be there for that. It was, by still rare accounts, an amazing show of force by the IF community, and from what I can tell a great time was had by all. It sounds like there was a groundswell of new or renewed interest in IF, which can only be a Good Thing. And, of course, GET LAMP. I can’t help but feel like I missed a significant event in IF and the opportunity to meet some great folks, but at the same time I am excited that it occurred and grateful that there are those who could make something like that happen.

Making things happen is a good theme to maintain, so let’s do that.

The last of the six NPCs we are bringing to life is Cecilia, the girl who suddenly appears at the monastery and…well, you either know what happens next or you don’t, and that’s not about to change now. There’s a reason I had saved her for last, though, and it’s not because she’s the easiest.

The main problem with Cecilia is that she doesn’t conform to the usual NPC implementation pattern. For most NPCs, each Act (mostly) consists of a simple set of idle animations and an extended set of conversation animations. The character typically stays in one location (Matteo in the tower, Constantin in his room, etc.), doing his own thing, and responding to the occasional player question. Pretty straightforward.

Cecilia, of course, makes things far more difficult and challenging. (I could mention at this point that this is partly why we made her a redhead, but I know far better than to do that.)

The main reason is that there is a portion of Act I where Cecilia acts like an object rather than an NPC per se. Without giving too much away, the idea is that, after she collapses at the front door, the player is supposed to pick her up and carry her to the locutory to be placed on the bed there. That means I have to implement her in two additional forms that are different than the usual NPC: as an inventory object (so she shows up in the visual inventory while being carried), and as an object that Torque calls a “ShapeBaseImage” – an object that mounts to the player and is displayed as part of the HUD in first-person mode, the same way a gun would appear in the camera view in an FPS game.

Cool, but what happens when you hit the "fire" button?

Neither of these is particularly challenging, though; just time consuming, and the implementation requires special code coordination to make sure it handles each of those correctly.

The real challenge occurs when you consider that, while being carried, she should be handled just like any other inventory object. Which means she should be able to be dropped at any time.

Dropping creates all kind of issues in a 3D first-person game. When you drop something, where do you drop it? In front of the player? Directly at the player’s feet? Do you want to show the object falling to the ground, or just make it appear on the ground immediately? What happens if the player is standing right in front of another object, and there is no room to drop it? What if the player is standing directly in front of a wall? What if the player wants to drop the object on the bed, but isn’t facing the bed at that time?

A closeup of Cecilia as "inventory object". It's dehumanizing, I know.

Another part of the equation is that NPC objects have collision boxes, just like the Player’s object has. So when you drop the girl, her collision box immediately interacts with the player’s collision box, causing all kinds of havoc. That requires all sorts of workarounds to make sure the collision boxes don’t interact, but that, in turn, tends to complicate other matters.

On top of that, rather than just teleporting her static body immediately to the ground near the player (or the bed), I’d like to give the whole process a bit of life by including an animation that shows her hitting the surface and coming to rest in her idle position. That means timing the whole process of dropping, starting the animation, and hitting the floor.

So in the end, we’ve taken the relatively simple process in IF of dropping an inventory item and proceeded to make it horrendously complicated. Go team!

More on Cecilia to come.

Posted in 3D/if, Vespers, interactive fiction | 5 Comments

iPad Games They’d Love To See

Spotted on CrunchGear.com:

From the web site:

Planetfall – One of the original Infocom classics. Listen: the iPad has a usable keyboard and can support external keyboards. Why not slap together an Infocom pack for $2 and sell some imagination to these whippersnappers. Who’s with me?”

Not bad, at least it’s good to see some people interested in seeing classic IF on the new device. Of course, it would have made sense to mention the fact that IF already exists on the iPhone platform (see iPhone Frotz) with an inexhaustable supply of excellent pieces, but I’m okay with that.

Posted in interactive fiction | 5 Comments

Long Flights Are Good For Something

One thing long flights are good for is addressing old issues that you’ve always meant to fix but never really got around to. So when I found myself on a three-and-a-half hour flight yesterday, I decided it was time to tackle an old parser syntax issue that has been nagging at me for some time.

My goal with the parser has always been to make it as robust as possible, even if much of the functionality isn’t necessarily used in Vespers — I’d hate to have to add functionality after the fact, like for a future game. So the idea was to develop the parser to provide at least the typical performance one might expect from a TADS or Inform game. Most of the early months of development were spent on engineering the parser, and it was quite the battle. Hard to say for sure, but I’d say I got about 85% of the way there.

One of the missing pieces was being able to parse a command using the syntax VERB CREATURE NOUN. For instance, SHOW CECILIA THE KEYS.

The easier form of the syntax is VERB NOUN ‘TO’ CREATURE, as in SHOW THE KEYS TO CECILIA. The presence of the preposition (TO) helpfully divides the two tokens in the command. The way I implemented the parser, after first parsing and removing the verb, I scan the remainder of the command until I hit either a preposition or the end of the command; the words collected from that scan compose the token. In the example above, THE KEYS would make up the token that comes before the preposition TO; everything after the preposition (CECILIA) makes up the following token. Then I would proceed to figure out what objects the two tokens were referring to.

The problem occurs when there is no preposition, but I’m expecting two consecutive nouns. So if the command is SHOW CECILIA THE KEYS, the parser would grab the entire phrase CECILIA THE KEYS as a single token. Actually, I automatically remove all occurrences of the definite article THE, so the token would really be CECILIA KEYS, which would be handled the same way as something like GOLD KEYS or SHINY KEYS. So the parser would look for an object called CECILIA KEYS, and then proceed to throw up.

Fixing that to allow the alternative syntax was something I always knew was important and would have to be done, although there aren’t many game verbs that require this syntax. Off the top of my head, I can think of SHOW, GIVE, and FEED, although I know there are more. On top of that, it doesn’t really come up much in Vespers, except for a couple of times. But it’s a good example of a syntax that people often use, and in a text game the parser should really be able to handle it gracefully since, without it, the error message is unlikely to be helpful (“You don’t see any such thing.” Say what?). Then, naturally, people will point fingers and say “See? This is why we don’t have text games anymore.”

I knew it was going to be a challenge, mostly because the parser code is a large, unwieldy beast, and on top of that, I haven’t really looked at it closely for a good long time. Enter the three-and-a-half hour long flight, and we have a golden opportunity to reorient, refamiliarize, and figure this thing out.

As it turns out, the whole thing needed a grand total of three lines of code.

The way I handled it before, if I was trying to match a NOUN in the syntax and I had a token consisting of a bunch of words from the command to match it to, I would find the closest match and count how many words in the command were matched. If there were leftover words that weren’t part of the match, that meant something was wrong and the syntax shouldn’t match — so I aborted that syntax and moved on to the next one. So in the case of the command SHOW CECILIA THE KEYS, the token would be CECILIA KEYS, and I’d be able to match CECILIA with the word KEYS left over. The leftover word would cause the syntax to fail, and we’d move on to try the next syntax for the verb.

Since I already had the code in place to count the number of words in the token that were matched, all I needed to do was reset the number of words in the token to the number of words that were matched. So in the CECILIA KEYS example, the number of words in the token is 2, but the number of words matched is only 1. So I tell the parser that the correct number of words in the token is actually 1 (not 2), and the remainder of the token is kept for the next round of token matching. Add in a quick check to see if the next syntax word is a NOUN or HELD object, and that’s all I needed to add.

%nextSynWord = %syntaxWord[%currentSynWordNum+1];
if ((%nextSynWord $= "noun") || (%nextSynWord $= "held")) {
%nouns = %nouns - %numMatchWords;
}

That left plenty of time to watch “Fantastic Mr. Fox”, too. Nice flick.

Posted in Vespers, interactive fiction, text in games | 1 Comment