mudsync-lisp-game-jam.skr 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. (post
  2. :title "8sync participates in the Lisp Game Jam with Mudsync"
  3. :date (make-date* 2016 05 11 17 30)
  4. :tags '("lisp-game-jam" "mudsync" "actors")
  5. :slug "mudsync-lisp-game-jam"
  6. (p [Hello, hello!
  7. Over the last week and a half, 8sync participated in the
  8. ,(anchor [Spring 2016 Lisp Game Jam]
  9. "https://itch.io/jam/spring-2016-lisp-game-jam").
  10. In short, I had ten days to build a game, so I decided to build a
  11. ,(anchor [MUD] "https://en.wikipedia.org/wiki/MUD")
  12. on top of 8sync.
  13. And so, ,(anchor [mudsync] "https://notabug.org/cwebber/mudsync/")
  14. was born!])
  15. (code-block "> go east
  16. **Smoking Parlor**
  17. This room looks quite posh. There are huge comfy seats you can sit in
  18. if you like.
  19. Strangely, you see a large sign saying \"No Smoking\". The owners must
  20. have installed this place and then changed their mind later.
  21. There's a door to the west leading back to the grand hallway, and
  22. a nondescript steel door to the south, leading apparently outside.
  23. You see here: a comfy leather chair, a plush leather sofa, Ford Prefect and a
  24. bar stool.
  25. > sit in the chair
  26. You sink into the comfy leather chair.
  27. > say Ahhhhhh, this is the life!
  28. paroneayea says: Ahhhhhh, this is the life!")
  29. (h2 [How'd it go?])
  30. (p [I'm happy to say that mudsync was successful overall.
  31. The end released project includes a fairly solid, live hackable
  32. game engine for multiplayer interactive fiction.
  33. This ended up being more of a piece of infrastructure to
  34. ,(em [build]) games rather than being a nice game itself, but
  35. it does ship with a mini-world called "Hotel Bricabrac" which
  36. has some interesting things, but is more of a tech demo.
  37. Most importantly, I feel like mudsync is a really nice foundation
  38. for future games, and the amount of world building I did do in it
  39. was a joy to put together.
  40. So! More of that in the future?])
  41. (p [Mudsync also made great use of 8sync's new actor model subsystem,
  42. which will publicly premiere in the upcoming 0.2.0 release.])
  43. (h2 [Why participate in the game jam?])
  44. (p [At first participating in the game jam may sound merely like an
  45. exercise in fun, and of course it was this too, but greater ambitions
  46. were also at play.
  47. I have plans to use 8sync for some larger projects involving federated
  48. networks, and I wanted to be sure that the technology worked well
  49. enough to invest my time by building something more complicated.
  50. Happily, all seems to have gone well;
  51. I am feeling much more confident in 8sync now having completed the jam
  52. and am looking forward to my larger projects with it.
  53. And along other federation-related lines, I've long been interested in
  54. the overlap between the type of federation-related work I am
  55. persuing with the
  56. ,(anchor [ActivityPub standard] "https://www.w3.org/TR/activitypub/")
  57. MUDs, and the actor model of programming.
  58. MUDS, the actor model, and
  59. ,(anchor [ActivityStreams]
  60. "https://www.w3.org/TR/activitystreams-core/")
  61. (the syntactic basis upon which ActivityPub rests)
  62. all share a subject-predicate-object syntax and use message passing as
  63. a primary communication mechanism.
  64. And lest it sound like I've gone completely off my rocker
  65. (maybe I have, of course)
  66. I might note that research in MUDs as a decentralized mechanism of
  67. communication was very high before the web took over everything,
  68. and even an active topic in a couple of research labs!
  69. (I recommend checking out the
  70. ,(anchor [Design Requirements for Network Spaces]
  71. "http://saraswat.org/desiderata.html")
  72. document to get a sense of this.)
  73. So I figured implementing a MUD might help me better think through
  74. some of this space, and it did!])
  75. (p [Furthermore, 8sync itself owes part of its existence to a much older
  76. interest of mine in creating networked games.
  77. ,(anchor [XUDD] "http://xudd.readthedocs.io/en/latest/"),
  78. the actor model system I wrote in Python and which preceded my
  79. thoughts on how to build 8sync, originally stood for
  80. "eXtensible User Dungeon Design"
  81. (but I gave it a sillier acronymn when its goals shifted).
  82. I haven't lost interest in how to design such systems, and the
  83. implications of them fueled a lot of my reading in this area.])
  84. (p [Plus, it sounded like a whole lot of fun!])
  85. (h2 [What does it look like?])
  86. (p [From a player's perspective, mudsync is your classic MUD-over-telnet.
  87. There are some things missing, but it works: you can walk around from
  88. room to room, interactive with objects and other players, and so on.])
  89. (p [From an administrator / hacker's perspective, mudsync is much more
  90. interesting.
  91. You write out a "game spec" like the following
  92. (which is borrowed from
  93. ,(anchor [real game code]
  94. "https://notabug.org/cwebber/mudsync/src/master/worlds/bricabrac.scm")):])
  95. (code-block-scheme
  96. "(define lobby
  97. (lol ; just a simple 'list of lists' macro
  98. ;; Starting place for players
  99. ('room:lobby
  100. <room> #f
  101. #:name \"Hotel Lobby\"
  102. #:desc
  103. \" You're in some sort of hotel lobby. You see a large sign hanging
  104. over the desk that says \\\"Hotel Bricabrac\\\". On the desk is a bell
  105. that says \\\"ring for service\\\". Terrible music plays from a speaker
  106. somewhere overhead.
  107. The room is lined with various curio cabinets, filled with all sorts
  108. of kitschy junk. It looks like whoever decorated this place had great
  109. ambitions, but actually assembled it all in a hurry and used whatever
  110. kind of objects they found lying around.
  111. There's a door to the north leading to some kind of hallway.\"
  112. #:exits
  113. (list (make <exit>
  114. #:name \"north\"
  115. #:to 'room:grand-hallway)))
  116. ;; Summons a clerk if a player does 'ring bell'
  117. ('thing:lobby:bell
  118. <summoning-bell> 'room:lobby
  119. #:name \"a shiny brass bell\"
  120. #:goes-by '(\"shiny brass bell\" \"shiny bell\" \"brass bell\" \"bell\")
  121. #:desc \" A shiny brass bell. Inscribed on its wooden base is the text
  122. \\\"ring me for service\\\". You probably could \\\"ring the bell\\\" if you
  123. wanted to.\"
  124. #:summons 'npc:break-room:desk-clerk)))")
  125. (p [This builds the kind of world you might expect from the above:])
  126. (code-block "> look
  127. **Hotel Lobby**
  128. You're in some sort of hotel lobby. You see a large sign hanging
  129. over the desk that says \"Hotel Bricabrac\". On the desk is a bell
  130. that says \"ring for service\". Terrible music plays from a speaker
  131. somewhere overhead.
  132. The room is lined with various curio cabinets, filled with all sorts
  133. of kitschy junk. It looks like whoever decorated this place had great
  134. ambitions, but actually assembled it all in a hurry and used whatever
  135. kind of objects they found lying around.
  136. There's a door to the north leading to some kind of hallway.
  137. You see here: a curio cabinet, a shiny brass bell, the Hotel Bricabrac sign, a
  138. frumpy fellow and sign-in form.
  139. > look at bell
  140. A shiny brass bell. Inscribed on its wooden base is the text
  141. \"ring me for service\". You probably could \"ring the bell\" if you
  142. wanted to.
  143. > ring the bell
  144. *ring ring!* You ring the bell!
  145. Suddenly, a uniformed woman rushes into the room! She's wearing a
  146. badge that says \"Desk Clerk\".
  147. \"Hello, yes,\" she says between breaths, \"welcome to Hotel Bricabrac!
  148. We look forward to your stay. If you'd like help getting acclimated,
  149. feel free to ask me. For example, 'ask clerk about changing name'.
  150. You can ask me about the following:
  151. 'changing name', 'common commands', and 'about the hotel'.\"")
  152. (p [(I inserted the ">" characters to make where the input was a bit
  153. clearer, but otherwise that's verbatim output from the game.)])
  154. (p [What's nice is that you can live hack everything that's going on.
  155. And by that of course I mean the kind of usual nice live hacking
  156. you have going on with 8sync and Guile... but it's not only that!
  157. Consider the following challenge: you've just tweaked the description
  158. of the room your friends are hanging out in, but you already
  159. ,(em [have]) a room set up in the game's universe, so how on earth
  160. can you replace it?
  161. Luckily Mudsync provides a nice protocol for replacing objects,
  162. and even provides a nice utility to inject it into the currently
  163. running game (the actors know how to "transfer important details",
  164. in this case, the participants in the room):])
  165. (code-block-scheme "(inject-gameobj! game-spec 'room:lobby)")
  166. (p [Obviously, you don't want to do this for anything other than live
  167. hacking.
  168. But it ,(em [is nice]) that you can live modify how things are
  169. running in the game.
  170. For example, at one point a player asked me how they could "emote"
  171. in the game, and we didn't have an emote command, so I added it
  172. and told them, and then we all happily did some emote'ing.
  173. At another point a player said they felt bad for the desk clerk
  174. and wanted a way to dismiss her so she wouldn't have to hang
  175. around the desk, so I added a dismiss command where she'll
  176. thank the player and "run off to do something important"
  177. (as it turns out, doing something important means to go smoke in the
  178. employee break room).])
  179. (h2 [A story about stories])
  180. (p [So, speaking of that, the "main game" that ships with Mudsync right
  181. now is a little mo... hotel named "Hotel Bricabrac" full of various
  182. strange and fun things (though, not as many as I would like).
  183. Unfortunately, it lacks any significant story.
  184. There's something that almost resembles a story, and which players
  185. seemed to like: the desk clerk, upon ringing the bell, arrives,
  186. but quickly becomes bored, starts fidgeting distractedly, and
  187. eventually leaves.
  188. When I first started coding this, I had envisioned the character as
  189. perhaps a disaffected and incompetent teenager, but as I was playing
  190. around I started to feel empathy for them... it really ,(em [was])
  191. a boring job that they had, and newcomers ringing the bell all the
  192. time ,(em [would]) get annoying.
  193. Thus, if you explore well enough, you might find the
  194. "employee break room", a cage affixed to the exterior of the building.
  195. Whenever the clerk leaves her post, she goes here to smoke and
  196. check her phone and slack off.
  197. But if you talk to her enough in this off-duty space, she'll tell you
  198. that she's a student studying high energy particle physics, that she's
  199. underpaid, but she's working the job because she doesn't have many other
  200. options and her student loans are crushing her.
  201. So she was never really incompetent after all, just overqualified,
  202. bored, and, well, still disaffected.
  203. Some players seemed to enjoy that and expressed empathy for the character
  204. (though it didn't seem to stop them from ringing the bell to provoke
  205. a response from her).
  206. I was glad about that, and I wish I had more time to script in more
  207. things like this.])
  208. (p [Indeed, my original ambitions were to build a full and immersive
  209. game as part of the game jam.
  210. I sketched in a notebook a layout for a haunted mansion or college
  211. campus.
  212. My original vision for the jam was that players would be collaborating
  213. in exploring an area on figuring out how to help various ghosts be put
  214. to rest.
  215. You'd find out what's binding them to this world and help them resolve
  216. their problems, and you as a player would have an "achievements" list
  217. showing off just how many interesting things you had done in the
  218. world.
  219. Unfortunately (though not surprisingly), building the engine itself
  220. ended up being enough work that I didn't have a lot of time for
  221. content.
  222. Thus the experimental little world where I was testing various game
  223. mechanics became the actual deliverable of a demo-world to be
  224. played.])
  225. (p [In the end, that's probably not the worst situation.
  226. I feel I have a good design on which future games could be built.
  227. And despite the chaos of it, players did seem to have a lot of fun
  228. (I think at one point we had about 8 players or so on the game who
  229. were hanging out and mostly socializing).
  230. The chaotic gathering place on some mysterious property atmosphere
  231. looks a lot like LambdaMOO, and as
  232. ,(anchor [LambdaMOO enthusiast Rob Myers]
  233. "https://robmyers.org/lambdamoo/")
  234. said to me at one point,
  235. "Themeliness is next to timeliness."
  236. It's not such a bad start!
  237. Though I do hope to have more interesting worlds to show in the
  238. future.])
  239. (h2 [Challenges])
  240. (p [No sprint like this is without its challenges.
  241. Here were mine:])
  242. (ul (li [It was really hard to decide what "flavor" of sentence
  243. parsing to go with.
  244. Basically you can either have more rich sentences which require
  245. a lot of complicated parsers, but then you can say complicated
  246. things like "Put the melon in the fruit basket."
  247. (Zork/ZIL/Z-Machine type single-player interactive fiction
  248. games tend to go like this.)
  249. Or you can go with more predictable but limited parser
  250. and parse more basic sentences like "put melon in fruit basket".
  251. The former lends itself to more immersive gameplay.
  252. The latter is faster, more predictable, and works better for
  253. either combining with non-text interfaces (maybe a web UI)
  254. and could concievably work with a federated game.
  255. I spent some time
  256. ,(anchor [agonizing over this]
  257. "https://identi.ca/cwebber/comment/mo2uRHqIQAKXsFYbYev46g").
  258. In the end I built kind of a hybrid: actors select from
  259. a few prebuilt "rich" command processors which handle all the
  260. basic cases you might want.])
  261. (li [8sync relies heavily on delimited continuations.
  262. However, sometimes if scheme calls C which then calls out to
  263. scheme again in Guile, things break.
  264. A few things caused this, including using the "@@" special
  265. form to try to get around dependency loops lazily.
  266. Most significantly, since 8sync's actor model system uses
  267. GOOPS, I learned the hard way that GOOPS being very C based
  268. in Guile 2.0 means that I had to forego many interesting
  269. GOOPS features, like generic methods or accessors.
  270. Once I realized this, things went a lot more smoothly,
  271. and I didn't really ,(em [need]) these features... but sometimes
  272. I wished I had them.])
  273. (li [You might say, "but Guile 2.2's GOOPS was rewritten in scheme!"
  274. And you'd be right.
  275. Unfortunately, I
  276. ,(anchor [uncovered a pretty critical bug]
  277. "https://lists.nongnu.org/archive/html/bug-guile/2016-04/msg00004.html")
  278. with GOOPS and Guile 2.2, and didn't have time to look into it
  279. seriously.
  280. Again, not a huge deal, but it did take up some time to look into.])
  281. (li [I hit a really weird SIGABRT issue in 8sync's actor model.
  282. Initially
  283. ,(anchor [I thought it was a Guile issue]
  284. "https://lists.nongnu.org/archive/html/bug-guile/2016-05/msg00003.html"),
  285. but it turned out I
  286. ,(anchor [just didn't understand some things about how prompts
  287. and exceptions work]
  288. "https://lists.nongnu.org/archive/html/bug-guile/2016-05/msg00004.html").])
  289. (li [I really wanted to have a nice text formatter, but I ran out
  290. of time to integrate one.
  291. (If you talk to the hotel owner in the lobby of Hotel
  292. Bricabrac, you'll find he complains about this kind of
  293. indirectly, expressing my wishes to explore something along
  294. the lines of
  295. ,(anchor [Skribilo] "http://www.nongnu.org/skribilo/") or
  296. ,(anchor [fmt] "http://synthcode.com/scheme/fmt/").
  297. Alas! No time for it...)])
  298. (li [Again, I would have loved to have more time to build a more
  299. coherent story.
  300. But time is always a challenge in these things!]))
  301. (h2 [What's next?])
  302. (p [So mudsync will be a background hacking task for me probably
  303. for a while, something to hack on for my and friends' amusement
  304. every now and then.
  305. I may end up writing some small and interesting stories.
  306. But it won't be my main project.])
  307. (p [But it probably will be a basis for research (and fun)
  308. for me.
  309. It's a nice system to test out ideas in.
  310. And I'll probably add some cool optional components, like
  311. persistent-world-supporting databases.
  312. (Maybe even player-scripted items?
  313. Unlikely in that it would require a carefully crafted sandboxed
  314. execution environment, but don't think I haven't been thinking
  315. about it...!)])
  316. (p [In the meanwhile, if you want to check it out, the
  317. ,(anchor [source is available]
  318. "https://notabug.org/cwebber/mudsync/").
  319. Patches most welcome!
  320. And if you hop in #8sync on irc.freenode.net, maybe you can
  321. find the address of the current dev server!])
  322. (p [Thanks to Rob Myers and Jason Self, who both know a lot more about
  323. interactive fiction than I do and answered a lot of questions
  324. and offered ideas.
  325. Thanks also to everyone who gave the game a try.
  326. I hope it was as fun for you as it was for me!])
  327. (p [Happy hacking...]))