Discourse Frotz 🧙

Wooah, un nuovo plugin! :tada: Questo è un po’ meno serio, però. :video_game:

Discourse Frotz


Non è più necessario menzionare il bot con @ a ogni passo. Una volta iniziato il gioco, basta rispondere a lui.

Repo Git: GitHub - merefield/discourse-frotz: A plugin that uses Frotz to give you an interactive fiction experience on your Discourse forum · GitHub

Che cos’è

È un ‘bot’ con cui giocare a narrativa interattiva, ovvero classici giochi di avventura testuale, sul tuo forum Discourse. È essenzialmente un adattatore per l’interprete Z-machine standard e straordinario chiamato ‘frotz’, disponibile su David Griffith / frotz · GitLab

Come usarlo

La configurazione aggiunge due giochi; puoi aggiungerne altri nelle impostazioni.

Ogni voce contiene un Titolo e il nome del file della storia.

Per avviare l’interazione, devi menzionare con @ il bot impostato nelle impostazioni. Dopo di che, rispondere al suo post è sufficiente.

Per elencare i giochi disponibili, devi prima menzionare il bot e chiedere:

@mybot list games

Questo ti mostrerà le opzioni disponibili.

Per iniziare un gioco, digita:

start game x sostituendo x con il numero dell’opzione.

Se vuoi passare a un altro gioco, puoi farlo; il plugin salva il tuo progresso ad ogni mossa, così puoi tornare alla prima storia in qualsiasi momento. Il plugin mantiene un salvataggio per ogni storia per ogni utente che la prova.

Per continuare una partita esistente, digita:

continue game x sostituendo x con il numero dell’opzione.

NB Una ricostruzione completa distruggerà tutti i file di salvataggio. Questo è un compromesso necessario.

Come si gioca a un gioco di IF (Narrativa Interattiva)?

Molti “Meta” sono cresciuti con queste cose. Per chi è meno familiare, consulta questa guida rapida: Play Some Interactive Fiction

Configurazione

Crea l’utente Bot

(scusa, automatizzare questo è nella mia lista di cose da fare!)

In una sessione ssh, entra nel tuo container e nella console rails:

./launcher enter app
rails c

Poi fai questo:

u = User.create!(username: "Frotz", name: "FrotzBot", id:-5, email: "not@really.valid")
u.activate

Il tuo nuovo bot sarà quindi disponibile per la configurazione nell’interfaccia utente. Vai alle impostazioni dell’utente nell’UI tramite il pulsante admin e disattiva tutte le email. Aggiorna l’avatar a tuo piacimento.

Installa Discourse Frotz

Aggiorna il tuo app.yml

Questa procedura è un po’ più invasiva rispetto a un normale plugin.

Aggiungi questo al file 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 -O zork1.z3 https://eblong.com/infocom/gamefiles/zork1-r119-s880429.z3
    - 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

prima delle altre voci dei plugin.

Ora devi anche aggiungere il plugin Discourse BBCode!!

Ricostruisci con il solito comando ./launcher rebuild app

Ora vai alle impostazioni del plugin e seleziona l’utente bot che hai aggiunto in precedenza:

image

Storie

Noterai che ho incluso un paio di storie. Puoi trovarne di più su https://ifdb.tads.org/.
Tuttavia, fai attenzione ai limiti di velocità qui! Ottenere troppe storie dalla stessa posizione potrebbe causare un errore.

Nota anche che le storie non si trovano su server protetti da HTTPS (tut tut).

Se insistete per caricarne di più, aggiungetele all’app.yml. Potreste anche aggiungerle manualmente dal prompt dei comandi, ma tenete presente che queste verranno cancellate alla prossima ricostruzione completa.

Abilita FrotzBot per i messaggi privati (consigliata cautela)

Permette agli utenti di giocare in privato, ma l’utilizzo sarà meno trasparente. Se hai un server abbastanza grande, questo potrebbe non essere un problema per te. In ogni caso, sii consapevole delle implicazioni per la capacità. In alternativa, incoraggia gli utenti a giocare in una Categoria dedicata.

image
default: OFF

Se non è abilitato lì, l’utente riceverà un messaggio gentile:

Limita FrotzBot per Categoria

Puoi limitare il bot a una (lista di) Categoria per evitare di riempire altre aree:

Scorciatoie da tastiera!

Questo è davvero importante per migliorare l’esperienza di ‘gioco’. E devi davvero ricordare solo due:

  • Shift-R per rispondere al bot

  • Ctrl-Enter per inviare la tua prossima mossa

Limitazioni e considerazioni

Non tutti i formati di storia e i giochi sono ancora supportati, né è probabile che lo siano. Ci sono molti giochi che non funzionano a causa della natura dei loro protocolli di richiesta e risposta. Dato che interagiamo post per post, dobbiamo chiedere a Frotz di salvare lo stato dopo ogni mossa. Se un passo del gioco non porta a un prompt in cui il sistema può salvare (ignorando i prompt “premi un tasto” o “Altro” che dovrebbero essere gestiti), allora la storia non funzionerà. Ad esempio, in Act of Murder (grande gioco!), la donna alla porta chiede se sei un poliziotto. Purtroppo questo è uno stato del gioco che non può essere salvato, quindi non soddisfa questo requisito e non vedo un modo per farlo funzionare.

NB La modalità mailing list è un disastro con questo plugin, quindi assicurati che non sia qualcosa che usi prima di provare a utilizzare questo plugin!

Si può dire che sprechi un po’ le risorse del forum, poiché richiede almeno due post per ogni ‘mossa’. È ovviamente spesso più appropriato giocare a questo tipo di giochi usando un’interfaccia di chat piuttosto che un forum, ma potresti obiettare che questo potrebbe essere usato per creare Guide di gioco? :wink:

Per una soluzione meno invasiva, considera: Turning a topic into interactive fiction ;)

Feedback

Tutti i feedback sono benvenuti!

Crediti

Questo plugin sfrutta David Griffith / frotz · GitLab, l’interprete Z-Interpreter di Frotz, che viene clonato e ‘compilato’ dallo script di configurazione.

Grazie a @P16 per avermi permesso di utilizzare estratti di codice da un chatbot a codice chiuso su cui abbiamo lavorato insieme.

45 Mi Piace

Wooah, back again!

New Feature-rettes

Enable FrotzBot for private messages (at your peril! :wink: )

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.

image
default: OFF

If (s)he is not enabled there, the user will get a polite message:

Restrict to a list of Categories, or allow all:


default: ON for all Categories

10 Mi Piace

Hi Robert! Thank you, I really like this plugin !
I tried to install it on dev environment (without docker) and my system asked for the ncursesw lib when making dfrotz, after installing that it worked, will it be the case with a prod env with docker?

1 Mi Piace

I tested on Production and building on Docker (to my surpirse) worked out of the box. Feel free to deploy to a Production instance and let me know how you get on.

Glad you like it!!

2 Mi Piace

For those like me, who might loose their last few hairs about that:

hhgg.z3,9,7,3
that’s :

  story_header_lines = 9
  story_load_lines = 7
  story_save_lines = 3

and now, how to adapt it… :sweat_smile:, that’s an adventure inside an adventure…!

1 Mi Piace

I’m currently working with the maintainer of Frotz to see if we can do away with those. It’s an approach I ported from restful-Frotz but hardly perfect :slight_smile:

1 Mi Piace

Yes ! found it !
kheper.z8,20,15,4 almost works
for this one :

:smiley:

it’s nothing, but there is something weird

) Line-type display OFF
Compression mode MAX, hiding top 0 lines

is displayed once by Pause() with

[Pause notNeeded;
@read_char 1 notNeeded;
rtrue;
];

1 Mi Piace

Ha, yeah, there are lots of quirks and a considerable amount of variety in the stories. I cannot promise to support all.

Right now my focus is on:

  1. simplifying code
  2. making the code more secure
  3. adding formatting where pragmatic.

#3 is surprisingly hard.

1 Mi Piace

I’ve pushed some improvements to a feature branch:

This does away with the silly suppression settings, introduces translation to BBCode to support formatting and colour, leverages the Dumb Frotz command line options better, obviates the need to write to a text stream and squashes a vulnerability.

This branch requires the official BBCode plugin to be installed.

I’m still experimenting with it. Feel free to do so too.

I’ll probably merge after some significant trials.

1 Mi Piace

Does the plugin need the whole frotz repo clone or does it just need $home/frotz/dfrotz to exist? Because I’d rather just compile it once and save the binary between rebuilds.

Not sure why you would care? The resources we are talking about are comparatively tiny. (6MB for the entire repo post make versus Gigabytes for the forum?). It clones the whole repo, then just makes dfrotz. Perhaps that is slightly wasteful, but the simplicity and repeatability is more important I feel. I could go into greater detail and perform a sparse clone, but that would make the build script more complex and less robust. Would it be worth it? Feel free to suggest an optimisation. This is all building inside the container, so will get cleaned whenever the container does.

I’m just trying to optimize for my tiny server, not asking you to change the general install.

1 Mi Piace

This is a really cool plugin! This reminds me of a “classic” computer game that was created years ago(I forgot the name).

3 Mi Piace

It’s a great suggestion for a future optimisation if I can keep it simple and robust. Thanks!

1 Mi Piace

Yes there are many playable classics. More via the link in the OP.

2 Mi Piace

BIG update: :tada: :kiwi_fruit:

(this has taken months of occasional background work and coordination with Frotz team).

Introducing full colour and monospaced formatting for stories

This big update comes with a bunch of improvements:

  • ADDED colour formatting and monospaced text support
  • IMPROVED simplified settings: no longer requires calibration of header and footer, just the desired title and story file, whoop!
  • IMPROVED uses Open3 gem for system commands, reducing risk of abuse/vulnerabilities.
  • IMPROVED internal interaction with command line to remove need for stream files, now copes with more/press any key prompts

Now REQUIRES the Discourse BBCode plugin!!

This required the collaboration of the maintainer of Frotz, David Griffiths and one of the very active members of that community, Borg323 who wrote the BBCode extensions against the BBCode Discourse standard. Many many thanks to them! We had to get a bit creative to get the monospaced text stuff to work, but the solution is really great!

Some examples of the new formatting (I’ve not fully tested these stories, these are just examples of formatting)

and notice the coloured compass here:

KNOWN ISSUES: There are loads of games that don’t work because of the nature of their call and response protocols. If one step of the game doesn’t lead you to a prompt at which you 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.

There are probably games that are now compatible with Discourse Frotz that weren’t before … please experiment but note the limitation above!

Let me know if you have any issues getting this to work and I’ll refine the instructions as required.

8 Mi Piace

Un promemoria: puoi utilizzare le scorciatoie da tastiera per migliorare la tua esperienza con questo plugin:

  • Shift-R per rispondere al bot

  • Ctrl-Invio per inviare la tua prossima mossa

(Scorciatoie da tastiera standard predefinite).

5 Mi Piace

Ciao Robert!
Finalmente ho avuto tempo di andare oltre, finora tutto bene, ha funzionato subito in produzione :+1:

Stranamente frotz non riesce a rispondere ai messaggi privati a meno che non lo imposti anche in una categoria :thinking:
Prossimo passo: giocare :grinning_face_with_smiling_eyes:

1 Mi Piace

Grazie per la segnalazione!

Ho già provveduto a correggere il problema: FIX: behaviour of private messages playing permission setting · merefield/discourse-frotz@34b022e · GitHub

NTS: bisogna aggiungere alcuni test unitari!

2 Mi Piace

Ho provato ad aggiungere :grin: in una fonte,

sarà divertente!

1 Mi Piace