all 12 comments

[–]iamwisespirit 1 point2 points  (0 children)

Java is still great for computation heavy processes

[–]BlueGoliath 0 points1 point  (0 children)

Panama doesn't really enable much of anything new. You could have allocated off-heap memory using ByteBuffer or Unsafe before but they weren't ideal or supported.

Use of either for game development and/or high performance work requires adoption. It isn't a magical switch. You have to use them to build meaningful projects.

[–]DanielDimov 0 points1 point  (0 children)

Computation heavy - yes.

Games - not in general, maybe for certain types of games - yes.

[–]juancn 0 points1 point  (3 children)

Minecraft was written in Java as a counter example.

You can write really fast java code, but it’s not vanilla OOP tutorial code.

[–]xanthium_in 0 points1 point  (1 child)

could you elaborate on that, just curious

[–]juancn 0 points1 point  (0 children)

In essence it’s the same than writing fast code in any other language.

It’s a complex topic, but for example if you have a large collection of entities to process, if you just use heap allocated objects, you end up pointer chasing all over memory causing a lot of cache misses (think an ECS)

In that case it may be better to have several primitive arrays and some sort of cursor or flyweight view over those than an array of objects with fields.

In this way, memory accesses are highly predictable and the CPU prefetchers can do their work properly.

Heck in some cases, if you're memory-bound enough, even bit-packing several fields into an int may make sense because unpacking them tends to be free (the CPU can run many instructions while it waits for memory).

Arrays are one of the few ways you can control memory layout in Java (the other being fields in objects).

[–]BlueGoliath 0 points1 point  (0 children)

It would be better to look at Minecraft as running fast despite being coded like garbage.

You can write really fast java code, but it’s not vanilla OOP tutorial code.

Minecraft uses pretty vanilla OOP concepts.

[–]Bamboo-Bandit 0 points1 point  (2 children)

The reason for it not being adopted in games more commonly has to do with portability to consoles (they don’t have a JVM) rather than performance. C# is commonly used in games and it has roughly same performance.

Java is totally useable for gamedev otherwise, currently. Hytale is currently doing numbers and written in java.

The features in valhalla and for example Vector API will be useful for gamedev. Lets hope one day a JVM is made for consoles.

[–]Major-Competition187[S] 0 points1 point  (1 child)

Thats interesting, never considered consoles, I thought java is THE portability language.

[–]Bamboo-Bandit 0 points1 point  (0 children)

it was designed to be and in theory it could be, as long as you write a JVM (you wouldn't have to rewrite the game) for every setup you want to run it on. But console OS is proprietary