Making a choice-based game in Inform

This is a hypothetical question. I don’t have an idea for a project, just an interest and the desire to know more.

So, Inform people, if you wanted to write a choice-based game without parser, but with a more or less complex underlying world model…

Would you consider it doable? Would you think Inform 7 (with or without Vorple) could work well enough for it? If workable, would it be normal hard, hard hard, or demented hard? Is there any example of how to do something like that? Any game that does it and has public code?

A basic interface like The impossible bottle would work pretty well for me. (Why am I not looking at Dialog then? Because Dialog’s syntax gives me a totally alien feel.)

Why would I ask this? Working with a rule-based system, Gruescript, in Tricks of light in the forest, was really really enjoyable, a very welcome change from the branching stuff I had almost always done. It’s not the world model part that really interests me, but defining everything in terms of rules. But perhaps I’d like a system that is more powerful and without some of Gruescript’s quirks.

2 Likes

You can do hyperlinks and remove the parser in Inform. Vorple opens a few more options for visual presentation (but not as much as using html would).

Here’s a fun example of an rpg gang generator that Sam Kabo Ashwell made in Inform which has buttons and no parser:

https://samkabo.com/ApocalypseFuel/index.html

With source code available:

2 Likes

I think you could do it with Hybrid Choices. I think it’s most commonly used for dialog, but you can fire off rules with it and do all kind of stuff.

I can’t say how well a large game would go, I’ve only used it for small stuff.

4 Likes

If either of these demo itch games are interesting, I can show you how to make them:

(a mockup of a Twine clone using Inform)

(a game that blends choice-based and parser-based segments)

5 Likes

oooh, that’s beatiful. Would you say that kind of interface is hard to create in Inform 7?

This is all pure speculation from my part (I don’t even have an idea yet!) but I guess that at first I would define choices by hand, like in a choice-based system, and use rules to define behaviours, but eventually I would like to define choices not by hand but programatically (kind of telling the system to check all object-verb pairs available in the current turn and display those that fulfil certain conditions). I’ve always tried to bend every system I’ve used until almost breaking it, after all.

Thanks @kamineko and @Joey !

3 Likes

It’s not too hard! This is the full code, mostly CSS (which I know you’re an expert on):

"FakeTwine" by Mathbrush

Release along with a "Bisquixe" interpreter.

Include Simple Multimedia Effects by Mathbrush.
Include Basic Screen Effects by Emily Short.

Current Room is a room.

When play begins:
	css-set-fast ".BufferWindow;background-color;black";
	css-set-fast ".BufferWindow;padding;100px 250px 6px 2px";
	css-set-fast ".BufferWindow;overflow;auto";
	css-set-fast ".GridWindow;background-color;black";
	css-set-fast ".BufferLine;font-size;16px";
	css-set-fast ".BufferLine;color;white";
	css-set-fast ".Input;display;none";
	css-set-fast ".coverimage;display;none";
	css-set-fast ".interpretercredit;display;none";
	css-set-fast ".links;display;none";
	css-set-fast ".play;background-color;black";
	css-set-fast ".BufferLine;font-family;Verdana, sans serif";
	now the command prompt is "";
	
Report looking for the first time:
	[If we used when play begins, the first passage would be lower down.]
	clear the screen;
	say "Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the [passage world]."
	
To say passage (nextPassage - a passage):
	hyperlink "[nextPassage]" as "zzxvm [nextPassage]"

Passaging is an action applying to one thing.  Understand "zzxvm [any passage]" as passaging.

A passage is a kind of thing.

Carry out passaging:
	if the noun is a passage listed in the Table of All Passages:
		clear the screen;
		say "[reply entry]";
	
Some passages are defined by the table of all passages.

A passage has some text called the reply.

When play begins:
	now every passage is held by the player;

Table of All Passages 
passage	reply
world	 "'All the world's a [passage stage], and all the men and women are merely [passage players].'"
players	 "Don't hate the players, hate the game. -[passage Moby Dick]"
stage	 "At this stage, we're pretty similar to Twine. -[passage Moby Dick]"
moby dick	"Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the [passage world]."

Rule for printing the banner text:
	do nothing;
	
The room description heading rule does nothing.

Rule for constructing the status line:
	do nothing;

So it’s just a table of ‘passages’, each with some text, and you link to each one using the ‘passaging’ technique. If you wanted to change variables, you would just say

After passaging moby dick:
    now IshmaelSpoke is true;

or whatever you want.

1 Like

Did you use the same method in Never Gives up her Dead? While being very simple, I see it could become a problem with a lot of passages or long passages.

Anyway, it seems way simpler to make a choice game than I expected!

1 Like

I used something like it for the trailer, but I didn’t keep the code.

Yeah, it’s not that bad! And if you just want something like Impossible Bottle, Dialog has a lot of built in features for that that are about the same difficulty level as this. So you have several options, all of which aren’t too bad.

1 Like

I remember Linus saying that Dialog was intended from the beginning to allow a choice interface if desired. And the way choices are displayed in The impossible bottle is, I’m sure, exactly what I described before as “displaying choices programatically”. But I don’t think I’ve ever seen a language syntax as terrifying and uninviting (only to me!) as Dialog’s. ¯_(ツ)_/¯

1 Like

There’s an officially supported choices mode coming up in a future version of Inform, right? Graham Nelson’s thorough docs for how it will work exist and I’ve read them… but can’t find them right now. His roadmap stuff is hard to Google. The link is probably somewhere in this board.

So you could wait for that, but I don’t know how far off it is.

Basically, everyone in Inform currently uses Hybrid Choices for what you want to do. For me, it’s way too circuitous a route to programming something that I could do in 5 seconds in any version of BASIC, and with much more readable code, too. So I developed my own system for an Inform extension. Then I tried to anticipate too many end use requests, and the extension got too crazy and I stopped! Then I culled it and picked it up again, but unfortunately the end result only exists in my WIP. But I’ll show you what it does:

This is the n-nico-africa-menu rule:
	if cyoa_node_stage is "a":
		say "'An interesting vessel. It had a totally different anti-grav design to the others. That's why it looks like a spear, not blocky. The engines are way up the back, the living area up the front. The whole thing would spin. It made the worst landing here of any of the ships, but that's nobody's fault. None of them were meant to land here, were they?'[lb]I'm aware that my pilot's eye does like the silhouette of this ship.[lb]'So,' says Nico, 'is the Dembe the holo for you?'";
	cp 1 for "I'll go with the Dembe";
	cp 2 for "I'll look at the main ships menu again";
otherwise if cyoa_node_stage is "b":
	now made-very-first-ship-presentation-yet of Nico is true;
	if cm is 1:
		now c5-ship-choice-as-number of Korhva is 8;[store your ship pick]
		now cyoa_node is n-nico-format-confirmation rule;
	otherwise if cm is	2:
		now cyoa_node is n-nico-ships-choice rule;
	handle the current input event as the action of nodegoing;

This is one rule that has everything I need for a node in one place. The text to be printed. The choices. The code to be run after the choices. This is what I wanted. I can’t stand choice programming consisting of multiple rules and bits of pieces all over the source. I wouldn’t have attempted my current game if I had to do it that way.

So I guess this speaks to: Inform is inherently Not Good at dialogue choices as is. But a non-vapourware choice mode is coming. How far off is it? I don’t know. In the meantime, you can grapple with Hybrid Choices or something, or roll your own.

-Wade

1 Like

Interesting code! I don’t know enough Inform to understand it yet, but my initial fears that this kind of thing would be too hard in Inform 7 seem to be totally refuted.

I would like to define choices not by hand but programatically (kind of telling the system to check all object-verb pairs available in the current turn and display those that fulfil certain conditions).

This is quite an important feature for systems that overlap choice and parser. I’ve been calling this “command elevate to choice”. It means promoting certain commands into choices automatically depending on context, scope and other conditions.

Wade mentioned the forthcoming Inform choice features. Does anyone know whether this sort of thing will be possible with it?

2 Likes

In a limited way this could be done, but in general the complexity of before/check/instead rules is too high to, say, list all actions that could be done. Just checking whether a single action is available is impossible unless some real restrictions are imposed. This is a hard restriction on computability, not a weakness of Inform.

1 Like

There’s a reason The Impossible Bottle, which tries to put a choice-based interface over a parser world model, has you select a verb and an object separately instead of showing every possible combination!

1 Like

Just for additional data, my games The Exigent Seasons and This Old Haunted House are effectively choice-based games in Inform. Source code for each is available.

2 Likes

The kind of hypothetical mechanism I’m thinking of would be something like tagging an action as visible (of course, I have no idea if this concept is implementable in Inform in any way), and then each turn the engine loops through all the visible things and displays the tagged actions associated with each one. Tagging could be purely manual, in a typical CYOA way, or through rules, like “jump from plane will be visible when parachute is ready.”

All that could be impossible of course. Then one would have to go the pure CYOA way, explicitly writing the available choices for each situation.

I’m testing it right now.

2 Likes

Possible, yes. Easy, perhaps not. It depends how elaborate you want the logic to be.

Anecdotally (I’m using an interface like this for my IFComp entry), I only display the choices for one or two objects at a time, and even still I’m struggling with there being too many of them! The flow goes something like “click a noun in the description, see viable actions for that noun, click one of them, choose a second noun if necessary”.

2 Likes

toyed a bit with exigent seasons: I think is an interesting mechanism, albeit has some margin of improvement, (and porting it to TADS (whose supports link-style parser input) will be very interesting… but I have to pass… jbg ? you like the idea ?)

Best regards from Italy,
dott. Piergiorgio

1 Like

Anyone who finds value in the effort is welcome to port the game to TADS, though I hope that they will not feel that permission thus granted is an obligation. I would indeed be interested to see what changes might ensue from a transformation of this nature!