💾 Archived View for gemini.ctrl-c.club › ~nttp › writing › intfic › writing-alan3.html captured on 2023-03-20 at 20:03:01.

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

<!DOCTYPE html>
<meta charset="utf-8">
<title>Writing a text adventure In Alan 3</title>
<link rel="stylesheet" type="text/css" href="diary.css">
<link rel="icon" type="image/png" href="icon.png">
<meta name="viewport" content="width=device-width">
<meta name="description" content="">
<meta name="author" content="Felix Pleşoianu">
<meta property="og:site_name" content="Fictionally interactive">
<meta property="og:type" content="website">

<header role="banner">
 <a href="https://felix.plesoianu.ro/intfic/">Fictionally interactive</a>
 <h1>Writing a text adventure In Alan 3</h1>
</header>

<time>25 March 2013</time>

<p>For the past few months, the only hobby I've practiced was writing.
That's because every time I tried programming for pleasure I found
myself giving up in minutes &mdash; that's how badly I was burnt out.
There's been one exception to this: writing a text adventure in Alan 3.

<p>Of course, <a href='https://felix.plesoianu.ro/intfic/catch-that-cat/'>Catch That Cat</a> isn't a <em>new</em> adventure. Initially
written as a demo for a <a href='https://notimetoplay.org/engines/jaiffa/'>homebrew authoring system</a> and later
<a href='https://notimetoplay.org/cgi-bin/wiki/What_porting_can_teach_you'>ported to TADS 3</a>, it's more like my own personal <a href='http://www.firthworks.com/roger/cloak/'>Cloak of Darkness</a>, albeit one that's rather large and complex for the
task, having a bigger than needed map (like everything I design) and
two NPCs with radically different behavior. But that only makes it
more suitable for exploring a new authoring system in depth.

<p>Well, not entirely new. Ever since I <a href='alan3-review.html'>first looked at Alan 3</a>,
it was my intention to try and use it seriously. Maybe it's because
I always root for the underdog, out of a reflex to avoid monocultures.
Maybe it's because of the system's exotic flavor. That you don't
absolutely need a standard library to use the language is definitely
attractive, and indeed I ended up writing my own instead of using the
official one; more about this in the next article.

<p>Where to begin? Alan 3 is one of those programming languages that do
their best to be friendly and natural-looking. It does not, however,
try to pass for English. The syntax is simple and for the most part
uniform, with terse but clear error messages. I'd say the language can
appeal to both programmers and non-programmers alike. Alan does seem
to be overly verbose initially, but the game came out smaller than in
TADS 3. So much for first impressions!

<p>Also, while Alan appears inflexible on the surface, what with the
hardcoded parser and everything, it does in fact offer a surprising
amount of control. I suspect that with a bit of fiddling I could even
have simulated the retro-styled auto-listing of visible objects and
exits (well, doors &mdash; you can't manipulate exits programmatically in
Alan). But that would have required me to wrestle with the language
instead of writing my little story, so I decided to go with the flow.

<p>The one major limitation I found is the impossibility to trigger
actions from code. That means no redirecting verbs, and implicit
commands can only be implemented with ample code duplication. For an
example, consider the very common case of trying to enter a locked
door:

<pre><code>
	&gt; west
	(first opening the big red door)
	(first unlocking the big red door)
	(with the small brass key)
</code></pre>

<p>Unless I've missed something big, the amount of work required to make
that happen in Alan would be absurd. But you know what? Take that as
an incentive to replace locked doors, which are a very tired trope,
with more imaginative obstacles. Say, a tunnel with a security system
you can trick by shadowing a robot on its cleaning tour.

<p>(Edit: I later found a way to do it in door object checks with only
a small amount of boilerplate and a little library support.)

<p>That, by the way, is especially easy to do in Alan thanks to the
system of "scripts" built into actors &mdash; think theatrical scripts.
(Or, if you're a programmer, finite state automata.) That's similar to
the actor states in TADS, except here I was able to figure them out
fully without spending too much time.

<p>I do have a number of quibbles with the language, such as the "after"
verb qualifier being made nearly useless by the overreaching scope of
"only", (also, what's up with the "or" operator precedence?) but
overall I was able to achieve more or less what I wanted with less
effort than I'm used to. Where the manual wasn't clear enough, a quick
look at the beginner's guide or standard library set me on the right
path. More on this next time.

<p>To draw some sort of conclusion, I'd say Alan 3 is the ideal language
to experiment with if you're looking to do something unusual, such as
keyword-driven games or rooms representing states of mind. Arbitrary
exit names, as well as the ease of declaring verbs per location, seem
made for that. I would also choose it if I wanted to make something
like <i>The Fire Tower</i>, with a big, open map and little in the way of
puzzles. Only if you require hyperlinks or online play should you look
elsewhere from the start.

<p>On the game's page you'll find this new implementation with source.