Thursday, July 16, 2009
Frayed Knights: Edgar the Enchanter and the Endless Interlocutions
It's once again time for me to check in with the latest in development musings about Frayed Knights, the upcoming comedic indie RPG being made here at Rampant Games.
Meet EdgarHere's the concept art for Edgar. Edgar is a magic user in the Heroes of Bastionne, rivals of the Frayed Knights. In keeping with the theme, Edgar is in many ways Chloe's equal and opposite. He's clear-headed, tactical, subtle, conservative, restrained, fabulously well-educated in the art and lore of magic but pretty badly lacking in terms of street smarts and field knowledge. He has an inflated opinion of his own skills, and how cool he looks in that blue robe. If Edgar was a player character in a dice-and-paper RPG, he'd be the guy run by a somewhat uncreative rules lawyer / power gamer.
Edgar is fun. He's just asking to be abused. I wish he had a bigger role in the game than he does, but it's still a secondary role primarily in the second act ("act" works better than "chapter" for my brain for some reason). But he's got some amusing dialogs.
Dying on Dialogs
Speaking of dialogs - Argh!!!!
Anybody who has ever made a significant module in Neverwinter Nights understands some of the challenge of creating a dialog. Let's take a simple case - an NPC whose sole purpose in life is to give the player a quest. I don't feel like making a flowchart, so here's kind of a bad pseudocodeish example of how their dialogs might fire:
[code]
IF (Is this the first time the NPC has met the PCs?)
Dialog 1: "Hi. I'm NPC X. Good to meet you. Oh, I've got this quest. Interested?"
* IF (The player accepts)
* * Dialog 2: "Awesome. Here are the quest details. See me when you are done."
* ELSE
* * Dialog 3: "Fine. I'll wait for some REAL adventurers to offer them this quest."
ELSE IF (the player refused the quest?)
* Re-offer the quest. Repeat dialog 2 or 3 based on player response.
ELSE IF (The player accepted the quest but hasn't made progress yet?)
* Dialog 4: "Good luck on your quest. And here's a reminder of how to get started, since you probably forgot"
ELSE IF (The player start the quest but hasn't finished yet?)
* Dialog 5: "Wow. I'm glad to hear you are progressing. Here's a hint to help you finish."
ELSE IF (The player finish the quest and hasn't talked to the NPC since doing so?)
* Dialog 6: "Ah, cool! You finished the quest. Here's your reward."
ELSE
* Dialog 7: "Hello again. I've got nothing more to say to you. Toodles!"
[/code]
So - seven dialogs to accomplish relatively little. Now, since this is Frayed Knights, I don't just leave it at a single sentence or two that the NPC speaks - I (usually) expand it into a two-way dialog between the NPC and the various party members. And I try to inject some lame humor where I can. This comes out to a surprisingly significant amount of writing.
BUT ... it gets worse. Far worse. Oh, so much worse.
Are You Talkin' To Me?
The above only handles a very simple case for an NPC that has only one purpose in the game. And that's currently how NPCs are behaving in-game. But that's inadequate. I'd like characters in the game to project at least a slightly deeper illusion of life than simply being a person-shaped quest dispenser.
But what happens if an NPC is part of another quest, and has some key dialog to say if the player happens to be on THAT quest. Oh, our IF / THEN / ELSE logic gets a lot more confusing doesn't it? What if the NPC has a minor role in two other quests, AND has a follow-up quest to offer after the first one? What if the player has somehow angered their NPC (perhaps by "failing" a quest), and we need multiple dialogs to deal with a honked-off and non-honked-off character?
And what if they are also a merchant?
Whatever the case, the relatively simple logic of the example falls apart pretty quickly when you end up with more complex states. That means (to me) setting up a queueing and prioritization system for NPC dialog - queueing up all the dialogs that apply to the current player / game / NPC state, and then dropping all low-priority dialogs unless they are the only dialog in the queue. (And if this made any sense to you at all, you are probably a more l33t programmer than I am, and you are also able to translate from Coyote-ese, which makes you a very dangerous person).
It also means tons more writing, much of which the player will never see on a single play-through. Considering the quality of my writing, you can probably count that as a blessing.
Labels: Frayed Knights, programming, Roleplaying Games
Comments:
Links to this post:
<< Home
I haven't got to dialog yet for my mobile RPG but I'm a big believer in abstraction. In that I write a boat load of code so that the user gets a smooth fun experience.
Really though what I mean is that I abstract things like this myself. Try and break all the code up so your working with a lot of methods. I plan on doing the 'dynamic' aspect for my dialog like you are in that it changes along with the player/world. Which really just means a crap load of if statements and tracking variables. I will probably though most of the dialog into a lot of classes to break up the walls of text and then just call them out neatly with a few if statements in my game loop.
(probably doesnt make much sense since I'm tired and just happened to see your post before I hit shut-down haha)
Really though what I mean is that I abstract things like this myself. Try and break all the code up so your working with a lot of methods. I plan on doing the 'dynamic' aspect for my dialog like you are in that it changes along with the player/world. Which really just means a crap load of if statements and tracking variables. I will probably though most of the dialog into a lot of classes to break up the walls of text and then just call them out neatly with a few if statements in my game loop.
(probably doesnt make much sense since I'm tired and just happened to see your post before I hit shut-down haha)
That's pretty much the plan. Even now, I have a system handling the if-then-else stuff automatically now. I just need to change it to deal with priorities and multiple dialogs in a single exchange. The nifty part should be that the existing NPCs should still work the same under the new system.
I prefer to do flow charts instead of pseudocode, just because it's easier to see the conditions for each dialog.
All that is pretty neat but in Casting Shadows when it came the time to implement it in code... well ... it was a big huge mess of matrixes of strings (I did not know that GM could manage lists, queues and stacks at the time).
I do not want to program something like that EVER again.
All that is pretty neat but in Casting Shadows when it came the time to implement it in code... well ... it was a big huge mess of matrixes of strings (I did not know that GM could manage lists, queues and stacks at the time).
I do not want to program something like that EVER again.
Making a rich(read complex) dialog system's a b*tch to synchronize, no mistake, and if anyone tells you otherwise they probably haven't tried it or have a) a photographic memory and b) an IQ of 160 :P BTW, love you blog althoug this is the first time i've commented :P
As you say, the worst thing is that most people will never see all these complexities.
I make it a point to talk to everyone character every time I see one in a game. At least twice every time. On the opposite, many of my friends just go to the NPCs needed to advance in the game, having no time for "fluff characters".
As it is, I AM trying to do a NWN module, and have characters different from the jRPGs ones (*click* "Get out of my house immediately" *click* "Get out of my house immediately" *click* "Get out of my house immediately" *click* "Get...). Well I am currently trying to make a hole in the wall to my right, too. I wonder what I will achieve first...
I make it a point to talk to everyone character every time I see one in a game. At least twice every time. On the opposite, many of my friends just go to the NPCs needed to advance in the game, having no time for "fluff characters".
As it is, I AM trying to do a NWN module, and have characters different from the jRPGs ones (*click* "Get out of my house immediately" *click* "Get out of my house immediately" *click* "Get out of my house immediately" *click* "Get...). Well I am currently trying to make a hole in the wall to my right, too. I wonder what I will achieve first...
I'm a big fan of code generation for this kind of stuff. I'll often knock up a simple in openoffice spreadsheet/excel and write some backend VBA to dump it to my scriptcode (lua), this way I can tweak and regen all the time. Makes life easy.
my dialogues can change depending on characters stats (presence check), politcal alignmnent in the game and if the npc likes them or not.. so one question may have half a dozen responsed based on what the npc has done in the game prior... so many things can change a simple dialogue.
my dialogues can change depending on characters stats (presence check), politcal alignmnent in the game and if the npc likes them or not.. so one question may have half a dozen responsed based on what the npc has done in the game prior... so many things can change a simple dialogue.
I think some OO combined with a priority system could result in a fairly natural-seeming way of doing it without too much irritating if-elseing.
To help simplify the if/elses, set numerical values for various stages of the quest. (All quests can use, say, unclaimed, claimed not started, progress 1, 2, 3, finished, etc. With gaps between the numbers to accommodate complicated quests that need more states.)
Then characters would have a list of quests that they are interested in, sorted by their interest level. You put in the appropriate comments at the appropriate level of quest-progression. For an NWN style of select-the-number, you can just list all the active quests that the NPC is interested in for comment. Otherwise just do a priority with maybe a bit of random. (With some 'Oh, I hear that you are searching for the bloody chalice, did you know that...').
The topic/interest objects can also be imbued with extra data, say about how many times the NPC has talked about it, the player's attitude to the responses, etc. All optional to add flavor if desired.
It's still complicated, but it cuts out some if-elsing by turning into casing, which lets you group up certain states that that NPC might not distinguish between. It also provides a natural way to have an NPC keep track of which quests they most care about. (Plus if you add a quest later they _really_ care about, you just prioritize it highest, instead of having to re-jigger all the ifs.)
Just a thought!
Post a Comment
To help simplify the if/elses, set numerical values for various stages of the quest. (All quests can use, say, unclaimed, claimed not started, progress 1, 2, 3, finished, etc. With gaps between the numbers to accommodate complicated quests that need more states.)
Then characters would have a list of quests that they are interested in, sorted by their interest level. You put in the appropriate comments at the appropriate level of quest-progression. For an NWN style of select-the-number, you can just list all the active quests that the NPC is interested in for comment. Otherwise just do a priority with maybe a bit of random. (With some 'Oh, I hear that you are searching for the bloody chalice, did you know that...').
The topic/interest objects can also be imbued with extra data, say about how many times the NPC has talked about it, the player's attitude to the responses, etc. All optional to add flavor if desired.
It's still complicated, but it cuts out some if-elsing by turning into casing, which lets you group up certain states that that NPC might not distinguish between. It also provides a natural way to have an NPC keep track of which quests they most care about. (Plus if you add a quest later they _really_ care about, you just prioritize it highest, instead of having to re-jigger all the ifs.)
Just a thought!
Links to this post:
<< Home



