Page 1 of 1

Is this still being worked on?

Posted: Tue Jul 06, 2010 3:56 am
by fictiveLaark
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:

Code: Select all

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(
        at java.lang.ClassLoader.loadLibrary(
        at java.lang.Runtime.loadLibrary0(
        at java.lang.System.loadLibrary(
        at org.lwjgl.Sys$
        at Method)
        at org.lwjgl.Sys.doLoadLibrary(
        at org.lwjgl.Sys.loadLibrary(
        at org.lwjgl.Sys.<clinit>(
        at org.lwjgl.opengl.Display.<clinit>(
        at org.newdawn.slick.AppGameContainer$
        at Method)
        at org.newdawn.slick.AppGameContainer.<clinit>(
        at org.villane.box2d.testbed.slick.TestbedRunner$.main(TestbedRunner.scala:25)
        at org.villane.box2d.testbed.slick.TestbedRunner.main(TestbedRunner.scala)

Re: Is this still being worked on?

Posted: Tue Jul 06, 2010 11:23 am
by ewjordan
Can't speak for Villane.

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?

Re: Is this still being worked on?

Posted: Wed Jul 07, 2010 12:29 am
by fictiveLaark
I use netbeans which handles maven projects.

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.,2860.0.html

Re: Is this still being worked on?

Posted: Thu Nov 11, 2010 3:34 pm
by Villane

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:, 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.

Re: Is this still being worked on?

Posted: Sat Feb 12, 2011 3:38 pm
by Villane
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.

I'm porting rev. r146, if someone reading this knows a better revision to base the port on, please let me know.

Re: Is this still being worked on?

Posted: Sat Jul 30, 2011 6:06 am
by Villane
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 )

Re: Is this still being worked on?

Posted: Sun Sep 23, 2012 5:04 am
by Villane
Sorry guys, I am no longer working on the Scala port. If anyone wants to take over the project, just fork it on github -- :) 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: 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.

Re: Is this still being worked on?

Posted: Sat Sep 29, 2012 7:23 pm
by Villane
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.

For example, see ... ider.scala

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):

Code: Select all

  //b2Assert(0 <= edge1 && edge1 < poly1->m_count);
  // Convert normal from poly1's frame into poly2's frame.
  val normal1World = xf1.rot * poly1.normals[edge1];
  val normal1 = xf2.rotᵀ * normal1World;

  // Find support vertex on poly2 for -normal.
  val v := poly2.vertices.findMin(v -> v ∙ normal1);
  (xf1 * poly1.vertices[edge1] - xf2 * v) ∙ normal1World

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 :(