DefArc - Defold + Arcweave tool for branching conversations and narrative

Hi!

As a continuation of Defork a new tool was born, for even more advanced, interactive dialogues:

defarc_hor

About DefArc

DefArc is a runtime for Arcweave projects, a module helping easily create interactive branching or linear conversations or quests flow - anything you can create in Arcweave for Defold game engine.

DefArc, underneath, is a JSON parsed data and a set of helper functions to easily and conveniently create a dialogue flow in Lua. It comes with unit tests and an example Defold project. You can mix DefArc with other Defold assets like RichText or Defold Printer for text animation and displaying and Gooey or Druid for GUI handling.

DefArc is an incarnation or inheritance of my first narrative module - Defork which was used with JSON files produced by Twinson format for open-source Twine. Arcweave is not open-source, but its free plan allows you to create anything in a much more enhanced, advanced and professional environment with possibility to collaborate online on one project (2 editors for free plan). Arcweave offers also paid plans with larger limits like more editors for online collaboration on projects for larger teams. For solodevs or indie teams, it’s a great tool used by professionals like CDPR, Mojang, Microsoft, Primal, etc.

Installation

In order to use DefArc in your Defold game add it to your game.project as a Defold library dependency.

Once added, you must require the main Lua module in scripts via

local defarc = require("defarc.defarc")

Then you need to add dialogs exported from Arcweave in a JSON format to your project. To add it, you need to provide a path in Custom Resource field of your game.project in Defold.

image

For example, if you have your file in the dialogs folder in the project directory, type: dialogs. You can find more informations about custom resources in official Defold’s documentation here.

What you can do?

With DefArc you can easily:

  • add linear or non-linear, interactive dialogues to your games

  • utilize powerful Arcweave branching with code chunks and variables

  • load and save variables changing the flow of conversations

  • load json data exported from Arcweave conversation making tool

  • get text, options and links leading to next conversation’s nodes

  • store and manage current links, options and flow through nodes

  • modify data by adding actors, colors and custom text effects

  • add images, portraits, locations or emoticons from Arcweave assets

Arcweave

Arcweave allows to create complex diagrams that can be used to build linear dialogues, non-linear branching conversations with variables or quest or story flow design.

Arcweave offers a lot of options, all of them are available in free plan. Check out Arcweave features here.

Defold Example

Though DefArc offers over hundred of functions, for most games purposes, one would practically narrow the usage to just few. A simple example for handling branching dialogue in Defold is used in example project. For it to work you need to:

  1. Load the project from JSON resource:
defarc.load("/dialogs/test_board.json") -- loading Arcweave exported JSON from custom resources
  1. Select an element to start working with it, e.g. displaying the text and options.
defarc.select_element("Example welcome") -- selecting element by its title from Arcweave element
  1. Get text and options_table and put it in GUI:
local text = defarc.get_text()
	local options = defarc.get_options_table()

	gui.set_text(gui.get_node("NPC"), text) -- set text

	for i=1,3 do                            -- set 3 corresponding options
		gui.set_text(gui.get_node("Option_"..i), options[i] and options[i].label or "")
	end

The given example runs a simple conversation, where you can choose each of the options and when reaching an end - it starts again.

Tests

To check if DefArc is working you can run a set of unit and functional tests from the example:

local defarc_test = require "defarc.defarc_test"
defarc_test.run()

DefArc API

You can find the API documentation and module itself with above example and tests in my public repository (link below). The module is released with MIT license, so by leaving the license as is, you can use it however you like and in any non-comercial and commercial projects! :slight_smile:

Happy Defolding and Arcweaving! :wink:

Github:

Asset Portal:

19 Likes