Dialogue System Template (Templates)

Discuss Scirra's 2D Asset Store

Post » Tue Dec 05, 2017 5:36 am

adelwich wrote:I noticed that there are some sample files in the early part of this message thread, and that's exactly the sort of thing I need to find. Unfortunately, those links are no longer functional.


I have a simple example, but @magistross does not want us to post them. (Rightly so, because it would give away his template.)

In the example, I started with the demo, I stripped away all the unneeded utility objects and events, created 3 buttons on the layout to call different dialogues, I added events to load the example dictionary and some events for UI controls for the dialogues when they are in progress, the UI controls are simple, not foolproof, but they work with mouse and keyboard. Pretty simple. I think you can get it from this example.

Also see the 'cheat sheet' post in this thread that I did about the commands for the dialogues.

Image
B
42
S
17
G
14
Posts: 133
Reputation: 10,350

Post » Tue Dec 05, 2017 4:15 pm

@adelwich The most useful post for installation is my first reply in the thread. I will quote it here for your conveniance :
Magistross wrote:Here's the breakdown of what you should do :

1. Copy these objects to your project (an event-less layout works wonder, like the "Dummy" layout) : ContinueIndicator, PortraitSprite, SpriteFont, WindowFrame
(edit: Version 1.02 now needs additional objects : UpArrow, DownArrow, ChoiceSelector)

2. Create these objects and name them like so :
1 Array Object named "DialogueData"
1 Dictionnary Object named "DialogueDictionary"
1 Dictionnary Object named "DialogueCommands"
1 Dictionnary Object named "GameVariables" (this is where you game should store its variables, so that dialogues can fetch them)
1 Function Object named "Function" (default)
1 Browser Object named "Browser" (default)
1 Audio Object named "Audio" (default)

3. Create a new event sheet, and copy over all the content from the "DialogueEvents" sheet from the template. If all objects were correctly copied / created, it should give no error message. (per @haddy22 's remark, variables should be copied over before other events, so doing it in chunks might be better)

4. Include this new event sheet inside whatever layout where you want to use the system.

5. Be sure to have a "HUD" layer in all your layouts where you need dialogues. (You can also define your own layer by changing the "DIALOGUE_LAYER" constant)

6. You can then initiate a dialogue with the "Dialogue_StartDialogue" function. It will start a dialogue with the data currently in the "DialogueData" array, or you can also provide a "key" parameter, it will then load the dialogue from the "DialogueDictionary" and start it. An AJAX call to retrieve either an array or a dictionnary JSON will most likely be needed.

Please let me know if you need further help !

edit: User mikal tried to import the template in a C3 project and found out that additional work must be done.

@mikal wrote:Porting to a project in Construct 3 took a few extra steps (I suggest editing the top post to include this).

The sample project works fine, to include the template into an existing project takes a little more work.

Since the current version of Construct 3 Beta (r66), does not seem to support copying between projects (Ashley turned it off when it was causing problems), you cannot copy the following objects from the template project to a new project, so you must create them (for example in Dummy layout) and then copy over the 'Animations' as needed from the original sprites in the template project.

ContinueIndicator (sprite)
PortraitSprite (sprite with multiple animations from default test case)
SpriteFont (sprite font, add instance variable type string: 'ID', 'choiceFork')
WindowFrame (9 patch, add instance variable type string: 'ID')
UpArrow (sprite)
DownArrow (sprite)
ChoiceSelector (9 patch, add instance variables type string: 'callback', 'params')


Mikal also provided a nice barebone event sheet screenshot that should get you started. Thanks Mikal!
B
76
S
31
G
27
Posts: 1,015
Reputation: 20,790

Post » Tue Dec 05, 2017 4:23 pm

Also, I think we can remove the C3 workarounds, C3 has been updated and you can now copy between projects again.
B
42
S
17
G
14
Posts: 133
Reputation: 10,350

Post » Tue Dec 05, 2017 5:06 pm

Edited the post in question, but kept the workaround in my previous quote, for posterity.

Thanks again @Mikal for being on the lookout!
B
76
S
31
G
27
Posts: 1,015
Reputation: 20,790

Post » Tue Dec 05, 2017 8:14 pm

Thank you @mikal and @magistross. I will circle back if I have any questions. :)
B
10
Posts: 25
Reputation: 406

Post » Tue Dec 05, 2017 8:38 pm

This is starting to make more sense, but I am struggling with the big picture. Imagine that I'm a hobbyist game developer who hopes to use this dialogue system as part of an interactive novel. Can you help me understand how all of the pieces fit together? These are my questions:

1) I realize that I should use the layout named UTILITY to create the game dialogues, and I have noticed that it is possible to export this information as a JSON file that is loaded into a dictionary or as a CSV file. Is there any reason that I should favor JSON over CSV or vice versa?

2) How much of the branching logic can be handled with the fork elements of the dialogue system template, and how much of the branching logic should be stored in the CAPX itself? In the C3 dialogue template example image, there are three buttons used to fire individual bits of a dialogue. I'm assuming that the buttons are hardwired in this way to demonstrate *how* the system works. (Which is exactly what I asked for.) In a larger game, would you recommend that all subsequent calls to dialogue sequences be handled internally through use of the fork command?

3) I'm trying to figure out the best way to articulate this question, so I apologize if it is confusing. Trying to wrap my hand around how the overall game loop will work when using this system. In the image titled C3DialogueTemplateExample.png, it seems that the dialogue is triggered after the layout loads, and then the user is being handled by the logic of the dialogue template. But what happens if the user reaches a point where they want to exit dialogue mode and do some other things before returning? For example, what if it were an RPG game and the user were to wander off and battle some slime molds before returning to town and entering into the dialogue mode. How does the dialogue system get reactivated? Would I need to load an entirely new dialogue dictionary? Or would I use variables stored in the Game Dictionary to keep track of the user's progress through the game, and just use that information to restart the dialogue template with the appropriate sequence?

Thanks for your patience, and for the helpful resources. The image is very useful, as is the list of dialogue commands.
B
10
Posts: 25
Reputation: 406

Post » Wed Dec 06, 2017 7:47 am

OK, here's a big question for you @adelwich : what is your intent?
  • Have students create a game engine which can then be used to create an interactive novel? If so C2/C3 is a good basis for the work to create an engine and then create an interactive novel. There will be a bit of work involved, but very doable. They will need to learn game design, UI design, etc. and then do all the content.
  • Have students create an interactive novel, the focus being on the content of the novel? In that case I would just start with an interactive novel engine like https://www.renpy.org/ and have the students focus on script, art, content rather than engine development.
B
42
S
17
G
14
Posts: 133
Reputation: 10,350

Post » Wed Dec 06, 2017 3:53 pm

Hi @Mikal. The answer is "neither."

I'm using Construct for the second time in a college class titled "mobile gaming." Although some of the students have experience with other programming languages, the course begins with the assumption that people don't have any formal training in computer programming. We start out by creating animations with Adobe Animate, we transition into fundamental programming concepts with Code Combat, and then we spend the rest of the semester creating games with Construct. Along the way, students read scholarly and applied articles about game design. We talk about user interface design, tutorial levels, game design documentation, game narrative, the importance of choice in games, the role of randomness in games, and -- of course -- graphic/visual design.

These students have already used Construct to create their own platform games, and they are currently working on individual final projects. Some students are creating their own riffs on familiar game templates (e.g. tower defense games or top-down shooters), and two students are interested in creating games that involve a dialogue component. I think both of these students are inspired by Japanese otome and visual novels. In an ideal world, I might point the two students toward a different platform for authoring interactive fiction, but -- considering the time constraints and the nature of the assignment -- for now we are using Construct.

Since these are small projects of modest scope, it is certainly possible for students to brute force the dialogue trees. I had hoped that this could be an opportunity to teach them more about arrays, dictionaries, and ways of storing/retrieving data from an external file, but -- considering that they are now in the throes of finals week -- a brute force solution might be the most sensible option.

I don't want students to create a game engine for handling narrative content, and was hoping that the dialogue system would be a friendly, well-documented template that they could easily pick up and run with. Don't get me wrong: the dialogue system is awesome and worth every penny. It's just that the system might not be an ideal educational tool for beginners. In order to explain how the system works to the students, I need to fully grasp the big picture of how the various parts interact, and those big picture interactions are still fuzzy to me.

I can't send you a private message yet, but -- if you message me -- I might be able to attach a copy of the course syllabus in my reply message. You can see examples of the students reflecting on their platform games at: gamesclass2017.wordpress.com

Thanks!
B
10
Posts: 25
Reputation: 406

Post » Wed Dec 06, 2017 7:47 pm

OK, @adelwich I'm with you, I see where you are going with this. I think this is all doable with the Dialogue system and not too tough. See my sheet for how to get going. @magistross gave all the details on setting things up. To create the json, you can use the utility, or do it by hand with csv (or if you really want, I can send you the Parser I wrote that takes in text files and spits out JSON, see details earlier in the thread, but I don't' have time to do tech support for it.)

Use the dialogue trees you create in the utility to have choice and forks in the dialogue and then set Gamestate variables if a choice will make other conversations change (e.g. which dialogue is started when you talk to the king after you have insulted the queen, triggered by an event where you click on the queen) These Gamestate variables can be created and set through dialogue commands, see the cheat sheet for how to do it.

If it's just a short game put all the different dialogues into one JSON file, so you only need to load it once per layout.

I really enjoyed reading the writeups from the students, espeically the 'reflections', well done!
B
42
S
17
G
14
Posts: 133
Reputation: 10,350

Post » Thu Dec 07, 2017 5:48 pm

I'm glad you enjoyed reading the class blog postings, @Mikal! Thank you also for answering my questions. I'm diving back into this now and will resurface if I have any additional questions. Thanks again!
B
10
Posts: 25
Reputation: 406

Previous

Return to Scirra Store

Who is online

Users browsing this forum: No registered users and 4 guests