The last post by Villane was in Feburary and the last commit at github was in June 2009, and I've become interested in Scala lately so I thought I would ask what's going on with this project.

Also, I downloaded the code and tried to run the test bed, but the jars for lwjgl in the project are too old to work with the more recent native libraries I have, and when I switched to the old ones I get this error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Jarl\Desktop\scalabox2d\scalabox2d-testbed\lwjgl.dll: Can't find dependent libraries at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1803) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1728) at java.lang.Runtime.loadLibrary0(Runtime.java:823) at java.lang.System.loadLibrary(System.java:1028) at org.lwjgl.Sys$1.run(Sys.java:72) at java.security.AccessController.doPrivileged(Native Method) at org.lwjgl.Sys.doLoadLibrary(Sys.java:65) at org.lwjgl.Sys.loadLibrary(Sys.java:81) at org.lwjgl.Sys.<clinit>(Sys.java:98) at org.lwjgl.opengl.Display.<clinit>(Display.java:129) at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39) at java.security.AccessController.doPrivileged(Native Method) at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36) at org.villane.box2d.testbed.slick.TestbedRunner$.main(TestbedRunner.scala:25) at org.villane.box2d.testbed.slick.TestbedRunner.main(TestbedRunner.scala)

But re: the jars, have you tried just swapping out all the old ones for the new ones? I'm sure you'll have to do some tidying up after the fact, but I'm pretty sure LWJGL has been at least mostly API stable for quite a while now, so I can't imagine you'd need to do too much editing.

Or is it a matter of getting things to link right that you're having trouble with? What IDE do you use, if that's the case?

But I got the testbed working, I didn't swap out the jars for lwjgl because, well, I don't know exactly what maven is or how it works but as far as I could tell I was not allowed to use a jar that wasn't on some server(the github repository?), clicking on the libraries node only allows me to, "Add Dependencies," an option that won't let me just browse my computer for jars.

The solution to my problem was to add JAVA_HOME\jdk1.6.0_18\jre\bin to my Path, I use 64-bit Windows 7.

I haven't had any time to work on it, but when I find time (no idea when exactly, might be December) I'll finish porting it to Scala 2.8, then we'll see what happens next.Besides the upgrade in Scala version, I want to bring it up to date with the latest Box2D release.

One thing that has gained my interest lately is the possibility of compiling Scala to LLVM IR (someone is working on it: https://github.com/greedy/scala/), which might have better overall performance and faster calls to native code than the JVM. It would be interesting to get scalabox2d working on that if it's ever completed.

Quick update: I started working on it again, but it seems the C++ Box2D has changed so much that in order to not miss anything, I'm doing a full port again. Not quite from scratch, I'm copying classes from the old code, but this time I'm porting from the bottom-up, so I'll have compiling code all the time. And I'm going over the C++ code line by line basically to see what needs changing in Scala code. I hope to have it done in a month.

Update: as you've probably noticed, it's been way more than a month and no news. I suffered a hard disk crash and after I got the data restored, I didn't have as much time any more I hope I will find time to continue this, but I'm not sure when.

In other news, I started working on my own programming language that has a somewhat Scala-like syntax, but compiles to machine code (using LLVM), taking advantage of SSE instructions where possible. I want it to be a good language for writing games, so when I get far enough with implementing the language features and compiler, I may do a new port of Box2D in my own language. Currently complex 2D vector ops already compile to just a few SSE instructions. For example SSE4.1 has dot product as a single instruction.( I'm documenting the project at http://villane.wordpress.com/ )

Sorry guys, I am no longer working on the Scala port. If anyone wants to take over the project, just fork it on github -- https://github.com/Villane/scalabox2d/ At least I am not making any long term plans for it -- I may take it up again one day if I feel like it, but don't have plans to keep maintaining it.

-- off topic shameless plug follows --

I've made some progress with my own programming language, but it's not ready for the public yet. However, one of the first "programs" in it is probably going to be a simplified Box2D port with a small testbed. The language is pretty much geared towards math syntax, a mix of OOP/Functional programming and good performance with control over memory use.

Here's an example of a 2x2 matrix implementation: https://gist.github.com/3767858 I've been doing some low-level microbenchmarks and noted that the LLVM compiler optimizes away a separate transpose function on the matrix. So 'm.transpose * v' has the same performance as 'm mulT v'. So I am able to save implementing a lot of duplicate functions for performance reasons. Also, the mathematical syntax allows to write things like: rotᵀ * (v - pos). And it should be as fast as the C++ code that inlines some of that computation.

If someone who isn't as concerned about performance as I was wants to take over the Scala port -- I just realized that there are some nice opportunities there to take advantage of a more functional programming style -- and with recent optimizations in JVM's, the performance might even not be that much worse.

So it might be a nice exercise to practice going from imperative to functional programming -- because a lot of the code there is still as imperative as the original.

the edgeSeparation function is pretty much the same as in the C++ version. It's even harder to read because of the inlining of some operations, but disregarding that it still isn't much more concise. But what it essentially boils down to is (in pseudocode, not exactly Scala):

This is assuming there would be a findMin function in the library, which there probably isn't, but it should be easy enough to add as a separate function or "extension method". [EDIT] There is that function in Scala 2.9 at least, it's called minBy

I'd actually love to go and do things like this myself just as an exercise, and then compare performance with imperative version, but I don't have the time