# Welcome To Part 2! <a href="https://www.youtube.com/watch?v=4mDk_p6UUao" target="_blank"> <img src="https://narrativeflow.dev/DocsImages/Walkthrough%20Part%202%20Video%20Thumbnail.webp" alt="Walkthrough Part 2 Video Thumbnail"> </a> In the previous part of our NarrativeFlow walkthrough, we learned the basics of how to use NarrativeFlow to design your incredible narrative. In this second "intermediate" part, we'll discover: - The remaining Node types (Probability, Function, Connector, and Comment) - How and where to write notes, reminders, and direction in your project - How to define Node Properties - How to define and use custom text styles - How to search for Nodes (including how to search for TODO notes, properties, etc.) - How to create and use Node bookmarks - And how to create and use Node Presets (very powerful and time saving!) I'm just as excited as you are to learn how to speed up your workflow, so let's buckle up dive in! ## The Probability, Function, Connector, and Comment Nodes ### The Probability Node If you want your narrative to have elements of "randomness", it'd be pretty difficult (or at the very least inconvenient) without the Probability Node. The Probability Node allows you to define any amount of outputs (routes) and assign a "weight" (the likelihood that route will be taken) to each. Let's create a Probability Node now and discover how it works. After creating the Node, you'll see that, by default, it has two routes/outputs, with a default weight of `1` for each route. ![[01 - Probability Node.webp]] Open the Probability Node in the Node Editor and let's configure it. ![[02 - Probability Node Editor.webp]] By default, which route is taken is determined by a "weighted random" algorithm. Basically, higher weights have a higher likelihood of being chosen as the route to take. So, for example, let's say you want your narrative to have two branches, with the first being taken most of the time, with the second being a "secret" or simply less likely chance. This is easily done with the Probability Node: If we set the first branch's weight to `10` and the second to `1`, the first branch will be chosen 90% of the time, and the second branch will only be chosen 10% of the time. This could easily allow you to create secrets in your narrative that only a few player's will experience, or even "roguelike" narrative. NarrativeFlow doesn't restrict you to just static numbers though. We can also insert a variable into the weight field, and at runtime, the value currently held by that variable will be used instead. Using our example above, let's say we've already defined a variable called `[ChanceToSeeSecretNarrative]` that has a default value of `1`. Yet, elsewhere in our narrative, depending on choices that the player makes, the value of this variable can increase (or perhaps even decrease), giving the player a higher (or impossible) chance of experiencing that narrative branch. ![[03 - Probability Node Editor With Variable.webp]] > [!warning] > By default, if the content of the weight field cannot be directly evaluated as a number (such as words), that route won't be considered as valid, and will therefore never be taken/chosen. > > As long as you're only using variables that contain numbers or simply using numbers themselves, you'll be totally fine. ### The Function Node The Function Node is an extremely powerful Node that allows you to signal to your game engine to do something (anything, really). ![[04 - Function Node.webp]] You can update, change, or do something completely disconnected from your narrative while in the middle of a chain. If this seems overwhelming or like a feature you won't need, don't worry, you can safely skip this section and move onto learning about the Connector Node. Function Nodes and defining what they do in your game engine is an advanced feature, and can be incredibly useful and powerful for those who need it. Don't feel bad though if you don't need it. Powerful, dynamic narrative is more than possible without using the Function Node. Let's start with an example: Let's say you want to transition which scene your player is currently in (i.e. you need to load a new scene in your game engine). This is something that your game engine has to do, not NarrativeFlow, so how do we accomplish this? First, create a new Function Node and open it in the Node Editor. ![[05 - Function Node Editor.webp]] Editing the Function Node is pretty simple. There's just one field, called the "Statement", with the label "Code function to invoke". When your game engine gets to this Function Node, the statement is the "signal" that tells it what to do, as well as contains any information that it needs. Since we want to signal our game engine to transition the current scene, we could define our statement something like this: `LoadScene: OtherScene`. Then, when our game engine gets the statement, the game engine can parse the statement for both what we want it to do (load a scene) as well as any relevant information (such as which scene to load: `OtherScene`). Note that NarrativeFlow doesn't make you conform to a specific way to define your statements. You have the freedom to design and define your statements however is most convenient to you, however is easiest for you to parse and react accordingly in your chosen game engine or programming language. So, for example, we could define our above statement in many different ways: - `LoadScene(OtherScene)` - `LoadScene - OtherScene` - `Hey Game Engine, It's Time To Load OtherScene` ### The Connector Node When designing your narrative, especially when it's complex, it's pretty common to have crossed wires, loops, and tangled webs of links. To help organize your links and clear the visual noise and confusion, NarrativeFlow provides Connector Nodes. Connector Nodes are just simple nodes that allow you to organize your links and Nodes more elegantly. They're just for visual convenience and have no effect on your narrative. Let's create one now and see how it works. ![[06 - Connector Node.webp]] In their default state, Connector Nodes flow from left to right. One of the most useful uses of the Connector Nodes is when you need to create a loop or go back to earlier in your narrative chain. In it's default left-to-right configuration, that situation doesn't result in a clean or organized look. To solve this, we can simply click the `>` button in the center of the Connector Node to toggle its flow direction. You can combine any amount of Connector Nodes in a chain to organize your links however you want, creating an even cleaner look. ![[07 - Connector Nodes In Action.webp]] ### The Comment Node While designing your narrative, it's helpful to add notes or reminders—such as why something was set up a certain way, areas to refactor, or scene overviews. These can keep your goals and vision clear as you build. Comment Nodes are purpose-built for this. Try creating one now. ![[08 - Comment Node.webp]] Comment Nodes don't need to be opened in the Node Editor and can have their content edited in the Node itself. Simply click in its text field and start typing any notes you may have! > [!tip] > You can write `TODO:` in Comment Nodes, followed by a note about what needs to be done. > > Later, you can easily search for "TODO" to quickly find and jump to the relevant parts of your project. ## Writing Notes, Reminders, and Direction In Your Project We just talked about Comment Nodes for writing notes, reminders, and direction for your project. NarrativeFlow has two more places where you can write notes: - Experience Notes - Dialog and Choice Notes ### Experience Notes While Comment Nodes allow you to write notes in a Node and place them anywhere in your Experience, you may have notes that you wish to associate with the Experience overall. First, make sure an Experience is open in the main workspace. Then, simply click the "Experience Notes" tab in the Left Panel. ![[09 - Experience Notes.webp]] This tab is simply one large text field where you can enter any notes, reminders, descriptions, explanations, direction, etc. that's relevant to the Experience as a whole. ### Dialog And Choice Notes While designing specific dialog and choices, you may want to write notes about future changes, Properties to add when external assets are finished, or direction notes for a cutscene. Or perhaps your game will have VO and you wish to add voice-direction notes for when the VO is recorded (such as the emotion, where emphasis should be, timing, etc.). Dialog and Choice Node notes are perfect for this. Let's create a Dialog Node now and open it in the Node Editor. When you're editing a Dialog or Choice Node, there will be a "Notes" button to the right of the Node Editor. Clicking that "Notes" button will expand/collapse the Notes Panel. Let's click it now and open it. ![[10 - Node Notes.webp]] Now, feel free to write any notes, reminders, VO direction, descriptions, etc. that you may have for that Node! > [!question] > As mentioned, the Notes Panel is only displayed for Dialog and Choice Nodes. > > I've thought about whether it'd be useful to have the Notes Panel for the other Node types as well, yet didn't see a direct benefit outside of Dialog and Choice Nodes that couldn't be solved with a simple Comment Node. > > With that said, I would greatly appreciate your feedback if having the Notes Panel on the other Node types would be beneficial to you. > > If so, please [reach out to me](https://narrativeflow.dev/lets-talk) and let me know. ## Node Properties Node Properties are an extremely powerful and simple way to attach data to Dialog, Choice, Start, and End Nodes. For example, let's say your narrative has VO that you want to associate with each Dialog Node. You can easily do this with Node Properties. To learn all about how Node Properties are defined, check out [this page on Properties in the Reference Guide](Node%20Properties). Properties are completely optional. So if your narrative doesn't need Properties, don't worry, you can safely skip this. ## How To Define And Use Custom Text Styles To Give Your Narrative Visual Flavor And Flare Depending on how you want your narrative to look and feel, you may want to style parts of your text, such as **bold**, *italicized*, <span style="color: red;">colored</span>, etc. Rather than limiting you to a small set of basic styles and forcing you to conform to how they're defined, NarrativeFlow gives you the freedom to define as many text styles as you need however you want. You get to decide what styles you want or don't want, how they'll look in your game engine, and how they're defined. For example, let's say we want to make specific words or parts of our text colored sky-blue. To accomplish this, first open the Text Styles modal by clicking the aptly named "Text Styles" button in the Menu Bar. ![[11 - Text Styles Modal.webp]] NarrativeFlow, by default, already has some basic text styles defined for you. This way, if you don't feel like creating your own, you can simply use the ones already defined. Feel free to change or remove them however you need though. You won't hurt my feelings, promise. Let's create a new definition for our sky-blue text style. You can either create a new group or simply add a new text style definition to the existing "Colors" group by clicking the "Add Text Style" button within that group. Each text style definition has four fields, with the last being optional: **Label:** This is the label you'll click on to insert this text style into a field. This is exactly the same as labels for variables. **Open Tag:** This is the tag that will signal to your game engine to change the current styling for all text between this open tag and the close tag. **Close Tag:** Signals to your game engine to return to the previous styling (the styling configuration before the open tag was encountered). **Presented Text CSS Rules:** (optional) If you want, you can define CSS rules here that will tell NarrativeFlow how to display text within your tags in Presented Text areas. This way, you can get a representation of how your text will look to your player (as long as your game engine has been told how to display that style). For our sky-blue style example, let's fill out the text style fields like this: - Label: `Sky-Blue` - Open Tag: `{sky-blue}` - Close Tag: `{/sky-blue}` - CSS: `color: #87ceeb;` Now that we've defined our text style, and even defined the CSS rule that we want NarrativeFlow to use to give us an idea of how our text could look in our game engine, let's close the Text Style modal by clicking the "Done" button in the top right of the modal. Now, let's use our new text style! Open a Dialog Node in the Node Editor and write some text, perhaps like this: `Hello, Traveler! What brings you back here today?` Now, use your mouse to select the word "Traveler". Then, click the "Insert Style" button at the top and near the middle of the Node Editor. Exactly like the Quick Access and variables menus, you'll see a list of every text style that has been defined, organized by their group. Simply click the definition we just created: "Sky-Blue". After clicking that, our style tags will be automatically inserted around the text we had selected. If we didn't select anything before inserting the style, our tags simply would have been placed "around" our cursor. So now the text in our Dialog field should be: `Hello, {sky-blue}Traveler{/sky-blue}! What brings you back here today?`. In addition, if you look at the Presented Text section in the Node Editor, NarrativeFlow has automatically, in real-time, recognized and parsed our sky-blue text style and used our CSS rule to display a representation of what your player will see. ![[12 - Text Styles Presented Text.webp]] The Dialog field will always display your "raw" text, while the Presented Text area will always show your styled text, allowing you to easily see if a style tag is improperly positioned, typos are present, a tag is missing, etc. Now, for fun and learning, let's say we want our colored "Traveler" text to also have a larger font size. Simply select that text, click the Insert Style button, and click the "Large" style. Congratulations! You now know how to define your own custom text styles in NarrativeFlow! > [!warning] > Improperly nested tags can cause erratic, unintended behavior and styling. > > Please always make sure that tags are closed in the reverse order to how they were opened. > > For example, the following nesting is invalid: > `Hello {sky-blue}{large}Traveler{/sky-blue}{/large}!`. > > This is because the last open tag was {large}, which means that style must be closed before {sky-blue} can close. > > The correct nesting, as we saw with our example above, is: > `Hello {sky-blue}{large}Traveler{/large}{/sky-blue}!` > > If you experience any styling errors or your Presented Text doesn't display as intended, improperly nested tags could be the issue. > > Don't feel bad if this happens to you. Pretty much everyone has made this mistake! ## How To Search In NarrativeFlow Now let's discover how to search for specific Nodes you've created. Perhaps you've forgotten where a specific Node is, or maybe you want to change the name of a character or variable, or perhaps you accidentally spelled something incorrectly throughout dozens of Nodes but don't remember where (it happens to all of us!). Thankfully, the Search and Filter Left Panel tab is ready to help! Let's learn how to use it. First, let's make sure it's selected in the Left Panel. ![[13 - Search And Filter.webp]] Let's run through a quick example of how to use this. First, create a new Dialog Node (or just use the one we created in the text styles section above) and put something in the dialog field. I'll write "Hello, Traveler!". Now, in the Search and Filter tab, let's type "Traveler" in the search field. You'll see that our Dialog Node is now listed in the Search and Filter tab under the "Dialog Nodes" header. ![[14 - Search Result.webp]] When search results are listed, they're organized by Node type, allowing you to more easily find a Node that's of a specific type. You can collapse a header simply by clicking it. Each search result has a button to the right of it that allows you to quickly go to that Node. The button will have a different icon depending on if the Node is in the currently open Experience or a different one. There are a few settings that you can toggle to change how NarrativeFlow searches your Nodes. Let's quickly go over what the settings do: **List all Nodes in current Experience:** Instead of displaying a list of Nodes that contain a match for your search, this setting will cause *all* Nodes in the current Experience to be listed in the Search and Filter tab. This can be especially useful if you lost track of a Node while panning around and can't find it (you can then click the "Go To Node" button, copy/cut the Node, and paste it in a relevant location). **Search in all Experiences:** Enabling this setting will cause NarrativeFlow to search in all Experiences, not just the currently open one. **Case sensitive:** Checking this will make the search, well, case sensitive. Try it now. Check this setting, then type "traveler" (with a lowercase 't') in the search field. Notice how our Dialog Node with "Traveler" (an uppercase 'T') doesn't show up. **Fade non-matching Nodes:** When enabled, this will cause all Nodes that don't match to fade, allowing you to quickly see in the workspace which Nodes match and which ones don't. Below these main settings, you'll see a header labeled "Node Fade Settings" which is collapsed by default. Opening that header will reveal a setting to fade each type of Node. Checking any of these boxes will fade all Nodes of that type, regardless of whether they match the search or the "Fade non-matching Nodes" setting is checked or not. This can help you clear visual noise quickly, allow you to only see narrative-content Nodes (like Dialog and Choice), or help you find a Node you're looking for quicker. When searching, you're not limited to just searching in basic Node attributes like dialog or choices. You can search for text stored within *any* Node attribute. Variables, comparisons, probability weights, Properties, dialog source, Start Node names, Dialog and Choice Node notes, etc. You can even search for text within Comment Nodes, which creates some very interesting and helpful possibilities. For example, let's say that whenever you want to remind yourself to come back and finish a part of your narrative later, you could create a Comment Node there with the text "TODO:" and a description of what you need to finish. Then, when you're ready to tackle a bunch of your 'Narrative To Dos', you can simply search for "TODO" (and possibly check the 'Search in all Experiences' setting) and NarrativeFlow will list all Comment Nodes containing your reminders. ## Create Node Bookmarks To Never Lose Where You Were Working Especially when designing large dialog with tens of thousands of words (or even Nodes!) you may wish you could bookmark specific Nodes to keep track of them or quickly return to them later. Thankfully, bookmarking Nodes is a feature already built into NarrativeFlow! Let's give it a try now. For our example, I'm going to use the "Hello, Traveler!" Node we created in the Search and Filter section above. To bookmark a Node, simply click the three-dot button in the top right of the Node. Then, click "Bookmark". A small modal will open asking you to give your bookmark a name. For our example, I'm going to give it the name "Greeting". Then click "Create" and your Node has been bookmarked! Where is our Bookmark though? To see a list of all your bookmarks, click the "Node Bookmarks" tab in the Left Panel. ![[15 - Node Bookmarks.webp]] Each bookmark has buttons to change it's name or remove the bookmark (to the left), or to quickly go to that Node (to the right). ## Define Node Presets To Save Time And Eliminate Repetition When designing your narrative, you may find that you're configuring Nodes in exactly the same way, or at least very similarly, potentially hundreds of times. For example, when creating a Dialog Node for a specific character, you may find it quite redundant to enter the same character's name in the dialog source field and fill in several Properties the same way every time. That's a lot of wasted time doing something repetitive. Thankfully, this is where Node presets come in! Node presets allow you to save a Node exactly as it's currently configured and create a Node with that exact configuration anywhere in your project. If that sounds confusing, think of it like a "template for Nodes", a stamp, a stencil, a mold, a pattern, etc. Let's use our example of a Dialog Node being configured for a specific character. First, we'll create the Node exactly as we want our preset to be. I'll set mine up like this: ![[16 - Create Preset From Node.webp]] Then, click the three-dot menu on the Node, and click "Create Preset". Similar to bookmarking a Node, you'll be asked to name your new Node preset. Enter a name and click Create. To see all your presets, click the "Node Presets" tab in the Left Panel. ![[17 - Node Presets.webp]] Each preset has buttons to rename, duplicate, or remove the preset (to the left), or create a Node from this preset or modify the preset's configuration (to the right). > [!tip] > Removing the Node you created the preset from won't effect the preset in any way. They're completely separated. > > Also, modifying the preset's configuration will simply open the preset in the Node Editor, allowing you to configure it in exactly the same way as a regular Node. Now, anywhere in our project, we can simply click the "Create Node from Preset" button (the button with the stamp icon) and a new Node will be created with that exact configuration. Let's go through another example with a Choice Node. I'll configure my Choice Node like this: ![[18 - Choice Node For Preset.webp]] By creating a preset from this Choice Node, we could quickly add it to anywhere in our project and then change the text of the choices to something that's unique and relevant for that part of the narrative. Congratulations, you've completed the second part of the Walkthrough! When you're ready, let's continue to the final part, [[Part 3 - Using Advanced Capabilities For Sophisticated Narrative]], and finish this journey (don't worry, it's the shortest part)!