diff --git a/atlantis.txt b/atlantis.txt index bd3c80a..e0de6dd 100644 --- a/atlantis.txt +++ b/atlantis.txt @@ -23,11 +23,35 @@ Networking: does Common Lisp support networking? threading? If not the latter, how can a real-time networked multiplayer game be implemented? + -> CLisp supports neither :-( However, it should be + possible to write a simple server-client model in C and then + integrate it with the CL code. A lot of the networking is + probably passing simple strings around, so that shouldn't be + too difficult. The threading is probably more of a challenge. + (If it's necessary, that is?) + Implementation: presumably Atlantis will have to have a server-client model. How do the two communicate? Are there alternative implementation models? + -> As stated above, this should be fairly easy to solve + with string representations of objects in Lisp. (Just pass + the *world* object to the client, for instance.) + -> For the sake of better code separation, it would probably + be wise to create two Lisp packages (server and client). -Language: how complex should the inbuilt language be? Is it a purely descriptive - language similar to XML/INI files? Should it be possible to script - actions with it? Must it be Turing complete? +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 + +Networking: as described above. I would tend to leave this for quite late, the + only problem might be that at a later stage, it would take a lot of + refactoring/rewriting to adjust the game to deal with networking. + Perhaps I can build a mockup of a server-client situation now, and + do the actual implementation later. + +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. diff --git a/atlantis.txt b/atlantis.txt index bd3c80a..e0de6dd 100644 --- a/atlantis.txt +++ b/atlantis.txt @@ -23,11 +23,35 @@ Networking: does Common Lisp support networking? threading? If not the latter, how can a real-time networked multiplayer game be implemented? + -> CLisp supports neither :-( However, it should be + possible to write a simple server-client model in C and then + integrate it with the CL code. A lot of the networking is + probably passing simple strings around, so that shouldn't be + too difficult. The threading is probably more of a challenge. + (If it's necessary, that is?) + Implementation: presumably Atlantis will have to have a server-client model. How do the two communicate? Are there alternative implementation models? + -> As stated above, this should be fairly easy to solve + with string representations of objects in Lisp. (Just pass + the *world* object to the client, for instance.) + -> For the sake of better code separation, it would probably + be wise to create two Lisp packages (server and client). -Language: how complex should the inbuilt language be? Is it a purely descriptive - language similar to XML/INI files? Should it be possible to script - actions with it? Must it be Turing complete? +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 + +Networking: as described above. I would tend to leave this for quite late, the + only problem might be that at a later stage, it would take a lot of + refactoring/rewriting to adjust the game to deal with networking. + Perhaps I can build a mockup of a server-client situation now, and + do the actual implementation later. + +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. diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 840d51d..d437250 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -10,6 +10,9 @@ (defconstant ATLANTIS-VERSION '(0 1 0)) (load 'util.lisp) +(load 'game-objects.lisp) +(load 'player.lisp) +(load 'world.lisp) (load 'interpreter.lisp) (load 'client.lisp) diff --git a/atlantis.txt b/atlantis.txt index bd3c80a..e0de6dd 100644 --- a/atlantis.txt +++ b/atlantis.txt @@ -23,11 +23,35 @@ Networking: does Common Lisp support networking? threading? If not the latter, how can a real-time networked multiplayer game be implemented? + -> CLisp supports neither :-( However, it should be + possible to write a simple server-client model in C and then + integrate it with the CL code. A lot of the networking is + probably passing simple strings around, so that shouldn't be + too difficult. The threading is probably more of a challenge. + (If it's necessary, that is?) + Implementation: presumably Atlantis will have to have a server-client model. How do the two communicate? Are there alternative implementation models? + -> As stated above, this should be fairly easy to solve + with string representations of objects in Lisp. (Just pass + the *world* object to the client, for instance.) + -> For the sake of better code separation, it would probably + be wise to create two Lisp packages (server and client). -Language: how complex should the inbuilt language be? Is it a purely descriptive - language similar to XML/INI files? Should it be possible to script - actions with it? Must it be Turing complete? +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 + +Networking: as described above. I would tend to leave this for quite late, the + only problem might be that at a later stage, it would take a lot of + refactoring/rewriting to adjust the game to deal with networking. + Perhaps I can build a mockup of a server-client situation now, and + do the actual implementation later. + +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. diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 840d51d..d437250 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -10,6 +10,9 @@ (defconstant ATLANTIS-VERSION '(0 1 0)) (load 'util.lisp) +(load 'game-objects.lisp) +(load 'player.lisp) +(load 'world.lisp) (load 'interpreter.lisp) (load 'client.lisp) diff --git a/lisp/client.lisp b/lisp/client.lisp index 9288591..f952c34 100644 --- a/lisp/client.lisp +++ b/lisp/client.lisp @@ -19,6 +19,8 @@ (setf player (get-game-object 'player player-name))) (when (null player) (setf player (create-player player-name)) + (when (null (list-objects 'player)) + (setf (world-game-manager *world*) (player-name player))) (add-game-object player) (set-object-attribute (get-game-object 'place (player-place player)) 'player (player-name player))) @@ -118,9 +120,9 @@ (defvar *commands* '(help place player goto)) -;;; The following commands consist of only one word and take only one argument +;;; The following commands don't take any arguments except for a player -(defun help (&optional player) +(defun help (player) "Print out a list of in-game commands" ;; TODO Prettify the typesetting (instead of using tabs) (let ((tab (string #\tab))) @@ -129,10 +131,13 @@ (format t "~&quit/exit~A-~AExit the game" tab tab) (format t "~&place~A-~ADescribe the current location" tab tab) (format t "~&player~A-~ADescribe your player" tab tab) - (format t "~&goto ~A-~AGo to a neighbouring location" tab tab))) + (format t "~&goto ~A-~AGo to a neighbouring location" tab tab) + (when (equalp (player-name player) (world-game-manager *world*)) + (format t "~&load ~A-~ALoad a saved game" tab tab) + (format t "~&save ~A-~ASave the game to file" tab tab)))) -;; XXX Will the following two functions give problems? -;; (Their name is identical with the struct name) +;; XXX Will the following two functions give problems? (Their name is +;; identical with the struct name) Probably not, but best to be aware. (defun place (player) "Describe the player's current location" (describe-place (player-place player))) diff --git a/atlantis.txt b/atlantis.txt index bd3c80a..e0de6dd 100644 --- a/atlantis.txt +++ b/atlantis.txt @@ -23,11 +23,35 @@ Networking: does Common Lisp support networking? threading? If not the latter, how can a real-time networked multiplayer game be implemented? + -> CLisp supports neither :-( However, it should be + possible to write a simple server-client model in C and then + integrate it with the CL code. A lot of the networking is + probably passing simple strings around, so that shouldn't be + too difficult. The threading is probably more of a challenge. + (If it's necessary, that is?) + Implementation: presumably Atlantis will have to have a server-client model. How do the two communicate? Are there alternative implementation models? + -> As stated above, this should be fairly easy to solve + with string representations of objects in Lisp. (Just pass + the *world* object to the client, for instance.) + -> For the sake of better code separation, it would probably + be wise to create two Lisp packages (server and client). -Language: how complex should the inbuilt language be? Is it a purely descriptive - language similar to XML/INI files? Should it be possible to script - actions with it? Must it be Turing complete? +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 + +Networking: as described above. I would tend to leave this for quite late, the + only problem might be that at a later stage, it would take a lot of + refactoring/rewriting to adjust the game to deal with networking. + Perhaps I can build a mockup of a server-client situation now, and + do the actual implementation later. + +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. diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 840d51d..d437250 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -10,6 +10,9 @@ (defconstant ATLANTIS-VERSION '(0 1 0)) (load 'util.lisp) +(load 'game-objects.lisp) +(load 'player.lisp) +(load 'world.lisp) (load 'interpreter.lisp) (load 'client.lisp) diff --git a/lisp/client.lisp b/lisp/client.lisp index 9288591..f952c34 100644 --- a/lisp/client.lisp +++ b/lisp/client.lisp @@ -19,6 +19,8 @@ (setf player (get-game-object 'player player-name))) (when (null player) (setf player (create-player player-name)) + (when (null (list-objects 'player)) + (setf (world-game-manager *world*) (player-name player))) (add-game-object player) (set-object-attribute (get-game-object 'place (player-place player)) 'player (player-name player))) @@ -118,9 +120,9 @@ (defvar *commands* '(help place player goto)) -;;; The following commands consist of only one word and take only one argument +;;; The following commands don't take any arguments except for a player -(defun help (&optional player) +(defun help (player) "Print out a list of in-game commands" ;; TODO Prettify the typesetting (instead of using tabs) (let ((tab (string #\tab))) @@ -129,10 +131,13 @@ (format t "~&quit/exit~A-~AExit the game" tab tab) (format t "~&place~A-~ADescribe the current location" tab tab) (format t "~&player~A-~ADescribe your player" tab tab) - (format t "~&goto ~A-~AGo to a neighbouring location" tab tab))) + (format t "~&goto ~A-~AGo to a neighbouring location" tab tab) + (when (equalp (player-name player) (world-game-manager *world*)) + (format t "~&load ~A-~ALoad a saved game" tab tab) + (format t "~&save ~A-~ASave the game to file" tab tab)))) -;; XXX Will the following two functions give problems? -;; (Their name is identical with the struct name) +;; XXX Will the following two functions give problems? (Their name is +;; identical with the struct name) Probably not, but best to be aware. (defun place (player) "Describe the player's current location" (describe-place (player-place player))) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index 22c1c37..9a9b5a6 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -9,11 +9,6 @@ ;;; date: 09/05/2015 ;;; -(load 'util.lisp) -(load 'game-objects.lisp) -(load 'player.lisp) -(load 'world.lisp) - (defun define-place (name) (format t "~&Making place ~A" name) diff --git a/atlantis.txt b/atlantis.txt index bd3c80a..e0de6dd 100644 --- a/atlantis.txt +++ b/atlantis.txt @@ -23,11 +23,35 @@ Networking: does Common Lisp support networking? threading? If not the latter, how can a real-time networked multiplayer game be implemented? + -> CLisp supports neither :-( However, it should be + possible to write a simple server-client model in C and then + integrate it with the CL code. A lot of the networking is + probably passing simple strings around, so that shouldn't be + too difficult. The threading is probably more of a challenge. + (If it's necessary, that is?) + Implementation: presumably Atlantis will have to have a server-client model. How do the two communicate? Are there alternative implementation models? + -> As stated above, this should be fairly easy to solve + with string representations of objects in Lisp. (Just pass + the *world* object to the client, for instance.) + -> For the sake of better code separation, it would probably + be wise to create two Lisp packages (server and client). -Language: how complex should the inbuilt language be? Is it a purely descriptive - language similar to XML/INI files? Should it be possible to script - actions with it? Must it be Turing complete? +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 + +Networking: as described above. I would tend to leave this for quite late, the + only problem might be that at a later stage, it would take a lot of + refactoring/rewriting to adjust the game to deal with networking. + Perhaps I can build a mockup of a server-client situation now, and + do the actual implementation later. + +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. diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 840d51d..d437250 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -10,6 +10,9 @@ (defconstant ATLANTIS-VERSION '(0 1 0)) (load 'util.lisp) +(load 'game-objects.lisp) +(load 'player.lisp) +(load 'world.lisp) (load 'interpreter.lisp) (load 'client.lisp) diff --git a/lisp/client.lisp b/lisp/client.lisp index 9288591..f952c34 100644 --- a/lisp/client.lisp +++ b/lisp/client.lisp @@ -19,6 +19,8 @@ (setf player (get-game-object 'player player-name))) (when (null player) (setf player (create-player player-name)) + (when (null (list-objects 'player)) + (setf (world-game-manager *world*) (player-name player))) (add-game-object player) (set-object-attribute (get-game-object 'place (player-place player)) 'player (player-name player))) @@ -118,9 +120,9 @@ (defvar *commands* '(help place player goto)) -;;; The following commands consist of only one word and take only one argument +;;; The following commands don't take any arguments except for a player -(defun help (&optional player) +(defun help (player) "Print out a list of in-game commands" ;; TODO Prettify the typesetting (instead of using tabs) (let ((tab (string #\tab))) @@ -129,10 +131,13 @@ (format t "~&quit/exit~A-~AExit the game" tab tab) (format t "~&place~A-~ADescribe the current location" tab tab) (format t "~&player~A-~ADescribe your player" tab tab) - (format t "~&goto ~A-~AGo to a neighbouring location" tab tab))) + (format t "~&goto ~A-~AGo to a neighbouring location" tab tab) + (when (equalp (player-name player) (world-game-manager *world*)) + (format t "~&load ~A-~ALoad a saved game" tab tab) + (format t "~&save ~A-~ASave the game to file" tab tab)))) -;; XXX Will the following two functions give problems? -;; (Their name is identical with the struct name) +;; XXX Will the following two functions give problems? (Their name is +;; identical with the struct name) Probably not, but best to be aware. (defun place (player) "Describe the player's current location" (describe-place (player-place player))) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index 22c1c37..9a9b5a6 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -9,11 +9,6 @@ ;;; date: 09/05/2015 ;;; -(load 'util.lisp) -(load 'game-objects.lisp) -(load 'player.lisp) -(load 'world.lisp) - (defun define-place (name) (format t "~&Making place ~A" name) diff --git a/lisp/networking.lisp b/lisp/networking.lisp new file mode 100644 index 0000000..2e22cbe --- /dev/null +++ b/lisp/networking.lisp @@ -0,0 +1,24 @@ +;;; +;;; Atlantis is a framework for creating multi-user dungeon worlds. +;;; This is the Common Lisp implementation. +;;; +;;; This module provides the necessary Lisp networking functions. The actual +;;; server will be implemented in C at some later stage. +;;; Currently, this file should be treated as a mockup. +;;; +;;; Licensed under the terms of the MIT license. +;;; author: Daniel Vedder +;;; date: 30/05/2015 +;;; + +(defun send-server-request (ip port request) + "Send a request string to the server" + ;; TODO this is a mockup function + (server-process-request request)) + +(defun server-process-request (request) + "The game server processes a request" + ;; XXX Is simply calling (eval) on the request good enough? + ;; Or should I come up with a proper networking protocol? + ;; (Considering a possible Python implementation.) + (eval request)) diff --git a/atlantis.txt b/atlantis.txt index bd3c80a..e0de6dd 100644 --- a/atlantis.txt +++ b/atlantis.txt @@ -23,11 +23,35 @@ Networking: does Common Lisp support networking? threading? If not the latter, how can a real-time networked multiplayer game be implemented? + -> CLisp supports neither :-( However, it should be + possible to write a simple server-client model in C and then + integrate it with the CL code. A lot of the networking is + probably passing simple strings around, so that shouldn't be + too difficult. The threading is probably more of a challenge. + (If it's necessary, that is?) + Implementation: presumably Atlantis will have to have a server-client model. How do the two communicate? Are there alternative implementation models? + -> As stated above, this should be fairly easy to solve + with string representations of objects in Lisp. (Just pass + the *world* object to the client, for instance.) + -> For the sake of better code separation, it would probably + be wise to create two Lisp packages (server and client). -Language: how complex should the inbuilt language be? Is it a purely descriptive - language similar to XML/INI files? Should it be possible to script - actions with it? Must it be Turing complete? +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 + +Networking: as described above. I would tend to leave this for quite late, the + only problem might be that at a later stage, it would take a lot of + refactoring/rewriting to adjust the game to deal with networking. + Perhaps I can build a mockup of a server-client situation now, and + do the actual implementation later. + +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. diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 840d51d..d437250 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -10,6 +10,9 @@ (defconstant ATLANTIS-VERSION '(0 1 0)) (load 'util.lisp) +(load 'game-objects.lisp) +(load 'player.lisp) +(load 'world.lisp) (load 'interpreter.lisp) (load 'client.lisp) diff --git a/lisp/client.lisp b/lisp/client.lisp index 9288591..f952c34 100644 --- a/lisp/client.lisp +++ b/lisp/client.lisp @@ -19,6 +19,8 @@ (setf player (get-game-object 'player player-name))) (when (null player) (setf player (create-player player-name)) + (when (null (list-objects 'player)) + (setf (world-game-manager *world*) (player-name player))) (add-game-object player) (set-object-attribute (get-game-object 'place (player-place player)) 'player (player-name player))) @@ -118,9 +120,9 @@ (defvar *commands* '(help place player goto)) -;;; The following commands consist of only one word and take only one argument +;;; The following commands don't take any arguments except for a player -(defun help (&optional player) +(defun help (player) "Print out a list of in-game commands" ;; TODO Prettify the typesetting (instead of using tabs) (let ((tab (string #\tab))) @@ -129,10 +131,13 @@ (format t "~&quit/exit~A-~AExit the game" tab tab) (format t "~&place~A-~ADescribe the current location" tab tab) (format t "~&player~A-~ADescribe your player" tab tab) - (format t "~&goto ~A-~AGo to a neighbouring location" tab tab))) + (format t "~&goto ~A-~AGo to a neighbouring location" tab tab) + (when (equalp (player-name player) (world-game-manager *world*)) + (format t "~&load ~A-~ALoad a saved game" tab tab) + (format t "~&save ~A-~ASave the game to file" tab tab)))) -;; XXX Will the following two functions give problems? -;; (Their name is identical with the struct name) +;; XXX Will the following two functions give problems? (Their name is +;; identical with the struct name) Probably not, but best to be aware. (defun place (player) "Describe the player's current location" (describe-place (player-place player))) diff --git a/lisp/interpreter.lisp b/lisp/interpreter.lisp index 22c1c37..9a9b5a6 100644 --- a/lisp/interpreter.lisp +++ b/lisp/interpreter.lisp @@ -9,11 +9,6 @@ ;;; date: 09/05/2015 ;;; -(load 'util.lisp) -(load 'game-objects.lisp) -(load 'player.lisp) -(load 'world.lisp) - (defun define-place (name) (format t "~&Making place ~A" name) diff --git a/lisp/networking.lisp b/lisp/networking.lisp new file mode 100644 index 0000000..2e22cbe --- /dev/null +++ b/lisp/networking.lisp @@ -0,0 +1,24 @@ +;;; +;;; Atlantis is a framework for creating multi-user dungeon worlds. +;;; This is the Common Lisp implementation. +;;; +;;; This module provides the necessary Lisp networking functions. The actual +;;; server will be implemented in C at some later stage. +;;; Currently, this file should be treated as a mockup. +;;; +;;; Licensed under the terms of the MIT license. +;;; author: Daniel Vedder +;;; date: 30/05/2015 +;;; + +(defun send-server-request (ip port request) + "Send a request string to the server" + ;; TODO this is a mockup function + (server-process-request request)) + +(defun server-process-request (request) + "The game server processes a request" + ;; XXX Is simply calling (eval) on the request good enough? + ;; Or should I come up with a proper networking protocol? + ;; (Considering a possible Python implementation.) + (eval request)) diff --git a/lisp/world.lisp b/lisp/world.lisp index 0d95ce0..889ef0c 100644 --- a/lisp/world.lisp +++ b/lisp/world.lisp @@ -25,7 +25,8 @@ (monsters NIL) (npcs NIL) (items NIL) - (starting-place "")) + (starting-place "") + (game-manager "")) ;The player in charge of the game (setf *world* (make-world))