dialogue system?

Blitz3D Forums/Blitz3D Programming/dialogue system?

vivaigiochi(Posted 2011) [#1]
someone have some example?


jfk EO-11110(Posted 2011) [#2]
it's a rather complex issue, esp. with 3d mimics. usually not very portable custom solutions. if you study my system, it may give you an idea.


vivaigiochi(Posted 2011) [#3]
I post for dialogue system like zelda or paper mario where mimics is simplified at all. it's only text and some audio effects(without sinc or other complex...).i need that player talk with other and interact with the mission.Some examples in form of .bb or .bsl are welcome.


Kryzon(Posted 2011) [#4]
Think analytically about it.

What do you think you need for a message-box system?
It's basically three elements: the box\frame, the formatted text of the message and a symbol to indicate that a player action is allowed for the text to scroll or continue.
An optional fourth element is the portrait to be shown the player - it could be the face of the one who is speaking, as it is common with RPGMaker-made games.

Message box from Zelda - OOT:

Features:
- A borderless frame
- The action symbol (blue square)
- A portrait space, with the icon of the Ocarina
- Colored, formatted text


Framed message box from a RPGMaker game:

Features:
- Bad grammar...
- A gradient background
- Action symbol (the triangle at the bottom of the screen)
- Padded text (it doesn't simply start right at the edge of the frame)


Do you know how to reproduce these features? I'm sure you know how to draw and place graphics on the screen (if you don't, the Beginners Area is purposed for these kinds of discussions regarding the Blitz3D language).
For those features you don't know how to reproduce you need to search for code that does it or at least the logic behind it, and study it. Sometimes you can realize it just by giving yourself the time to think about what you are trying to do.

I think the feature of formatting text to a defined rectangle on the screen is the hardest by far. Out-of-the-box I really don't know how to do that, and I'd resort to the Code Archives in this website, the forum search and Google for any piece of logic and code I can find - doesn't really matter the language, as the logic is what's important - I would try searching for different terms: "format text, wrap text, word wrap" etc. I remember seeing postings in this website about it.

You need the initiative to look for reference material in various places, or you'll be facing these roadblocks throughout the entire development of your project.

Last edited 2011


vivaigiochi(Posted 2011) [#5]
Dear Kryzon, i was born at the center of Sicily(IT). We have invented the word calculus...and pitagora was an example. I know what you say. For example your features are only an override of PRINT function.
I need data structure and other example.
Hovewer i take your suggestion for the MESSAGE BOX SYSTEM. I will seek also for this...


Kryzon(Posted 2011) [#6]
I see. I hope you don't take offense when I explain it so basically because there are lots of people reading these posts and they might otherwise not understand what we're talking about.

If you want to strike up actions and events when the player hits 'action' close to an interactive element (a treasure chest, a sign on a wall, an NPC etc.), you need to detect when this happens.
This condition is valid when the player is close to the object, and when he hits the action key.
KEY_Space = KeyHit(57)
KEY_...   = ...

For In.Interactive = Each Interactive
	If EntityDistance(player, In\object) < EVENT_DISTANCE Then
           If KEY_Space Then TriggerEvent(In)
        EndIf 
Next

Function TriggerEvent( event.Interactive )
	RunScript(event\script) ;You can build a script system so that each NPC\object interacts differently with the player.
End Function
The core of your interactivity is not the detection of the event; it's the script to be run.
I explain more how I would make my script system over at the BMax forums, in this thread.


vivaigiochi(Posted 2011) [#7]
i'm not offended at all. I think you are ok when say:
Sometimes you can realize it just by giving yourself the time to think about what you are trying to do.
I will follow youe thread and sample.
if there are other example for a data structure they are welcome.


Kryzon(Posted 2011) [#8]
You're also welcome to post what you think is a good data structure for this kind of system, or what you're coding of it.
Then we can discuss on it to reach an efficient design.


Ross C(Posted 2011) [#9]
Funny you should mention this, I am building a dialog system in my interactive story book thingy me bob.

I am going for a different system, and probably not the right way to do it. Each character has an array, filled with strings of things they can say. At the end of each string, are tags, which the code reads:

<goto 5>
<question><yes><goto 8><no><goto 10>

When for instance the question tag is read, you can have two options. Yes and No (you can actually have it display whatever text you want, but it's built round two options) after the yes, is the number for the array slot, which the dialog will proceed from. I have an event tag also, whereby you can generate events, such as giving the character an item, taking it away, changing locations... etc etc.


_PJ_(Posted 2011) [#10]
I'm not sure exactly WHICH aspect you are needing help with, wehter it's the actual displaying of the box and text, the identification of what the text should be, or the means to deal with the players' responses.

However, if it helps, here's a suggestion for the various phrases that may be spoken according to progression in the storyline

Each NPC would have flag variables, these can represent the progress through particular quests or stages of the game.
For example:

QUEST_1_FLAG_VARIABLE=11

QUEST_1_FLAG_NO_QUEST=0
QUEST_1_FLAG_ACCEPTED=1
QUEST_1_FLAG_SPOKEN_TO_WIZARD=2
QUEST_1_FLAG_GONE_TO_SMOKY_MOUNTAIN=4
QUEST_1_FLAG_KILLED_DRAGON=8
QUEST_1_FLAG_TAKEN_DRAGON_HOARD=16
QUEST_1_FLAG_SIDEQUEST_FREED_VIRGIN=32
QUEST_1_FLAG_GIVEN_HOARD_TO_KING=64
QUEST_1_FLAG_SIDEQUEST_REUNITED_KING_AND_PRINCESS=128

**(More can be added using more than 1 byte. If more than 32 quest flags are needed, you can combine quests together, using QUEST_FLAG_2_VAR as well etc. Though since most quests would in theory only be "Accept Quest - Kill Monster - Take Treasure - Give Treasure To X - Return For Reward" or similar at most, A single byte per quest SHOULD be enough.

So there are up to 9 responses, depending on the number of parts of the quest.

QUEST_1_RESPONSES$[x]
QUEST_1_RESPONSES$[0]$="Will you help us? A dragon threatens the village"
QUEST_1_RESPONSES$[1]$="Maybe the old wizard could help?"
QUEST_1_RESPONSES$[2]$="The dragon nests up in the mountains"
QUEST_1_RESPONSES$[3]$="Back so soon? The dragon's still abroad!"
QUEST_1_RESPONSES$[4]$="I can't believe you killed the dragon!"
QUEST_1_RESPONSES$[5]$="You have the treasure! The King would love to see that"
QUEST_1_RESPONSES$[6]$="Back so soon? The dragon's still abroad!"
etc. etc.


Different NPC's of course may have different responses - The WIZARD themselves at #2 would perhaps say something else. So generally, each NPC could have 'stiock' answers, or simply default to #0, but those who are important will have an overriding output, so the wizard might say:

QUEST_1_RESPONSES$[1]$="You were wise to come to me. The dragon cannot be slain by normal weapons, only with the magical sword, Dragonslayer!"


_PJ_(Posted 2011) [#11]
Addition:

The bitwise technique allows for sidequests to be logged separately, and reactions to include those, even if the main quest has not been concluded, or vice-versa.
Quests with multiple paths can be plotted likewise, and NPCs reacting to te state of missions only depends on the missions they are interested in, rther than having EVERY NPC checking EVERY quest every time the PC 'talks' to them.


vivaigiochi(Posted 2011) [#12]
nothing. This info are ok but there aren't ideas born in my mind.
so give me other suggestion...