The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
November 13, 2019, 01:38:18 pm
Home Help Search Login Register
News: Paul & Fred have reached a settlement with Stardock!

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  General UQM Discussion (Moderator: Death 999)
| | |-+  Scripting The Dialog System
« previous next »
Pages: [1] Print
Author Topic: Scripting The Dialog System  (Read 2379 times)
JonoPorter
Enlightened
*****
Offline Offline

Gender: Male
Posts: 656


Don't mess with the US.


View Profile WWW
Scripting The Dialog System
« on: September 25, 2006, 08:45:50 am »

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 havent 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 UQMs 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

There are none so blind as those who will not see. Jonathan Swift

My Remake of UQM.
My 2D physics engine
Both are written in C#.
OOPMan
Zebranky food
*
Offline Offline

Posts: 44



View Profile
Re: Scripting The Dialog System
« Reply #1 on: September 25, 2006, 09:08:23 am »

A scripting engine might be best. However, it could be difficult to implement, as the game was never designed with this in mind (Kinda like network play...)
Logged

"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI
Novus
Enlightened
*****
Offline Offline

Gender: Male
Posts: 1938


Fot or not?


View Profile
Re: Scripting The Dialog System
« Reply #2 on: September 25, 2006, 09:47:28 am »

If you were to try to make UQMs 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?
The only real reason I can think of to do this would be to allow greater flexibility in modding (i.e. don't need to recompile UQM to change dialogue); translations should work fine with unmodified dialogue logic. For similar reasons, one would probably want to move the entire adventure game logic (triggers, items, et.c.) into something easily modified.

Python and Perl, for example, integrate quite well with C (and C++) programs and would be naturals for moving functionality out into an interpreted (or at least pseudo-interpreted; many implementations of these are just-in-time compiled) language. Civilization 4 (warning: Flash- and music-heavy official site) uses Python for most of the gameplay rules and part of the UI, and I prefer Python's syntax over Perl's.
Logged

RTFM = Read the fine manual.
RTTFAQ = Read the Ur-Quan Masters Technical FAQ.
Death 999
Global Moderator
Enlightened
*****
Offline Offline

Gender: Male
Posts: 3830


We did. You did. Yes we can. No.


View Profile
Re: Scripting The Dialog System
« Reply #3 on: September 25, 2006, 04:30:09 pm »

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 Offline

Gender: Male
Posts: 656


Don't mess with the US.


View Profile WWW
Re: Scripting The Dialog System
« Reply #4 on: September 28, 2006, 08:00:43 pm »

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

There are none so blind as those who will not see. Jonathan Swift

My Remake of UQM.
My 2D physics engine
Both are written in C#.
Death 999
Global Moderator
Enlightened
*****
Offline Offline

Gender: Male
Posts: 3830


We did. You did. Yes we can. No.


View Profile
Re: Scripting The Dialog System
« Reply #5 on: September 29, 2006, 04:05:51 pm »

It seems to me that the script is one of the things in which scripting is least of a problem.
Logged
Deus Siddis
Enlightened
*****
Offline Offline

Gender: Male
Posts: 1387



View Profile
Re: Scripting The Dialog System
« Reply #6 on: September 29, 2006, 04:17:27 pm »

Quote
My main reason for trying to do that way was I wanted the whole campaign to be created from a nice GUI app.

That would have been interesting, almost a game in itself that is about creating other games. I can also see how that sort of a system would be very difficult to design, though.
Logged
guesst
Enlightened
*****
Offline Offline

Gender: Male
Posts: 692


Ancient Shofixti Warrior


View Profile WWW
Re: Scripting The Dialog System
« Reply #7 on: October 04, 2006, 11:54:04 pm »

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

A new game and it's code each week. Please visit Cymon's Games
Death 999
Global Moderator
Enlightened
*****
Offline Offline

Gender: Male
Posts: 3830


We did. You did. Yes we can. No.


View Profile
Re: Scripting The Dialog System
« Reply #8 on: October 05, 2006, 03:52:32 am »

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.

Code:
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
Code:
$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 Offline

Posts: 6



View Profile
Re: Scripting The Dialog System
« Reply #9 on: November 02, 2006, 10:48:47 pm »

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] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!