From 514fef5b7a31ba1bcf3bfe84b4ff7667fc6ae873 Mon Sep 17 00:00:00 2001 From: zongor Date: Tue, 31 Oct 2023 19:11:35 -0400 Subject: [PATCH] add lisp --- common/sql/test.db3 | Bin 8192 -> 8192 bytes lisp/README.md | 13 +++++++++++ lisp/client/README.md | 0 lisp/client/client.rkt | 50 +++++++++++++++++++++++++++++++++++++++++ lisp/server/README.md | 0 lisp/www/README.md | 0 6 files changed, 63 insertions(+) create mode 100644 lisp/client/README.md create mode 100644 lisp/client/client.rkt create mode 100644 lisp/server/README.md create mode 100644 lisp/www/README.md diff --git a/common/sql/test.db3 b/common/sql/test.db3 index 07210a49fd80335921b54bb71abb8fb98c037868..bb54ce876c8f6bd2ce4afce2c21b9b8d887972c1 100644 GIT binary patch delta 105 zcmZp0XmFSy&B!!S#+jdqLCVo?m2WWNc!Z#xT=C(b(t!P|5y3XU-}B>6CvS F901X38883< delta 105 zcmZp0XmFSy&B!=W#+jdyK`)t+mw|zSkzbC1Uv9IYzy`j_a{Mn@8Tgm-p96AJ_$LOi zPA-*?G%{e~W{?zTVq#)v=U}PI&r8oQGBh$aF=c3ASitbgLDAUg0MMNMf6km$0MaS{ GJU9T#CmFc_ diff --git a/lisp/README.md b/lisp/README.md index e69de29..b7d6d66 100644 --- a/lisp/README.md +++ b/lisp/README.md @@ -0,0 +1,13 @@ +# Lisp MMO Project Implementation + +The interesting thing about lisp is that for being the 2nd oldest language, it has some of the most flavors of any programming language. + +Lisp is much easier to implement from a compiler/interpreter point of view due to its structure, so it makes sense that it has so many implementations. + +[We are spoiled for choice for this challenge.](https://github.com/dundalek/awesome-lisp-languages) + +[lisp-µhttpd (game website & webserver) ](./www/README.md) + +[lisp-mmo-server (game backend) using picolisp](./server/README.md) + +[lisp-mmo-client (game frontend / UI) using common lisp](./client/README.md) diff --git a/lisp/client/README.md b/lisp/client/README.md new file mode 100644 index 0000000..e69de29 diff --git a/lisp/client/client.rkt b/lisp/client/client.rkt new file mode 100644 index 0000000..000d331 --- /dev/null +++ b/lisp/client/client.rkt @@ -0,0 +1,50 @@ +#!/usr/bin/env racket +#lang racket/base + +(module+ main + (require raylib/generated/unsafe) + + (define (sync-camera camera camera_pos target_pos) + (set-Camera3D-target! camera target_pos) + (set-Vector3-x! camera_pos (Vector3-x target_pos)) + (set-Vector3-y! camera_pos (+ (Vector3-y target_pos) 10.0)) + (set-Vector3-z! camera_pos (+ (Vector3-z target_pos) 10.0)) + (set-Camera3D-position! camera camera_pos)) + + (define (move-user camera pos scale) + (when (IsKeyDown KEY_RIGHT) + (set-Vector3-x! pos (+ (Vector3-x (Camera3D-target camera)) scale))) + (when (IsKeyDown KEY_LEFT) + (set-Vector3-x! pos (- (Vector3-x (Camera3D-target camera)) scale))) + (when (IsKeyDown KEY_UP) + (set-Vector3-z! pos (- (Vector3-z (Camera3D-target camera)) scale))) + (when (IsKeyDown KEY_DOWN) + (set-Vector3-z! pos (+ (Vector3-z (Camera3D-target camera)) scale)))) + + (InitWindow 800 450 "racket lisp client : raylib") + + (define camera_pos (make-Vector3 0.0 12.0 14.0)) + (define target_pos (make-Vector3 0.0 2.0 0.0)) + + (define camera (make-Camera3D camera_pos target_pos (make-Vector3 0.0 1.0 0.0) 60.0 CAMERA_PERSPECTIVE)) + + (SetTargetFPS 60) + + (let loop () + (when (not (WindowShouldClose)) + (BeginDrawing) + (ClearBackground RAYWHITE) + + (move-user camera target_pos 0.2) + (sync-camera camera camera_pos target_pos) + + (BeginMode3D camera) + + (DrawGrid 30 1.0) + (DrawCube (Camera3D-target camera) 0.5 0.5 0.5 PURPLE) + + (EndMode3D) + (EndDrawing) + (loop))) + + (CloseWindow)) diff --git a/lisp/server/README.md b/lisp/server/README.md new file mode 100644 index 0000000..e69de29 diff --git a/lisp/www/README.md b/lisp/www/README.md new file mode 100644 index 0000000..e69de29