News for hackers. Stuff that matters.
Re:Why You Might Want To Consider Java And/Or Clojure For Yo... by extension on Friday July 08, 2011 @12:45AM (#2741319)
I gave up on Java for games because I couldn't find a way to do vector math that was both clean and efficient. Basically, the options are:

Immutable vectors - loads of temporary heap objects

Mutable vectors - spaghetti data flow

Implicitly grouped primitives - horrible verbosity and repetition

And of course, there's no operator overloading.

There are potential solutions to this that could be implemented at the language level e.g. stack objects or macros that expand to primitives at compile time, but none of the other mature JVM languages seem to do any better at it.

Say what you will about C++, but it lets you write code like this:

  vec4 lerp(vec4 a, vec4 b, float s) {
    return a + s*(b - a)
  }
that compiles to something efficient. With all the vector math that ends up in my game code, I just couldn't live without this.

There are no comments on this comment yet.