TwineQuest: "Examples of Rule Based Objects" or "Template game structures in Twine"

2,605 views
Skip to first unread message

HarmlessTrouble

unread,
Feb 25, 2013, 10:42:34 AM2/25/13
to twee...@googlegroups.com
Hi All,

My goal is to build a Twine "TwineQuest" toolkit with templates for common structures found in Interactive Fiction.  I'm conducting research on common Interactive Fiction paradigms and what makes Twine stand apart from the more popular IF tools & interpreters.

Strengths:
There are no ready made rules or structures in a Twee / Twine story.  A passage in Twee / Twine is just a passage, just as a page in a book is a just a page.  What that passage represents is up to the author's design. Twine is the HyperText equivalent of pen and paper, writing HyperText "Choose-Your-Own-Adventure style" stories is fast and easy to author without worrying weather or not you should learn and use superfluous structural rules.  

Weaknesses:
When the story needs more complex gaming structures, new authors (and even some seasoned vets)burn away time scripting game logic that accomplishes behavior basic to IF.    It requires sifting through fragmented resources and tutorials.  Plotting out structural rules from scratch and even taking valuable time to learn html/css and JavaScript to try to make it all work.   Most authors would likely move on to a platform that has these ready made tools. (I nearly did.)

Threats:
In contrast to rule based design in other IF engines (Adrift, Tads, Inform) which, in addition to narrative, offer predefined structural rules for locations, objects, items, and characters. Using a human "readable" language to declare them. 

Opportunity:
Although Twee is primarily a used as HyperText Story engine, here is where Twine as a UI can easily be improved.   Twine needs tools which greatly simplify the creation of abstract rules for objects common to IF.   From the state of a locked door, the character inventory holding the key to the pot down the hall that the player had to break to find it. 

I want to free authors from the drudgery of fiddling with macros and get on with Authoring Immersive HyperText experiences.  I've already have a small arsenal of common macro tricks and passage structures, but for it to be a toolkit, It needs much more.  You can help me in my quest. 

Submit to this thread or the unofficial Twine community on Google+ and/or including the G+ tag #TwineQuest, your favorite examples of game logic written in Twee and Twine source.    Here are just a few example structures I'm looking to add to the toolkit.
  • Rooms
  • Locks
  • Objects
  • Surfaces
  • NPCs
  • Inventory
You and the source's original author will be named in the "Many Thanks Too" credits of this toolkit's readme and may eventually be distributed with a future version of Twine.

- Henry

lectronice

unread,
Feb 26, 2013, 6:46:17 PM2/26/13
to twee...@googlegroups.com
This is weird, because I started working on something a bit similar a few days ago. Being mostly JavaScript illiterate though, my goal was just to gather the most interesting snippets, macros and tutorials, and sort them nicely in a TiddlyWiki. The idea was to build a kind of dynamic cookbook in a single file, using tags and various search and categorization features, and make it available not only online, but also offline.

Your project seems more focused, advanced and useful than mine, so I'm not sure what to do with it right now. It's still at an early stage, and I guess you're already aware of most of its content, but I'd be glad if you find a way to use it for yours. Please let me know if you think it can help.

D W

unread,
Feb 26, 2013, 8:09:44 PM2/26/13
to twee...@googlegroups.com
Great ideas you got there, Harmless! Any chance btw you could add an insert name feature to the toolkit? I'm having a hard time getting player inserted names to save right, especially when refreshing the page. Also, dice and an enhanced way for people to save their progress would be good too -- especially for folks who want to do longer stories.

How long do you suppose this toolkit will take before releasing it? Please buzz us back with your progress! =)



From: HarmlessTrouble <henry...@gmail.com>
To: twee...@googlegroups.com
Sent: Monday, February 25, 2013 10:42 AM
Subject: [tweecode] TwineQuest: "Examples of Rule Based Objects" or "Template game structures in Twine"

--
You received this message because you are subscribed to the Google Groups "Tweecode / Twine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tweecode+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


Stormrose

unread,
Feb 27, 2013, 4:00:14 AM2/27/13
to twee...@googlegroups.com, D W
I like the idea and I already have code I can contribute from a project I am working on.

My caveat is that we do not over complicate the core functionality of Twine. Its strength is that a passage is whatever the author wants it to be. The power of this should not be underestimated. I came to Twine precisely because it did not enforce or encourage any particular structure on what I wanted to do as an author. I'd like Twine core to stay that way - but totally see (and will support with code) extensions that make creating certain common types of story easier.

Suggestion:
Can we start by doing these as .twee (.tw) files in a central repository just to get momentum then move them to a more formal "extensions" framework in Twine core as that builds.

I already have a few macros that I reuse across my own project - many more than I have made public on the Future of Twine site. I like the .twee format and have been evolving towards something like this:

9999 Macro name.twee <-- filename
::9999 Macro name.twee About [Twine.private]
This passage is used to document the macro, acknowledgements etc.
It does not end up in generated html files due to the tag

::9999 Macro name [script]
The actual code for the macro/s

I guess I should make that InterTwine screencast I've been meaning to do for a while.  Anyways; with a known repository for #TwineQuest then it would serve as a central clearing house for Quest style stories. The best part of that is: InterTwine already supports loading a .tws/.twee file over http or ftp - so authors can just link directly to a #TwineQuest library of their choice and have it automagically update whenever the library is updated. Or, they could download the library and maintain control over the updates.

My first real contribution would be: an random name generator for NPCs ... the names styles can be configured using language stems in appropriately tagged passages. The same code works for elves, orks, humans, aliens, cultures and all the author need do is supply a passage with language parts that are in a simple format. I did adapt the code from elsewhere (acknowledged) and thus will supply "stem passages" for their examples; I think elves, humans and goblins. There is an opportunity for us to develop and share stem files for various cultures too.
My NPC macros allow you to generate a name for an NPC then refer to that henceforth by number... NPC 1, NPC 2 etc...
It only does names for now.

What I learnt from doing this, which I'd like to propose to other #TwineQuest devs: The name generator finds the "culture" passages by looking for a passage tag. That means adding a new naming pattern is as simple as making a passage, adding a tag. Zero tricky syntax - just an extension of what is already known so that the authors can concentrate on making the language stems for the names and not on whether or not they forgot some silly punctuation character to close a declaration. ick.

I'd like to propose doing that with objects too: declare an object by making a passage (title up to the author), giving it a tag... TwineQuest.* seems a good way to prefix them... So, for an "Item" TwineQuest.Item.
I'd also like to suggest a simple format within the passage. People seem to have less trouble with a newline or colon delimited passage (author's option as to when to use a : or a newline or even a colon-newline. I'm not such a fan of using JSON or XML for this type of thing simply because of the unforgiving syntax burden it places on authors. Besides all those < } { , [ symbols in the densities used in JSON or XML are not exactly conducive to being human readable (except for programmers in c-style languages).

Here's what I'm proposing (as a syntax example, ignore the vocab)
::The Golden Axe [TwineQuest.Item]
LABEL
: Golden Axe
DESCRIPTION
The Golden Axe of Sega, sort after by Amazons, Dwarves and Warriors. Forged of purist pixels and engraved into the memories of many.

WEIGHT
:5kg
MATERIAL
:
Gold Alloy
Leather

LENGTH
:1.5m
SLOT
: 2-handed-weapon
ATTACK MODIFIER
: +5
(See how the syntax flexes and is forgiving?)

Then, when/if an UI extensions framework is added to Twine then wizards/special editors can simplify the creation of such things for authors.
So two proposals:
1) Use a passage per object. Mark objects with TwineQuest.* tags so TwineQuest libraries can use the existing Twine engine's API to find what they need
2) Use a forgiving colon/newline format within the passages. It is up to libraries to define the ATTRIBUTE: types allowed, but it should not expect them in any particular order.


As I release my twine stories; if anything looks useful for TwineQuest then let me know and I can lift it out and package it appropriately.
Re: dice macros.... for now... would my randomp macro do what you need?

--Et

Stormrose

unread,
Feb 27, 2013, 4:02:21 AM2/27/13
to twee...@googlegroups.com, D W
After you've done the <<set $var1 = prompt ....... thing then use <<remember $var1>> so that the variable is remembered when the page is reloaded. You might want to use the latest alpha builds (or at least the story formats from them) where the <<remember>> macro has been updated to play a bit nicer with files loaded from a hard-drive.


On Wednesday, February 27, 2013 2:09:44 PM UTC+13, Maren wrote:

HarmlessTrouble

unread,
Feb 27, 2013, 4:02:44 AM2/27/13
to twee...@googlegroups.com, D W
On Wednesday, February 27, 2013 2:09:44 AM UTC+1, Maren wrote:
Great ideas you got there, Harmless! Any chance btw you could add an insert name feature to the toolkit? I'm having a hard time getting player inserted names to save right, especially when refreshing the page.

I've been spinning on an idea about implementing text tokens in a way which is shorter and more readable than  "<<print $game.NPC.customName>> says, "Hello young <<print $game.PC.class>>."  Is that a <<print $game.PC.inventory[$item])>> in your pocket or are you just happy to see me.    Something as simple as camelCase matching or {curly} brackets that match the token to a custom mapped value. Just ideas though.  no proposed code or even a plan to get around to it.
 
Also, dice  
 There are some techniques for generating dice rolls floating around. presenting dice as an item with usable properties would be interesting to see.  

and an enhanced way for people to save their progress would be good too -- especially for folks who want to do longer stories.

 Your right, an arsenal of saving options should be represented.  So lets seek to add to the toolkit examples of; 
  • best practice uses of <<remember>>
  • how to save game data to a bookmarklet, ( I have a crude solution which needs work.) 
  • portable save files.
It might be stretching it a bit but I would like to include examples of AJAX mediated games with online saves.

How long do you suppose this toolkit will take before releasing it? 

As soon as we at least have some basic templates like a room/door/key structures and do the documentation work we can package it and call it a release.  

Does anyone recommend a file handling method.?  Right now I have a folder on my Google Drive but Github seems to be a better location for the release.  Transparency. 

- Henry

HarmlessTrouble

unread,
Feb 27, 2013, 4:23:19 AM2/27/13
to twee...@googlegroups.com, D W
Then, when/if an UI extensions framework is added to Twine then wizards/special editors can simplify the creation of such things for authors.
So two proposals:
1) Use a passage per object. Mark objects with TwineQuest.* tags so TwineQuest libraries can use the existing Twine engine's API to find what they need
2) Use a forgiving colon/newline format within the passages. It is up to libraries to define the ATTRIBUTE: types allowed, but it should not expect them in any particular order.

--Et 

This is excellent.   I'm clearly stuck in a box.  My imagined scope was confined to templates containing twee variables, macros and java-script cludging.  Your proposal for defining objects and structuring TwineQuest is a welcome dose of sanity.

- Henry

HarmlessTrouble

unread,
Feb 27, 2013, 4:39:40 AM2/27/13
to twee...@googlegroups.com, D W

My caveat is that we do not over complicate the core functionality of Twine. Its strength is that a passage is whatever the author wants it to be. The power of this should not be underestimated. I came to Twine precisely because it did not enforce or encourage any particular structure on what I wanted to do as an author. I'd like Twine core to stay that way - but totally see (and will support with code) extensions that make creating certain common types of story easier.

Twine's freedom is one of the reasons I stayed with it too.  I agree TwineQuest should be supplementary not mandatory.  

HarmlessTrouble

unread,
Feb 27, 2013, 7:37:47 AM2/27/13
to twee...@googlegroups.com


On Wednesday, February 27, 2013 12:46:17 AM UTC+1, lectronice wrote:
This is weird, because I started working on something a bit similar a few days ago. Being mostly JavaScript illiterate though, my goal was just to gather the most interesting snippets, macros and tutorials, and sort them nicely in a TiddlyWiki. The idea was to build a kind of dynamic cookbook in a single file, using tags and various search and categorization features, and make it available not only online, but also offline.

Your project seems more focused, advanced and useful than mine, so I'm not sure what to do with it right now. It's still at an early stage, and I guess you're already aware of most of its content, but I'd be glad if you find a way to use it for yours. Please let me know if you think it can help. 

This is a great idea, lectronice.  It could be bundled with the libraries as a portable reference and we could be the Wiki home page at the github repository. https://github.com/tweecode/TwineQuest

  You should defiantly run with it.  

  

lectronice

unread,
Feb 27, 2013, 6:25:39 PM2/27/13
to twee...@googlegroups.com
Sounds great! Let me clean my file a bit and ask everyone (Leon Arnott, Emmanuel Turner and Darius Kazemi for now) if they agree to see their work included here. I'm still thinking about the global wiki structure. Some articles I've collected can be used without any change, but others require a bit of editing (first person, notes, links and references to other articles, disparate formatting...)

I've collected various kinds of content:
* Specific macros with or without examples (sometimes with external files)
* General tutorial-oriented coding articles
* Styling tips & tricks
* Story formats hacks
* Markup & syntax references

All contributors are duly credited, with their own tag-based tiddler listing their posts, and links to original articles. Of course, there should be a category (maybe several of them?) dedicated to TwineQuest. I'm also considering a links section for useful tools (generators, ascii stuff, base64 converters, etc.)

I'm wondering if I should include the original Twine documentation and/or merge it with some similar articles. And I have a similar problem with external examples and long articles: should I include the files when possible, or simply link them as optional content? Break down long tutorials into smaller parts? (I'm thinking about Porpentine and Anna Anthropy, if they agree). I like the idea of keeping everything in a single TiddlyWiki for off-line use, but this means being concise.

Suggestions and ideas are welcome, feel free to point me to any Twine-related content I could add.

Stormrose

unread,
Mar 1, 2013, 4:35:18 AM3/1/13
to twee...@googlegroups.com
Thanks for asking;

I am asserting my rights as an author to say that articles/content on my sites (eturnerx.com and my eturnerx blog) may not copied but the wiki can link to them. 

I will, at times of my choosing, transition some content into this wiki and to TwineQuest. I have already agreed to contribute npc name generation code to TwineQuest as public domain code.

The wiki is free to quote anything that I have posted to this google group or the other twine groups on yahoo - I consider my posts to these groups to be public domain.

--Et

Stormrose

unread,
Mar 1, 2013, 10:14:33 AM3/1/13
to twee...@googlegroups.com, D W
Small thing on teh githubs : https://github.com/tweecode/TwineQuest/tree/master/demo
It lives. I drink more beer.

Stormrose

unread,
Mar 1, 2013, 10:23:21 AM3/1/13
to twee...@googlegroups.com, D W
Forgot the Twine code...

::RealStart
Frelling syntax: {test} with following text.
Can I say {hello} and {hello to you all} again?

[[Link 1]]


::Link 1
More frelling syntax: {test2 has more text}

[[Start again|RealStart]]

Stormrose

unread,
Mar 2, 2013, 5:52:59 AM3/2/13
to twee...@googlegroups.com, D W
Since I said I'd deliver random naming code... I built a basic TwineQuest plugin for mobs (Monster Objects). I'm aiming to make the system  extensible so that people can swap in/out their own ideas of what makes a mob. Obv. the random namer code will be one such extension. But bedtime.

Some twee:
::RealStart
As you enter you see {mob1 describe}. He name is {mob1} and he is <<print $mob1.age>> years old.


::mob1 [tq.mob]
name
: Tom
description
: a small, confused boy
age
: 7

What's going on? not so much for now. We can now put all properties associated with our mobs into a marked passage and TwineQuest (proposed) will load it automatically. We have special TwineQuest syntax for handling our mobs but we can also use standard tweecode.

Random name generation tomorrow. Bedtime.

Stormrose

unread,
Mar 2, 2013, 10:43:42 PM3/2/13
to twee...@googlegroups.com, D W
So I thought all those <<print $var>> things looked ugly.. so now {curlybrackets} falls-through to try to show a twine variable. With a {$var} dollar sign forces it to use twine vars (not TwineQuest's handling). Then... variable tree traversal can be done with {dot.syntax} or {space syntax}

Some twee:
As you enter you see {mob1 describe}. His name is {mob1} and he is {$mob1 age}.

Here I'm assuming a TwineQuest object (tq.mob) with the label 'mob1' and additional data given (age).
I think this is already much more readable than:
<<print $mob1.age>>

Oh, and this doesn't use eval() so it can only output the value of a single variable without anything fancy being done to it.

--Et

HarmlessTrouble

unread,
Mar 3, 2013, 4:24:22 AM3/3/13
to twee...@googlegroups.com, D W

Oh, and this doesn't use eval() so it can only output the value of a single variable without anything fancy being done to it.

--Et

I'm guessing the methods of the mob's class is declared in a script passage then?   Syntactically how would you invoke a method?

{mob1 attacks char1}  
or 
<<print mob1.attack(char1)>>
"Tom uses his slingshot and hits Jerry. 
Jerry takes 7 point's of damage."

- Henry

Stormrose

unread,
Mar 3, 2013, 4:50:23 AM3/3/13
to twee...@googlegroups.com, D W
Something like the first one: {tom attack goblin1}
The {var} shortcut is just that... a fall through for when nothing in TwineQuest catches it.
--Et
Message has been deleted

Stormrose

unread,
Mar 9, 2013, 9:51:20 PM3/9/13
to twee...@googlegroups.com, D W
I've made a plugin for TwineQuest that automatically generates names for mobs based on rules contained in culture files. This is an optional extension to the TwineQuest.mob plugin. There are three supplied culture stems; Roman, Goblin and Elvish. It is not too hard to create more.

::RealStart
{mob1 name} is {mob1 culture}.

::mob1
culture
: default
There is a more complete demo on github.

Oh - and finally I have committed the code for TwineQuest.twee so you can see how I'm thinking of structuring this. The TwineQuest objects automatically create themselves from tagged passages with special tags (defined by the plugin) and are stored in Twines variable store where that makes sense.
TwineQuest plugins are loaded by including a .twee file from inside the StoryIncludes passage. I did this so that everything beyond TwineQuest.twee is 100% optional. You're free to extend/change and share your plugins without worrying about it impacting others using the core (ok official) plugins.

Comments?

--Et


Stormrose

unread,
Mar 12, 2013, 12:55:11 PM3/12/13
to twee...@googlegroups.com, D W
Aw crap. The code snippet was missing the passage tag.

::RealStart
{mob1 name} is {mob1 culture}.

::mob1 [tq.mob]
culture
: default


On Sunday, March 10, 2013 3:51:20 PM UTC+13, Stormrose wrote:

Stormrose

unread,
Mar 17, 2013, 5:16:20 PM3/17/13
to twee...@googlegroups.com, D W
I started converting one of my gamestory projects to use TwineQuest. It's making much more sense structurally than the tangle of semi-interlocking macros I had before. Working on a real gamestory also pushes development of TwineQuest in useful directions based on real cases rather than conjecture.

The publicly released goodie this week is an autosynonym plugin. I was often used the randomp macro to add bits of random flavour around the place... well the autosynonym system makes it much easier: $$word tells the code which line to select a replacement from. The replacements are all from a specially tagged passage. It sits very nicely as an optional TwineQuest plugin and is much easier to code too.

I started moving my publicly released macros, mods and styles into TwineQuest. In most cases I make the code Public Domain when I do this, though some will remain "creative commons / attribute / modify". I aim to move all my free public stuff into the TwineQuest repositories over the coming few months.

I would encourage other people to do the same. The more useful content we get into the repo, the better it becomes.

Also started typing up stuff into the wiki.

--Et

Ade Smith

unread,
Oct 22, 2013, 3:17:35 AM10/22/13
to twee...@googlegroups.com
Ok so I have been using Twine for a week or so and I find the language good, I do need to work out micro CSS control for each page, that would be nice. 
I like the freedom of twee and twine.
I intend to put a story - eventually - into Windows Phone App store. 
I have the minibrowser container ready, I have tweeked the SugarCube header for the phone but just the I.F. to write :)

Still exploring the capabilities of Twee/Twine and getting a little frustrated with the lack of examples(thats the programmer in me).

Is there an examples thread where simple and complex examples can be posted? 
Maybe make it a sticky here? See below for a single page that is referenced all over the story example.


The language of twee is flexable, it just needs many more complex examples explaining how to do things, like what are and how do you use the tags!!! line in Twine?
You can do a lot all by your self (examples again), however the one feature I would add is a page template. 
So each new page has set text in it that I have repeat each time i start a new page.

For instance to view your inventory is easy and access this single page from any page but it requires you to store the current location in a variable so you can jump back.
To do this I have a line to set the current location, a Line to access the inventory and some other basic bits like current page title and a Options header, all this smacks at a template:

Example:
If you have a page and want to show it:
:: Start
<<set $showInven = true>>

:: A Page 1
<<set $place = "[[Continue|A Page 1]]">>
<<set $torch = "A Torch">>

You pick up a torch

Options

<<if $showInven>>Go look at tools in your [[Inventory]]<<endif>>

[[Continue|Next Page]]

then have a single inventory page like this

:: Inventory
[[Inventory]] 
You currently hold: 
 
<<print $torch>> 
<<print $knife>> 
<<print $pistol">> 
<<print $badTalisman>> 
 
Options 

<<print $place>>

If the item is blank it will then not show anything. (Well it will, it shows a blank line that is a little annoying)
The <<print $place>> at the end returns you to the place you came from as long as each page has a line in it that sets the $place variable (except in the Inventory page ofcause)

and this is where I would like a template so each time a new page is added in twine then a set layout is given or have a key combination that will populate a template.


How do you use tags and micro styling per page.

Cheers

Brad Becker

unread,
Oct 30, 2013, 12:30:46 PM10/30/13
to twee...@googlegroups.com
Is this still being developed?

HarmlessTrouble

unread,
Oct 31, 2013, 3:58:14 PM10/31/13
to twee...@googlegroups.com
Brad,

I should hope so. Much has happend with TwineQuest that I haven't had time to catch up on and there is a few things I want to pitch into it.  As for Twine itself. Although Twine 2 is actively being developed there is plenty of development life left in Twine.  I am also poking my head back in to see if we're ready for an new official release.   I see there is still pull requests to the github repository.  Hopefully we can get a polished update with some cool new features "soon" for whatever that means.

Reply all
Reply to author
Forward
0 new messages