Fork me on GitHub
#clojure-gamedev
<
2021-08-26
>
Joshua Suskalo18:08:46

Ohey I didn't realize this was a thing.

👋 4
Joshua Suskalo18:08:06

o/ I'll probably have things to share here over time. I write game engines a lot, it's what I went to school for. I have one in-progress in Clojure using OpenGL via LWJGL, along with a clj->glsl compiler that's pretty basic for now (just recursive descent expression translation), but will probably get more features in the future.

Joshua Suskalo18:08:16

The current one I'm working in already has some pretty advanced stuff for keeping framerates feeling good and having rendering decoupled from simulation, as well as the groundwork laid for really good reloadability of both graphics and game code, but is in the middle of a rewrite of all the examples to use the new features I've made, which inevitably means debugging.

Joshua Suskalo18:08:15

Something I have planned as well that might prove useful to y'all here is coffi, a library I'm in the middle of designing to allow you to use Project Panama for interacting with native libraries in a way that once something's wrapped with coffi will hopefully feel like calling clojure code.

Joshua Suskalo18:08:38

Expect to see a proper release of coffi shortly after java 17 drops.

Noah Bogart18:08:53

what’s project panama?

Joshua Suskalo18:08:42

Proper FFI that can be used to interact with off-heap memory allocated by native libraries, or to allocate memory to pass to native libraries, as well as the ability to wrap functions to be called from the JVM, and even to wrap JVM methods to be called as native functions so that they can be passed as callbacks, plus some layout tools (which are already in earlier versions of java but under the purview of project panama) for serializing and deserializing structs from memory segments.

❤️ 1
Joshua Suskalo18:08:27

What that means once coffi is done is that you'll be able to declare C structs and functions, and then call them like Clojure functions (even passing clojure functions as callbacks).

Joshua Suskalo18:08:15

It may come paired with a more general binary serialization library as well, but I've not yet determined if that's fully necessary.

Joshua Suskalo18:08:40

The key advantage that Project Panama brings over the existing JNI is that it doesn't require native code to wrap the library and expose it to the JVM.

Noah Bogart19:08:09

good god, lmao. makes sense and i understand why folks would want that, but i never want to deal with c or ffi. i love ignoring memory and just trusting the power of the JVM to handle it for me

Joshua Suskalo19:08:53

That works until you want to try out a really cool new font library that nobody's ever heard of