diff --git a/atlantis.txt b/atlantis.txt index df8813a..118ef5a 100644 --- a/atlantis.txt +++ b/atlantis.txt @@ -31,6 +31,8 @@ too difficult. The threading is probably more of a challenge. (If it's necessary, that is?) -> actually, clisp does support networking via sockets. Yeah! :-) + (But that means I would have to change the Atlantis license to + GPL. I should have a look at the cl-iolib...) Implementation: presumably Atlantis will have to have a server-client model. @@ -40,12 +42,13 @@ with string representations of objects in Lisp. (Just pass the *world* object to the client, for instance.) -> SECURITY RISK! + -> I would like to implement this in a way that keeps the + entire game logic on the server. The only thing the client + should do is take input from the user and send it to the + server. -> For the sake of better code separation, it would probably be wise to create two Lisp packages (server and client). -Combat system: Here I have to think of something clever... The OpenWorld method - would be an option, but I'm not too keen on it. - PLAN OF ACTION - TODO @@ -58,3 +61,7 @@ Game features: Currently (v0.1), creating the world using ATL works, and the player can move around. Now I need to add game items, NPCs, monsters, a combat system, etc. + +Targets: I am almost at v0.2. After that, I should start building a real game + world to mature the game on. Also, I should keep thinking about how + to implement the networking. By v0.4 I hope to have that up and running. diff --git a/atlantis.txt b/atlantis.txt index df8813a..118ef5a 100644 --- a/atlantis.txt +++ b/atlantis.txt @@ -31,6 +31,8 @@ too difficult. The threading is probably more of a challenge. (If it's necessary, that is?) -> actually, clisp does support networking via sockets. Yeah! :-) + (But that means I would have to change the Atlantis license to + GPL. I should have a look at the cl-iolib...) Implementation: presumably Atlantis will have to have a server-client model. @@ -40,12 +42,13 @@ with string representations of objects in Lisp. (Just pass the *world* object to the client, for instance.) -> SECURITY RISK! + -> I would like to implement this in a way that keeps the + entire game logic on the server. The only thing the client + should do is take input from the user and send it to the + server. -> For the sake of better code separation, it would probably be wise to create two Lisp packages (server and client). -Combat system: Here I have to think of something clever... The OpenWorld method - would be an option, but I'm not too keen on it. - PLAN OF ACTION - TODO @@ -58,3 +61,7 @@ Game features: Currently (v0.1), creating the world using ATL works, and the player can move around. Now I need to add game items, NPCs, monsters, a combat system, etc. + +Targets: I am almost at v0.2. After that, I should start building a real game + world to mature the game on. Also, I should keep thinking about how + to implement the networking. By v0.4 I hope to have that up and running. diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 585cc9b..8e2091a 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -96,3 +96,15 @@ (defun list-place-objects (object-type place) "Get a list of the names of all the place's objects of this type." (funcall list-function object-type place))) + +(defun get-object-description (object-name place) + "Get a description of this object in place (or nil if not there)" + (let ((p (if (place-p place) place (get-game-object 'place place)))) + (cond ((member object-name (list-place-objects 'item p) :test #'equalp) + (item-description (get-game-object 'item object-name))) + ((member object-name (list-place-objects 'monster p) :test #'equalp) + (monster-description (get-game-object 'monster object-name))) + ((member object-name (list-place-objects 'npc p) :test #'equalp) + (npc-description (get-game-object 'npc object-name))) + (t NIL)))) + diff --git a/atlantis.txt b/atlantis.txt index df8813a..118ef5a 100644 --- a/atlantis.txt +++ b/atlantis.txt @@ -31,6 +31,8 @@ too difficult. The threading is probably more of a challenge. (If it's necessary, that is?) -> actually, clisp does support networking via sockets. Yeah! :-) + (But that means I would have to change the Atlantis license to + GPL. I should have a look at the cl-iolib...) Implementation: presumably Atlantis will have to have a server-client model. @@ -40,12 +42,13 @@ with string representations of objects in Lisp. (Just pass the *world* object to the client, for instance.) -> SECURITY RISK! + -> I would like to implement this in a way that keeps the + entire game logic on the server. The only thing the client + should do is take input from the user and send it to the + server. -> For the sake of better code separation, it would probably be wise to create two Lisp packages (server and client). -Combat system: Here I have to think of something clever... The OpenWorld method - would be an option, but I'm not too keen on it. - PLAN OF ACTION - TODO @@ -58,3 +61,7 @@ Game features: Currently (v0.1), creating the world using ATL works, and the player can move around. Now I need to add game items, NPCs, monsters, a combat system, etc. + +Targets: I am almost at v0.2. After that, I should start building a real game + world to mature the game on. Also, I should keep thinking about how + to implement the networking. By v0.4 I hope to have that up and running. diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 585cc9b..8e2091a 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -96,3 +96,15 @@ (defun list-place-objects (object-type place) "Get a list of the names of all the place's objects of this type." (funcall list-function object-type place))) + +(defun get-object-description (object-name place) + "Get a description of this object in place (or nil if not there)" + (let ((p (if (place-p place) place (get-game-object 'place place)))) + (cond ((member object-name (list-place-objects 'item p) :test #'equalp) + (item-description (get-game-object 'item object-name))) + ((member object-name (list-place-objects 'monster p) :test #'equalp) + (monster-description (get-game-object 'monster object-name))) + ((member object-name (list-place-objects 'npc p) :test #'equalp) + (npc-description (get-game-object 'npc object-name))) + (t NIL)))) + diff --git a/lisp/ui.lisp b/lisp/ui.lisp index fb7c677..4f16ea6 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -217,21 +217,12 @@ ;; A bit of syntactic sugar... (cond ((equalp object-name "me") (player player) (return-from about)) ((equalp object-name "here") (place player) (return-from about))) - ;; FIXME What about objects that the player is carrying? - ;; TODO Outsource this to game-objects.lisp (or player.lisp) - (let ((place (get-game-object 'place (player-place player))) - (description NIL)) - (macrolet ((set-descr (type) - (let ((place-descr (build-symbol type "-description"))) - `(when (member object-name - (list-place-objects ',type place) - :test #'equalp) - (setf description (,place-descr - (get-game-object ',type - object-name))))))) - (set-descr item) - (set-descr monster) - (set-descr npc)) + (let ((description (get-object-description object-name + (player-place player)))) + ;; Don't forget items the player is carrying + (when (member object-name (player-item player) :test #'equalp) + (setf description + (item-description (get-game-object 'item object-name)))) (if description (format t "~&(~A) ~A" object-name description) (format t "~&Could not find ~A!" object-name)))) diff --git a/atlantis.txt b/atlantis.txt index df8813a..118ef5a 100644 --- a/atlantis.txt +++ b/atlantis.txt @@ -31,6 +31,8 @@ too difficult. The threading is probably more of a challenge. (If it's necessary, that is?) -> actually, clisp does support networking via sockets. Yeah! :-) + (But that means I would have to change the Atlantis license to + GPL. I should have a look at the cl-iolib...) Implementation: presumably Atlantis will have to have a server-client model. @@ -40,12 +42,13 @@ with string representations of objects in Lisp. (Just pass the *world* object to the client, for instance.) -> SECURITY RISK! + -> I would like to implement this in a way that keeps the + entire game logic on the server. The only thing the client + should do is take input from the user and send it to the + server. -> For the sake of better code separation, it would probably be wise to create two Lisp packages (server and client). -Combat system: Here I have to think of something clever... The OpenWorld method - would be an option, but I'm not too keen on it. - PLAN OF ACTION - TODO @@ -58,3 +61,7 @@ Game features: Currently (v0.1), creating the world using ATL works, and the player can move around. Now I need to add game items, NPCs, monsters, a combat system, etc. + +Targets: I am almost at v0.2. After that, I should start building a real game + world to mature the game on. Also, I should keep thinking about how + to implement the networking. By v0.4 I hope to have that up and running. diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index 585cc9b..8e2091a 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -96,3 +96,15 @@ (defun list-place-objects (object-type place) "Get a list of the names of all the place's objects of this type." (funcall list-function object-type place))) + +(defun get-object-description (object-name place) + "Get a description of this object in place (or nil if not there)" + (let ((p (if (place-p place) place (get-game-object 'place place)))) + (cond ((member object-name (list-place-objects 'item p) :test #'equalp) + (item-description (get-game-object 'item object-name))) + ((member object-name (list-place-objects 'monster p) :test #'equalp) + (monster-description (get-game-object 'monster object-name))) + ((member object-name (list-place-objects 'npc p) :test #'equalp) + (npc-description (get-game-object 'npc object-name))) + (t NIL)))) + diff --git a/lisp/ui.lisp b/lisp/ui.lisp index fb7c677..4f16ea6 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -217,21 +217,12 @@ ;; A bit of syntactic sugar... (cond ((equalp object-name "me") (player player) (return-from about)) ((equalp object-name "here") (place player) (return-from about))) - ;; FIXME What about objects that the player is carrying? - ;; TODO Outsource this to game-objects.lisp (or player.lisp) - (let ((place (get-game-object 'place (player-place player))) - (description NIL)) - (macrolet ((set-descr (type) - (let ((place-descr (build-symbol type "-description"))) - `(when (member object-name - (list-place-objects ',type place) - :test #'equalp) - (setf description (,place-descr - (get-game-object ',type - object-name))))))) - (set-descr item) - (set-descr monster) - (set-descr npc)) + (let ((description (get-object-description object-name + (player-place player)))) + ;; Don't forget items the player is carrying + (when (member object-name (player-item player) :test #'equalp) + (setf description + (item-description (get-game-object 'item object-name)))) (if description (format t "~&(~A) ~A" object-name description) (format t "~&Could not find ~A!" object-name)))) diff --git a/lisp/util.lisp b/lisp/util.lisp index db3765c..b47dc68 100644 --- a/lisp/util.lisp +++ b/lisp/util.lisp @@ -257,7 +257,7 @@ (format t "~&~S" (eval expr))) (simple-input expr "lisp >")))) -;; FIXME Interesting phenomenon of repl (security bug?): +;; XXX Interesting phenomenon of repl (security bug?): ;; Enter two Lisp expressions that have not had a value assigned to them in the ;; current session (e.g. 'foo ls'). The first will cause the interpreter to ;; exit with an error. The second, however, is still printed to stdout (which is