Archived

This topic is now archived and is closed to further replies.

Ahmad Farhan

Dialogue data structure..

Recommended Posts

Ahmad Farhan    122
hi this is the first time i''n posting here.. any help is appreciated.. i''m trying to design a text game that involves dialogue.. the dialogue is similar to those of baldurs gate and fallout where you select the answer from a number of options.. but i also want it to evaluate certain things before making an option avvailable(e.g. if you have a intelligence of more than 10 then only can you talk trash to the guy) and also different respond from the NPC if certain things are evaluated.(e.g the drug pusher won''t talk to the C if he joined the police).. my question us how do translate this into a database structure?? what attrributes and stuff... i''ve been thinking of this for a while but can''t think of a way.. please help if (sane==1) sanity++; else return 1;

Share this post


Link to post
Share on other sites
Palidine    1315
you might want to categorize your text somehow. add an extra field to each database row for things like "friendly" "trash talk" "hostile" etc

then you use a basic AI in the NPCs and character controll objects to determine which sets of responses/questions they have available.

and organize the questions for each character into some kind of tree of text. like

first encounter -> all posible questions

then at runtime you cull the "all possible questions" using the basic AI. so if the character is a cop an the NPC a drug dealer you instantly cull all the "friendly" questions.

that''s a start anyway. i''m sure there are TONS of ways to architect a solution

-me

Share this post


Link to post
Share on other sites
Ahmad Farhan    122
the problem is that there is so many things to evalute for different kind of NPC.. i was thinking of a attribute in the database that saves the stat to evaluate..
but i don''t how where to save the text since there is multiple version of the same text

if (sane==1)
sanity++;
else
return 1;

Share this post


Link to post
Share on other sites
Ahmad Farhan    122
here''s what i go a table called dialogue with dialogue id and checks that need to be done followed by the text that to be diasplay if the check was succesfull.


id-auto number
checks-text
check_value-integer
text_true-text
text_false-text

but still can''t figure out how to store the reply options...

Share this post


Link to post
Share on other sites
Kylotan    9870
Ideally, this is where you use something like a scripting language as it can handle all the conditional expressions and the like for you. Failing that, you''re going to have to find some way to store conditional checks with the text.

Some simple but awful-looking way would be to store a ''check number'' with each bit of text. If a bit of text has a check number, it calls Check(checkNumber) which has a big switch statement inside. It switches on the checkNumber and inside each case statement is the check you wish to perform. Then it returns true if the check was passed or false if it was not.

Ultima VII had a lot of branching and conditional dialogue, but that was all done in their internal scripting language, not from an external database. Basically, when you talked to someone, it performed all the checks and populated that NPCs conversation structure according to the results. You could approximate that by having a ''ConversationSetup'' function for each NPC, perhaps.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions ]

Share this post


Link to post
Share on other sites
Ahmad Farhan    122
thanx for the input i think your suggestion of check number is most suitable for me..
but if the game grows i don''t think that the big switch statement is effision...
i''ll try that for now..

what is involve in making a scripting language/engine to handle dialogue? is it worth the efffort??
any othersuggestion is welcome..
thanx


if (sane==1)
sanity++;
else
return 1;

Share this post


Link to post
Share on other sites