3 ms·
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 -
by extension 15y ago
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.