Pages: [1]
|
|
|
Author
|
Topic: Scripting The Dialog System (Read 3089 times)
|
JonoPorter
Enlightened
Offline
Gender:
Posts: 656
Don't mess with the US.
|
For a while now I have been trying to design and implement a dialog system that will be able to do all the conversations in UQM without anything being hard-coded. So far I haven’t had much success since each time I get the design to a demo form I find something done in UQM that throws it off. I also want it to be rather simple and easy to edit. So I decided to ask for some input from the devs. If you were to try to make UQM’s dialog logic to be non hard-coded how would you go about this task?
Would you want to transfer the logic to some kind of scripting language?
Would you want to use OO programming?
|
|
|
Logged
|
|
|
|
|
|
Death 999
Global Moderator
Enlightened
Offline
Gender:
Posts: 3874
We did. You did. Yes we can. No.
|
What difficulties are you having?
As far as I can tell, all you should need are:
1) string set (flags) 2) string-> integer map
Both of which are readable and writeable by conversation, and are maintained persistently.
When you enter conversation, the engine loads the map with your current position, position in-system (if applicable), position in planetary system (if applicable) and the date and the composition of your fleet and what modules you have. These last can be encoded in integers, even if there is no obvious mapping.
When the conversation is over, the engine checks to see if any of these have been changed.
This should cover the cases like being given ships, being moved from one place to another, time elapsing, and so forth.
What else tripped you up?
|
|
|
Logged
|
|
|
|
JonoPorter
Enlightened
Offline
Gender:
Posts: 656
Don't mess with the US.
|
My main problem was that I was programming it so all actions could be handled in a fashion where I would not use scripting. But I was not able to design a system capable of handling all the actions that can be done. So I have decided to redesign it with scripting as a primary component. My main reason for trying to do that way was I wanted the whole campaign to be created from a nice GUI app.
|
|
|
Logged
|
|
|
|
Death 999
Global Moderator
Enlightened
Offline
Gender:
Posts: 3874
We did. You did. Yes we can. No.
|
It seems to me that the script is one of the things in which scripting is least of a problem.
|
|
|
Logged
|
|
|
|
|
guesst
Enlightened
Offline
Gender:
Posts: 692
Ancient Shofixti Warrior
|
Bioslayer, I love you, you know I do. However, I still think you've bitten off more than you can chew. First and foremost make a little game with hard-coded game logic. Get SOMETHING done. Then, once you've done that and understand what a scripting system would require, the intricies and interconnectedness of all things, then try to make a scripting system.
That's my 2 cents.
|
|
|
Logged
|
|
|
|
Death 999
Global Moderator
Enlightened
Offline
Gender:
Posts: 3874
We did. You did. Yes we can. No.
|
With my own game-design work, I've found it's actually quite easy to devise a scripting system.
Consider a conversation node 'foo'. Now, node foo has several conversation options. If you say the option labelled 'bar', then you never again get to say 'bar', and some global flag is set. If you say 'quux', you go to a different node.
Here is how I would represent all this in my quick and dirty scripting system.
node foo bar baz quux # the various conversation options. Whether each one is visible is determined below.
#options for option 'bar'. The foo means after doing this conversation option, the game returns to this conversation node. The !bar means that if the 'bar' flag has been set, this option will not appear. The +bar means that if this is taken, the bar option is set. bar: foo !bar +bar # What you say as part of bar We are the Humans, from Earth # what they say as part of bar We are the Supox Utricularia, from Earth
# options for option 'baz'. foo means the same it did last time. =bar means this won't appear unless the bar flag is set. In other words, this is for the second time you say the same thing. baz: foo =bar We are the Humans, from Earth We heard you the first time.<br>We are still the Supox Utricularia, from Earth
#options for option 'quux' quux: biff Mmm... broccoli! WTF? I used a system very similar to this one for a FF knockoff I've been working on. It's surprisingly flexible, especially when you allow more general consequences and conditions like +cash:20 (gives 20 zorkmids), -cash:30 (takes away 30 zorkmids), ship:overworld15,20 (moves the ship on the map 'overworld' to square 15, 20), +item:wooden_sword (gives a wooden sword), =item:wooden_sword (checks for posession of a wooden sword), etc.
If you want to have variables presented as text (your credit with the trader), that could be indicated by $key_in_that_integer_map, for example
$melnorme_credit which retrieves the value stored in the melnorme_credit variable. you could change it by using +melnorme_credit:30 or some such construction.
I haven't done that, but that's just because I decided to make stores and such a separate behavior than conversations.
|
|
« Last Edit: October 08, 2006, 07:58:10 pm by Death 999 »
|
Logged
|
|
|
|
ahref
Zebranky food
Offline
Posts: 6
|
i am also looking at coding a dialog system like the one from star control 2 and havent had much luck but can say :
the method in the source of UQM is very messy
|
|
|
Logged
|
|
|
|
Pages: [1]
|
|
|
|
|