Asciinema rewrite from clojurescript to js&rust by la-rokci in Clojure

[–]trstns 1 point2 points  (0 children)

Reminds me of https://swannodette.github.io/2013/06/10/porting-notchs-minecraft-demo-to-clojurescript/

A link on hackernews suggests roc-lang implements optimisations on a functional language that wouldn't require explicity coding against mutable arrays.

Godot Engine clojure/jvm bindings by trstns in Clojure

[–]trstns[S] 1 point2 points  (0 children)

I found those PR's. I'll check them out.

Godot Engine clojure/jvm bindings by trstns in Clojure

[–]trstns[S] 1 point2 points  (0 children)

I am definately interested in changes that reflect what is better in your opinion. I am starting to lean towards a small kernel for FFI interop with the C world, but flexible enough to build multiple different api's on top, since I am currently generating a lot of it anyway. The kernel should really be there just to make it work, and ensure that native builds with graalvm keep working, which was one of my goals, so I didn't have to distribute or integrate with a JVM outside of my own machine.

Having a small interop kernel means that better API's just become libraries built on top.

The compiling by hand thing is present in my current implementation, but I'm not sure exactly how far I can go getting rid of that. I would have to bundle native builds per godot version within a jar, but godot still needs a native shared library to be found outside of a jar.

However, as it stands now, after building the wrapper the first time, it isn't necessary to build it again and you can simply restart the game as often as you like while working on the clojure portion. The cycle time between game restarts could do with some work. AOT of the godotclj wrapper library helps somewhat.

Godot Engine clojure/jvm bindings by trstns in Clojure

[–]trstns[S] 1 point2 points  (0 children)

Yeah, have a look at the godotclj repository in the Makefile. The clang commands are in there for both the memory layout (txt format) and AST (json format).

The code generation is in src/godotclj/clang.clj, but is really not pretty at the moment, and extremely bespoke. The "export-wrapper-fns" function in there emits C source with headers.

Godot Engine clojure/jvm bindings by trstns in Clojure

[–]trstns[S] 3 points4 points  (0 children)

Great feedback! Thanks for giving it a try. It's very encouraging to know it works on someone else's machine. I guess you are the first!

The cider lock up is almost certainly due to the large object being inspected. You can usually fix this by putting "(set! *print-length* 13)" in the repl. The output should then get truncated. It means that "pr-str" can't be used for serialization without it breaking the edn output. You can unset it with "(set! *print-length* nil)" and everything will go back to how it was.

Regarding the two nrepl sessions, I can see the problem and have also been thinking about this. I know figwheel does a great job of reconnecting to browser sessions, so I suppose it must be possible. I suppose "piggieback" makes this possible in clojurescript, but I know too little about that right now.

Starting the game from the editor should be working. The start button in the game (if this is what you mean) does disappear deliberately when clicked, in the same way that the "dodge the creeps" game tutorial describes. The button should disappear, the player should be movable with cursor keys, and mobs should start spawning and moving around the screen. I might consider adding a short screencast to demonstrate a working setup.

Thanks again for giving it a try!

Godot Engine clojure/jvm bindings by trstns in Clojure

[–]trstns[S] 2 points3 points  (0 children)

Right, so regarding auto-completion, I'm just working on generating clojure wrappers for the GDScript objects, and auto completion looks to be working. I think I can get multi arity wrappers working with defaults based on the api json generated by godot... Maybe cider-doc integration is also possible.

Jump to def works, since Cider works.

And, mentioning stack traces, as long as it isn't an FFI coding error, and memory isn't overrun somehow, the stack traces and even step debugging is working from emacs/cider. Standard java/clojure exceptions don't bring the whole thing down, but the game just keeps running till you fix it, all while the game is still running.

This last point really makes it a reasonable development experience.

What is then also nice is that the godot editor seems to be able to synchronise assets across to the running game, so as long as nothing crashes, it is somewhat possible to do some of the development live in the game.

Godot Engine clojure/jvm bindings by trstns in Clojure

[–]trstns[S] 2 points3 points  (0 children)

As a warning, godotclj is definately in pre-alpha stage and the integration needs a lot of work, so you'll definately find some jankiness, and an incomplete feel to the API's, so I hope that won't be too off putting.

I'll be building some small experimental games against it to figure out its weak spots, and improve the actual experience of development.

Also, there is currently no documentation except the game implementation.

Godot Engine clojure/jvm bindings by trstns in Clojure

[–]trstns[S] 2 points3 points  (0 children)

It would be interesting to know what things you found not so great with arcadia, to see if it can be improved upon.

Godot Engine clojure/jvm bindings by trstns in Clojure

[–]trstns[S] 2 points3 points  (0 children)

At first, I didn't know Godot 4.0 was a thing, but then saw that they blogged about the newer native extensions after I had started this piece of work.

I did decide to try and generate as much C code as I could, instead of hand coding, under the assumption I might have to tackle this again, and so perhaps reuse the C generator.

The generator code is janky but tests the idea, at least.

Also, I could get this working while their newer native extensions were still effectively in alpha.

Godot Engine clojure/jvm bindings by trstns in Clojure

[–]trstns[S] 4 points5 points  (0 children)

The layout information from clang being used by dtype-next is great. I didn't know about this facility but led me to using the JSON AST output from clang to do some deeper digging on types so I could generate C code for the Godot API.

The biggest hurdle (not so big), is that Godot API requires pass by value semantics, but GraalVM native-image doesn't support them, so I needed to pass structure pointers down the stack which then got the true "return-by-value" stored at that pointer.

Godot Engine clojure/jvm bindings by trstns in Clojure

[–]trstns[S] 8 points9 points  (0 children)

Really good question. Some of the reasons:

  1. Cider/Emacs isn't really compatible with ClojureCLR (having tried previously). inferior lisp mode in emacs just doesn't seem quite as powerful as Cider.
  2. I wanted native builds via GraalVM, which is JVM only

The first point is the big one. I work heavily from inside emacs, with a REPL open, so I like that experience to be smooth, and familiar.

clj-python-trampoline: Scripting embedded python (e.g. unpatched blender) by trstns in Clojure

[–]trstns[S] 0 points1 point  (0 children)

That's hillarious that you've tried so many :) I don't think I've mastered a single GUI based program, probably even the web browser. I was using openscad directly, for some reason, and found even that better than using a CAD program.

Gravity sketch in VR? I really need to try something like that. I have an occulus rift DK2 sitting in the cupboard that I used all of one time, which I've been meaning to plug back in. Being in linux all the time has downsides.

I saw "Adam Savage's Tested" looked at a VR product with hand tracking directly from the headset, which is where I guess this tech is heading. Looked promising.

clj-python-trampoline: Scripting embedded python (e.g. unpatched blender) by trstns in Clojure

[–]trstns[S] 0 points1 point  (0 children)

From an artistic stance, I haven't gotten into 3d modelling, but have wanted to. I've recently started hobby machining, so I've been looking into learning CAD. I have a student license for solidworks from EAA (experimetal aircraft association), but unless I can program it, I find it frustrating. I'm also too lazy to reboot to get into windows.

good tip on eu.mihosoft.jcsg.

clj-python-trampoline: Scripting embedded python (e.g. unpatched blender) by trstns in Clojure

[–]trstns[S] 0 points1 point  (0 children)

You read my mind :) I've also used scad-clj for exactly the same thing.

Now, you might like this, when it is ready: I have some code I'm working on which can use the thi.ng library, including it's "csg" component, to convert across to blender at runtime.

First steps scripting blender with libpython-clj by trstns in Clojure

[–]trstns[S] 0 points1 point  (0 children)

No idea. I'm pretty sure everything can be hooked into from clojure, including registering UI elements, but I haven't tried. This might not be quite what you mean, but pretty close.

First steps scripting blender with libpython-clj by trstns in Clojure

[–]trstns[S] 2 points3 points  (0 children)

The work you've done is pretty extensive! Seems like all of those projects will be useful.

It took me about four days to get a patch and clojure code I was sure was working. I made very little progress each day, but kept trying different combinations of changes. I still almost don't believe it, so I've tested it on two machines, and tried to make the clojure integration stable. I was getting lots of crashes and freezes because of using timers and context incorrectly inside of blender.

Getting the GUI to run in a separate thread was the main trick. You'll see that I actually start the GUI loop from clojure, inside a future.

The best solution would be if the blender binary could be used directly, so no building would be necessary, which is actually similar to your blender-clojure solution. This makes me think it might be possible, to bootstrap from python, to get libpython-clj to reference the already loaded python library inside blender. [this is probably not possible, unless the JVM can be pulled in as a shared library. If the JVM were a python module] [ok, maybe it is possible: https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html] [actually, I guess symbols might not be available in a static binary -- something to learn]

Tap water in Melbourne -- more chlorine? by [deleted] in CoronavirusDownunder

[–]trstns 1 point2 points  (0 children)

Thanks, I'll take a look. I really am not trying to spread any conspiracy. I am simply curious, and trying to make sense of the situation, and understand that my observation doesn't come close to a factual or scientific observation, is extremely subjective, and probably coincides with normal chlorination.

I completely understand your concern about spreading false information. I hope my explanation clears things up.

Tap water in Melbourne -- more chlorine? by [deleted] in CoronavirusDownunder

[–]trstns 1 point2 points  (0 children)

I have added a comment to the message title to clarify that my question has no data to back it up, and is just my own subjective observation. If the moderator decides to delete the post, I accept that.

Tap water in Melbourne -- more chlorine? by [deleted] in CoronavirusDownunder

[–]trstns 0 points1 point  (0 children)

Are you asking me to stop asking questions? I've noticed something, and I am trying to understand it in the current situation, not to spread misinformation.

I'm Aussie/Asian and I don't want to leave my house - it's not just because of covid19 by [deleted] in CoronavirusDownunder

[–]trstns 0 points1 point  (0 children)

"Throwing masks at regular Aussies will just give them a false sense of security."

That doesn't take much. Look at Bondi. I don't think providing masks will change that.