# Spring Lisp Game Jam 2023

**URL:** <https://racket.discourse.group/t/spring-lisp-game-jam-2023/1967>\
**Category:** General\
**Created:** [May 28, 2023, 8:29pm UTC](https://racket.discourse.group/t/spring-lisp-game-jam-2023/1967 "2023-05-28T20:29:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [May 28, 2023, 8:29pm UTC](https://racket.discourse.group/t/spring-lisp-game-jam-2023/1967/1 "2023-05-28T20:29:49Z")

</div>

Submission for the [Spring Lisp Game Jam 2023](https://itch.io/jam/spring-lisp-game-jam-2023) open from May 26th and runs until June 5th.

Is Rhombus a Lisp? It is a `#lang`: [Rhombus-in-the-rough: A 2D RPG implemented in the Rhombus Racket dialect](https://racket.discourse.group/t/rhombus-in-the-rough-a-2d-rpg-implemented-in-the-rhombus-racket-dialect/1966) - so maybe you could enter a game in Rhombus! (if you want to discuss if Rhombus is a lisp maybe start a new topic)

The lispgames wiki has a section '[Why use Lisp for games?](https://github.com/lispgames/lispgames.github.io/wiki/Why-use-Lisp-for-games%3F)':

> Lisp macros allow you to write very expressive code, and runtime images allow the ability to change and add code live, giving you access to a full [REPL](http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) while your game is running. These features and others make Lisp a very enjoyable language for projects like games.

While there are many situations where changing a running application is undesirable - if you want to discuss maybe start a new topic - there may be some situations where it might be useful in a development phase?:

I recently asked about this and @soegaard kindly provided some example code:

> Anything is possible in the land of macros.
> 
> One of the examples mentioned, where redefintions could be useful are games.  
> You start the game (and at the same time have a repl) and play for 10 minutes  
> and notice something, you want to change.  
> Being able to make the change on-the-fly seems convenient.
> 
> Making everything redefinable is not the only answer though.
> 
> That said, below is a quick version of `redefine`.  
> It's simple, very simple - so don't expect too much.  
> Avoid using it for local definitions.

```scheme
#lang Racket
;;;
;;; Redefine
;;;

;; SYNTAX (redefine id expr)
;;; (redefine (head args) body ...+)

;; The form
;; (redefine id expr)
;; expands to
;; (define id expr)
;; or (set! id expr).

;; The very first time `id` is used in a redefinition, the
;; expansion will use `define`. Subsequently, it will use `set!`.

(require (for-syntax syntax/parse
                     syntax/parse/lib/function-header))

(begin-for-syntax
  (define redefinables '())
  (define (register-redefinable id) (set! redefinables (cons id redefinables)))
  (define (is-redefinable? id) (member id redefinables free-identifier=?)))

(define-syntax (redefine stx)
  (syntax-parse stx
    ;; (redefine (head args) body ...+)
    [(_redefine header:function-header body ...+)
     (cond
       [(is-redefinable? #'header.name)
        (syntax/loc stx
          (set! header.name
                (let ()
                  (define header body ...)
                  header.name)))]
       [else
        (register-redefinable #'header.name)
        (syntax/loc stx
          (define header body ...))])]
    ;; (redefine id expr)
    [(_redefine id:id e:expr)
     (cond
       [(is-redefinable? #'id)
        (syntax/loc stx
          (set! id e))]
       [else
        (register-redefinable #'id)
        (syntax/loc stx
          (define id e))])]))

(redefine (foo x) (+ x 1))
(foo 10)
(define (bar x) (+ 10 (foo x)))
(bar 10)
(redefine (foo x) (+ x 2))
(foo 10)
(bar 10)
(redefine (foo x) (+ x 3))
(foo 10)
(bar 10)

(redefine baz 42)
baz
(redefine baz 43)
baz

(redefine hello 10)
(let ()
  (redefine (hello) "Hello")
  (displayln (hello))
  (redefine (hello) "Hi")
  (displayln (hello)))
hello ; => #<function>
   

(redefine (f x) 1)
(define ((g f) y) (f y))
(define h (g f))
(h 42) ; => 1 
(redefine (f x) 2)
(h 42) ; => 1

```

* * *

[https://itch.io/jam/spring-lisp-game-jam-2023](https://itch.io/jam/spring-lisp-game-jam-2023)  
[http://lispgames.org/](http://lispgames.org/) --\> [https://github.com/lispgames/lispgames.github.io/wiki](https://github.com/lispgames/lispgames.github.io/wiki)  
[https://github.com/lispgames/lispgames.github.io/wiki/Why-use-Lisp-for-games%3F](https://github.com/lispgames/lispgames.github.io/wiki/Why-use-Lisp-for-games%3F)

---

<div class="post-metadata">

**Author:** ![cadence](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/cadence/32/998_2.png) [@cadence](https://racket.discourse.group/u/cadence)\
**Post date:** [June 6, 2023, 12:06am UTC](https://racket.discourse.group/t/spring-lisp-game-jam-2023/1967/2 "2023-06-06T00:06:25Z")

</div>

Thanks for posting about the game jam! I scrambled to put together an entry and I submitted it just in time. My game is called Eval-em-up, and it's a shoot-up-em where you execute the enemies as code. You can play it here: [Rate Eval-em-up! by Cadence for Spring Lisp Game Jam 2023 - itch.io](https://itch.io/jam/spring-lisp-game-jam-2023/rate/2103517)

After the voting period ends in 2 days, I do plan to post an updated version with bug fixes for the boss's hitbox and projectiles. Enjoy!

While I likely won't add more stuff to the game after that, the license is BSD 3-Clause, so you're welcome to adapt and improve it yourself to scratch that itch.
