Wooah, a new plugin! This one is a little less serious, though.
It’s a ‘bot’ with which to play interactive fiction aka classic text adventure games on your Discourse forum and is essentially an adaptor to the standard and amazing Z-machine interpreter called ‘frotz’ at David Griffith / frotz · GitLab
The setup adds two games, you can add more in settings.
Each entry contains a Title and the name of the story file.
To kick off the interaction you need to @ mention the bot set in settings. After that, replying to a post of theirs is enough.
To list the available games, you first need to mention the bot and ask:
@mybot list games
This will give you the range of options
To start a game type:
start game x substituting x for the option number.
If you want to switch to another game you can do so; the plugin saves your progress on every move so you can return to the first story at any time. The plugin maintains a save for every story for every user that tries it.
To continue an existing game type:
continue game x substituting x for the option number.
NB A full rebuild will destroy all save files. This is a necessary compromise.
Many “Meta’s” will have grown up with these things. For those less familiar, check out this cheatsheet: Play Some Interactive Fiction
(apologies, automating this is on my list!)
In an ssh session, enter your container and the rails console:
./launcher enter app rails c
Then do this:
u = User.create!(username: "Frotz", name: "FrotzBot", id:-5, email: "firstname.lastname@example.org") u.activate
Your new bot will then be available to set up in the UI. Go to the user’s settings in the UI via the admin button and turn off all emailing. Update the avatar to taste.
This is a little more invasive than a usual plugin.
add this to app.yml:
hooks: after_code: - exec: cd: $home cmd: - git clone https://gitlab.com/DavidGriffith/frotz - exec: cd: $home/frotz cmd: - make dfrotz - exec: cd: $home/frotz cmd: - mkdir savegames - exec: cd: $home/frotz cmd: - mkdir stories - exec: cd: $home/frotz/stories cmd: - wget --no-check-certificate http://www.batmantis.com/zorks/zork1.z5 - exec: cd: $home/frotz/stories cmd: - wget --no-check-certificate http://www.douglasadams.com/creations/hhgg.z3 - exec: cd: $home/plugins cmd: - git clone https://github.com/merefield/discourse-frotz
before your other plugin entries.
You now also need to add the Discourse BBCode plugin!!
Rebuild with the usual
./launcher rebuild app
Now go to the plugin settings and select the bot user you added earlier:
You will note I’ve included a couple of stories. You can find more at https://ifdb.tads.org/.
However, watch rate limits here! Getting too many stories from the same location may cause an error.
Also note that the stories are not sitting on https protected servers (tut tut).
If you insist on loading more add them to app.yml. You could also add them manually from the command prompt, but realise these will be wiped on the next full rebuild.
Allows users to play in private, but usage will be less transparent. If you have a big enough server this may not be an issue for you. In any case be aware of implications for capacity. As an alternative, encourage users to play in a designated Category.
If (s)he is not enabled there, the user will get a polite message:
You can restrict the bot to a (list of) Category to avoid filling up other areas:
This is really important to improve the ‘gaming’ experience. And you really only need to remember two:
Shift-R to reply to the bot
Ctrl-Enter to submit your next move
Not all story formats and games are yet supported. There are loads of games that don’t work because of the nature of their call and response protocols. Because of the way we are interacting post by post we have to ask Frotz to save state at each mode. If one step of the game doesn’t lead to a prompt at which the system can can save (ignoring press any key or More prompts which should be handled), then the story won’t work. e.g. in Act of Murder (great game!) the lady at the door asks if you are a policeman. Unfortunately this is a state of the game that’s unsaveable so fails this requirement and I can’t see a way we would get that to work.
NB Mailing list mode is a disaster with this, so make sure this is not something you use before attempting to use this plugin!
It is arguably a bit wasteful of forum resources as it requires at least two posts for every ‘move’. It is obviously often more appropriate to play these kind of games using a chat interface, rather than a forum, but you might argue this could be used to create Walkthroughs? Having said that, we have the popular Babble chat plugin which uses the same Topic and Post models and probably generates even more data. I have not tested it with Babble btw.
For a less invasive solution, consider: Turning a topic into interactive fiction ;)
Before I created this, I thought about utilising the existing RESTful service credited below (and in plugin.rb), but I felt this would over complicate the setup. It would require users to set up a separate server. Instead, I decided to port that code into my code and extend it as a local service. I may regret that decision though as clearly there is always a maintenance overhead with these things. I can’t promise I won’t switch to or add a RESTful interface later on.
All feedback is welcome!
This plugin exploits David Griffith / frotz · GitLab the Frotz Z-Interpreter which is cloned and ‘made’ by the setup script
Thanks to @P16 for allowing me to use excerpts of code from a closed source chatbot we worked on together.