News for hackers. Stuff that matters.
Re:Java 12 by stefan_ on Tuesday March 19, 2019 @06:29PM (#19436731)
Their lower end target is 10 ms. In a game, 16 ms is your entire time budget.
Re:Java 12 by pron on Tuesday March 19, 2019 @08:05PM (#19437515)
ZGC, included in JDK 11, has a 1ms average pause time and 4ms max on some demanding benchmarks, and they're now targeting 1ms max pauses.

https://www.opsian.com/blog/javas-new-zgc-is-very-exciting/

Re:Java 12 by spricket on Tuesday March 19, 2019 @09:00PM (#19437850)
Wow great link. I live pretty deep in Javaland and had no idea it was that good!
Re:Java 12 by gigatexal on Wednesday March 20, 2019 @03:46AM (#19439857)
If it lives up to claims surely it’s a paid for add on?
Re:Java 12 by pron on Wednesday March 20, 2019 @07:15AM (#19440925)
Originally it was intended as a commercial feature, but since JDK 11 Oracle open sourced all previously-commercial features in the JDK, and now it's part of OpenJDK. It's already available in JDK 11 and 12.
Re:Java 12 by gigatexal on Wednesday March 20, 2019 @05:28PM (#19447136)
I never got to the level where I needed anything more than the stock default GC. But this looks compelling. Does Kotlin and other JVM based languages benefit from it, too?
Re:Java 12 by pron on Wednesday March 20, 2019 @05:51PM (#19447354)
Sure. All languages that run on the Java platform[1] can benefit from it, and from most other Java platform enhancements.

[1]: I prefer saying Java platform rather than JVM, because a program written in Kotlin shares over 90% of its infrastructure code with a program written in Java (not including the OS), and the JVM constitutes only about 20% of that.

Re:Java 12 by karussell on Thursday March 21, 2019 @04:43PM (#19457110)
It works really great with heaps >100GB and is included in the openjdk since 11. Note, that only linux is supported, I think
Re:Java 12 by gigatexal on Friday March 22, 2019 @01:08AM (#19459789)
As my world is currently only serverside this isn’t a limitation but a feature ;)
Re:Java 12 by arianvanp on Tuesday March 19, 2019 @06:36PM (#19436810)
In VR your budget is 11 ms and you can't miss it or the entire frame is thrown away and you introduce a frame of latency to compensate. So for VR these kind of effects of GC are even worse.
Re:Java 12 by chipperyman573 on Tuesday March 19, 2019 @06:53PM (#19436973)
Also, while most games are fine with losing a frame or two every few minutes, in VR dropping frames will cause motion sickness really fast. FPS is, from what I've observed, the most important part of a VR game. If you're dropping frames or stuttering, the experience will suffer greatly

When I was developing a VR game, my team noticed that some ultra-sensitive people started to get sick when we would drop around five frames (the vive displays 90, so this is only a ~5% drop). There was more to it (dropping a few frames every few minutes was usually fine, but consistently dropping frames every second or two is an issue).

Re:Java 12 by spricket on Tuesday March 19, 2019 @06:57PM (#19437000)
10 ms isn't all that much. When games load in assets they'll do various things like malloc huge chunks and you lose a few frames.

If GC only causes occasional (maybe every 2 minutes) loss of a frame or two it should be no problem. If you watch benchmark FPS traces that count every frame delay you'll see that occasional stutters happen in basically every game.

Loss of a single frame just isn't noticeable

Re:Java 12 by barrkel on Wednesday March 20, 2019 @12:21AM (#19438959)
Quake, back in the late 90s, would preload assets for all entities in a level at level load time explicitly to avoid stutter when the entity finally shows up and needs to make a noise or whatever.

And some games much later didn't. I recall needing to fire off a shot on each new gun I picked up in Far Cry to be sure I wouldn't get a stutter later at a more critical moment.

Re:Java 12 by RussianCow on Tuesday March 19, 2019 @07:31PM (#19437292)
Frame drops that happen more than once every several seconds are definitely noticeable (and, as a sibling comment pointed out, especially so in VR). Plus, throwing away more than half your frame budget just because of GC seems unreasonable. And this isn't even considering monitors with high refresh rates, which are slowly getting more and more popular.
Re:Java 12 by blattimwind on Tuesday March 19, 2019 @08:30PM (#19437652)
> When games load in assets they'll do various things like malloc huge chunks and you lose a few frames.

Streaming/Loading assets in the main render thread is a very 2005 thing to do.

Re:Java 12 by vvanders on Tuesday March 19, 2019 @09:39PM (#19438079)
Yeah, the whole reason you have pools and arena allocators is so that you don't do small/large malloc mid-frame. Perf 101 is don't malloc during regular gameplay.
Re:Java 12 by jtolmar on Wednesday March 20, 2019 @02:03AM (#19439446)
If you have some control over when a GC triggers you could sneak one in during hitstun.
Re:Java 12 by CaptainJustin on Wednesday March 20, 2019 @02:31AM (#19439563)
A few of us built a webgl game backend in Java. It was fun but optimizing to make everything always work within 16ms was hard. In our case it was especially complicated because we shared state over websockets back to the clients.
Re:Java 12 by AnIdiotOnTheNet on Tuesday March 19, 2019 @10:06PM (#19438228)
16ms is only if you're just targeting 60fps. We now have 144hz monitors, leaving less than half of that if you want to take full advantage of the hardware.