Figuring out how my moonclimb worked


1. Moonclimb's README.org gives the example (abridged here):

(in-package :moonclimb/user)
(push (verb-plist :verb 'com-sneeze :dobj 'screwtape)
      (get 'screwtape :queue))
(make-kernel (make-clock))
(funcall * :push-now 'screwtape)
(funcall **)
"you sneeze" 

2. well, it worked admirably for my jamtest:

(uiop:Define-package :lispmoo2/main
    (:mix :moonclimb/all :clim :clim-lisp :cl)
  (:export))
(in-package :moonclimb/user)
(push (verb-plist :verb 'com-sneeze :dobj 'screwtape)
      (get 'screwtape :queue))
(make-kernel (make-clock))
(funcall * :push-now 'screwtape)
(funcall **)
"you sneeze" 

3. but tbh how did this work

So it turns out that the game clock has :push-now and :push-later which registers a symbol's :queue (of commands) to either happen immediately next or on the next clock tick.

4. But what about sneezing?

On inspection, screwtape is a $player

LISPMOO2/MAIN> (symbol-plist 'screwtape)
(:OWNER SCREWTAPE :PARENTS ($PLAYER $OBJECT) :QUEUE NIL)

and $player-commands has

LISPMOO2/MAIN> (symbol-plist '$player-commands)
(:COMMANDS ((COM-SNEEZE (PRINT "you sneeze"))) :PARENTS ($PLAYER))

5. This COM-SNEEZE is pretty straightforward!

So rather than attempt to implement a new engine, I'm just going to use this :commands thing basically for everything to implement the following plan

  1. (Start-game 'screwtapes-jam) 

    There is a road leading north into a forest.You are in a place of new beginnings. You should type 'connect my-name' and then head north.

  2. connect playername 
    1. playername connected
  3. north 
    1. You follow the road north and enter the forest. There is a road leading south and a trail leading west. You see distressed-princess here.

    1. Distressed-princess says, "I lost my gold-ring at a picnic in the clearing to the west! If you find it, please give it to me."
  4. west 
    1. You follow the trail until it reaches a clearing. There is a picnic-table here. In the setting sun, a metallic glint catches your attention on the ground beneath picnic-table. There is a trail to the east.
  5. look ground under picnic-table 
    1. You see a gold-ring.
  6. take gold-ring under picnic-table 
    1. You take the gold-ring.
  7. east 
    1. You follow the trail and enter the forest. There is a road leading south and a trail leading west. You see distressed-princess here.

    1. Distressed-princess says, "Hello again! Did you find my gold-ring?
  8. give gold-ring to distressed-princess 
    1. You give the gold-ring to distressed-princess

    1. Distressed-princess morphs into relieved-princess

    1. Relieved-princess says, "Thank-you so much! My hero!"

    1. Relieved-princess says, "This concludes my own jam, but feel free to screw around in your repl while here."

6. That will conclude my autumn-lisp-game-jam

In particular, I'm going to do all of this by specifying new commands. So I am not going to try and make engine changes such as having a special class of commands related to movement, everything is going to be explicit, like sneeze above.

7. LambdaMOO

Searching for a princess's lost ring is a reference to the lambda RPG first quest people encounter when you come across a room with an N64 in it and reality subtely shifts into one with a princess and lost ring. Go check out the east wing guest bedroom in

telnet lambda.moo.mud.org 8888

to have the authentic lambda rpg princess ring finding experience. 'help rpg' is also interesting.

Come hang out at the live show every Wednesday 0UTC and talk about lispgamejam, lambda, lisp and sm0lnet, or asyncronously chatter on the mastodon, though chattering in lambda via *chatter would be even better tbh.

Author: screwlisp

Created: 2024-11-02 Sat 14:22

Validate

Get lispmoo2

Leave a comment

Log in with itch.io to leave a comment.