Dialogs and Quests for RPG
by Andre Lind · in Torque Game Builder · 01/24/2007 (9:26 am) · 6 replies
Hi all!
I'm still quite new to TGB and got the idea to create a small RPG, mostly to create a "RPG framework" and learn more about TGB.
Now to my question:
I need some input to how I could design a Questing system and all the dialogs to it...
I know, its not a small question, but if anyone have done something remotely similar, maybe you could push me in the right direction?
My dialog-system needs to be tied in with the quest system (i.e some NPCs say different stuff depending on how far in the story you are...)
Reading and writing the text would perhaps be easiest using an XML-document.... I think...
Do my questing party need some sort of "counter" to see how far they are in the story or should i use a SimSet with all the quests and then see if "that quest" is done?
Any general thougts on how to design this?
I'm not on the hunt for code, just thoughts and experience around this...
Thanx
Andre Lind
I'm still quite new to TGB and got the idea to create a small RPG, mostly to create a "RPG framework" and learn more about TGB.
Now to my question:
I need some input to how I could design a Questing system and all the dialogs to it...
I know, its not a small question, but if anyone have done something remotely similar, maybe you could push me in the right direction?
My dialog-system needs to be tied in with the quest system (i.e some NPCs say different stuff depending on how far in the story you are...)
Reading and writing the text would perhaps be easiest using an XML-document.... I think...
Do my questing party need some sort of "counter" to see how far they are in the story or should i use a SimSet with all the quests and then see if "that quest" is done?
Any general thougts on how to design this?
I'm not on the hunt for code, just thoughts and experience around this...
Thanx
Andre Lind
#2
Thanx for the long and very detailed reply!
I've been working on this and has completed my dialog system using a XML document and it even sports scriptable studd so I can use it to do story events :)
My dream-2d RPG Framework is coming together very rapidly, even got turnbased battles and a lot of other stuff going!
Now to my new problem...
I've tried to use GUI controls for my textbubbles with not very nice results :(
So now I'm trying to use t2dTextObjects instead...
Has anyone used these in this fashion? Because I can't get it to respond to setText although it says on TDN that it should respond to it...
Is it not the same t2dTextObject thats been submitted as resource, that has been added to TGB 1.1.3??
Suggestions on another route? Is GUI-controls better perhaps?
Best Regards
Andr
03/13/2007 (1:25 pm)
Hi again!Thanx for the long and very detailed reply!
I've been working on this and has completed my dialog system using a XML document and it even sports scriptable studd so I can use it to do story events :)
My dream-2d RPG Framework is coming together very rapidly, even got turnbased battles and a lot of other stuff going!
Now to my new problem...
I've tried to use GUI controls for my textbubbles with not very nice results :(
So now I'm trying to use t2dTextObjects instead...
Has anyone used these in this fashion? Because I can't get it to respond to setText although it says on TDN that it should respond to it...
Is it not the same t2dTextObject thats been submitted as resource, that has been added to TGB 1.1.3??
Suggestions on another route? Is GUI-controls better perhaps?
Best Regards
Andr
#3
textClass.text = "blah SPC blah"
I have done this with my game, and it works. At least I hope we're talking about the same text resource. Like I said, I don't have my development pc with me at the moment, so can't verify exactly what I did.
03/13/2007 (1:59 pm)
@Andre - I'm responding on a different pc. So, can't access my code at the moment. But, have you tried assigning a class name to it, and doing something like: textClass.text = "blah SPC blah"
I have done this with my game, and it works. At least I hope we're talking about the same text resource. Like I said, I don't have my development pc with me at the moment, so can't verify exactly what I did.
#4
03/13/2007 (2:32 pm)
@Andre, I will confirm A's response -- to change the text in a t2dTextObject, you simply set the Text field to a new value -- the t2dTextObject is/was an experiment for GG on using 'accessor' concepts -- similar to properties in other OO languages with get/set code
#5
Just a small design note. Take it or leave it.
03/13/2007 (2:34 pm)
To avoid confusion between the interface elements and the data it contains, I would recommend using consistent terminology. Dialogs are are interface elements while dialogue is the interaction between characters. Just making that distinction separates the content from the interface options. Because in-game messages, quest boxes, player stat notices (you've gone up a level!) are often done with dialogs, but dialogue is strictly interaction based, whether between PC's or NPC's.Just a small design note. Take it or leave it.
#6
Still can't get my text to show up though :(
Heres my code:
03/13/2007 (2:51 pm)
Thank you for your quick answers :)Still can't get my text to show up though :(
Heres my code:
%event.char.gui = new t2dTextObject()
{
scenegraph = %this.getScenegraph();
};
%event.char.gui.text = %event.say;
//%event.char.gui.setText(%event.say);
%event.char.gui.setPosition(%event.char.getPosition());
%event.char.gui.setVisible(true);
Associate David Higgins
Example, your GUI form would most likely have the following items:
* NPC Conversation Bit (the part of the conversation the NPC is currently saying)
* Player response options (usually some form of pre-determined text response that is clickable)
How you display this, is up to you -- how you tell the GUI what to display, is the fun part though ... you have a number of options available, some are easier to implement then others, of course ... my favorite would be an XML File format that defined the NPC's statement, and the pre-determined Player responses available for the statement (be the statement a question, concern, direction, fact, etc, etc, etc)
You could use something similiar to this, for the XML layout:
<dialogs> <dialog id="1"> <npc>How are you doing today?</npc> <player> <response id="1">I'm fine, yourself?</response> <response id="2">Horrible, lets FIGHT!</response> </player> </dialog> </dialogs>The 'id' attributes for the 'dialog' elements could then be directly accessed via torquescript, if you wrote a 'dialog.xml' to 'SimSet' or 'dialog.xml' to 'TorqueScript array' system that stored the dialogs in memory for you (if you have large dialogs, it would probably be best to only load the dialogs relevant to nearby area -- set 'region' triggers that load/unload dialogs)
You could then, on your NPC object in game, add a dynamic field that indicated what dialog id the NPC was to display -- using some form of a 'state' system, you could have the NPC change it's dialog id through script (which could also be attached to the dialog XML using something like:
For example, you could have:
Pressumably, your player will only be having a single conversation at once, so your eval'd script could then store it's result in a global $var, or perhaps you could have a global ScriptObject that contains a number of dynamic fields that can be used to store the relevant data -- your script can also be passed a reference to the NPC object, as well as your player object, using the %params variable -- you could then have your script initiate a 'quest', and configure the NPC to respond with a new dialog the next time the player talks to them.
You could take this a few steps further and have 'pre-speak' and 'post-speak' scripts executed, which can then determine the state of the player (ie; recurse a 'Quests' array or SimSet and determine if the Quest items needed have been obtained, if so, respond with Dialog 4, if not, respond with Dialog 6).
Etc, etc, etc ...
Your question is fairly 'loaded', and has a varying number of possible response, this is simply just one way to do it, and it's also an idea I popped off the top of my head after reading your question, after further evaluation of requirements and overall 'needs', I myself might change this logic.
You could also replace the XML file with a database, for example SQLite, which would allow you to simply 'query' for the dialogs, responses, etc, etc, which eliminates the need to store large amounts of data in memory at once (especially for regions such as towns where you may have 20-1000 or more dialogs loaded at once).
I would most likely go with the database concept myself, using a similiar layout as the XML File ... you could also then create a subsidiary application (in whatever your more comfortable with) that allowed you to easily create your dialogs and link them to quests, and link your responses together, etc, etc --
Anyhow, I can explore this in further detail with you if you'd like ...