Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dialogues [2020/11/06 11:57] – [Events] admin | dialogues [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Dialogues ====== | ||
- | {{:: | ||
- | |||
- | A huge topic in game and multimedia app development is good and none-redundant dialogue or conversation management. With Gorilla3D you have an easy-to-use component which is also able to handle complex conversations. | ||
- | |||
- | ===== Features ===== | ||
- | |||
- | * Complex & flexible design in tree structure | ||
- | * (Un)lockable items | ||
- | * Crosslinking of items possible | ||
- | * Set question, answer or floating item display time - for fast-reaction games | ||
- | * Design of dialogues & monologues with colloquist information | ||
- | * Multilingual system easily definable | ||
- | * Auto-language selection | ||
- | * Set variables to implement gaming elements | ||
- | * Set parameters to interact back with your game/ | ||
- | * Events for: showing text and images, playing audio, video and animations, executing method calls, property settings, redirection & more | ||
- | * Events with different scopes: dialogue item, UI-element, gaming element | ||
- | * Pause, stop and skip dialogues and items | ||
- | * Storable as single or multiple dialogue files/ | ||
- | * Storeable in xml format | ||
- | * Loadable from xml file/stream | ||
- | * Readable and understandable xml format, to outsource design & management of dialogues. | ||
- | * Fully customizable in Delphi | ||
- | |||
- | ==== DialogueDesigner ==== | ||
- | |||
- | We already built a helper tool for you to setup dialogues by a flow chart editor. | ||
- | |||
- | * Create dialogues, items and events simply by drag & drop | ||
- | * Move, rearrange and delete items & events | ||
- | * Configure every dialogue, item and event in detail | ||
- | * Treeview for easy dialogue navigation | ||
- | * Preview dialogues in sandbox viewer | ||
- | |||
- | ===== TGorillaDialogueSystem ===== | ||
- | |||
- | The dialogue system is the basis component for setting up and manage multiple dialogues/ | ||
- | Imagine the dialogue system as a hierarchy, which is able to jump between leaves (items) and execute events, to playback animations, sounds or execute scripts: | ||
- | |||
- | DialogueSystem | ||
- | - Dialogues | ||
- | - Characters (conversation partner) | ||
- | - Items (Textfragments of conversation) | ||
- | - Events (do something) | ||
- | - Variables | ||
- | |||
- | To start setting up a system, a few properties are important to know: | ||
- | |||
- | ^Property ^Description^ | ||
- | |Id|Unique id for a specific dialogue system. On creation automatically a random id will be generated, but it's possible that this id is not unique. The user should take care, that this id is unique!| | ||
- | |Language|Defines the currently used language by id. This property affects auto language map handling for items and events.| | ||
- | |Dialogues|A collection of available dialogue instances.| | ||
- | |Variables|A hashmap of < | ||
- | |||
- | Simply set up a dialogue system at runtime like in the following code snippet: | ||
- | |||
- | <file pascal> | ||
- | uses | ||
- | Gorilla.Utils.Dialogue.System; | ||
- | |||
- | [...] | ||
- | |||
- | FDialogueSys : TGorillaDialogueSystem; | ||
- | FDialogue : TGorillaDialogue; | ||
- | |||
- | [...] | ||
- | |||
- | // create a dialogue system on our form (its a none-visual component) | ||
- | FDialogueSys := TGorillaDialogueSystem.Create(Self); | ||
- | |||
- | // create a new dialogue | ||
- | FDialogue := FDialogueSys.Dialogues.Add() as TGorillaDialogue; | ||
- | </ | ||
- | |||
- | ===== Conversation (TGorillaDialogue) ===== | ||
- | |||
- | A TGorillaDialogue instance is a single closed conversation. So if you want to have a dialogue between character A and B this is the point to start. | ||
- | A TGorillaDialogue manages items and characters. An item can be seen as a text-fragment in your conversation but is much more. A character is a helper structure to organize your conversation. Because it's always important to know who is speaking. Besides this simple fact, a character is used as variable, which can be accessed. | ||
- | |||
- | As you've seen above, you add a new dialogue by adding a collection item in the TGorillaDialogueSystem.Dialogues collection. | ||
- | In the next step we should add two characters for our conversation partners, which is also done by adding a collection item. You can of course add more than 2 characters, but to keep it simple, we'll stay here with A and B. | ||
- | |||
- | <file pascal> | ||
- | FCharacterA := FDialogue.Characters.Add() as TGorillaDialogueCharacter; | ||
- | FCharacterA.Name := ' | ||
- | |||
- | FCharacterB := FDialogue.Characters.Add() as TGorillaDialogueCharacter; | ||
- | FCharacterB.Name := ' | ||
- | </ | ||
- | |||
- | Once you've done that, we can start adding our text fragments. | ||
- | |||
- | ===== Text-Fragments (TGorillaDialogueItem) ===== | ||
- | |||
- | A text fragment is an entity representing a snippet of a conversation or monologue. | ||
- | In most cases its a phrase, a sentance or longer text passage spoken by a single character. | ||
- | So the main duty for setting up a conversation is to split it up the complete text into parts or so called items. | ||
- | |||
- | A TGorillaDialogue and a TGorillaDialogueItem are both inherited from TGorillaDialogueParentItem, | ||
- | |||
- | < | ||
- | Dialogue | ||
- | "Hello World!" | ||
- | "How are you?" | ||
- | " | ||
- | </ | ||
- | |||
- | The example above will playback the text fragments in order: | ||
- | - "Hello World" | ||
- | - "How are you?" | ||
- | - " | ||
- | |||
- | Each item also has the possibility to register events to control the text flow. | ||
- | Those events allow the dialogue system to handle even complex conversation flow. | ||
- | What events can do for you, you can read further below. | ||
- | |||
- | ^Property ^Description^ | ||
- | |Kind |Currently the following item kinds are supported: Question, Answer, Flow, Reference| | ||
- | |DisplayName|This value should be unique, but is managed by the user| | ||
- | |Character|Defines a linked character. If DisplayName is not set, but a character is defined, the component will return the characters name as display name.| | ||
- | |Reference|In case the kind is set to TGorillaDialogueItemKind.Reference, | ||
- | |DisplayTime |Defines a time, for how long an item is going to be displayed, before it gets automtically skipped by the system.| | ||
- | |Text |The hashmap is a list of << | ||
- | |Events |Returns a collection of item events.| | ||
- | |||
- | ==== Kinds of items ==== | ||
- | |||
- | A dialogue seldomly is just a text flow. You nearly always will have questions, answers to choose from or points to which to return to. | ||
- | Our dialogue system allows to configure those variations easily. | ||
- | |||
- | ^Kind ^Description^ | ||
- | |TGorillaDialogueItemKind.None|undefined kind - should never be set| | ||
- | |TGorillaDialogueItemKind.Question|A text-fragment marked as question. This will load up sub-items as possible answers to choose from.| | ||
- | |TGorillaDialogueItemKind.Answer|Text-fragments marked as possible options to choose from. The parent item should be a question item.| | ||
- | |TGorillaDialogueItemKind.Flow|A default text-fragment, | ||
- | |TGorillaDialogueItemKind.Reference|A reference item is used as dummy fragment to forward to another item. Use this to jump at specific text-fragments in your dialogue. For example if you want to reask a question.| | ||
- | |||
- | ===== Events ===== | ||
- | |||
- | Events in items allow interaction with your game and to control the text flow of the conversation. | ||
- | |||
- | <file pascal> | ||
- | LItem : TGorillaDialogueItem; | ||
- | LEvent : TGorillaDialogueItemEvent; | ||
- | |||
- | [...] | ||
- | LEvent := LItem.Events.Add() as TGorillaDialogueItemEvent; | ||
- | LEvent.Kind := TGorillaDialogueEventKind.Text; | ||
- | LEvent.Trigger := TGorillaDialogueEventTrigger.OnBegin; | ||
- | </ | ||
- | |||
- | A few configuration properties allowing you to setup an event for many purposes: | ||
- | |||
- | ^Property ^Description ^ | ||
- | |OwnerEvent |It is possible to execute events by another event. For example for animations, where you have a starting and finish event. | | ||
- | |Kind|Defines the kind of event. Supported types are: Text, Image, Audio, Video, Animation, Method, ObjProperty, | ||
- | |Trigger |Defines the moment of event execution. Supported types are: OnBegin, OnEnd, OnTimeout| | ||
- | |Scope | A scope should be a component name or a dialogue item ident. Which value to be used depends on the kind of event.| | ||
- | |Data |Defines the multilingual data container. Use this property to define language specific texts, f.e. for displaying a text event.| | ||
- | |Iterations |If the property is set to zero, functionality is disabled. Values larger than zero, perform iteration checks inside Execute() method.| |