intfiction.org

The Interactive Fiction Community Forum
It is currently Sun Feb 17, 2019 4:07 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: gamebookformat
PostPosted: Mon Feb 24, 2014 5:47 pm 
Offline

Joined: Sat Apr 23, 2011 3:53 pm
Posts: 70
Hello. I created an account and introduced myself on this forum almost 2 years ago, but have not posted anything since. I did lurk a bit though (as I have, mostly, lurked on the usenet groups before that, on and off since 1995).

Gamebooks and tools to make them are sometimes discussed on this forum (I refuse to talk about them as CYOA after reading some actual CYOA books) so I thought someone might be interested in this open source tool I created last year to help me create such books:
https://github.com/lifelike/gamebookformat

It is a python script that reads a gamebook file with some simple markup. Output can be a gamebook as LaTeX, RTF, plain text, HTML for instance. Or you can generate playable HTML with JavaScript that lets you play/read in a browser, keeping track of stats and inventory, allowing you to disable choices not available (eg not being able to open a door without the right key or whatever). I have read many gamebooks, studied even more, trying to include enough features to implement most of them. The main thing lacking is a combat system (not that all gamebooks need one, right?).

Paragraphs are given symbolic names, and the paragraphs are shuffled and numbered automatically. The numbers used are saved to a separate file so the same paragraphs can be given the same numbers again when you re-run the script (trust me, that makes incremental development/playtesting a lot easier).

Why yet another format, you ask (or should ask)? Well, I started because I wanted to make paragraph-driven boardgames, so I needed nice printable output, plus some features that makes it easier for me to integrate with a printed board. I also wanted something that would play well printed on paper and played on a computer/tablet/smartphone. While the format supports adding some logic to the books, I have tried very hard to make the results always playable also in a printed version (or if you want to read the PDF on a screen; it has clickable links to take you between paragraphs, but of course no other logic). For instance I have avoided any feature, like optionally displaying text, that simply can not work in a printed book. That was the main problem I had with existing solutions I could find, that in the rare cases they supported static printable output it seemed more like an afterthought and relied on carefully using a subset of the tool. Or the tools only could create a static book, no playable digital version at all. There were probably some tools I did not see, but anyway NIH is always a strong reason as well I guess.

It is easy to add templates for more output formats, or add new tags to existing formats, for instance if a book needs some special 'macros' or formatting and/or scripting. I made a quick attempt at creating some Twine output, but there were some of my tags that were not trivial to translate to that format, so I put that project on hold for now (it felt a bit redundant too because I already export directly to HTML+JS, but since I have not spent much time making nice CSS for my HTML Twine would have been a nice shortcut to get much prettier results).

Here is an example file:
bgg.gamebook

And this is what the output looks like:
PDF
HTML
PNG (flowchart)
JSON (section-number map)

Not going to bother anyone much about this. It's mainly for my own use, for games/gamebooks I want to make. But if it happens to be useful to someone I would be happy to discuss it and accept patches and/or discuss future updates.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: gamebookformat
PostPosted: Mon Feb 24, 2014 7:06 pm 
Offline

Joined: Fri Oct 18, 2013 10:13 am
Posts: 2684
Location: The Midwest
I'm not able to access the site the examples are hosted on for some reason. Do you have any mirrors? (Or, alternatively, would you mind just sending me a zip with the different formats of the example in it?)

_________________
Daniel Stelzer


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: gamebookformat
PostPosted: Tue Feb 25, 2014 1:42 am 
Offline

Joined: Sat Apr 23, 2011 3:53 pm
Posts: 70
They are also all in the expected/ subdir in the github repo (together with some more examples).


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: gamebookformat
PostPosted: Fri Feb 28, 2014 12:39 am 
Offline
User avatar

Joined: Thu Feb 27, 2014 11:50 pm
Posts: 47
Location: amish-land
Try a program called Advelh. Last release was in 2007 revision 36.1 for the pc windows system. It mainly tracks paragraphs so if you swap two locations around it changes all the pointers to acomidate the swap. That way you dont end up with "Goto X" and theres nothing at X. It can handle up to 800 "sections". I find it verry usefull.

_________________
I play for fun! Not for points or success. Now where's that cheat sheet?


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: gamebookformat
PostPosted: Fri Feb 28, 2014 12:58 am 
Offline

Joined: Sat Apr 23, 2011 3:53 pm
Posts: 70
That sounds extremely limited though, as my system has no limit on the number of paragraphs, handles many more things than numbering paragraph links, do not force you to use a specific editor, and is not limited to just one operating system. Not to mention gamebookformat was last updated in 2013 and you can expect more in 2014

But I will have a look to see if there are other features worth borrowing from that tool. Do not remember if it was one of those I considered before writing my own.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: gamebookformat
PostPosted: Sun Mar 02, 2014 2:48 pm 
Offline
User avatar

Joined: Sun Dec 23, 2007 3:24 pm
Posts: 189
It'll be interesting for me to look at your option to shuffle paragraphs, I may be able to reuse it for using with my own tool, textallion, which has a similar purpose and aims at producing printed documents, ebooks or website (I'm also using graphviz and latex like you do), and it can exports to several other formats as well (among others, twine).
The manual: http://anamnese.online.fr/site2/textall ... oa_en.html

You can find some examples there: http://anamnese.online.fr/site2/textall ... lue_death/


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: gamebookformat
PostPosted: Sun Mar 02, 2014 3:42 pm 
Offline

Joined: Sat Apr 23, 2011 3:53 pm
Posts: 70
Impressive list of output formats, and looks like a nice markup language!

Named paragraphs that are automatically numbered and have the correct number inserted for all links is very easy really. Surprised so few tools do that. Although mine just does a standard shuffle. Ideally it would use some algorithm to number sections more intelligently, eg never link from one section to the very next one.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: gamebookformat
PostPosted: Tue Sep 23, 2014 4:41 pm 
Offline

Joined: Sat Apr 23, 2011 3:53 pm
Posts: 70
gamebookformat now also includes the tool checkgamebook.py that for now can at least do some simple sanity-checking (finding unreachable sections and print out a list of all ending/death sections in a book). Requires a debug output-file built for a gamebook using the same flags as will be used for the real output-files (eg if ignoring some tags when making the HTML and PDF versions of a book, those same tags must be ignored when generating the debug file).

To support that script the old debug format has been changed to a much more formal one (in JSON) that makes it trivial to write scripts like checkgamebook.py. It would also make sense really to use that format for players. Maybe I will even throw out the old HTML+js gamebook-player and replace it with a new one that use the JSON data to render sections instead of the rather kludgy HTML data-tags in the current one. But if the debug format isn't only used for debugging gamebooks it should probably have a better name.

Also some other misc bug fixes and small improvements, including a short section in the README with some hints on how to make EPUB (tl;dr: make the static HTML version of your book and convert it using Calibre) and also documenting a few other minor features in the README.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: gamebookformat
PostPosted: Mon Dec 22, 2014 9:01 am 
Offline

Joined: Sat Apr 23, 2011 3:53 pm
Posts: 70
(Perhaps admin could move this thread to the choice-based if-tools forum now that it exists?)

Twine 2 looks very nice, and the generated HTML is (like old Twine) much nicer than what the HTML generated by gamebookformat is (TODO: borrow some nice stylesheets). For fun because I sort of had an hour to spare I added an option in gamebookformat to export to Twine 2. It is in the latest version on github now.

Here is an included example file and what it looks like when exported to Twine 2 (that file can be imported in the Twine 2 user interface to play or edit):

https://raw.githubusercontent.com/lifel ... t.gamebook

https://raw.githubusercontent.com/lifel ... est.twine2

... and this is what the story looks and plays like when exported from Twine to a stand-alone HTML file:

http://www.lysator.liu.se/~perni/Gamebo ... ample.html

(Not much of a story though. Also that file is not updated with the latest changes from github so it differs slightly from what is in the files seen above.)

Obviously lots of things missing. To make it really useful I should add proper markup for collections and items. It looks like that will not be too difficult though. I think they did a great job on Twine not only with the user interface but also the data format (except I have some issues with whitespace being significant that is always annoying).

EDIT: Note how the generated "HTML" isn't actually html at all. Maybe I should give it another extension in the future. It was just that the generated files when you exported from Twine were called html, so I followed that convention.

EDIT 2: Changed output type from html to twine2. Updated this post to reflect that to avoid confusion.


Last edited by pelle on Mon Dec 22, 2014 11:34 am, edited 1 time in total.

Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: gamebookformat
PostPosted: Mon Dec 22, 2014 9:57 am 
Offline

Joined: Sat Apr 23, 2011 3:53 pm
Posts: 70
While at it I added a new command-line flag (-x, or --allow-unknown) and some supporting code and documented it a bit like this:

"Any of the built-in templates can be overridden easily. New tags can be added that can generate any output you need for different file formats. However to add a tag that is not included in the default distribution the command-line flat -x is required to tell gamebookformat that you know what you are doing. Otherwise when an unknown tag is encountered you get an ugly error message. The reason for making it moderately difficult to add a new tag is that all the builtin tags have been choosen to work reasonably well in anything from static printed gamebooks to dynamic digital app gamebooks. Anyone thinking of adding a new tag should think twice about how having that tag might mean that some output formats are not longer useful. Sticking to the default tags and not overriding them to do bad things ensures that your gamebooks are still readable and playable in all supported output formats. (The process of adding new templates and new output formats really should be better documented.)"

It is a difficult balance to make it easy to extend the format with any template the user want to have and also make sure that generated gamebooks work both on paper and on screen. To make books that only work on a screen there are many other tools, some most likely much better than gamebookformat. This tool is by design made to compromise and only include features that will also look good on paper, meaning that some stuff supported by eg Twine will never be included (anything dynamically generating text, essentially, so no inserting variables or optionally including a block of text).


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group