From 36618a500ce45d6d26998bb0591ec4f80a8f2b7e Mon Sep 17 00:00:00 2001 From: zongor Date: Sun, 31 Dec 2023 16:00:52 -0500 Subject: [PATCH] Add jzon to serialize data --- lisp/client/common-lisp/client.lisp | 10 ++++------ lisp/server/server.lisp | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lisp/client/common-lisp/client.lisp b/lisp/client/common-lisp/client.lisp index 7076050..4fbefe5 100644 --- a/lisp/client/common-lisp/client.lisp +++ b/lisp/client/common-lisp/client.lisp @@ -1,8 +1,8 @@ (load "~/quicklisp/setup.lisp") ; need to load quicklisp -(ql:quickload '(:cl-raylib :cl-bcrypt :usocket :bordeaux-threads :alexandria)) +(ql:quickload '(:cl-raylib :cl-bcrypt :usocket :bordeaux-threads :alexandria :com.inuoe.jzon)) (defpackage :mmo-client - (:use :common-lisp :cl-raylib :3d-vectors :usocket :bordeaux-threads :alexandria)) + (:use :common-lisp :cl-raylib :3d-vectors :usocket :bordeaux-threads :alexandria :com.inuoe.jzon)) (in-package :mmo-client) @@ -25,7 +25,7 @@ (unwind-protect (progn (loop - (format stream "~a~%" (get-value 'pos)) + (format stream "~a~%" (com.inuoe.jzon:stringify (get-value 'pos))) (force-output stream) (usocket:wait-for-input socket) (format t "from server: ~a~%" (read-line stream))))) @@ -43,8 +43,6 @@ :projection :camera-perspective)) (cube-screen-pos (vec 0.0 0.0))) - (add-entry 'pos (camera3d-target camera)) - (with-window (screen-width screen-height title) (disable-cursor) (set-target-fps 60) ; Set our game to run at 60 FPS @@ -52,7 +50,7 @@ until (window-should-close) ; detect window close button or ESC key do (update-camera camera :camera-third-person) - (add-entry 'pos (camera3d-target camera)) + (add-entry 'pos (list (camera3d-target camera) username :red :move)) (setf cube-screen-pos (get-world-to-screen (v+ (camera3d-target camera) (vec 0 1.0 0)) camera)) (with-drawing (clear-background :raywhite) diff --git a/lisp/server/server.lisp b/lisp/server/server.lisp index bd0b48f..7f5bfec 100644 --- a/lisp/server/server.lisp +++ b/lisp/server/server.lisp @@ -1,8 +1,8 @@ (load "~/quicklisp/setup.lisp") -(ql:quickload '(:usocket :bordeaux-threads :cl-bcrypt :datafly :sxql :alexandria)) +(ql:quickload '(:usocket :bordeaux-threads :cl-bcrypt :datafly :sxql :alexandria :com.inuoe.jzon)) (defpackage :mmo-server - (:use :common-lisp :usocket :bordeaux-threads :cl-bcrypt :datafly :sxql :alexandria)) + (:use :common-lisp :usocket :bordeaux-threads :cl-bcrypt :datafly :sxql :alexandria :com.inuoe.jzon)) (in-package :mmo-server)