arcadia godot

Created: Oct 24, 2021Published: Mar 28, 2023Last modified: Apr 05, 2023
No tags
Word count: 136Backlinks: 1

https://github.com/arcadia-unity/ArcadiaGodot

Clojure for scripting godot games!

consider a fork with this guy's ideas

and generally just hacking ontop of arcadiaGodot

probably not too crazy if it's already added to the game itself

might need some kind of env management for using forks/versions across games

may need to get into clojure clr specifics

probably worth reading all of this

also, more arcadia info

godot-arcadia example

godot cljs ??

arcadiaGodot PR

> NRepl.cs

// dodge a noisy nullReferenceException

if (message["symbol"] == null) break;

finding some of the limits

gdscript has some special treatment? https://godotengine.org/qa/20915/godot-3-load-preload-functions-in-c%23

might be able to get autocompletion/jump-to-def via miracle

https://github.com/Saikyun/miracle

fork of monroe, emacs nrepl tool

things to doc

> timeouts/yield

(let [x "hi there"
      n 2]
      ;; (await (Godot.Object/ToSignal 2 "timeout"))
      ;; (await (Godot.Object/ToSignal (.CreateTimer (Godot.Engine/GetMainLoop) 2 true) "timeout"))
      (a/timeout n (fn []
                     (a/log "waited for n" n x)))
    (a/log "fired right away" x))

refactoring examples

> cleaner bullet track/destory (untested)

;; 1
    (swap! bullets
           (fn [bs]
             (let [;; add new bullet to front
                   new-bs               (concat
                                          ;; Storing weak refs b/c these can be freed upon
                                          ;; impact with enemies
                                          [(Godot.Object/WeakRef bullet-inst)]
                                          bs)
                   ;; split via max-bullets
                   [to-keep to-destroy] (split-at max-bullets new-bs)
                   to-keep              (vec to-keep)]

               ;; destroy excess bullets
               (doall
                 (for [b to-destroy] (bullet/kill b)))

               ;; return new list of bullets
               to-keep)))

;; vs 2
    (if (> (- (count @bullets) 1) @current-bullet)
      (let [to-remove (get @bullets @current-bullet)]
        (if to-remove
          (do
            (a/log "to-remove" to-remove)
            (a/log "a/obj" (a/obj to-remove)))
          (a/log "no to-remove"))
        (when (and to-remove (a/obj to-remove))
          (a/log "destroying bullet!" to-remove)
          (a/destroy to-remove)))
      (swap! bullets #(conj % bullet-inst)))

    (swap! current-bullet
           #(if (> % max-bullets) 0 (inc %)))

Backlinks