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