Fork me on GitHub
#clojure-gamedev
<
2023-09-20
>
Noah Bogart00:09:45

Recently I’ve been trying my hand at some clojure gamedev, but I’m on a mac so recent versions of opengl don’t work. Anyone have suggestions for cross platform gamedev frameworks?

phronmophobic00:09:18

what kind of game are you interested in making?

Noah Bogart00:09:45

2d of whatever style, haven’t decided yet. I prefer to not use large frameworks like Godot or Unity.

phronmophobic00:09:43

My opinion is that most 2d games don't really push the hardware so any option that seems comfortable: • swing • processing • skija/humbleui I've started to prefer swing more since it's dependency free and works well enough.

phronmophobic00:09:23

2d games typically only need a few drawing primitives: • shapes • text • images In general, you usually want to have a model that's agnostic of the graphics library and it's pretty easy to write your game in terms of the model and provide drawing implementations for the graphics and window library you care about.

Noah Bogart02:09:46

i saw your posts, mx2000, gdl looks cool! looks much more fleshed out than it did 10 months ago, so congrats on that. do you have any walkthroughs or tutorials yet on how to get started? i see the sample project

mx200002:09:57

I am struggling at the moment with the exact purpose of gdl. On the one hand it is a wrapper for some libgdx code and on the other hand it contains some state handling (like setting up sprite-batch, shape-drawer, ui-default-skin, viewports, etc.) Basically it is the backend of the action RPG mentioned there (cyber dungeon quest linked in the repo). Nowadays I am opinionated away from wrapper libraries and more using plain interop for newer projects. I would just recommend the libgdx documentation, it is well worth learning! libgdx is over 1000 classes and utilizing good abstractions. On the other hand, what kind of questions do you have about getting started? The test example in gdl (start with lein dev shows how to set up a window and render something)

Noah Bogart02:09:03

yeah that makes sense, it's hard to know exactly what to put into such a library

Noah Bogart02:09:39

the libgdx documentation is very java oriented, hard to know where to start or how to construct a clojure library that doesn't involve a lot of :gen-class, which i find unreasonably challenging to use

mx200002:09:13

Oh, just use reify or proxy.

mx200002:09:28

But please try to think of some questions about getting started, I would love to update the readme. as I said libgdx its such a huge project its hard to know where to start.

mx200002:09:39

I am not using :gen-class anywhere !

🎉 1
phronmophobic03:09:23

Does libgdx offer anything particular for building specific genres of games?

mx200003:09:43

I see the example here is using :gen-class : https://libgdx.com/wiki/jvm-langs/using-libgdx-with-clojure Maybe it can be updated just to use a proxy/reify.

👍 1
phronmophobic03:09:30

I'm curious what kinds of features of libgdx that you leverage compared to trying simple libraries for state, graphics, audio, networking, etc

mx200003:09:41

Thats exactly what libgdx is, a collection of utilities for all this! See here which classes are used: https://github.com/search?q=repo%3Adamn%2Fgdl%20com.badlogic&amp;type=code

phronmophobic03:09:53

Right, how does that compare to using simple libraries for each rather than using libgdx's options?

mx200003:09:56

What simple libraries do you mean? Using plain lwjgl ? I guess using libgdx allows you to work at a higher abstraction level by having everything included. Also the scene2d.ui package is very nice for building GUI elements like buttons/layouting/etc.

mx200003:09:52

Also libgdx abstracts away from lwjgl/android so you can port your game easily

Chris McCormick08:09:23

If you're doing 2d I highly recommend making your game in the browser with cljs.

Noah Bogart15:09:09

i played around with libgdx directly last night and could not get it to work on my mac. for some reason, -XstartOnFirstThread never made it to the jvm no matter how I passed it in and libgdx failed to work.

mx200017:09:22

What libraries did you import ? What was the code ? What was the error message?

escherize05:11:55

I was able to get live reloads + open-glish workflow going on an M1 mac with https://medium.com/@kadirmalak/interactive-opengl-development-with-clojure-and-lwjgl-2066e9e48b52 The only change I needed to do was changing dependencies in project.clj: :classifier "natives-macos" -> :classifier "natives-macos-arm64" for

[org.lwjgl/lwjgl "3.3.3" :classifier "natives-macos"]
[org.lwjgl/lwjgl-opengl "3.3.3" :classifier "natives-macos"]
[org.lwjgl/lwjgl-glfw "3.3.3" :classifier "natives-macos"]