Changing the dialog system - How should I do this?

Started by Tozy, Mon 10/10/2011 07:30:22

Previous topic - Next topic

Tozy

Hello everyone! I don't come here very often, but now and then I decide to use AGS for a game and all your posts here in this foum are alweys very usefull, thanks!

However, this time I have a very specific question.

I want to change the dialog system, and I don't know what parts of the engine can I make good use of.

The idea is that instead of waiting for an scripted dialog to pause and then choosing from a set of options, the player could choose from some options at any time. All dialogs should be of the "background" kind. I mean, you can start speaking at any time, even if the interlocutor is still saying something. And options should appear and disappear at certain times, based on the changing topic of the dialog.
Also, the character should be able to walk away in the middle of a conversation without saying good bye (that's why I say that speech should be always "background").

Well... I think I could use the very dialog system or maybe something else. I guess I'll create my own GUI for this. I've downloaded the State Machine "module". I could use that, but it will probably get too big in just a few minutes of conversation.

Excuse my Engrish (feel free to point me out my mistakes). I can try to explain it better if it's not clear enough.

Also, let me tell you that I have some programming skills. If necessary, I can code a solution without AGS tools...

Snarky

Interesting question. I think it's a bit beyond a "beginners" question, though...

Anyway, I don't think you can use the built-in dialogue system. Once the dialogue options are displayed, there's no way to make them go away again except by making a selection, and that seems like a dealbreaker for what you describe.

The State Machine module is probably a good place to start in order to build your own dialogue system, and with a few helper functions to tailor it more directly to your needs, dialogue writing shouldn't be much more verbose than in the built-in system.

monkey0506

I recently posted to find out if anyone's aware of a reason why you can't stop dialogs more generically. If you could then using the custom rendering options, repeatedly_execute_always, and Character.SayBackground it would be simpler to accomplish this, but unfortunately that would require a change to the engine.

I can't say too much more than what's already been said on the method, but let me know how the module works out for you. :)

Tozy

I downloaded many dialog modules, but none of them seem to do what I want... now I'm thinking about it from another point of view.

I could use a context-sensitive verb coin, where the verbs change according to the hotspot and the statete of the hotspot (like in the game Return to Zork, wich I discovered searching this forums). But I don't know how should I do this, or if it hasn't already been done.

The State machine module should be useful either way. I still haven't tried it, though.

Edit: It doesn't even need to be a verb coin as long as the verbs change.

hedgefield

I built the system you describe in your first post a while ago. It was possible to walk around and interact with the environment all during dialog, interrupting people and all. However the problem with a system like that is that when all speech is done in the background it is impossible to play animations or trigger blocking interactions as they will skip over any speech that is queued up. I feel like there might be a way around it but I was using the QueuedSpeech module as the backbone for the system and as I did not write that module I have no understanding of the possibilities of such a workaround.

monkey0506

#5
The QueuedSpeech module was originally based on some code by Scorpiorus (sp?) and the basic idea was that you would just store the speech lines in an array and then display them at the appropriate times. I haven't looked back at that module's code recently, but I seem to recall it having a Pause method, which could be used to prevent the queue from being cleared while you're doing other blocking interactions, then you could UnPause the queue...

However, as for doing anything blocking during a dialog (from character speech to interactions) that's not currently possible because the dialog itself is running on the blocking thread, and you can't run multiple things on that thread at once. You would have to replace the built-in dialog system altogether for that (which it seems is already going to be done anyway), and make it run in the non-blocking thread (in which case you wouldn't have to "work around" and avoid blocking calls).

And while we're all in the process of bringing up modules that I've written... ::)...my Verbcoin module actually provides the possibility to dynamically replace the "action text" of a given button on a per-(character/hotspot/inventory item/object) basis. Then you could just change the text based on the current context of the associated item as needed. (This is actually different than the method used by Electroshokker's template, which relies on custom properties, which are read-only at run-time. My module would allow the given context to change more dynamically.)

hedgefield

Oh yeah I forgot to mention I did build a non-blocking custom dialogue system to go with what I described above. I actually used PauseQueue to make it possible to interrupt NPC's when you click on a hotspot mid-sentence, but I never considered pausing the queue right before an animation or some such. I think that was because I wanted the characters to keep talking while they did stuff, but it might be worth looking into, thanks Monkey.

Tozy

Well... it's a long way ahead, but I think I'm figuring this out.
I'm using LeKhris's code now (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=31253.0 if he reads this, thank you very much! You'll be in the credits xD). Gladly, I got the think half chewed, I just need to work it out a little more and it will be working as I suppose it did in his game. Then I have to change everything and improve it to make it look like I wanted in the first place (adaptate for dialogs, add the state machines, etc.).

I have a little problem now. I need to make some variables global and the Global Variables don't have an option for these types:
Hotspot* hs;
Object* obj;

Using import in the heder doesn't seem to work either.
The error is "Undefined token 'hs'" in a module called GotThere (I don't remember where did I get it). Maybe this has to do whit the module being above the global script (?)

And tell me if I should create a new thread or if it is ok to continue posting here.

Khris

#8
I wrote the GotThere module, but it doesn't use those global variables.

Anyway, to create a global pointer:

Code: ags
// header
import Hotspot*hs;

// script

Hotspot*hs;
export hs;


The script with these lines and every one further down the tree can see and use the pointer now.

(Btw, the code for the verb menu is badly obsolete, for one it still uses GlobalStrings. I would recommend studying it, then reimplementing the method using proper, current code.)

SMF spam blocked by CleanTalk