It’s a bit late for me now to switch over. Besides does JavaFX give me any gains in performance (are transformations performed on the GPU when using JavaFX?) Anyway it will be way too much work at this point. For a new game in Java I would use LWJGL or maybe just switch over to something like Unity but I’m not going to do a new game for a long time probably because I want to build onto what I have with my current one.
JavaFX gives you hardware accelerated rendering for scaling, rotation, and alpha, in any combination. It’s also designed from the bottom up to be animated smoothly at 60fps. It might be worth tinkering with if you’re really in need of that hardware acceleration.
You did write your game such that the back-end was split from the front end, right? ;D
Hey! was away for a bit. Well the rendering is mostly separate from the game-logic. But it is uses Graphics2D extensively. There’s all kinds of UI components and effects that I created that all use Graphics2D. Of course game-logic uses things like Point2D etc. in things like locations of objects and collision, etc. I’ve looked a few minutes at JavaFX and I think it would be a lot of work to port it over.
What happened was: I had envisioned the whole thing so that it wouldn’t need “heavy” graphics processing. But then some planets came out so beautifully when I pushed the object density a bit more that it became part and parcel of the look. There’s two modes possible with my game: with control-panel on the right or full wide-screen. I’ll probably keep the full widescreen disabled because the whole game-loop (rendering and game-mechanics (movement & collisions etc.)) goes up to about 13ms per iteration on some planets. Which sounds fine because it’s still over 60 fps, but because the images are quite sharply delineated it might look slightly not smooth. It doesn’t bother me but it might bother others. I can scale down the object density easily by a simple config setting too.
Anyway, my concern is more that something in AWT might “break” or become badly supported (for example letter-spacing is broken in OpenJDK (and always has been I think)). A couple of years ago JavaFX seemed to be pronounced dead. So I didn’t go with it since I would have to learn it and I didn’t think I’de really need it. Now people seem to be talking about it all over the place.
I think the spacing may be fixed now - at least in some versions - https://bugs.openjdk.java.net/browse/JDK-8217731
JavaFX went through a bit of a period of uncertainty but I believe it may have been the “FUD” sort of uncertainty rather than a “lack of communication” sort. It was fairly clearly announced that it was (very sensibly!) being chopped out of the JDK into a separate project so it could evolve more or less independently, but of course, that sort of manoeuvre often looks like a death sentence for a bit of technology. Fortunately it seems to have flourished as OpenJFX with the help of Gluon Labs. Minor disclaimer though: I’ve not used OpenJFX yet; my experiences are limited still to JavaFX under OracleJDK 8 still (grr).
My experience with OpenJFX on OpenJDK 13 was pretty smooth, i’m using it for a small GUI now. Maven makes the library setup and also the jlink process a no brainer.
I had a terrible time with getting it to work with OpenJDK11 and 12, but I’ve recently just migrated to 13, so I might give it another go.
Oh, I see, letter-spacing might be fixed it was OpenJDK 11 & 12 I remember seeing it in…well, that’s good news.
Terrible time, how?
I can’t remember, are you developing with Eclipse? I don’t think I have the best set up, but I have something that works.
I’ve been using it as my main GUI for a while now, since switching over to OpenJDK with Java 9.
My problems stemmed from 3 things:
- The module system being horribly complex and still largely unnecessary for nearly all uses of Java
- Eclipse’s module system handling being totally broken. Hm. Probably still is. Anyone remember the generics fiasco of 2005?
- Bugs in JDK11/OpenJavaFX that meant it just didn’t work properly.
For what is is worth, I posted a quick wiki on what I’m currently doing for OpenJFX on Eclipse.
I won’t have a chance to proof some of the issues about using environment variables PATH_TO_FX and PATH_TO_FX_MODS for a few days at best. I think Gluon documentation may be a bit spurious on not adequately emphasizing that two downloads are needed (the mods, the SDK files) and which to link where.
It’s a “wiki” so people can edit what I wrote. It would be great if people do so, especially if they have better instructions or a better method!
You should look at the way boardspace.net is packaged, with a minimal
Java launcher wrapped in an exe (on Windows). This retains the ability
To dynamically update the app, and bypasses the deprecated mess that
It’s also possible to embed a JRE with an exe package, but it’s not worth
The trouble IMO, you’re still tied to specific windows versions.