小说与文学2016facundoolano.github.io
Show HN:Advenjure——终端和浏览器中的互动小说
Show HN: Advenjure – Interactive fiction on the terminal and in the browser
导读
这是一个用 Clojure 写的交互小说(文字冒险)引擎,示例游戏既能在终端跑,也能通过 ClojureScript 在浏览器里玩。对写作者来说,它展示了「读者用自然语言指令推动故事」这种叙事形式的底层结构:世界由房间、物品和状态定义,而解析器理解指令的能力,直接决定了读者的体验是沉浸还是挫败。
可以直接用的写作要点
- 01
交互叙事的骨架是「世界模型」而不是分支脚本:把房间、物品、状态和可用动作定义清楚,故事才能被读者自由探索。
- 02
你写下的每个细节都是对读者的承诺——文中提到「小桌子上有个瓶子」,读者就一定会去拿瓶子;如果系统无法回应,挫败感立刻出现。
- 03
设计互动时要先问「读者可能输入什么」,再问「我的解析器能懂什么」;两者之间的差距就是体验的裂缝。
- 04
想学结构,先读别人示例里的世界定义文件(房间与动作),比先读引擎源码更快建立直觉。
HN 评论精选
这类引擎的入门关键是先读示例的世界定义代码;Lisp 的「代码即数据」传统可能比现有引擎更适合兼顾作者与程序员。
先解释一下这是什么,因为我也是花了一会儿才看明白:它看起来是一个用 Clojure 写的交互小说引擎。链接的示例游戏通过 ClojureScript 在浏览器里运行,但引擎也能在终端工作。这里给出示例游戏中定义房间和动作的主代码文件链接;我怀疑不只我一个人在看交互小说引擎时喜欢先看这类示例。交互小说与 Lisp 的历史交织得令人意外:据我所知,Infocom 早期的游戏全部用 ZIL 编写,那是 Lisp 的一个古怪变体;而 ZIL 又是为了把当年写大型机 Zork 用的 MDL 变得更可移植,MDL 的设计者中有些人也参与过 Scheme 和 Common Lisp。现在有一个活跃但尚不完整的 C# 版 ZIL 编译器,还有一些 Common Lisp 的实验,但成熟的「交互小说 + Lisp」项目不多。我希望这类项目能流行起来。我很难搞懂别的交互小说引擎,它们常常想同时讨好程序员和写作者,结果卡在尴尬的中间地带;而 Lisp 的「代码即数据」思路或许更合适。
m48查看英文原文
A quick explanation of what this is, because it took me a bit to figure it out: it appears to be an interactive fiction engine written in Clojure. The linked example game is running through ClojureScript in the browser, but the engine also works in the terminal. Here's a quick link to the main code file defining the rooms and actions for the example game: https://github.com/facundoolano/advenjure-example/blob/master/src/example/rooms.cljc. I doubt I'm the only one that likes looking at this type of example first when looking at an interactive fiction engine, and it may help some people confused by the game. The history of interactive fiction and Lisp is surprisingly intertwined. To the best of my knowledge, all of the original Infocom games were written in ZIL [0], an idiosyncratic Lisp variant that was meant to be a more portable version of the programming language used to write the original mainframe Zork, MDL—which was apparently designed by some of the same people who worked on Scheme and Common Lisp [1]. There appears to be an active but still incomplete open source compiler for ZIL written in C# [2], and a few Common Lisp experiments, but not many mature projects combining interactive fiction and Lisp. I hope projects like this one catch on more. I've had trouble grasping other interactive fiction engines, which I often feel are trying to please programmers and writers but hitting an awkward space in between. Lisp's "code is data" idea seems like it could be a more graceful way of hitting that balance. [0] http://www.ifwiki.org/index.php/ZIL [1] https://en.wikipedia.org/wiki/MDL_(programming_language) [2] https://bitbucket.org/jmcgrew/zilf/overview
文本里出现了瓶子,玩家自然会去尝试所有动词;解析器一旦不懂,细节描写就变成了空头承诺。
那里有张小桌子。小桌子上有:一个瓶子。瓶子里装着一定量的水。 @Bedroom [0] > 拿全部 我没看到那个。 @Bedroom [1] > 拿瓶子 我拿不了那个。 @Bedroom [2] > 取瓶子 我拿不了那个。 @Bedroom [3] > 喝水 我不知道怎么做那个。 @Bedroom [4] > 打开瓶子 我打不开那个。 我只是想喝口水。:(
PhasmaFelis查看英文原文
There was a small table there. The small table contained: A bottle. The bottle contained a amount of water @Bedroom [0] > get all I didn't see that. @Bedroom [1] > get bottle I couldn't take that. @Bedroom [2] > take bottle I couldn't take that. @Bedroom [3] > drink water I didn't know how to do that. @Bedroom [4] > open bottle I couldn't open that. I just wanted a drink. :(
业余实验可以,但严肃作品应选择解析和互动能力更成熟的引擎。
挺不错的。我其实用 Scheme 写过类似但简陋得多的东西(CL 更差、解析器原始、互动极少等等)。不过我不推荐用这两个系统写严肃的交互小说,Tads、Inform 之类的成熟引擎能力强得多。
qwertyuiop924查看英文原文
Really neat. I actually wrote something similar but far more primitive in Scheme (worse CL, primitive parser, minimal interactivity, and so on). I wouldn't reccomend either system for serious IF, though. Tads, Inform and the rest are far more capable.
用可加载节点与状态的状态机建模,比硬编码房间逻辑更能支撑复杂的叙事结构。
我认为这个实现没有解决根本问题。把它做成一个能加载任意节点、状态和链接的状态机,会更好地建模这个问题。不过保持简单这点做得不错。
gravypod查看英文原文
I think this implementation isn't tackling the root of the problem here. Implementing this as a state machine that can load arbitrary node, status, and links would better model the problem. Good work though on keeping this very simple.
同类还值得读
乔治·奥威尔1940年对《我的奋斗》的书评
George Orwell’s 1940 Review of Mein Kampf
这是奥威尔 1940 年对《我的奋斗》的书评,他没有简单谴责,而是认真分析希特勒的宣传手法为何奏效、又暴露了哪些思维特征。
小说与文学2022 · 499 分 · 545 评4 条写作要点编辑精选我们都是极客:尼尔·斯蒂芬森的文学作品
We are all nerds: The literary works of Neal Stephenson
这是一篇讨论 Neal Stephenson 科幻小说的文章,评论区读者围绕《Anathem》《钻石年代》《Snow Crash》等作品,聊世界构建、结尾处理和写作风格的变化。
小说与文学2022 · 307 分 · 220 评4 条写作要点编辑精选又一部我不会再去写的小说
Yet another novel I will no longer write
科幻作家 Charles Stross 讲述自己为何放弃一部已经构思好的小说:COVID-19 疫情让他的病毒灾难设定显得多余,现实给所有人上了一堂生动的疫情应对课。
小说与文学2020 · 304 分 · 169 评4 条写作要点编辑精选用图画写作:理查德·斯卡里与儿童文学的艺术
Writing in Pictures: Richard Scarry and the art of children's literature
这是《耶鲁评论》上漫画家 Chris Ware 写的文章,分析童书作家 Richard Scarry 如何用图画而不是文字来讲故事。
小说与文学2024 · 297 分 · 131 评4 条写作要点编辑精选如何写一部小说
How to Write a Novel
这篇来自 The Millions 的文章讨论写小说的两种路径——“计划派”(planners)与“即兴派”(pantsers,即“跟着感觉走、边写边编”)。
小说与文学2016 · 238 分 · 112 评4 条写作要点编辑精选