clojure-gamedev 2024-08-04

Hey there, wanted to share that I am currently working on Godot-Clojure ( https://github.com/3starblaze/godot-clojure ). I haven't committed to the repo for a while because I needed some time to figure out GDExtension API details (which I have documented in another repo). For the MVP implementation I intend to make Godot-Clojure ready enough to implement the classic "Dodge the Creeps" 2d game that is used for teaching 2d game dev. Right now I have these things in my todo list: - Make a Java-like interface to Godot API - Add ability to override virtual methods like _process and _ready - Some helpers for wrapping and unwrapping values in Variant (similar vibe to Java boxing) If that works out well, I will take care on proper deployment in which I package the exported code with a JRE or compile the code via GraalVM. Also, to be honest, I could probably generate a bunch of Java classes as the base library and then make some Clojure-friendly abstractions on top of that. Godot is very OOP, so all this class generation makes a lot of sense. If you have some thoughts about it, let me know.

👍 15
👍🏼 1
❤️ 6
😎 4
🎉 4

Hi do you have an example project? I have setup your stuff to the point of running the repl in the headless Godot. How do I put it into a Godot project and start hacking clojure? 😄 aka the empty project works

Hey! The godot-clojure kind of moved to godot-java and now my project is dead. There's nothing else you can do in godot-clojure but you can try using https://godot-kotl.in/en/stable/ . There are some people that use Godot-Kotlin from Java so there is a good chance you can use it via Clojure. They have a community in discord.

Hi, why you decided to move from Clojure?

The code generator is still in Clojure, it's just that Godot is so OOP that I might as well generate Java for it.

👍 1

Thank you for the comprehensive answer. I’ve tried some of these tutorials, so you replicating them is a very welcome introduction.

Great, I’m looking forward to it. I have a question - I’ve only worked with Godot for a day or two. I suppose if I start using Godot with something other than C# or GScript, I will lose various (point and click) features of their editor. Well, my question is: Do you think it will be reasonable to learn Godot with Clojure? Or would you first get very familiar with Godot before you start using unofficial languages?

You don't have to be very familiar with Godot but you should be comfortable using it and understand the core Godot concepts. It's like using clojurescript, you have to know some javascript and how the frontend works more or less. I would recommend going through the official Godot tutorials https://docs.godotengine.org/en/stable/getting_started/introduction/index.html and https://docs.godotengine.org/en/stable/getting_started/step_by_step/index.html in GDScript. The 2d game example is the same example I will implement Godot-Clojure because most Godot users know about it and this popular example would make it easier to understand the differences in Clojure. About the features: The only feature you would lose is the built-in editor because (at least for now) I am not supporting that. I am certain you and other people have their own cozy code editors so I don't see much value in the built-in code editor. Most of the drag 'n' drop and other functionality is related to Nodes and Scenes which is not really programming and since I am not affecting them in any way, you don't lose the functionality.

👀 1

Given you're extracting an API from Godot, just thought I'd check whether you've seen the recently posted https://www.youtube.com/watch?v=Y2Stj6oYc5Q ?

I haven't seen the talk but there seems to be heavy focus on GPU and high-performance computing which is not my area of interest at the moment (although I like to tinker with interop).

@3starblaze Take a look at 19min (and prior). It covers the different options available in wrapping CPU and GPU libraries.

With attention to clong

A lot of the talk deals with complexity of offloading work from Clojure using native libraries.

I think I have been suggested clong before but the hard part isn't really about the C side but how the Godot's C layer works where every typedef in 99% of cases is either a function or a void*.

Right now I moved away from Godot-Clojure to Godot-Java (where java is generated with Clojure). I felt like OOP in Godot aligns perfectly with Java, so once I finish that, I will make a bit more ergonomic interface for Clojure.

Cool. I thought it was neat that clong got the interface as a set of maps, and could support dynamically switching between native library versions (automated wrappers). However, if you're already aware then I have nothing further to add 🙂

👍 1