[ANN] Dialog Tool 2.0-alpha-5

I’m proud/happy/scared to announce the initial release of dgt - the Dialog Tool.

dgt is a tiny, specialized, highly opinionated command line tool used to build, debug, and test interactive fiction created with Dialog.

I’ve been using it while I translate Aaron Reed’s “Sand-dancer” to Dialog, and creating a threaded conversation library. Here’s what it looks like in action:

16:18:45 ~/workspaces/dialog/sanddancer-dialog > dgt test
 control-center-via-courage ... ✓        83.734411ms
control-center-via-strength ... ✓        76.634892ms
             get-flashlight ... ✓        82.800885ms
                   memories ... ✓        74.346684ms
                open-desert ... ✓        73.358375ms
         pursuit/first-time ... ✓        75.075295ms
     pursuit/lost-and-found ... ✓        77.340047ms

OK
16:18:51 ~/workspaces/dialog/sanddancer-dialog > dgt debug -d
dgdebug --quit src/scenes/pursuit.dg src/scenes/rabbits-offer.dg src/scenes/rainstorm.dg src/base-of-tower.dg src/break-room.dg src/burrow.dg src/control-center.dg src/crumbling-concrete.dg src/hints.dg src/knock.dg src/light.dg src/memories.dg src/middle-of-nowhere.dg src/office-interior.dg src/office.dg src/open-desert.dg src/plans.dg src/roof.dg src/sand-dancer.dg src/smoking.dg src/staging-area.dg src/storage-room.dg src/talents.dg src/tower.dg src/weed-strewn-rust.dg src/windows.dg lib/debug/extra-debug.dg /usr/local/share/dialog-if/stddebug.dg lib/location-tracking.dg lib/room-connections.dg lib/scenes.dg lib/stdlib-extensions.dg lib/stdlib-overrides.dg /usr/local/share/dialog-if/stdlib.dg
Dialog Interactive Debugger (dgdebug) version 0i/03.
Type @help at the game prompt for a brief introduction.


Middle of Nowhere (in the pickup truck)
The tire tracks from the south stop abruptly here, but where the hell are you?
The desert sand and clumps of pale sagebrush are all your dimming headlights
pick out before barely reaching the concrete building to the north.

Your poor old pickup truck ticks and groans, smashed gracelessly against a tall
Saguaro; wiffs of evaporating gasoline linger in the chill air. On the dash you
can see a piece of jade. The glove compartment is closed.

> 

dgt encourages you to break your project up into many small files, and understands that some files must be included for debugging and testing, but not in a released game.

More details are available at: GitHub - hlship/dialog-tool: Tool to assist in testing and building interactive fiction using Dialog

I’ve created a Homebrew package for installation on OS X:

brew install hlship/brew/dialog-tool

This will download the tool and its dependencies – hopefully, as it’s my first Homebrew formula.

I suspect the tool will continue to evolve rapidly and big disclaimer backwards compatibility is not an overriding goal, despite the 1.0 version number. However, I don’t expect to introduce anything too disruptive, so have fun kids!

7 Likes

Absolutely fantastic work! I’ve said before that I see Dialog as a very healthy friendly competitor to Inform 7. Part of that is, of course, building up an ecosystem around Dialog, which tooling like this encourages.

1 Like

Dialog Tool, dgt, is used to build, test, and debug Dialog projects.

New in release 1.1:

  • Fixed bug where dgt test would mismatch the test scripts against the expected output
2 Likes

Dialog Tool, dgt , is used to build, test, and debug Dialog projects.

Changes:

  • dgt test now accepts an optional test name fragment to execute (useful when creating a new test)
3 Likes

This release enables the building of web and c64 games, using the aambundle command, among other improvements.

3 Likes

==> Tapping hlship/brew
Cloning into ‘/usr/local/Homebrew/Library/Taps/hlship/homebrew-brew’…
remote: Enumerating objects: 25, done.
remote: Counting objects: 100% (25/25), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 25 (delta 7), reused 20 (delta 5), pack-reused 0
Unpacking objects: 100% (25/25), done.
Tapped 2 formulae (51 files, 47.2KB).
==> Installing dialog-tool from hlship/brew
==> Tapping candid82/brew
Cloning into ‘/usr/local/Homebrew/Library/Taps/candid82/homebrew-brew’…
remote: Enumerating objects: 148, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 148 (delta 3), reused 11 (delta 3), pack-reused 136
Receiving objects: 100% (148/148), 18.38 KiB | 1.15 MiB/s, done.
Resolving deltas: 100% (47/47), done.
Tapped 1 formula (26 files, 46.9KB).
==> Tapping vickio/dialog
Cloning into ‘/usr/local/Homebrew/Library/Taps/vickio/homebrew-dialog’…
remote: Enumerating objects: 87, done.
remote: Counting objects: 100% (87/87), done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 87 (delta 19), reused 75 (delta 18), pack-reused 0
Unpacking objects: 100% (87/87), done.
Tapped 1 formula (113 files, 52.5KB).
==> Downloading https://github.com/candid82/joker/releases/download/v0.16.0/joker-0.16.0-mac-amd64.zip
==> Downloading from https://github-releases.githubusercontent.com/76160954/8c2f3c00-84cd-11eb-8206-205ebdd12267?X-Amz-Algorithm=AWS
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/colordiff-1.0.19.big_sur.bottle.1.tar.gz
##O#- #
curl: (22) The requested URL returned error: 404 Not Found
Trying a mirror…
==> Downloading https://ghcr.io/v2/homebrew/core/colordiff-1.0.19.big_sur.bottle.1.tar.gz
==> Downloading from https://github.com/-/v2/packages/container/package/homebrew%2Fcore%2Fcolordiff-1.0.19.big_sur.bottle.1.tar.gz
#=#=#
curl: (22) The requested URL returned error: 404
Error: Failed to download resource “colordiff”
Download failed: https://ghcr.io/v2/homebrew/core/colordiff-1.0.19.big_sur.bottle.1.tar.gz

I’m not sure when I’ll get a chance to look at this; I’m still on Catalina, so if there’s brew packages that don’t exist yet for Big Sur (looks like colordiff may be in that category) I’m not sure what to do about it.

Dialog Tool 2.0-alpha-3

Dialog Tool is a CLI that makes it far easier to create projects using Dialog. It provides the missing tools to get started, debug and test your project, and bundle it for release.

Lots of details in the README, here’s a summary:

Dialog Tool is a command line tool for OS X. It installs with Homebrew.

Dialog Tool 2.0 is a complete rewrite. New features in 2.0:

  • dgt new - create a new, empty Dialog project
  • dgt skein - opens a web-based UI to test your project
  • dgt test - used the Skein to test your project
  • dgt bundle - bundles a project for upload, including a “play in your browser”

The Skein and the bundling code is heavily indebted to Inform 7.

The Skein is the most important part here; there’s a separate discussion about it. The Skein is like a transcript of you playing your game, including all the different branches you have taken. You will run the Skein as you build your project, and record into it how the project should play. Later, your can “Replay All” and the Skein will show you anything that’s changed, with an option to Bless (aka Approve) the changes — this is terrific for identifying regressions in your project’s logic.

I’d love some help with the Skein, especially in terms of making it a bit prettier. Ultimately, I hope for a more graphical nodes-and-lines UI like the one inside Inform. Further, I’d love to get it all working on Linux and Windows.

All feedback quite welcome!

5 Likes

Changes in 2.0-alpha-4:

  • The Skein UI has been rebuilt to look more like a transcript
  • The dgt bundle command includes Zarf’s one-pager
  • The dgt bundle command now also creates a Zip of the bundle

There’s a few lesser changes under the covers; but the main bit is streamlining and improving the Skein UI.

Each node now has an actions popup:

… and a popup to select the child:

The Skein uses colors to identify differences between the skein and the running game; for example, replaying after correcting a typo:

Ok, since that’s what you expected and all you expected, you can bless the change and save the skein.

… anyway, I need to write more documentation, but I’m quite happy with how it is coming out.

I still have a few more improvements for the dialog tool and I could always use help with the CSS and design parts of the Skein.

Please give it a try and be in touch about what you like and what you don’t.

And now I need to work on my writer’s block for the actual game I’m trying to create …

4 Likes

This is fantastic! And now I need to restructure my projects.

A feature that I’d really, really love to see would be the ability to run unit tests with testrunner.dg or similar, and be able to feed it which files make up a given test set, and recognize success and failure. (Since “test” is already used as a keyword, it’d need some other command, or have “unittest” and “skeintest” and then “test” rolls both of them up.) I’m using just a very simple and stupid shell script for that at the moment.

My entry for the 1995 IfComp is still unfinished because I went off and fiddled with tools for a decade or so, and then life intervened. Good luck!

1 Like
sue@solfar workspace % brew reinstall hlship/brew/dialog-tool
==> Fetching hlship/brew/dialog-tool
==> Downloading https://github.com/hlship/dialog-tool/releases/download/2.0-alph
Already downloaded: /Users/sue/Library/Caches/Homebrew/downloads/cff66dd8533df928b3c56790a3a3ccb0f5fe5bec53f4083924fa48c659481490--dialog-tool-2.0-alpha-4.zip
==> Reinstalling hlship/brew/dialog-tool 
🍺  /opt/homebrew/Cellar/dialog-tool/2.0-alpha-4: 24 files, 445.2KB, built in 12 seconds
==> Running `brew cleanup dialog-tool`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
sue@solfar workspace % dgt new foo
Creating foo ...
  dialog.edn
----- Error --------------------------------------------------------------------
Type:     clojure.lang.ExceptionInfo
Message:  resource-path for template/dialog.edn returned nil, typically means the file doesn't exist in your classpath.
Data:     {:type :selmer/validation-error, :error "resource-path for template/dialog.edn returned nil, typically means the file doesn't exist in your classpath.", :error-template "<html>\n<head>\n    <font face='arial'>\n        <style type='text/css'>\n            body {\n                margin: 0px;\n                background: #ececec;\n            }\n            #header {\n                padding-top:  5px;\n                padding-left: 25px;\n                color: white;\n                background: #a32306;\n                text-shadow: 1px 1px #33333;\n                border-bottom: 1px solid #710000;\n            }\n            #error-wrap {\n                border-top: 5px solid #d46e6b;\n            }\n            #error-message {\n                color: #800000;\n                background: #f5a29f;\n                padding: 10px;\n                text-shadow: 1px 1px #FFBBBB;\n                border-top: 1px solid #f4b1ae;\n            }\n            #file-wrap {\n                border-top: 5px solid #2a2a2a;\n            }\n            #file {\n                color: white;\n                background: #333333;\n                padding: 10px;\n                padding-left: 20px;\n                text-shadow: 1px 1px #555555;\n                border-top: 1px solid #444444;\n            }\n            #line-number {\n                width=20px;\n                color: #8b8b8b;\n                background: #d6d6d6;\n                float: left;\n                padding: 5px;\n                text-shadow: 1px 1px #EEEEEE;\n                border-right: 1px solid #b6b6b6;\n            }\n            #line-content {\n                float: left;\n                padding: 5px;\n            }\n            #error-content {\n                float: left;\n                width: 100%;\n                border-top: 5px solid #cdcdcd;\n                border-bottom: 5px solid #cdcdcd;\n            }\n        </style>\n</head>\n<body>\n<div id='header'>\n    <h1>Template Compilation Error</h1>\n</div>\n<div id='error-wrap'>\n    <div id='error-message'>{{error}}.</div>\n</div>\n{% if template %}\n<div id='file-wrap'>\n    <div id='file'>In {{template}}{% if line %} on line {{line}}{% endif %}.</div>\n</div>\n{% for error in validation-errors %}\n<div id='error-content'>\n    <div id='line-number'>{{error.line}}</div>\n    <div id='line-content'>{{error.tag}}</div>\n</div>\n{% endfor %}\n{% endif %}\n</body>\n</html>", :line nil, :template nil, :validation-errors ({:tag "   ", :line nil})}
Location: /opt/homebrew/Cellar/dialog-tool/2.0-alpha-4/bin/src/dialog_tool/template.clj:29:17

----- Context ------------------------------------------------------------------
25: 
26: (defn copy
27:   [resource-path context target]
28:   (setup-target target)
29:   (let [content (s/render-file resource-path context)]
                    ^--- resource-path for template/dialog.edn returned nil, typically means the file doesn't exist in your classpath.
30:     (with-open [w (-> target
31:                       maybe-create
32:                       fs/file
33:                       io/writer)]
34:       (.write w content))))

----- Stack trace --------------------------------------------------------------
selmer.validator/validation-error                    - <built-in>
selmer.parser/render-file                            - <built-in>
clojure.core/apply                                   - <built-in>
babashka.impl.selmer/render-file                     - <built-in>
dialog-tool.template/copy                            - /opt/homebrew/Cellar/dialog-tool/2.0-alpha-4/bin/src/dialog_tool/template.clj:29:17
... (run with --debug to see elided elements)
net.lewisship.cli-tools/dispatch*                    - net/lewisship/cli_tools.clj:242:3
net.lewisship.cli-tools/dispatch*                    - net/lewisship/cli_tools.clj:215:1
net.lewisship.cli-tools/dispatch                     - net/lewisship/cli_tools.clj:316:3
net.lewisship.cli-tools/dispatch                     - net/lewisship/cli_tools.clj:286:1
user                                                 - /opt/homebrew/bin/dgt:5:1

Hm. Works for me. Let me look into it.

Might be an issue with the brew formula. I’ll look into it.

Try uninstalling it, then reinstalling it. There was a missing line in the brew formula.

Also, FYI, adding an issue to the dialog-tool GitHub repo would have gotten my attention earlier. Hope it works for you now.

Do you have a pointer to testrunner.dg? First I’ve heard of it.

Ah, stellar-core/testrunner.dg at main · susan-davis/stellar-core · GitHub

We should chat on how this could be well integrated into dialog-tool. dgt unit and, maybe, extra search paths that are specific to unit testing.

1 Like

In addition to the Github link that you’ve found, it’s posted here in a topic from a couple of years ago.

I’ve just rewritten the Skein UI in Svelte 5 and TypeScript and it’s making it easier to add yet more features; the next release will have (at least) an “Edit Command” for knots.

I’d love to hear back from anyone else using dialog-tool and the Skein.

1 Like

Dialog Tool 2.0-alpha-5

Install on OS X:

brew install hlship/brew/dialog-tool

Changes:

  • Skein UI Rewritten in Svelte 5 and TypeScript
  • New Skein commands:
    • Edit Command
    • Insert Parent
    • Splice Out

Edit Command lets you change an existing command.
Insert Parent inserts a new command before a knot, reparenting the knot to this new parent.
Splice Out is the opposite, it removes a knot, and reparents the knot’s children to the removed knot’s parent.

In all of these cases, you should “Replay All” after adjusting the tree structure to find any unintended changes. Because of how Dialog’s random-number generator works, you may find that randomly chosen text (or other randomly-generated things) will be different lower in the tree after changing things higher in the tree.

2 Likes