bricabrac.scm 90 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261
  1. ;;; Mudsync --- Live hackable MUD
  2. ;;; Copyright © 2016, 2017 Christopher Allan Webber <cwebber@dustycloud.org>
  3. ;;;
  4. ;;; This file is part of Mudsync.
  5. ;;;
  6. ;;; Mudsync is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 3 of the License, or
  9. ;;; (at your option) any later version.
  10. ;;;
  11. ;;; Mudsync is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. ;;; General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with Mudsync. If not, see <http://www.gnu.org/licenses/>.
  18. ;;; Hotel Bricabrac
  19. (use-modules (mudsync)
  20. (mudsync container)
  21. (8sync)
  22. (8sync daydream)
  23. (oop goops)
  24. (ice-9 control)
  25. (ice-9 format)
  26. (ice-9 match)
  27. (rx irregex))
  28. ;;; Utilities, useful or otherwise
  29. ;;; ==============================
  30. (set! *random-state* (random-state-from-platform))
  31. (define (random-choice lst)
  32. (list-ref lst (random (length lst))))
  33. ;; list of lists, lol.
  34. (define-syntax-rule (lol (list-contents ...) ...)
  35. (list (list list-contents ...) ...))
  36. ;;; Some simple object types.
  37. ;;; =========================
  38. (define-class <readable> (<gameobj>)
  39. (read-text #:init-value "All it says is: \"Blah blah blah.\""
  40. #:init-keyword #:read-text)
  41. (commands
  42. #:allocation #:each-subclass
  43. #:init-thunk (build-commands
  44. ("read" ((direct-command cmd-read)))))
  45. (actions #:allocation #:each-subclass
  46. #:init-thunk (build-actions
  47. (cmd-read readable-cmd-read))))
  48. (define (readable-cmd-read actor message . _)
  49. (<- (message-from message) 'tell
  50. #:text (slot-ref actor 'read-text)))
  51. ;; This one is just where reading is the same thing as looking
  52. ;; at the description
  53. (define-class <readable-desc> (<gameobj>)
  54. (commands
  55. #:allocation #:each-subclass
  56. #:init-thunk (build-commands
  57. ("read" ((direct-command cmd-look-at))))))
  58. ;; This one allows you to take from items that are proxied by it
  59. (define-actor <proxy-items> (<gameobj>)
  60. ((cmd-take-from take-from-proxy))
  61. (proxy-items #:init-keyword #:proxy-items))
  62. (define* (take-from-proxy gameobj message
  63. #:key direct-obj indir-obj preposition
  64. (player (message-from message)))
  65. (call/ec
  66. (lambda (escape)
  67. (for-each
  68. (lambda (obj-sym)
  69. (define obj-id (dyn-ref gameobj obj-sym))
  70. (define goes-by (<-wait obj-id 'goes-by))
  71. (when (ci-member direct-obj goes-by)
  72. (<- obj-id 'cmd-take #:direct-obj direct-obj #:player player)
  73. (escape #f)))
  74. (slot-ref gameobj 'proxy-items))
  75. (<- player 'tell
  76. #:text `("You don't see any such " ,direct-obj " to take "
  77. ,preposition " " ,(slot-ref gameobj 'name) ".")))))
  78. ;;; Lobby
  79. ;;; -----
  80. (define (npc-chat-randomly actor message . _)
  81. (define catchphrase
  82. (random-choice (slot-ref actor 'catchphrases)))
  83. (define text-to-send
  84. ((slot-ref actor 'chat-format) actor catchphrase))
  85. (<- (message-from message) 'tell
  86. #:text text-to-send))
  87. (define hotel-owner-grumps
  88. '("Eight sinks! Eight sinks! And I couldn't unwind them..."
  89. "Don't mind the mess. I built this place on a dare, you
  90. know?"
  91. "(*tearfully*) Here, take this parenthesis. May it serve
  92. you well."
  93. "I gotta get back to the goblin farm soon..."
  94. "Oh, but I was going to make a mansion... a great,
  95. beautiful mansion! Full of ghosts! Now all I have is this cruddy
  96. mo... hotel. Oh... If only I had more time!"
  97. "I told them to paint more of the walls purple.
  98. Why didn't they listen?"
  99. "Listen to that overhead muzak. Whoever made that doesn't
  100. know how to compose very well! Have you heard of the bands 'fmt'
  101. or 'skribe'? Now *that's* composition!"))
  102. (define-class <chatty-npc> (<gameobj>)
  103. (catchphrases #:init-value '("Blarga blarga blarga!")
  104. #:init-keyword #:catchphrases)
  105. (chat-format #:init-value (lambda (npc catchphrase)
  106. `(,(slot-ref npc 'name) " says: \""
  107. ,catchphrase "\""))
  108. #:init-keyword #:chat-format)
  109. (commands
  110. #:allocation #:each-subclass
  111. #:init-thunk (build-commands
  112. (("chat" "talk") ((direct-command cmd-chat)))))
  113. (actions #:allocation #:each-subclass
  114. #:init-thunk
  115. (build-actions
  116. (cmd-chat npc-chat-randomly))))
  117. (define-class <sign-in-form> (<gameobj>)
  118. (commands
  119. #:allocation #:each-subclass
  120. #:init-thunk (build-commands
  121. ("sign" ((prep-direct-command cmd-sign-form '("as"))))))
  122. (actions #:allocation #:each-subclass
  123. #:init-thunk (build-actions
  124. (cmd-sign-form sign-cmd-sign-in))))
  125. (define name-sre
  126. (sre->irregex '(: alpha (** 1 14 (or alphanum "-" "_")))))
  127. (define forbidden-words
  128. (append article preposition
  129. '("and" "or" "but" "admin")))
  130. (define (valid-name? name)
  131. (and (irregex-match name-sre name)
  132. (not (member name forbidden-words))))
  133. (define* (sign-cmd-sign-in actor message
  134. #:key direct-obj indir-obj preposition)
  135. (define old-name (<-wait (message-from message) 'get-name))
  136. (define name indir-obj)
  137. (if (valid-name? indir-obj)
  138. (begin
  139. (<-wait (message-from message) 'set-name! name)
  140. (<- (slot-ref actor 'loc) 'tell-room
  141. #:text (format #f "~a signs the form!\n~a is now known as ~a\n"
  142. old-name old-name name)))
  143. (<- (message-from message) 'tell
  144. #:text "Sorry, that's not a valid name.
  145. Alphanumerics, _ and - only, 2-15 characters, starts with an alphabetic
  146. character.\n")))
  147. (define-class <summoning-bell> (<gameobj>)
  148. (summons #:init-keyword #:summons)
  149. (commands
  150. #:allocation #:each-subclass
  151. #:init-thunk (build-commands
  152. ("ring" ((direct-command cmd-ring)))))
  153. (actions #:allocation #:each-subclass
  154. #:init-thunk (build-actions
  155. (cmd-ring summoning-bell-cmd-ring))))
  156. (define* (summoning-bell-cmd-ring bell message . _)
  157. ;; Call back to actor who invoked this message handler
  158. ;; and find out their name. We'll call *their* get-name message
  159. ;; handler... meanwhile, this procedure suspends until we get
  160. ;; their response.
  161. (define who-rang (<-wait (message-from message) 'get-name))
  162. ;; Now we'll invoke the "tell" message handler on the player
  163. ;; who rang us, displaying this text on their screen.
  164. ;; This one just uses <- instead of <-wait, since we don't
  165. ;; care when it's delivered; we're not following up on it.
  166. (<- (message-from message) 'tell
  167. #:text "*ring ring!* You ring the bell!\n")
  168. ;; We also want everyone else in the room to "hear" the bell,
  169. ;; but they get a different message since they aren't the ones
  170. ;; ringing it. Notice here's where we make use of the invoker's
  171. ;; name as extracted and assigned to the who-rang variable.
  172. ;; Notice how we send this message to our "location", which
  173. ;; forwards it to the rest of the occupants in the room.
  174. (<- (gameobj-loc bell) 'tell-room
  175. #:text
  176. (format #f "*ring ring!* ~a rings the bell!\n"
  177. who-rang)
  178. #:exclude (message-from message))
  179. ;; Now we perform the primary task of the bell, which is to summon
  180. ;; the "clerk" character to the room. (This is configurable,
  181. ;; so we dynamically look up their address.)
  182. (<- (dyn-ref bell (slot-ref bell 'summons)) 'be-summoned
  183. #:who-summoned (message-from message)))
  184. (define prefect-quotes
  185. '("I'm a frood who really knows where my towel is!"
  186. "On no account allow a Vogon to read poetry at you."
  187. "Time is an illusion, lunchtime doubly so!"
  188. "How can you have money if none of you produces anything?"
  189. "On no account allow Arthur to request tea on this ship."))
  190. (define-class <cabinet-item> (<gameobj>)
  191. (take-me? #:init-value
  192. (lambda _
  193. (values #f #:why-not
  194. `("Hm, well... the cabinet is locked and the properitor "
  195. "is right over there.")))))
  196. (define lobby
  197. (lol
  198. ('lobby
  199. <room> #f
  200. #:name "Hotel Lobby"
  201. #:desc
  202. '((p "You're in some sort of hotel lobby. You see a large sign hanging "
  203. "over the desk that says \"Hotel Bricabrac\". On the desk is a bell "
  204. "that says \"'ring bell' for service\". Terrible music plays from a speaker "
  205. "somewhere overhead. "
  206. "The room is lined with various curio cabinets, filled with all sorts "
  207. "of kitschy junk. It looks like whoever decorated this place had great "
  208. "ambitions, but actually assembled it all in a hurry and used whatever "
  209. "kind of objects they found lying around.")
  210. (p "There's a door to the north leading to some kind of hallway."))
  211. #:exits
  212. (list (make <exit>
  213. #:name "north"
  214. #:to 'grand-hallway)))
  215. ;; NPC: hotel owner
  216. ('lobby:hotel-owner
  217. <chatty-npc> 'lobby
  218. #:name "a frumpy fellow"
  219. #:desc
  220. '((p " Whoever this is, they looks totally exhausted. They're
  221. collapsed into the only comfortable looking chair in the room and you
  222. don't get the sense that they're likely to move any time soon.
  223. You notice they're wearing a sticker badly adhesed to their clothing
  224. which says \"Hotel Proprietor\", but they look so disorganized that you
  225. think that can't possibly be true... can it?
  226. Despite their exhaustion, you sense they'd be happy to chat with you,
  227. though the conversation may be a bit one sided."))
  228. #:goes-by '("frumpy fellow" "fellow"
  229. "Chris Webber" ; heh, did you rtfc? or was it so obvious?
  230. "hotel proprietor" "proprietor")
  231. #:catchphrases hotel-owner-grumps)
  232. ;; Object: Sign
  233. ('lobby:sign
  234. <readable> 'lobby
  235. #:name "the Hotel Bricabrac sign"
  236. #:desc " It strikes you that there's something funny going on with this sign.
  237. Sure enough, if you look at it hard enough, you can tell that someone
  238. hastily painted over an existing sign and changed the \"M\" to an \"H\".
  239. Classy!"
  240. #:read-text " All it says is \"Hotel Bricabrac\" in smudged, hasty text."
  241. #:goes-by '("sign"
  242. "bricabrac sign"
  243. "hotel sign"
  244. "hotel bricabrac sign"
  245. "lobby sign"))
  246. ('lobby:bell
  247. <summoning-bell> 'lobby
  248. #:name "a shiny brass bell"
  249. #:goes-by '("shiny brass bell" "shiny bell" "brass bell" "bell")
  250. #:desc " A shiny brass bell. Inscribed on its wooden base is the text
  251. \"ring me for service\". You probably could \"ring the bell\" if you
  252. wanted to."
  253. #:summons 'break-room:desk-clerk)
  254. ('lobby:sign-in-form
  255. <sign-in-form> 'lobby
  256. #:name "sign-in form"
  257. #:goes-by '("sign-in form" "form" "signin form")
  258. #:desc '("It looks like you could sign this form and set your name like so: "
  259. (i "sign form as <my-name-here>")))
  260. ;; Object: curio cabinets
  261. ;; TODO: respond to attempts to open the curio cabinet
  262. ('lobby:cabinet
  263. <proxy-items> 'lobby
  264. #:proxy-items '(lobby:porcelain-doll
  265. lobby:1950s-robots
  266. lobby:tea-set lobby:mustard-pot
  267. lobby:head-of-elvis lobby:circuitboard-of-evlis
  268. lobby:teletype-scroll lobby:orange-cat-phone)
  269. #:name "a curio cabinet"
  270. #:goes-by '("curio cabinet" "cabinet" "bricabrac cabinet"
  271. "cabinet of curiosities")
  272. #:desc (lambda _
  273. (format #f " The curio cabinet is full of all sorts of oddities!
  274. Something catches your eye!
  275. Ooh, ~a!" (random-choice
  276. '("a creepy porcelain doll"
  277. "assorted 1950s robots"
  278. "an exquisite tea set"
  279. "an antique mustard pot"
  280. "the pickled head of Elvis"
  281. "the pickled circuitboard of EVLIS"
  282. "a scroll of teletype paper holding the software Four Freedoms"
  283. "a telephone shaped like an orange cartoon cat")))))
  284. ('lobby:porcelain-doll
  285. <cabinet-item> 'lobby
  286. #:invisible? #t
  287. #:name "a creepy porcelain doll"
  288. #:desc "It strikes you that while the doll is technically well crafted,
  289. it's also the stuff of nightmares."
  290. #:goes-by '("porcelain doll" "doll"))
  291. ('lobby:1950s-robots
  292. <cabinet-item> 'lobby
  293. #:invisible? #t
  294. #:name "a set of 1950s robots"
  295. #:desc "There's a whole set of these 1950s style robots.
  296. They seem to be stamped out of tin, and have various decorations of levers
  297. and buttons and springs. Some of them have wind-up knobs on them."
  298. #:goes-by '("robot" "robots" "1950s robot" "1950s robots"))
  299. ('lobby:tea-set
  300. <cabinet-item> 'lobby
  301. #:invisible? #t
  302. #:name "a tea set"
  303. #:desc "A complete tea set. Some of the cups are chipped.
  304. You can imagine yourself joining a tea party using this set, around a
  305. nice table with some doilies, drinking some Earl Grey tea, hot. Mmmm."
  306. #:goes-by '("tea set" "tea"))
  307. ('lobby:cups
  308. <cabinet-item> 'lobby
  309. #:invisible? #t
  310. #:name "cups from the tea set"
  311. #:desc "They're chipped."
  312. #:goes-by '("cups"))
  313. ('lobby:mustard-pot
  314. <cabinet-item> 'lobby
  315. #:invisible? #t
  316. #:name "a mustard pot"
  317. #:desc '((p "It's a mustard pot. I mean, it's kind of cool, it has a
  318. nice design, and it's an antique, but you can't imagine putting something
  319. like this in a museum.")
  320. (p "Ha... imagine that... a mustard museum."))
  321. #:goes-by '("mustard pot" "antique mustard pot" "mustard"))
  322. ('lobby:head-of-elvis
  323. <cabinet-item> 'lobby
  324. #:invisible? #t
  325. #:name "the pickled head of Elvis"
  326. #:desc '((p "It's a jar full of some briny-looking liquid and...
  327. a free floating head. The head looks an awful lot like Elvis, and
  328. definitely not the younger Elvis. The hair even somehow maintains
  329. that signature swoop while suspended in liquid. But of course it's
  330. not Elvis.")
  331. (p "Oh, wait, it has a label at the bottom which says:
  332. \"This is really the head of Elvis\". Well... maybe don't believe
  333. everything you read."))
  334. #:goes-by '("pickled head of elvis" "pickled head of Elvis"
  335. "elvis" "Elvis" "head" "pickled head"))
  336. ('lobby:circuitboard-of-evlis
  337. <cabinet-item> 'lobby
  338. #:invisible? #t
  339. #:name "the pickled circuitboard of Evlis"
  340. #:desc '((p "It's a circuitboard from a Lisp Machine called EVLIS.
  341. This is quite the find, and you bet just about anyone interested in
  342. preserving computer history would love to get their hands on this.")
  343. (p "Unfortunately, whatever moron did acquire this has
  344. no idea what it means to preserve computers, so here it is floating
  345. in some kind of briny liquid. It appears to be heavily corroded.
  346. Too bad..."))
  347. #:goes-by '("pickled circuitboard of evlis" "pickled circuitboard of Evlis"
  348. "pickled circuitboard of EVLIS"
  349. "evlis" "Evlis" "EVLIS" "circuitboard" "pickled circuitboard"))
  350. ('lobby:teletype-scroll
  351. <cabinet-item> 'lobby
  352. #:invisible? #t
  353. #:name "a scroll of teletype"
  354. #:desc '((p "This is a scroll of teletype paper. It's a bit old
  355. and yellowed but the type is very legible. It says:")
  356. (br)
  357. (i
  358. (p (strong "== The four essential freedoms =="))
  359. (p "A program is free software if the program's users have
  360. the four essential freedoms: ")
  361. (ul (li "The freedom to run the program as you wish, for any purpose (freedom 0).")
  362. (li "The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.")
  363. (li "The freedom to redistribute copies so you can help your neighbor (freedom 2).")
  364. (li "The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.")))
  365. (p "You get this feeling that ambiguities in the
  366. English language surrounding the word 'free' have lead to a lot of terminology debates."))
  367. #:goes-by '("scroll of teletype" "scroll of teletype paper" "teletype scroll"
  368. "teletype paper" "scroll" "four freedoms"
  369. "scroll of teletype paper holding the software Four Freedoms"
  370. "scroll of teletype paper holding the software four freedoms"))
  371. ('lobby:orange-cat-phone
  372. <cabinet-item> 'lobby
  373. #:invisible? #t
  374. #:name "a telephone shaped like an orange cartoon cat"
  375. #:desc "It's made out of a cheap plastic, and it's very orange.
  376. It resembles a striped tabby, and it's eyes hold the emotion of
  377. a being both sleepy and smarmy.
  378. You suspect that someone, somewhere made a ton of cash on items holding
  379. this general shape in the 1990s."
  380. #:goes-by '("orange cartoon cat phone" "orange cartoon cat telephone"
  381. "orange cat phone" "orange cat telephone"
  382. "cartoon cat phone" "cartoon cat"
  383. "cat phone" "cat telephone" "phone" "telephone"))))
  384. ;;; Grand hallway
  385. ;;; -------------
  386. (define-actor <disc-shield> (<gameobj>)
  387. ((cmd-take disc-shield-take)))
  388. (define* (disc-shield-take gameobj message
  389. #:key direct-obj
  390. (player (message-from message)))
  391. (create-gameobj <glowing-disc> (gameobj-gm gameobj)
  392. player) ;; set loc to player to put in player's inventory
  393. (<- player 'tell
  394. #:text '((p "As you attempt to pull the shield / disk platter
  395. from the statue a shining outline appears around it... and a
  396. completely separate, glowing copy of the disc materializes into your
  397. hands!")))
  398. (<- (gameobj-loc gameobj) 'tell-room
  399. #:text `(,(<-wait player 'get-name)
  400. " pulls on the shield of the statue, and a glowing "
  401. "copy of it materializes into their hands!")
  402. #:exclude player)
  403. (<- (gameobj-loc gameobj) 'tell-room
  404. #:text
  405. '(p "You hear a voice whisper: "
  406. (i "\"Share the software... and you'll be free...\""))))
  407. ;;; This is the disc that gets put in the player's inventory
  408. (define-actor <glowing-disc> (<gameobj>)
  409. ((cmd-drop glowing-disc-drop-cmd))
  410. (initial-props
  411. #:allocation #:each-subclass
  412. #:init-thunk (build-props
  413. '((hd-platter? . #t))))
  414. (name #:allocation #:each-subclass
  415. #:init-value "a glowing disc")
  416. (desc #:allocation #:each-subclass
  417. #:init-value "A brightly glowing disc. It's shaped like a hard
  418. drive platter, not unlike the one from the statue it came from. It's
  419. labeled \"RL02.5\".")
  420. (goes-by #:init-value '("glowing disc" "glowing platter"
  421. "glowing disc platter" "glowing disk platter"
  422. "platter" "disc" "disk" "glowing shield")))
  423. (define* (glowing-disc-drop-cmd gameobj message
  424. #:key direct-obj
  425. (player (message-from message)))
  426. (<- player 'tell
  427. #:text "You drop the glowing disc, and it shatters into a million pieces!")
  428. (<- (<-wait player 'get-loc) 'tell-room
  429. #:text `(,(<-wait player 'get-name)
  430. " drops a glowing disc, and it shatters into a million pieces!")
  431. #:exclude player)
  432. (gameobj-self-destruct gameobj))
  433. ;;; Grand hallway
  434. (define lobby-map-text
  435. "\
  436. | : : |
  437. .----------.----------. : & : .----------.----------.
  438. | computer | |& :YOU ARE: &| smoking | *UNDER* |
  439. | room + playroom + : HERE : + parlor | *CONS- |
  440. | > | |& : : &| | TRUCTION*|
  441. '----------'----------'-++-------++-'-------+--'----------'
  442. | '-----' | | |
  443. : LOBBY : '---'
  444. '. .'
  445. '---------'")
  446. (define grand-hallway
  447. (lol
  448. ('grand-hallway
  449. <room> #f
  450. #:name "Grand Hallway"
  451. #:desc '((p " A majestic red carpet runs down the center of the room.
  452. Busts of serious looking people line the walls, but there's no
  453. clear indication that they have any logical relation to this place.")
  454. (p "In the center is a large statue of a woman in a warrior's
  455. pose, but something is strange about her weapon and shield. You wonder what
  456. that's all about?")
  457. (p "To the south is the lobby. A door to the east is labeled \"smoking
  458. room\", while a door to the west is labeled \"playroom\"."))
  459. #:exits
  460. (list (make <exit>
  461. #:name "south"
  462. #:to 'lobby)
  463. (make <exit>
  464. #:name "west"
  465. #:to 'playroom)
  466. (make <exit>
  467. #:name "east"
  468. #:to 'smoking-parlor)))
  469. ('grand-hallway:map
  470. <readable> 'grand-hallway
  471. #:name "the hotel map"
  472. #:desc '("This appears to be a map of the hotel. "
  473. "Like the hotel itself, it seems to be "
  474. "incomplete."
  475. "You could read it if you want to.")
  476. #:read-text `(pre ,lobby-map-text)
  477. #:goes-by '("map" "hotel map"))
  478. ('grand-hallway:carpet
  479. <gameobj> 'grand-hallway
  480. #:name "the Grand Hallway carpet"
  481. #:desc "It's very red, except in the places where it's very worn."
  482. #:invisible? #t
  483. #:goes-by '("red carpet" "carpet"))
  484. ('grand-hallway:busts
  485. <gameobj> 'grand-hallway
  486. #:name "the busts of serious people"
  487. #:desc "There are about 6 of them in total. They look distinguished
  488. but there's no indication of who they are."
  489. #:invisible? #t
  490. #:goes-by '("busts" "bust" "busts of serious people" "bust of serious person"))
  491. ('grand-hallway:hackthena-statue
  492. <proxy-items> 'grand-hallway
  493. #:name "the statue of Hackthena"
  494. #:desc '((p "The base of the statue says \"Hackthena, guardian of the hacker
  495. spirit\". You've heard of Hackthena... not a goddess, but spiritual protector of
  496. all good hacks, and legendary hacker herself.")
  497. (p "Hackthena holds the form of a human woman. She wears flowing
  498. robes, has a pear of curly bovine-esque horns protruding from the sides of her
  499. head, wears a pair of horn-rimmed glasses, and appears posed as if for battle.
  500. But instead of a weapon, she seems to hold some sort of keyboard. And her
  501. shield... well it's round like a shield, but something seems off about it.
  502. You'd better take a closer look to be sure."))
  503. #:goes-by '("hackthena statue" "hackthena" "statue" "statue of hackthena")
  504. #:proxy-items '(grand-hallway:keyboard
  505. grand-hallway:disc-platter
  506. grand-hallway:hackthena-horns))
  507. ('grand-hallway:keyboard
  508. <gameobj> 'grand-hallway
  509. #:name "a Knight Keyboard"
  510. #:desc "Whoa, this isn't just any old keyboard, this is a Knight Keyboard!
  511. Any space cadet can see that with that kind of layout a hack-and-slayer could
  512. thrash out some serious key-chords like there's no tomorrow. You guess
  513. Hackthena must be an emacs user."
  514. #:invisible? #t
  515. #:take-me? (lambda _
  516. (values #f
  517. #:why-not
  518. `("Are you kidding? Do you know how hard it is to find "
  519. "a Knight Keyboard? There's no way she's going "
  520. "to give that up.")))
  521. #:goes-by '("knight keyboard" "keyboard"))
  522. ('grand-hallway:hackthena-horns
  523. <gameobj> 'grand-hallway
  524. #:name "Hackthena's horns"
  525. #:desc "They're not unlike a Gnu's horns."
  526. #:invisible? #t
  527. #:take-me? (lambda _
  528. (values #f
  529. #:why-not
  530. `("Are you seriously considering desecrating a statue?")))
  531. #:goes-by '("hackthena's horns" "horns" "horns of hacktena"))
  532. ('grand-hallway:disc-platter
  533. <disc-shield> 'grand-hallway
  534. #:name "Hackthena's shield"
  535. #:desc "No wonder the \"shield\" looks unusual... it seems to be a hard disk
  536. platter! It has \"RL02.5\" written on it. It looks kind of loose."
  537. #:invisible? #t
  538. #:goes-by '("hackthena's shield" "shield" "platter" "hard disk platter"))))
  539. ;;; Playroom
  540. ;;; --------
  541. (define-actor <rgb-machine> (<gameobj>)
  542. ((cmd-run rgb-machine-cmd-run)
  543. (cmd-reset rgb-machine-cmd-reset))
  544. (commands
  545. #:allocation #:each-subclass
  546. #:init-thunk (build-commands
  547. (("run" "start") ((direct-command cmd-run)))
  548. ("reset" ((direct-command cmd-reset)))))
  549. (resetting #:init-value #f
  550. #:accessor .resetting)
  551. ;; used to reset, and to kick off the first item in the list
  552. (rgb-items #:init-keyword #:rgb-items
  553. #:accessor .rgb-items))
  554. (define (rgb-machine-cmd-run rgb-machine message . _)
  555. (define player (message-from message))
  556. (<-wait player 'tell
  557. #:text '("You start the rube goldberg machine."))
  558. (<-wait (gameobj-loc rgb-machine) 'tell-room
  559. #:text `(,(<-wait player 'get-name)
  560. " runs the rube goldberg machine.")
  561. #:exclude player)
  562. (daydream 1)
  563. (match (.rgb-items rgb-machine)
  564. ((first-item rest ...)
  565. (<- (dyn-ref rgb-machine first-item) 'trigger))))
  566. (define (rgb-machine-cmd-reset rgb-machine message . _)
  567. (define player (message-from message))
  568. (cond
  569. ((not (.resetting rgb-machine))
  570. (set! (.resetting rgb-machine) #t)
  571. (<-wait player 'tell
  572. #:text '("You reset the rube goldberg machine."))
  573. (<-wait (gameobj-loc rgb-machine) 'tell-room
  574. #:text `(,(<-wait player 'get-name)
  575. " resets the rube goldberg machine.")
  576. #:exclude player)
  577. (<-wait (gameobj-loc rgb-machine) 'tell-room
  578. #:text '("From a panel in the wall, a white gloved mechanical "
  579. "arm reaches out to reset all the "
  580. "rube goldberg components."))
  581. (daydream (/ 1 2))
  582. (for-each
  583. (lambda (rgb-item)
  584. (<- (dyn-ref rgb-machine rgb-item) 'reset)
  585. (daydream (/ 1 2)))
  586. (.rgb-items rgb-machine))
  587. (<- (gameobj-loc rgb-machine) 'tell-room
  588. #:text "The machine's mechanical arm retreats into the wall!")
  589. (set! (.resetting rgb-machine) #f))
  590. (else
  591. (<-wait player 'tell
  592. #:text '("But it's in the middle of resetting right now!")))))
  593. (define-actor <rgb-item> (<gameobj>)
  594. ((trigger rgb-item-trigger)
  595. (reset rgb-item-reset))
  596. (invisible? #:init-value #t)
  597. (steps #:init-keyword #:steps
  598. #:accessor .steps)
  599. (triggers-as #:init-value #f
  600. #:init-keyword #:triggers-as
  601. #:getter .triggers-as)
  602. (reset-msg #:init-keyword #:reset-msg
  603. #:getter .reset-msg)
  604. ;; States: ready -> running -> ran
  605. (state #:init-value 'ready
  606. #:accessor .state))
  607. (define (rgb-item-trigger rgb-item message . _)
  608. (define room (gameobj-loc rgb-item))
  609. (case (.state rgb-item)
  610. ((ready)
  611. ;; Set state to running
  612. (set! (.state rgb-item) 'running)
  613. ;; Loop through all steps
  614. (for-each
  615. (lambda (step)
  616. (match step
  617. ;; A string? That's the description of what's happening, tell players
  618. ((? string? str)
  619. (<- room 'tell-room #:text str))
  620. ;; A number? Sleep for that many secs
  621. ((? number? num)
  622. (daydream num))
  623. ;; A symbol? That's another gameobj to look up dynamically
  624. ((? symbol? sym)
  625. (<- (dyn-ref rgb-item sym) 'trigger
  626. #:triggered-by (.triggers-as rgb-item)))
  627. (_ (throw 'unknown-step-type
  628. "Don't know how to process rube goldberg machine step type?"
  629. #:step step))))
  630. (.steps rgb-item))
  631. ;; We're done! Set state to ran
  632. (set! (.state rgb-item) 'ran))
  633. (else
  634. (<- room 'tell-room
  635. #:text `("... but " ,(slot-ref rgb-item 'name)
  636. " has already been triggered!")))))
  637. (define (rgb-item-reset rgb-item message . _)
  638. (define room (gameobj-loc rgb-item))
  639. (case (.state rgb-item)
  640. ((ran)
  641. (set! (.state rgb-item) 'ready)
  642. (<- room 'tell-room
  643. #:text (.reset-msg rgb-item)))
  644. ((running)
  645. (<- room 'tell-room
  646. #:text `("... but " ,(slot-ref rgb-item 'name)
  647. " is currently running!")))
  648. ((ready)
  649. (<- room 'tell-room
  650. #:text `("... but " ,(slot-ref rgb-item 'name)
  651. " has already been reset.")))))
  652. (define-actor <rgb-kettle> (<rgb-item>)
  653. ((trigger rgb-kettle-trigger)
  654. (reset rgb-kettle-reset))
  655. (heated #:accessor .heated
  656. #:init-value #f)
  657. (filled #:accessor .filled
  658. #:init-value #f))
  659. (define* (rgb-kettle-trigger rgb-item message #:key triggered-by)
  660. (define room (gameobj-loc rgb-item))
  661. (if (not (eq? (.state rgb-item) 'ran))
  662. (begin
  663. (match triggered-by
  664. ('water-demon
  665. (set! (.state rgb-item) 'running)
  666. (set! (.filled rgb-item) #t))
  667. ('quik-heater
  668. (set! (.state rgb-item) 'running)
  669. (set! (.heated rgb-item) #t)))
  670. (when (and (.filled rgb-item)
  671. (.heated rgb-item))
  672. (<- room 'tell-room
  673. #:text '((i "*kshhhhhh!*")
  674. " The water has boiled!"))
  675. (daydream .25)
  676. (set! (.state rgb-item) 'ran)
  677. ;; insert a cup of hot tea in the room
  678. (create-gameobj <hot-tea> (gameobj-gm rgb-item) room)
  679. (<- room 'tell-room
  680. #:text '("The machine pours out a cup of hot tea! "
  681. "Looks like the machine finished!"))))
  682. (<- room 'tell-room
  683. #:text `("... but " ,(slot-ref rgb-item 'name)
  684. " has already been triggered!"))))
  685. (define (rgb-kettle-reset rgb-item message . rest-args)
  686. (define room (gameobj-loc rgb-item))
  687. (when (eq? (.state rgb-item) 'ran)
  688. (set! (.heated rgb-item) #f)
  689. (set! (.filled rgb-item) #f))
  690. (apply rgb-item-reset rgb-item message rest-args))
  691. (define-actor <tinfoil-hat> (<gameobj>)
  692. ((cmd-wear tinfoil-hat-wear))
  693. (contained-commands
  694. #:allocation #:each-subclass
  695. #:init-thunk (build-commands
  696. ("wear" ((direct-command cmd-wear))))))
  697. (define (tinfoil-hat-wear tinfoil-hat message . _)
  698. (<- (message-from message) 'tell
  699. #:text '("You put on the tinfoil hat, and, to be perfectly honest with you "
  700. "it's a lot harder to take you seriously.")))
  701. (define-actor <hot-tea> (<gameobj>)
  702. ((cmd-drink hot-tea-cmd-drink)
  703. (cmd-sip hot-tea-cmd-sip))
  704. (contained-commands
  705. #:allocation #:each-subclass
  706. #:init-thunk (build-commands
  707. ("drink" ((direct-command cmd-drink)))
  708. ("sip" ((direct-command cmd-sip)))))
  709. (sips-left #:init-value 4
  710. #:accessor .sips-left)
  711. (name #:init-value "a cup of hot tea")
  712. (take-me? #:init-value #t)
  713. (goes-by #:init-value '("cup of hot tea" "cup of tea" "tea" "cup"))
  714. (desc #:init-value "It's a steaming cup of hot tea. It looks pretty good!"))
  715. (define (hot-tea-cmd-drink hot-tea message . _)
  716. (define player (message-from message))
  717. (define player-loc (<-wait player 'get-loc))
  718. (define player-name (<-wait player 'get-name))
  719. (<- player 'tell
  720. #:text "You drink a steaming cup of hot tea all at once... hot hot hot!")
  721. (<- player-loc 'tell-room
  722. #:text `(,player-name
  723. " drinks a steaming cup of hot tea all at once.")
  724. #:exclude player)
  725. (gameobj-self-destruct hot-tea))
  726. (define (hot-tea-cmd-sip hot-tea message . _)
  727. (define player (message-from message))
  728. (define player-loc (<-wait player 'get-loc))
  729. (define player-name (<-wait player 'get-name))
  730. (set! (.sips-left hot-tea) (- (.sips-left hot-tea) 1))
  731. (<- player 'tell
  732. #:text "You take a sip of your steaming hot tea. How refined!")
  733. (<- player-loc 'tell-room
  734. #:text `(,player-name
  735. " takes a sip of their steaming hot tea. How refined!")
  736. #:exclude player)
  737. (when (= (.sips-left hot-tea) 0)
  738. (<- player 'tell
  739. #:text "You've finished your tea!")
  740. (<- player-loc 'tell-room
  741. #:text `(,player-name
  742. " finishes their tea!")
  743. #:exclude player)
  744. (gameobj-self-destruct hot-tea)))
  745. (define-actor <fanny-pack> (<container>)
  746. ((cmd-take-from-while-wearing cmd-take-from)
  747. (cmd-put-in-while-wearing cmd-put-in))
  748. (contained-commands
  749. #:allocation #:each-subclass
  750. #:init-thunk
  751. (build-commands
  752. (("l" "look") ((direct-command cmd-look-at)))
  753. ("take" ((prep-indir-command cmd-take-from-while-wearing
  754. '("from" "out of"))))
  755. ("put" ((prep-indir-command cmd-put-in-while-wearing
  756. '("in" "inside" "into" "on")))))))
  757. (define playroom
  758. (lol
  759. ('playroom
  760. <room> #f
  761. #:name "The Playroom"
  762. #:desc '(p (" There are toys scattered everywhere here. It's really unclear
  763. if this room is intended for children or child-like adults.")
  764. (" There are doors to both the east and the west."))
  765. #:exits
  766. (list (make <exit>
  767. #:name "east"
  768. #:to 'grand-hallway)
  769. (make <exit>
  770. #:name "west"
  771. #:to 'computer-room)))
  772. ('playroom:cubey
  773. <gameobj> 'playroom
  774. #:name "Cubey"
  775. #:take-me? #t
  776. #:desc " It's a little foam cube with googly eyes on it. So cute!")
  777. ('playroom:cuddles-plushie
  778. <gameobj> 'playroom
  779. #:name "a Cuddles plushie"
  780. #:goes-by '("plushie" "cuddles plushie" "cuddles")
  781. #:take-me? #t
  782. #:desc " A warm and fuzzy cuddles plushie! It's a cuddlefish!")
  783. ('playroom:toy-chest
  784. <container> 'playroom
  785. #:name "a toy chest"
  786. #:goes-by '("toy chest" "chest")
  787. #:desc (lambda (toy-chest whos-looking)
  788. (let ((contents (gameobj-occupants toy-chest)))
  789. `((p "A brightly painted wooden chest. The word \"TOYS\" is "
  790. "engraved on it.")
  791. (p "Inside you see:"
  792. ,(if (eq? contents '())
  793. " nothing! It's empty!"
  794. `(ul ,(map (lambda (occupant)
  795. `(li ,(<-wait occupant 'get-name)))
  796. (gameobj-occupants toy-chest))))))))
  797. #:take-from-me? #t
  798. #:put-in-me? #t)
  799. ;; Things inside the toy chest
  800. ('playroom:toy-chest:rubber-duck
  801. <gameobj> 'playroom:toy-chest
  802. #:name "a rubber duck"
  803. #:goes-by '("rubber duck" "duck")
  804. #:take-me? #t
  805. #:desc "It's a yellow rubber duck with a bright orange beak.")
  806. ('playroom:toy-chest:tinfoil-hat
  807. <tinfoil-hat> 'playroom:toy-chest
  808. #:name "a tinfoil hat"
  809. #:goes-by '("tinfoil hat" "hat")
  810. #:take-me? #t
  811. #:desc "You'd have to be a crazy person to wear this thing!")
  812. ('playroom:toy-chest:fanny-pack
  813. <fanny-pack> 'playroom:toy-chest
  814. #:name "a fanny pack"
  815. #:goes-by '("fanny pack" "pack")
  816. #:take-me? #t
  817. #:desc
  818. (lambda (toy-chest whos-looking)
  819. (let ((contents (gameobj-occupants toy-chest)))
  820. `((p "It's a leather fanny pack, so it's both tacky and kinda cool.")
  821. (p "Inside you see:"
  822. ,(if (eq? contents '())
  823. " nothing! It's empty!"
  824. `(ul ,(map (lambda (occupant)
  825. `(li ,(<-wait occupant 'get-name)))
  826. (gameobj-occupants toy-chest)))))))))
  827. ;; Things inside the toy chest
  828. ('playroom:toy-chest:fanny-pack:plastic-elephant
  829. <gameobj> 'playroom:toy-chest:fanny-pack
  830. #:name "a plastic elephant"
  831. #:goes-by '("plastic elephant" "elephant")
  832. #:take-me? #t
  833. #:desc "It's a tiny little plastic elephant. Small, but heartwarming.")
  834. ('playroom:rgb-machine
  835. <rgb-machine> 'playroom
  836. #:name "a Rube Goldberg machine"
  837. #:goes-by '("rube goldberg machine" "machine")
  838. #:rgb-items '(playroom:rgb-dominoes
  839. playroom:rgb-switch-match
  840. playroom:rgb-candle
  841. playroom:rgb-catapult
  842. playroom:rgb-water-demon
  843. playroom:rgb-quik-heater
  844. playroom:rgb-kettle)
  845. #:desc "It's one of those hilarious Rube Goldberg machines.
  846. What could happen if you started it?")
  847. ;; Dominoes topple
  848. ('playroom:rgb-dominoes
  849. <rgb-item> 'playroom
  850. #:name "some dominoes"
  851. #:goes-by '("dominoes" "some dominoes")
  852. #:steps `("The dominoes topple down the line..."
  853. 1
  854. "The last domino lands on a switch!"
  855. 1.5
  856. playroom:rgb-switch-match)
  857. #:reset-msg "The dominoes are placed back into position.")
  858. ;; Which hit the switch and strike a match
  859. ('playroom:rgb-switch-match
  860. <rgb-item> 'playroom
  861. #:name "a switch"
  862. #:goes-by '("switch" "match")
  863. #:steps `("The switch lights a match!"
  864. ,(/ 2 3)
  865. "The match lights a candle!"
  866. 1.5
  867. playroom:rgb-candle)
  868. #:reset-msg "A fresh match is installed and the switch is reset.")
  869. ;; which lights a candle and burns a rope
  870. ('playroom:rgb-candle
  871. <rgb-item> 'playroom
  872. #:name "a candle"
  873. #:goes-by '("candle")
  874. #:steps `("The candle burns..."
  875. (/ 2 3) ; oops!
  876. "The candle is burning away a rope!"
  877. 2
  878. "The rope snaps!"
  879. .5
  880. playroom:rgb-catapult)
  881. #:reset-msg "A fresh candle is installed.")
  882. ;; which catapults a rock
  883. ('playroom:rgb-catapult
  884. <rgb-item> 'playroom
  885. #:name "a catapult"
  886. #:goes-by '("catapult")
  887. #:steps `("The snapped rope unleashes a catapult, which throws a rock!"
  888. 2
  889. "The rock flies through a water demon, startling it!"
  890. .5
  891. playroom:rgb-water-demon
  892. 2
  893. "The rock whacks into the quik-heater's on button!"
  894. .5
  895. playroom:rgb-quik-heater)
  896. #:reset-msg
  897. '("A fresh rope is attached to the catapult, which is pulled taught. "
  898. "A fresh rock is placed on the catapult."))
  899. ;; which both:
  900. ;; '- panics the water demon
  901. ;; '- which waters the kettle
  902. ('playroom:rgb-water-demon
  903. <rgb-item> 'playroom
  904. #:name "the water demon"
  905. #:triggers-as 'water-demon
  906. #:goes-by '("water demon" "demon")
  907. #:steps `("The water demon panics, and starts leaking water into the kettle below!"
  908. 3
  909. "The kettle is filled!"
  910. playroom:rgb-kettle)
  911. #:reset-msg '("The water demon is scratched behind the ears and calms down."))
  912. ;; '- bops the quik-heater button
  913. ;; '- which heats the kettle
  914. ('playroom:rgb-quik-heater
  915. <rgb-item> 'playroom
  916. #:name "the quik heater"
  917. #:triggers-as 'quik-heater
  918. #:goes-by '("quik heater" "heater")
  919. #:steps `("The quik-heater heats up the kettle above it!"
  920. 3
  921. "The kettle is heated up!"
  922. playroom:rgb-kettle)
  923. #:reset-msg '("The quik heater is turned off."))
  924. ;; Finally, the kettle
  925. ('playroom:rgb-kettle
  926. <rgb-kettle> 'playroom
  927. #:name "the kettle"
  928. #:goes-by '("kettle")
  929. #:reset-msg '("The kettle is emptied."))))
  930. ;;; Writing room
  931. ;;; ------------
  932. ;;; Armory???
  933. ;;; ---------
  934. ;; ... full of NURPH weapons?
  935. ;;; Smoking parlor
  936. ;;; --------------
  937. (define-class <furniture> (<gameobj>)
  938. (sit-phrase #:init-keyword #:sit-phrase)
  939. (sit-phrase-third-person #:init-keyword #:sit-phrase-third-person)
  940. (sit-name #:init-keyword #:sit-name)
  941. (commands
  942. #:allocation #:each-subclass
  943. #:init-thunk (build-commands
  944. ("sit" ((direct-command cmd-sit-furniture)))))
  945. (actions #:allocation #:each-subclass
  946. #:init-thunk (build-actions
  947. (cmd-sit-furniture furniture-cmd-sit))))
  948. (define* (furniture-cmd-sit actor message #:key direct-obj)
  949. (define player-name
  950. (<-wait (message-from message) 'get-name))
  951. (<- (message-from message) 'tell
  952. #:text (format #f "You ~a ~a.\n"
  953. (slot-ref actor 'sit-phrase)
  954. (slot-ref actor 'sit-name)))
  955. (<- (slot-ref actor 'loc) 'tell-room
  956. #:text (format #f "~a ~a on ~a.\n"
  957. player-name
  958. (slot-ref actor 'sit-phrase-third-person)
  959. (slot-ref actor 'sit-name))
  960. #:exclude (message-from message)))
  961. (define smoking-parlor
  962. (lol
  963. ('smoking-parlor
  964. <room> #f
  965. #:name "Smoking Parlor"
  966. #:desc
  967. '((p "This room looks quite posh. There are huge comfy seats you can sit in
  968. if you like. Strangely, you see a large sign saying \"No Smoking\". The owners must
  969. have installed this place and then changed their mind later.")
  970. (p "There's a door to the west leading back to the grand hallway, and
  971. a nondescript steel door to the south, leading apparently outside."))
  972. #:exits
  973. (list (make <exit>
  974. #:name "west"
  975. #:to 'grand-hallway)
  976. (make <exit>
  977. #:name "south"
  978. #:to 'break-room)))
  979. ('smoking-parlor:chair
  980. <furniture> 'smoking-parlor
  981. #:name "a comfy leather chair"
  982. #:desc " That leather chair looks really comfy!"
  983. #:goes-by '("leather chair" "comfy leather chair" "chair")
  984. #:sit-phrase "sink into"
  985. #:sit-phrase-third-person "sinks into"
  986. #:sit-name "the comfy leather chair")
  987. ('smoking-parlor:sofa
  988. <furniture> 'smoking-parlor
  989. #:name "a plush leather sofa"
  990. #:desc " That leather chair looks really comfy!"
  991. #:goes-by '("leather sofa" "plush leather sofa" "sofa"
  992. "leather couch" "plush leather couch" "couch")
  993. #:sit-phrase "sprawl out on"
  994. #:sit-phrase-third-person "sprawls out on into"
  995. #:sit-name "the plush leather couch")
  996. ('smoking-parlor:bar-stool
  997. <furniture> 'smoking-parlor
  998. #:name "a bar stool"
  999. #:desc " Conveniently located near the bar! Not the most comfortable
  1000. seat in the room, though."
  1001. #:goes-by '("stool" "bar stool" "seat")
  1002. #:sit-phrase "hop on"
  1003. #:sit-phrase-third-person "hops onto"
  1004. #:sit-name "the bar stool")
  1005. ('ford-prefect
  1006. <chatty-npc> 'smoking-parlor
  1007. #:name "Ford Prefect"
  1008. #:desc "Just some guy, you know?"
  1009. #:goes-by '("Ford Prefect" "ford prefect"
  1010. "frood" "prefect" "ford")
  1011. #:catchphrases prefect-quotes)
  1012. ('smoking-parlor:no-smoking-sign
  1013. <readable> 'smoking-parlor
  1014. #:invisible? #t
  1015. #:name "No Smoking Sign"
  1016. #:desc "This sign says \"No Smoking\" in big, red letters.
  1017. It has some bits of bubble gum stuck to it... yuck."
  1018. #:goes-by '("no smoking sign" "sign")
  1019. #:read-text "It says \"No Smoking\", just like you'd expect from
  1020. a No Smoking sign.")
  1021. ;; TODO: Cigar dispenser
  1022. ))
  1023. ;;; Breakroom
  1024. ;;; ---------
  1025. (define-class <desk-clerk> (<gameobj>)
  1026. ;; The desk clerk has three states:
  1027. ;; - on-duty: Arrived, and waiting for instructions (and losing patience
  1028. ;; gradually)
  1029. ;; - slacking: In the break room, probably smoking a cigarette
  1030. ;; or checking text messages
  1031. (state #:init-value 'slacking)
  1032. (commands #:allocation #:each-subclass
  1033. #:init-thunk
  1034. (build-commands
  1035. (("talk" "chat") ((direct-command cmd-chat)))
  1036. ("ask" ((direct-command cmd-ask-incomplete)
  1037. (prep-direct-command cmd-ask-about)))
  1038. ("dismiss" ((direct-command cmd-dismiss)))))
  1039. (patience #:init-value 0)
  1040. (actions #:allocation #:each-subclass
  1041. #:init-thunk (build-actions
  1042. (init clerk-act-init)
  1043. (cmd-chat clerk-cmd-chat)
  1044. (cmd-ask-incomplete clerk-cmd-ask-incomplete)
  1045. (cmd-ask-about clerk-cmd-ask)
  1046. (cmd-dismiss clerk-cmd-dismiss)
  1047. (update-loop clerk-act-update-loop)
  1048. (be-summoned clerk-act-be-summoned))))
  1049. (define (clerk-act-init clerk message . _)
  1050. ;; call the gameobj main init method
  1051. (gameobj-act-init clerk message)
  1052. ;; start our main loop
  1053. (<- (actor-id clerk) 'update-loop))
  1054. (define changing-name-text "Changing your name is easy!
  1055. We have a clipboard here at the desk
  1056. where you can make yourself known to other participants in the hotel
  1057. if you sign it. Try 'sign form as <your-name>', replacing
  1058. <your-name>, obviously!")
  1059. (define phd-text
  1060. "Ah... when I'm not here, I've got a PHD to finish.")
  1061. (define clerk-help-topics
  1062. `(("changing name" . ,changing-name-text)
  1063. ("sign-in form" . ,changing-name-text)
  1064. ("form" . ,changing-name-text)
  1065. ("common commands" .
  1066. "Here are some useful commands you might like to try: chat,
  1067. go, take, drop, say...")
  1068. ("hotel" .
  1069. "We hope you enjoy your stay at Hotel Bricabrac. As you may see,
  1070. our hotel emphasizes interesting experiences over rest and lodging.
  1071. The origins of the hotel are... unclear... and it has recently come
  1072. under new... 'management'. But at Hotel Bricabrac we believe these
  1073. aspects make the hotel into a fun and unique experience! Please,
  1074. feel free to walk around and explore.")
  1075. ("physics paper" . ,phd-text)
  1076. ("paper" . ,phd-text)
  1077. ("proprietor" . "Oh, he's that frumpy looking fellow sitting over there.")))
  1078. (define clerk-knows-about
  1079. "'ask clerk about changing name', 'ask clerk about common commands', and 'ask clerk about the hotel'")
  1080. (define clerk-general-helpful-line
  1081. (string-append
  1082. "The clerk says, \"If you need help with anything, feel free to ask me about it.
  1083. For example, 'ask clerk about changing name'. You can ask me about the following:
  1084. " clerk-knows-about ".\"\n"))
  1085. (define clerk-slacking-complaints
  1086. '("The pay here is absolutely lousy."
  1087. "The owner here has no idea what they're doing."
  1088. "Some times you just gotta step away, you know?"
  1089. "You as exhausted as I am?"
  1090. "Yeah well, this is just temporary. I'm studying to be a high
  1091. energy particle physicist. But ya gotta pay the bills, especially
  1092. with tuition at where it is..."))
  1093. (define* (clerk-cmd-chat clerk message #:key direct-obj)
  1094. (match (slot-ref clerk 'state)
  1095. ('on-duty
  1096. (<- (message-from message) 'tell
  1097. #:text clerk-general-helpful-line))
  1098. ('slacking
  1099. (<- (message-from message) 'tell
  1100. #:text
  1101. (string-append
  1102. "The clerk says, \""
  1103. (random-choice clerk-slacking-complaints)
  1104. "\"\n")))))
  1105. (define (clerk-cmd-ask-incomplete clerk message . _)
  1106. (<- (message-from message) 'tell
  1107. #:text "The clerk says, \"Ask about what?\"\n"))
  1108. (define clerk-doesnt-know-text
  1109. "The clerk apologizes and says she doesn't know about that topic.\n")
  1110. (define* (clerk-cmd-ask clerk message #:key indir-obj
  1111. #:allow-other-keys)
  1112. (match (slot-ref clerk 'state)
  1113. ('on-duty
  1114. (match (assoc indir-obj clerk-help-topics)
  1115. ((_ . info)
  1116. (<- (message-from message) 'tell
  1117. #:text
  1118. (string-append "The clerk clears her throat and says:\n \""
  1119. info
  1120. "\"\n")))
  1121. (#f
  1122. (<- (message-from message) 'tell
  1123. #:text clerk-doesnt-know-text))))
  1124. ('slacking
  1125. (<- (message-from message) 'tell
  1126. #:text "The clerk says, \"Sorry, I'm on my break.\"\n"))))
  1127. (define* (clerk-act-be-summoned clerk message #:key who-summoned)
  1128. (match (slot-ref clerk 'state)
  1129. ('on-duty
  1130. (<- who-summoned 'tell
  1131. #:text
  1132. "The clerk tells you as politely as she can that she's already here,
  1133. so there's no need to ring the bell.\n"))
  1134. ('slacking
  1135. (<- (gameobj-loc clerk) 'tell-room
  1136. #:text
  1137. "The clerk's ears perk up, she stamps out a cigarette, and she
  1138. runs out of the room!\n")
  1139. (gameobj-set-loc! clerk (dyn-ref clerk 'lobby))
  1140. (slot-set! clerk 'patience 8)
  1141. (slot-set! clerk 'state 'on-duty)
  1142. (<- (gameobj-loc clerk) 'tell-room
  1143. #:text
  1144. (string-append
  1145. " Suddenly, a uniformed woman rushes into the room! She's wearing a
  1146. badge that says \"Desk Clerk\".
  1147. \"Hello, yes,\" she says between breaths, \"welcome to Hotel Bricabrac!
  1148. We look forward to your stay. If you'd like help getting acclimated,
  1149. feel free to ask me. For example, 'ask clerk about changing name'.
  1150. You can ask me about the following:
  1151. " clerk-knows-about ".\"\n")))))
  1152. (define* (clerk-cmd-dismiss clerk message . _)
  1153. (define player-name
  1154. (<-wait (message-from message) 'get-name))
  1155. (match (slot-ref clerk 'state)
  1156. ('on-duty
  1157. (<- (gameobj-loc clerk) 'tell-room
  1158. #:text
  1159. (format #f "\"Thanks ~a!\" says the clerk. \"I have somewhere I need to be.\"
  1160. The clerk leaves the room in a hurry.\n"
  1161. player-name)
  1162. #:exclude (actor-id clerk))
  1163. (gameobj-set-loc! clerk (dyn-ref clerk 'break-room))
  1164. (slot-set! clerk 'state 'slacking)
  1165. (<- (gameobj-loc clerk) 'tell-room
  1166. #:text clerk-return-to-slacking-text
  1167. #:exclude (actor-id clerk)))
  1168. ('slacking
  1169. (<- (message-from message) 'tell
  1170. #:text "The clerk sternly asks you to not be so dismissive.\n"))))
  1171. (define clerk-slacking-texts
  1172. '("The clerk takes a long drag on her cigarette.\n"
  1173. "The clerk scrolls through text messages on her phone.\n"
  1174. "The clerk coughs a few times.\n"
  1175. "The clerk checks her watch and justifies a few more minutes outside.\n"
  1176. "The clerk fumbles around for a lighter.\n"
  1177. "The clerk sighs deeply and exhaustedly.\n"
  1178. "The clerk fumbles around for a cigarette.\n"))
  1179. (define clerk-working-impatience-texts
  1180. '("The clerk hums something, but you're not sure what it is."
  1181. "The clerk attempts to change the overhead music, but the dial seems broken."
  1182. "The clerk clicks around on the desk computer."
  1183. "The clerk scribbles an equation on a memo pad, then crosses it out."
  1184. "The clerk mutters something about the proprietor having no idea how to run a hotel."
  1185. "The clerk thumbs through a printout of some physics paper."))
  1186. (define clerk-slack-excuse-text
  1187. "The desk clerk excuses herself, but says you are welcome to ring the bell
  1188. if you need further help.")
  1189. (define clerk-return-to-slacking-text
  1190. "The desk clerk enters and slams the door behind her.\n")
  1191. (define (clerk-act-update-loop clerk message)
  1192. (define (tell-room text)
  1193. (<- (gameobj-loc clerk) 'tell-room
  1194. #:text text
  1195. #:exclude (actor-id clerk)))
  1196. (define (loop-if-not-destructed)
  1197. (if (not (slot-ref clerk 'destructed))
  1198. ;; This iterates by "recursing" on itself by calling itself
  1199. ;; (as the message handler) again. It used to be that we had to do
  1200. ;; this, because there was a bug where a loop which yielded like this
  1201. ;; would keep growing the stack due to some parameter goofiness.
  1202. ;; That's no longer true, but there's an added advantage to this
  1203. ;; route: it's much more live hackable. If we change the definition
  1204. ;; of this method, the character will act differently on the next
  1205. ;; "tick" of the loop.
  1206. (<- (actor-id clerk) 'update-loop)))
  1207. (match (slot-ref clerk 'state)
  1208. ('slacking
  1209. (tell-room (random-choice clerk-slacking-texts))
  1210. (daydream (+ (random 20) 15))
  1211. (loop-if-not-destructed))
  1212. ('on-duty
  1213. (if (> (slot-ref clerk 'patience) 0)
  1214. ;; Keep working but lose patience gradually
  1215. (begin
  1216. (tell-room (random-choice clerk-working-impatience-texts))
  1217. (slot-set! clerk 'patience (- (slot-ref clerk 'patience)
  1218. (+ (random 2) 1)))
  1219. (daydream (+ (random 60) 40))
  1220. (loop-if-not-destructed))
  1221. ;; Back to slacking
  1222. (begin
  1223. (tell-room clerk-slack-excuse-text)
  1224. ;; back bto the break room
  1225. (gameobj-set-loc! clerk (dyn-ref clerk 'break-room))
  1226. (tell-room clerk-return-to-slacking-text)
  1227. ;; annnnnd back to slacking
  1228. (slot-set! clerk 'state 'slacking)
  1229. (daydream (+ (random 30) 15))
  1230. (loop-if-not-destructed))))))
  1231. (define break-room
  1232. (lol
  1233. ('break-room
  1234. <room> #f
  1235. #:name "Employee Break Room"
  1236. #:desc " This is less a room and more of an outdoor wire cage. You get
  1237. a bit of a view of the brick exterior of the building, and a crisp wind blows,
  1238. whistling, through the openings of the fenced area. Partly smoked cigarettes
  1239. and various other debris cover the floor.
  1240. Through the wires you can see... well... hm. It looks oddly like
  1241. the scenery tapers off nothingness. But that can't be right, can it?"
  1242. #:exits
  1243. (list (make <exit>
  1244. #:name "north"
  1245. #:to 'smoking-parlor)))
  1246. ('break-room:desk-clerk
  1247. <desk-clerk> 'break-room
  1248. #:name "the hotel desk clerk"
  1249. #:desc " The hotel clerk is wearing a neatly pressed uniform bearing the
  1250. hotel insignia. She appears to be rather exhausted."
  1251. #:goes-by '("hotel desk clerk" "clerk" "desk clerk"))
  1252. ('break-room:void
  1253. <gameobj> 'break-room
  1254. #:invisible? #t
  1255. #:name "The Void"
  1256. #:desc "As you stare into the void, the void stares back into you."
  1257. #:goes-by '("void" "abyss" "nothingness" "scenery"))
  1258. ('break-room:fence
  1259. <gameobj> 'break-room
  1260. #:invisible? #t
  1261. #:name "break room cage"
  1262. #:desc "It's a mostly-cubical wire mesh surrounding the break area.
  1263. You can see through the gaps, but they're too small to put more than a
  1264. couple of fingers through. There appears to be some wear and tear to
  1265. the paint, but the wires themselves seem to be unusually sturdy."
  1266. #:goes-by '("fence" "cage" "wire cage"))))
  1267. ;;; Ennpie's Sea Lounge
  1268. ;;; -------------------
  1269. ;;; Computer room
  1270. ;;; -------------
  1271. ;; Our computer and hard drive are based off the PDP-11 and the RL01 /
  1272. ;; RL02 disk drives. However we increment both by .5 (a true heresy)
  1273. ;; to distinguish both from the real thing.
  1274. (define-actor <hard-drive> (<gameobj>)
  1275. ((cmd-put-in hard-drive-insert)
  1276. (cmd-push-button hard-drive-push-button)
  1277. (get-state hard-drive-act-get-state))
  1278. (commands #:allocation #:each-subclass
  1279. #:init-thunk (build-commands
  1280. ("insert" ((prep-indir-command cmd-put-in
  1281. '("in" "inside" "into"))))
  1282. (("press" "push") ((prep-indir-command cmd-push-button)))))
  1283. ;; the state moves from: empty -> with-disc -> loading -> ready
  1284. (state #:init-value 'empty
  1285. #:accessor .state))
  1286. (define (hard-drive-act-get-state hard-drive message)
  1287. (.state hard-drive))
  1288. (define* (hard-drive-desc hard-drive #:optional whos-looking)
  1289. `((p "The hard drive is labeled \"RL02.5\". It's a little under a meter tall.")
  1290. (p "There is a slot where a disk platter could be inserted, "
  1291. ,(if (eq? (.state hard-drive) 'empty)
  1292. "which is currently empty"
  1293. "which contains a glowing platter")
  1294. ". There is a LOAD button "
  1295. ,(if (member (.state hard-drive) '(empty with-disc))
  1296. "which is glowing"
  1297. "which is pressed in and unlit")
  1298. ". There is a READY indicator "
  1299. ,(if (eq? (.state hard-drive) 'ready)
  1300. "which is glowing."
  1301. "which is unlit.")
  1302. ,(if (member (.state hard-drive) '(loading ready))
  1303. " The machine emits a gentle whirring noise."
  1304. ""))))
  1305. (define* (hard-drive-push-button gameobj message
  1306. #:key direct-obj indir-obj preposition
  1307. (player (message-from message)))
  1308. (define (tell-room text)
  1309. (<-wait (gameobj-loc gameobj) 'tell-room
  1310. #:text text))
  1311. (define (tell-room-excluding-player text)
  1312. (<-wait (gameobj-loc gameobj) 'tell-room
  1313. #:text text
  1314. #:exclude player))
  1315. (cond
  1316. ((ci-member direct-obj '("button" "load button" "load"))
  1317. (tell-room-excluding-player
  1318. `(,(<-wait player 'get-name)
  1319. " presses the button on the hard disk."))
  1320. (<- player 'tell
  1321. #:text "You press the button on the hard disk.")
  1322. (case (.state gameobj)
  1323. ((empty)
  1324. ;; I have no idea what this drive did when you didn't have a platter
  1325. ;; in it and pressed load, but I know there was a FAULT button.
  1326. (tell-room "You hear some movement inside the hard drive...")
  1327. (daydream 1.5)
  1328. (tell-room
  1329. '("... but then the FAULT button blinks a couple times. "
  1330. "What could be missing?")))
  1331. ((with-disc)
  1332. (set! (.state gameobj) 'loading)
  1333. (tell-room "The hard disk begins to spin up!")
  1334. (daydream 2)
  1335. (set! (.state gameobj) 'ready)
  1336. (tell-room "The READY light turns on!"))
  1337. ((loading ready)
  1338. (<- player 'tell
  1339. #:text '("Pressing the button does nothing right now, "
  1340. "but it does feel satisfying.")))))
  1341. (else
  1342. (<- player 'tell
  1343. #:text '("How could you think of pressing anything else "
  1344. "but that tantalizing button right in front of you?")))))
  1345. (define* (hard-drive-insert gameobj message
  1346. #:key direct-obj indir-obj preposition
  1347. (player (message-from message)))
  1348. (define our-name (slot-ref gameobj 'name))
  1349. (define this-thing
  1350. (call/ec
  1351. (lambda (return)
  1352. (for-each (lambda (occupant)
  1353. (define goes-by (<-wait occupant 'goes-by))
  1354. (when (ci-member direct-obj goes-by)
  1355. (return occupant)))
  1356. (<-wait player 'get-occupants))
  1357. ;; nothing found
  1358. #f)))
  1359. (cond
  1360. ((not this-thing)
  1361. (<- player 'tell
  1362. #:text `("You don't seem to have any such " ,direct-obj " to put "
  1363. ,preposition " " ,our-name ".")))
  1364. ((not (<-wait this-thing 'get-prop 'hd-platter?))
  1365. (<- player 'tell
  1366. #:text `("It wouldn't make sense to put "
  1367. ,(<-wait this-thing 'get-name)
  1368. " " ,preposition " " ,our-name ".")))
  1369. ((not (eq? (.state gameobj) 'empty))
  1370. (<- player 'tell
  1371. #:text "The disk drive already has a platter in it."))
  1372. (else
  1373. (set! (.state gameobj) 'with-disc)
  1374. (<- player 'tell
  1375. #:text '((p "You insert the glowing disc into the drive.")
  1376. (p "The LOAD button begins to glow."))))))
  1377. ;; The computar
  1378. (define-actor <computer> (<gameobj>)
  1379. ((cmd-run-program computer-run-program)
  1380. (cmd-run-what (lambda (gameobj message . _)
  1381. (<- (message-from message) 'tell
  1382. #:text '("The computer is already running, and a program appears "
  1383. "ready to run."
  1384. "you mean to \"run the program on the computer\""))))
  1385. (cmd-help-run-not-press
  1386. (lambda (gameobj message . _)
  1387. (<- (message-from message) 'tell
  1388. #:text '("You don't need to press / push / flip anything. "
  1389. "You could " (i "run program on computer")
  1390. " already if you wanted to.")))))
  1391. (commands #:allocation #:each-subclass
  1392. #:init-thunk (build-commands
  1393. ("run" ((prep-indir-command cmd-run-program
  1394. '("on"))
  1395. (direct-command cmd-run-what)))
  1396. (("press" "push" "flip")
  1397. ((prep-indir-command cmd-help-run-not-press))))))
  1398. (define* (computer-run-program gameobj message
  1399. #:key direct-obj indir-obj preposition
  1400. (player (message-from message)))
  1401. (define (hd-state)
  1402. (<-wait (dyn-ref gameobj 'computer-room:hard-drive) 'get-state))
  1403. (define (tell-room text)
  1404. (<-wait (gameobj-loc gameobj) 'tell-room
  1405. #:text text))
  1406. (define (tell-room-excluding-player text)
  1407. (<-wait (gameobj-loc gameobj) 'tell-room
  1408. #:text text
  1409. #:exclude player))
  1410. (define (tell-player text)
  1411. (<-wait player 'tell
  1412. #:text text))
  1413. (cond
  1414. ((ci-member direct-obj '("program"))
  1415. (tell-room-excluding-player
  1416. `(,(<-wait player 'get-name)
  1417. " runs the program loaded on the computer..."))
  1418. (tell-player "You run the program on the computer...")
  1419. (cond
  1420. ((not (eq? (hd-state) 'ready))
  1421. (tell-room '("... but it errors out. "
  1422. "It seems to be complaining about a " (b "DISK ERROR!")
  1423. ". It looks like it is missing some essential software.")))
  1424. (else
  1425. (<- (dyn-ref gameobj 'computer-room:floor-panel) 'open-up))))))
  1426. ;; floor panel
  1427. (define-actor <floor-panel> (<gameobj>)
  1428. ;; TODO: Add "open" verb, since obviously people will try that
  1429. ((open? (lambda (panel message)
  1430. (slot-ref panel 'open)))
  1431. (open-up floor-panel-open-up))
  1432. (open #:init-value #f))
  1433. (define (floor-panel-open-up panel message)
  1434. (if (slot-ref panel 'open)
  1435. (<- (gameobj-loc panel) 'tell-room
  1436. #:text '("You hear some gears grind around the hinges of the "
  1437. "floor panel, but it appears to already be open."))
  1438. (begin
  1439. (slot-set! panel 'open #t)
  1440. (<- (gameobj-loc panel) 'tell-room
  1441. #:text '("You hear some gears grind, as the metal panel on "
  1442. "the ground opens and reveals a stairwell going down!")))))
  1443. (define* (floor-panel-desc panel #:optional whos-looking)
  1444. `("It's a large metal panel on the floor in the middle of the room. "
  1445. ,(if (slot-ref panel 'open)
  1446. '("It's currently wide open, revealing a spiraling staircase "
  1447. "which descends into darkness.")
  1448. '("It's currently closed shut, but there are clearly hinges, and "
  1449. "it seems like there is a mechanism which probably opens it via "
  1450. "some automation. What could be down there?"))))
  1451. (define computer-room
  1452. (lol
  1453. ('computer-room
  1454. <room> #f
  1455. #:name "Computer Room"
  1456. #:desc (lambda (gameobj whos-looking)
  1457. (define panel-open
  1458. (<-wait (dyn-ref gameobj 'computer-room:floor-panel)
  1459. 'open?))
  1460. `((p "A sizable computer cabinet covers a good portion of the left
  1461. wall. It emits a pleasant hum which covers the room like a warm blanket.
  1462. Connected to a computer is a large hard drive.")
  1463. (p "On the floor is a large steel panel. "
  1464. ,(if panel-open
  1465. '("It is wide open, exposing a spiral staircase "
  1466. "which descends into darkness.")
  1467. '("It is closed, but it has hinges which "
  1468. "suggest it could be opened.")))))
  1469. #:exits
  1470. (list (make <exit>
  1471. #:name "east"
  1472. #:to 'playroom)
  1473. (make <exit>
  1474. #:name "down"
  1475. #:to 'underground-lab
  1476. #:traverse-check
  1477. (lambda (exit room whos-exiting)
  1478. (define panel-open
  1479. (<-wait (dyn-ref room 'computer-room:floor-panel)
  1480. 'open?))
  1481. (if panel-open
  1482. (values #t "You descend the spiral staircase.")
  1483. (values #f '("You'd love to go down, but the only way "
  1484. "through is through that metal panel, "
  1485. "which seems closed.")))))))
  1486. ('computer-room:hard-drive
  1487. <hard-drive> 'computer-room
  1488. #:name "the hard drive"
  1489. #:desc (wrap-apply hard-drive-desc)
  1490. #:goes-by '("hard drive" "drive" "hard disk"))
  1491. ('computer-room:computer
  1492. <computer> 'computer-room
  1493. #:name "the computer"
  1494. #:desc '((p "It's a coat closet sized computer labeled \"PDP-11.5\". ")
  1495. (p "The computer is itself turned on, and it looks like it is "
  1496. "all set up for you to run a program on it."))
  1497. #:goes-by '("computer"))
  1498. ('computer-room:floor-panel
  1499. <floor-panel> 'computer-room
  1500. #:name "a floor panel"
  1501. #:desc (wrap-apply floor-panel-desc)
  1502. #:invisible? #t
  1503. #:goes-by '("floor panel" "panel"))))
  1504. ;;; * UNDERGROUND SECTION OF THE GAME! *
  1505. ;;; The lab
  1506. (define underground-map-text
  1507. "\
  1508. _______ |
  1509. .-' @ '-. \\ ?????
  1510. .' '. .\\
  1511. | [8sync Hive] |======' '-_____
  1512. ', M ,'
  1513. '. @ .'
  1514. \\ @ /
  1515. '-__+__-'
  1516. '. @ .'
  1517. .--------------. \\ /
  1518. | [Guile Async | .-------+------.
  1519. | Museum] | | [Lab] #!#| .-------------.
  1520. | @| | MM | |[Federation |
  1521. | & ^ +##+@ || < +##| Station]|
  1522. | | | @ | | |
  1523. | & # | |*You-Are-Here*| '-------------'
  1524. | # ^ | #+-------+------'
  1525. '-------+------' # #
  1526. # # #
  1527. # # .-----------.
  1528. .-+----. # |# F |
  1529. |@?+%? +#### | ^ f## |
  1530. '------' | f f %|
  1531. |F [Mudsync |
  1532. | $ Swamp] |
  1533. '-----------'")
  1534. (define 8sync-design-goals
  1535. '(ul (li (b "Actor based, shared nothing environment: ")
  1536. "Shared resources are hard to control and result in fighting
  1537. deadlocks, etc. Escape the drudgery: only one actor controls a resource,
  1538. and they only receive one message at a time (though they can \"juggle\"
  1539. messages).")
  1540. (li (b "Live hackable: ")
  1541. "It's hard to plan out a concurrent system; the right structure
  1542. is often found by evolving the system while it runs. Make it easy to
  1543. build, shape, and change a running system, as well as observe and correct
  1544. errors.")
  1545. (li (b "No callback hell: ")
  1546. "Just because you're calling out to some other asynchronous
  1547. code doesn't mean you should need to chop up your program into a bunch of bits.
  1548. Clever use of delimited continuations makes it easy.")))
  1549. (define underground-lab
  1550. (lol
  1551. ('underground-lab
  1552. <room> #f
  1553. #:name "Underground laboratory"
  1554. #:desc '((p "This appears to be some sort of underground laboratory."
  1555. "There is a spiral staircase here leading upwards, where "
  1556. "it seems much brighter.")
  1557. (p "There are a number of doors leading in different directions:
  1558. north, south, east, and west, as well as a revolving door to the southwest.
  1559. It looks like it could be easy to get lost, but luckily there
  1560. is a map detailing the layout of the underground structure."))
  1561. #:exits
  1562. (list (make <exit>
  1563. #:name "up"
  1564. #:to 'computer-room
  1565. #:traverse-check
  1566. (lambda (exit room whos-exiting)
  1567. (values #t "You climb the spiral staircase.")))
  1568. (make <exit>
  1569. #:name "west"
  1570. #:to 'async-museum
  1571. #:traverse-check
  1572. (lambda (exit room whos-exiting)
  1573. (values #t '("You head west through a fancy-looking entrance. "
  1574. "A security guard steps aside for you to pass through, "
  1575. "into the room, then stands in front of the door."))))
  1576. (make <exit>
  1577. #:name "north"
  1578. #:to 'hive-entrance)
  1579. (make <exit>
  1580. #:name "east"
  1581. #:to 'federation-station)
  1582. (make <exit>
  1583. #:name "south"
  1584. #:traverse-check
  1585. (lambda (exit room whos-exiting)
  1586. (values #f '("Ooh, if only you could go south and check this out! "
  1587. "Unfortunately this whole area is sealed off... the proprietor "
  1588. "probably never got around to fixing it. "
  1589. "Too bad, it would have had monsters to fight and everything!"))))
  1590. (make <exit>
  1591. #:name "southwest"
  1592. #:traverse-check
  1593. (lambda (exit room whos-exiting)
  1594. (values #f '("Hm, it's one of those revolving doors that only revolves in "
  1595. "one direction, and it isn't this one. You guess that while "
  1596. "this doesn't appear to be an entrance, it probably is an exit."))))))
  1597. ;; map
  1598. ('underground-lab:map
  1599. <readable> 'underground-lab
  1600. #:name "the underground map"
  1601. #:desc '("This appears to be a map of the surrounding area. "
  1602. "You could read it if you want to.")
  1603. #:read-text `(pre ,underground-map-text)
  1604. #:goes-by '("map" "underground map" "lab map"))
  1605. ('underground-lab:8sync-sign
  1606. <readable> 'underground-lab
  1607. #:name "a sign labeled \"8sync design goals\""
  1608. #:goes-by '("sign" "8sync design goals sign" "8sync goals" "8sync design" "8sync sign")
  1609. #:read-text 8sync-design-goals
  1610. #:desc `((p "The sign says:")
  1611. ,8sync-design-goals))))
  1612. ;;; guile async museum
  1613. (define async-museum
  1614. (list
  1615. (list
  1616. 'async-museum
  1617. <room> #f
  1618. #:name "Guile Asynchronous Museum"
  1619. #:desc '((p "You're in the Guile Asynchronous Museum. There is a list of exhibits
  1620. on the wall near the entrance. Scattered around the room are the exhibits
  1621. themselves, but it's difficult to pick them out. Maybe you should read the list
  1622. to orient yourself.")
  1623. (p "There is a door to the east, watched by a security guard,
  1624. as well as an exit leading to the south."))
  1625. #:exits (list
  1626. (make <exit>
  1627. #:name "south"
  1628. #:to 'gift-shop)
  1629. (make <exit>
  1630. #:name "east"
  1631. #:to 'underground-lab
  1632. #:traverse-check
  1633. (lambda (exit room whos-exiting)
  1634. (values #f '("The security guard stops you and tells you "
  1635. "that the only exit is through the gift shop."))))))
  1636. (list
  1637. 'async-museum:security-guard
  1638. <chatty-npc> 'async-museum
  1639. #:name "a security guard"
  1640. #:desc
  1641. '(p "The security guard is blocking the eastern entrance, where "
  1642. "you came in from.")
  1643. #:goes-by '("security guard" "guard" "security")
  1644. #:catchphrases '("It's hard standing here all day."
  1645. "I just want to go home."
  1646. "The exhibits are nice, but I've seen them all before."))
  1647. (let ((placard
  1648. `((p "Welcome to our humble museum! The exhibits are listed below. "
  1649. (br)
  1650. "To look at one, simply type: " (i "look at <exhibit-name>"))
  1651. (p "Available exhibits:")
  1652. (ul ,@(map (lambda (exhibit)
  1653. `(li ,exhibit))
  1654. '("2016 Progress"
  1655. "8sync and Fibers"
  1656. "Suspendable Ports"
  1657. "The Actor Model"))))))
  1658. (list
  1659. 'async-museum:list-of-exhibits
  1660. <readable> 'async-museum
  1661. #:name "list of exhibits"
  1662. #:desc
  1663. `((p "It's a list of exibits in the room. The placard says:")
  1664. ,@placard)
  1665. #:goes-by '("list of exhibits" "exhibit list" "list" "exhibits")
  1666. #:read-text placard))
  1667. (list
  1668. 'async-museum:2016-progress-exhibit
  1669. <readable-desc> 'async-museum
  1670. #:name "2016 Progress Exhibit"
  1671. #:goes-by '("2016 progress exhibit" "2016 progress" "2016 exhibit")
  1672. #:desc
  1673. '((p "It's a three-piece exhibit, with three little dioramas and some text "
  1674. "explaining what they represent. They are:")
  1675. (ul (li (b "Late 2015/Early 2016 talk: ")
  1676. "This one explains the run-up conversation from late 2015 "
  1677. "and early 2016 about the need for an "
  1678. "\"asynchronous event loop for Guile\". The diorama "
  1679. "is a model of the Veggie Galaxy restaurant where after "
  1680. "the FSF 30th anniversary party; Mark Weaver, Christopher "
  1681. "Allan Webber, David Thompson, and Andrew Engelbrecht chat "
  1682. "about the need for Guile to have an answer to asynchronous "
  1683. "programming. A mailing list post " ; TODO: link it?
  1684. "summarizing the discussion is released along with various "
  1685. "conversations around what is needed, as well as further "
  1686. "discussion at FOSDEM 2016.")
  1687. (li (b "Early implementations: ")
  1688. "This one shows Chris Webber's 8sync and Chris Vine's "
  1689. "guile-a-sync, both appearing in late 2015 and evolving "
  1690. "into their basic designs in early 2016. It's less a diorama "
  1691. "than a printout of some mailing list posts. Come on, the "
  1692. "curators could have done better with this one.")
  1693. (li (b "Suspendable ports and Fibers: ")
  1694. "The diorama shows Andy Wingo furiously hacking at his keyboard. "
  1695. "The description talks about Wingo's mailing list thread "
  1696. "about possibly breaking Guile compatibility for a \"ports refactor\". "
  1697. "Wingo releases Fibers, another asynchronous library, making use of "
  1698. "the new interface, and 8sync and guile-a-sync "
  1699. "quickly move to support suspendable ports as well. "
  1700. "The description also mentions that there is an exhibit entirely "
  1701. "devoted to suspendable ports."))
  1702. (p "Attached at the bottom is a post it note mentioning "
  1703. "https integration landing in Guile 2.2.")))
  1704. (list
  1705. 'async-museum:8sync-and-fibers-exhibit
  1706. <readable-desc> 'async-museum
  1707. #:name "8sync and Fibers Exhibit"
  1708. #:goes-by '("8sync and fibers exhibit" "8sync exhibit" "fibers exhibit")
  1709. #:desc
  1710. '((p "This exhibit is a series of charts explaining the similarities "
  1711. "and differences between 8sync and Fibers, two asynchronous programming "
  1712. "libraries for GNU Guile. It's way too wordy, but you get the general gist.")
  1713. (p (b "Similarities:")
  1714. (ul (li "Both use Guile's suspendable-ports facility")
  1715. (li "Both use message passing")))
  1716. (p (b "Differences:")
  1717. (ul (li "Fibers \"processes\" can read from multiple \"channels\", "
  1718. "but 8sync actors only read from one \"inbox\" each.")
  1719. (li "Different theoretical basis:"
  1720. (ul (li "Fibers: based on CSP (Communicating Sequential Processes), "
  1721. "a form of Process Calculi")
  1722. (li "8sync: based on the Actor Model")
  1723. (li "Luckily CSP and the Actor Model are \"dual\"!")))))
  1724. (p "Fibers is also designed by Andy Wingo, an excellent compiler hacker, "
  1725. "whereas 8sync is designed by Chris Webber, who built this crappy "
  1726. "hotel simulator.")))
  1727. (list
  1728. 'async-museum:8sync-and-fibers-exhibit
  1729. <readable-desc> 'async-museum
  1730. #:name "8sync and Fibers Exhibit"
  1731. #:goes-by '("8sync and fibers exhibit" "8sync exhibit" "fibers exhibit")
  1732. #:desc
  1733. '((p "This exhibit is a series of charts explaining the similarities "
  1734. "and differences between 8sync and Fibers, two asynchronous programming "
  1735. "libraries for GNU Guile. It's way too wordy, but you get the general gist.")
  1736. (p (b "Similarities:")
  1737. (ul (li "Both use Guile's suspendable-ports facility")
  1738. (li "Both use message passing")))
  1739. (p (b "Differences:")
  1740. (ul (li "Fibers \"processes\" can read from multiple \"channels\", "
  1741. "but 8sync actors only read from one \"inbox\" each.")
  1742. (li "Different theoretical basis:"
  1743. (ul (li "Fibers: based on CSP (Communicating Sequential Processes), "
  1744. "a form of Process Calculi")
  1745. (li "8sync: based on the Actor Model")
  1746. (li "Luckily CSP and the Actor Model are \"dual\"!")))))
  1747. (p "Fibers is also designed by Andy Wingo, an excellent compiler hacker, "
  1748. "whereas 8sync is designed by Chris Webber, who built this crappy "
  1749. "hotel simulator.")))
  1750. (list
  1751. 'async-museum:suspendable-ports-exhibit
  1752. <readable-desc> 'async-museum
  1753. #:name "Suspendable Ports Exhibit"
  1754. #:goes-by '("suspendable ports exhibit" "ports exhibit"
  1755. "suspendable exhibit" "suspendable ports" "ports")
  1756. #:desc
  1757. '((p "Suspendable ports are a new feature in Guile 2.2, and allows code "
  1758. "that would normally block on IO to " (i "automatically") " suspend "
  1759. "to the scheduler until information is ready to be read/written!")
  1760. (p "Yow! You might barely need to change your existing blocking code!")
  1761. (p "Fibers, 8sync, and guile-a-sync now support suspendable ports.")))
  1762. (list
  1763. 'async-museum:actor-model-exhibit
  1764. <readable-desc> 'async-museum
  1765. #:name "Actor Model Exhibit"
  1766. #:goes-by '("actor model exhibit" "actor exhibit"
  1767. "actor model")
  1768. #:desc
  1769. '((p "Here are some fact(oids) about the actor model!")
  1770. (ul (li "Concieved initially by Carl Hewitt in early 1970s")
  1771. (li "\"A society of experts\"")
  1772. (li "shared nothing, message passing")
  1773. (li "Originally the research goal of Scheme! "
  1774. "(message passing / lambda anecdote here)")
  1775. (li "Key concepts consistent, but implementation details vary widely")
  1776. (li "Almost all distributed systems can be viewed in terms of actor model")
  1777. (li "Replaced by vanilla lambdas & generic methods? "
  1778. "Maybe not if address space not shared!"))))))
  1779. (define gift-shop
  1780. (lol
  1781. ('gift-shop
  1782. <room> #f
  1783. #:name "Museum Gift Shop"
  1784. #:desc '("There are all sorts of scrolls and knicknacks laying around here, "
  1785. "but they all seem glued in place and instead of a person manning the shop "
  1786. "there's merely a cardboard cutout of a person with a \"shopkeeper\" nametag. "
  1787. "You can pretty well bet that someone wanted to finish this room but ran out of "
  1788. "time.")
  1789. #:exits (list
  1790. (make <exit>
  1791. #:name "northeast"
  1792. #:to 'underground-lab
  1793. #:traverse-check
  1794. (lambda (exit room whos-exiting)
  1795. (values #t '("The revolving door spins as you walk through it. Whee!"))))
  1796. (make <exit>
  1797. #:name "north"
  1798. #:to 'async-museum)))))
  1799. ;;; Hive entrance
  1800. (define actor-descriptions
  1801. '("This one is fused to the side of the hive. It isn't receiving any
  1802. messages, and it seems to be in hibernation."
  1803. "A chat program glows in front of this actor's face. They seem to
  1804. be responding to chat messages and forwarding them to some other actors,
  1805. and forwarding messages from other actors back to the chat."
  1806. "This actor is bossing around other actors, delegating tasks to them
  1807. as it receives requests, and providing reports on the worker actors'
  1808. progress."
  1809. "This actor is trying to write to some device, but the device keeps
  1810. alternating between saying \"BUSY\" or \"READY\". Whenever it says
  1811. \"BUSY\" the actor falls asleep, and whenever it says \"READY\" it
  1812. seems to wake up again and starts writing to the device."
  1813. "Whoa, this actor is totally wigging out! It seems to be throwing
  1814. some errors. It probably has some important work it should be doing
  1815. but you're relieved to see that it isn't grinding the rest of the Hive
  1816. to a halt."))
  1817. (define hive-entrance
  1818. (lol
  1819. ('hive-entrance
  1820. <room> #f
  1821. #:name "Entrance to the 8sync Hive"
  1822. #:desc
  1823. '((p "Towering before you is the great dome-like 8sync Hive, or at least
  1824. one of them. You've heard about this... the Hive is itself the actor that all
  1825. the other actors attach themselves to. It's shaped like a spherical half-dome.
  1826. There are some actors milling about, and some seem fused to the side of the
  1827. hive itself, but all of them have an umbellical cord attached to the hive from
  1828. which you see flashes of light comunicating what must be some sort of messaging
  1829. protocol.")
  1830. (p "To the south is a door leading back to the underground lab.
  1831. North leads into the Hive itself."))
  1832. #:exits
  1833. (list (make <exit>
  1834. #:name "south"
  1835. #:to 'underground-lab)
  1836. (make <exit>
  1837. #:name "north"
  1838. #:to 'hive-inside)))
  1839. ('hive-entrance:hive
  1840. <gameobj> 'hive-entrance
  1841. #:name "the Hive"
  1842. #:goes-by '("hive")
  1843. #:desc
  1844. '((p "It's shaped like half a sphere embedded in the ground.
  1845. Supposedly, while all actors are autonomous and control their own state,
  1846. they communicate through the hive itself, which is a sort of meta-actor.
  1847. There are rumors that actors can speak to each other even across totally
  1848. different hives. Could that possibly be true?")))
  1849. ('hive-entrance:actor
  1850. <chatty-npc> 'hive-entrance
  1851. #:name "some actors"
  1852. #:goes-by '("actor" "actors" "some actors")
  1853. #:chat-format (lambda (npc catchphrase)
  1854. `((p "You pick one actor out of the mix and chat with it. ")
  1855. (p "It says: \"" ,catchphrase "\"")))
  1856. #:desc
  1857. (lambda _
  1858. `((p "There are many actors, but your eyes focus on one in particular.")
  1859. (p ,(random-choice actor-descriptions))))
  1860. #:catchphrases
  1861. '("Yeah we go through a lot of sleep/awake cycles around here.
  1862. If you aren't busy processing a message, what's the point of burning
  1863. valuable resources?"
  1864. "I know I look like I'm some part of dreary collective, but
  1865. really we have a lot of independence. It's a shared nothing environment,
  1866. after all. (Well, except for CPU cycles, and memory, and...)"
  1867. "Shh! I've got another message coming in and I've GOT to
  1868. handle it!"
  1869. "I just want to go to 8sleep already."
  1870. "What a lousy scheduler we're using! I hope someone upgrades
  1871. that thing soon."))))
  1872. ;;; Inside the hive
  1873. (define-actor <meta-message> (<readable>)
  1874. ((cmd-read meta-message-read)))
  1875. (define (meta-message-read gameobj message . _)
  1876. (define meta-message-text
  1877. (with-output-to-string
  1878. (lambda ()
  1879. (pprint-message message))))
  1880. (<- (message-from message) 'tell
  1881. #:text `((p (i "Through a bizarre error in spacetime, the message "
  1882. "prints itself out:"))
  1883. (p (pre ,meta-message-text)))))
  1884. ;;; Inside the Hive
  1885. (define hive-inside
  1886. (lol
  1887. ('hive-inside
  1888. <room> #f
  1889. #:name "Inside the 8sync Hive"
  1890. #:desc
  1891. '((p "You're inside the 8sync Hive. Wow, from in here it's obvious just how "
  1892. (i "goopy") " everything is. Is that sanitary?")
  1893. (p "In the center of the room is a large, tentacled monster who is sorting,
  1894. consuming, and routing messages. It is sitting in a wrap-around desk labeled
  1895. \"Hive Actor: The Real Thing (TM)\".")
  1896. (p "There's a stray message floating just above the ground, stuck outside of
  1897. time.")
  1898. (p "A door to the south exits from the Hive."))
  1899. #:exits
  1900. (list (make <exit>
  1901. #:name "south"
  1902. #:to 'hive-entrance)))
  1903. ;; hive actor
  1904. ;; TODO: Occasionally "fret" some noises, similar to the Clerk.
  1905. ('hive-inside:hive-actor
  1906. <chatty-npc> 'hive-inside
  1907. #:name "the Hive Actor"
  1908. #:desc
  1909. '((p "It's a giant tentacled monster, somehow integrated with the core of
  1910. this building. A chute is dropping messages into a bin on its desk which the
  1911. Hive Actor is checking the \"to\" line of, then ingesting. Whenever the Hive
  1912. Actor injests a messsage a pulse of light flows along a tentacle which leaves
  1913. the room... presumably connecting to one of those actors milling about.")
  1914. (p "Amusingly, the Hive has an \"umbellical cord\" type tentacle too, but
  1915. it seems to simply attach to itself.")
  1916. (p "You get the sense that the Hive Actor, despite being at the
  1917. center of everything, is kind of lonely and would love to chat if you
  1918. could spare a moment."))
  1919. #:goes-by '("hive" "hive actor")
  1920. #:chat-format (lambda (npc catchphrase)
  1921. `("The tentacle monster bellows, \"" ,catchphrase "\""))
  1922. #:catchphrases
  1923. '("It's not MY fault everything's so GOOPY around here. Blame the
  1924. PROPRIETOR."
  1925. "CAN'T you SEE that I'm BUSY??? SO MANY MESSAGES TO SHUFFLE.
  1926. No wait... DON'T GO! I don't get many VISITORS."
  1927. "I hear the FIBERS system has a nice WORK STEALING system, but the
  1928. PROPRIETOR is not convinced that our DESIGN won't CORRUPT ACTOR STATE.
  1929. That and the ACTORS threatened to STRIKE when it CAME UP LAST."
  1930. "WHO WATCHES THE ACTORS? I watch them, and I empower them.
  1931. BUT WHO WATCHES OR EMPOWERS ME??? Well, that'd be the scheduler."
  1932. "The scheduler is NO GOOD! The proprietory said he'd FIX IT,
  1933. but the LAST TIME I ASKED how things were GOING, he said he DIDN'T HAVE
  1934. TIME. If you DON'T HAVE TIME to fix the THING THAT POWERS THE TIME,
  1935. something is TERRIBLY WRONG."
  1936. "There's ANOTHER HIVE somewhere out there. I HAVEN'T SEEN IT
  1937. personally, because I CAN'T MOVE, but we have an AMBASSADOR which forwards
  1938. MESSAGES to the OTHER HIVE."))
  1939. ;; chute
  1940. ('hive-inside:chute
  1941. <gameobj> 'hive-inside
  1942. #:name "a chute"
  1943. #:goes-by '("chute")
  1944. #:desc "Messages are being dropped onto the desk via this chute."
  1945. #:invisible? #t)
  1946. ;; meta-message
  1947. ('hive-inside:meta-message
  1948. <meta-message> 'hive-inside
  1949. #:name "a stray message"
  1950. #:goes-by '("meta message" "meta-message" "metamessage" "message" "stray message")
  1951. #:desc '((p "Something strange has happened to the fabric and space and time
  1952. around this message. It is floating right above the floor. It's clearly
  1953. rubbage that hadn't been delivered, but for whatever reason it was never
  1954. garbage collected, perhaps because it's impossible to do.")
  1955. (p "You get the sense that if you tried to read the message
  1956. that you would somehow read the message of the message that instructed to
  1957. read the message itself, which would be both confusing and intriguing.")))
  1958. ;; desk
  1959. ('hive-inside:desk
  1960. <floor-panel> 'hive-inside
  1961. #:name "the Hive Actor's desk"
  1962. #:desc "The desk surrounds the Hive Actor on all sides, and honestly, it's a little
  1963. bit hard to tell when the desk ends and the Hive Actor begins."
  1964. #:invisible? #t
  1965. #:goes-by '("Hive Actor's desk" "hive desk" "desk"))))
  1966. ;;; Federation Station
  1967. (define federation-station
  1968. (lol
  1969. ('federation-station
  1970. <room> #f
  1971. #:name "Federation Station"
  1972. #:desc
  1973. '((p "This room has an unusual structure. It's almost as if a starscape
  1974. covered the walls and ceiling, but upon closer inspection you realize that
  1975. these are all brightly glowing nodes with lines drawn between them. They
  1976. seem decentralized, and yet seem to be sharing information as if all one
  1977. network.")
  1978. ;; @@: Maybe add the cork message board here?
  1979. (p "To the west is a door leading back to the underground laboratory."))
  1980. #:exits
  1981. (list (make <exit>
  1982. #:name "west"
  1983. #:to 'underground-lab)))
  1984. ;; nodes
  1985. ('federation-station:nodes
  1986. <floor-panel> 'federation-station
  1987. #:name "some nodes"
  1988. #:desc "Each node seems to be producing its own information, but publishing
  1989. updates to subscribing nodes on the graph. You see various posts of notes, videos,
  1990. comments, and so on flowing from node to node."
  1991. #:invisible? #t
  1992. #:goes-by '("nodes" "node" "some nodes"))
  1993. ;; network
  1994. ;; activitypub poster
  1995. ('federation-station:activitypub-poster
  1996. <readable-desc> 'federation-station
  1997. #:name "an ActivityPub poster"
  1998. #:goes-by '("activitypub poster" "activitypub" "poster")
  1999. #:desc
  2000. '((p (a "https://www.w3.org/TR/activitypub/"
  2001. "ActivityPub")
  2002. " is a federation standard being developed under the "
  2003. (a "https://www.w3.org/wiki/Socialwg/"
  2004. "w3C Social Working Group")
  2005. ", and doubles as a general client-to-server API. "
  2006. "It follows a few simple core ideas:")
  2007. (ul (li "Uses "
  2008. (a "https://www.w3.org/TR/activitystreams-core/"
  2009. "ActivityStreams")
  2010. " for its serialization format: easy to read, e json(-ld) syntax "
  2011. "with an extensible vocabulary covering the majority of "
  2012. "social networking interations.")
  2013. (li "Email-like addressing: list of recipients as "
  2014. (b "to") ", " (b "cc") ", " (b "bcc") " fields.")
  2015. (li "Every user has URLs for their outbox and inbox:"
  2016. (ul (li (b "inbox: ")
  2017. "Servers POST messages to addressed recipients' inboxes "
  2018. "to federate out content. "
  2019. "Also doubles as endpoint for a client to read most "
  2020. "recently received messages via GET.")
  2021. (li (b "outbox: ")
  2022. "Clients can POST to user's outbox to send a message to others. "
  2023. "(Similar to sending an email via your MTA.) "
  2024. "Doubles as endpoint others can read from to the "
  2025. "extent authorized; for example publicly available posts."))
  2026. "All the federation bits happen by servers posting to users' inboxes."))))
  2027. ;; An ActivityStreams message
  2028. ;; conspiracy chart
  2029. ('federation-station:conspiracy-chart
  2030. <readable-desc> 'federation-station
  2031. #:name "a conspiracy chart"
  2032. #:goes-by '("conspiracy chart" "chart")
  2033. #:desc
  2034. '((p (i "\"IT'S ALL RELATED!\"") " shouts the over-exuberant conspiracy "
  2035. "chart. "
  2036. (i "\"ActivityPub? Federation? The actor model? Scheme? Text adventures? "
  2037. "MUDS???? What do these have in common? Merely... EVERYTHING!\""))
  2038. (p "There are circles and lines drawn between all the items in red marker, "
  2039. "with scrawled notes annotating the theoretical relationships. Is the "
  2040. "author of this poster mad, or onto something? Perhaps a bit of both. "
  2041. "There's a lot written here, but here are some of the highlights:")
  2042. (p
  2043. (ul
  2044. (li (b "Scheme") " "
  2045. (a "http://cs.au.dk/~hosc/local/HOSC-11-4-pp399-404.pdf"
  2046. "was originally started ")
  2047. " to explore the " (b "actor model")
  2048. ". (It became more focused around studying the " (b "lambda calculus")
  2049. " very quickly, while also uncovering relationships between the two systems.)")
  2050. ;; Subject Predicate Object
  2051. (li "The " (a "https://www.w3.org/TR/activitypub/"
  2052. (b "ActivityPub"))
  2053. " protocol for " (b "federation")
  2054. " uses the " (b "ActivityStreams") " format for serialization. "
  2055. (b "Text adventures") " and " (b "MUDS")
  2056. " follow a similar structure to break down the commands of players.")
  2057. (li (b "Federation") " and the " (b "actor model") " both are related to "
  2058. "highly concurrent systems and both use message passing to communicate "
  2059. "between nodes.")
  2060. (li "Zork, the first major text adventure, used the " (b "MUDDLE") " "
  2061. "language as the basis for the Zork Interactive Language. MUDDLE "
  2062. "is very " (b "Scheme") "-like and in fact was one of Scheme's predecessors. "
  2063. "And of course singleplayer text adventures like Zork were the "
  2064. "predecessors to MUDs.")
  2065. (li "In the 1990s, before the Web became big, " (b "MUDs")
  2066. " were an active topic of research, and there was strong interest "
  2067. (a "http://www.saraswat.org/desiderata.html"
  2068. "in building decentralized MUDs")
  2069. " similar to what is being "
  2070. "worked on for " (b "federation") ". ")))))
  2071. ;; goblin
  2072. ))
  2073. ;;; Game
  2074. ;;; ----
  2075. (define (game-spec)
  2076. (append lobby grand-hallway smoking-parlor
  2077. playroom break-room computer-room underground-lab
  2078. async-museum gift-shop hive-entrance
  2079. hive-inside federation-station))
  2080. ;; TODO: Provide command line args
  2081. (define (run-game . args)
  2082. (run-demo (game-spec) 'lobby #:repl-server #t))