I am working on a video game written in javafx 1.3. I notice that when I execute the game from the IDE (standard execution) I get better performance than when I execute from JNLP or in browser applet. It does not matter that its the same jar sitting in the same local directory. The difference in performance is very noticeable... the frame rate looks slower and more choppy on the JNLP/applet execution.
Anyone else experience this? Maybe this is a known phenom with well established fix.
The javafx 1.3 doesn't have good performance when the application get's huge.
I had also made a Software from javafx 1.3 which was really big which need to be run in browser. At first it was very slow and finally I've optimized many codes and graphics then the javafx ran smoothly. If you are developing some high graphics games then optimize the codes , use bind only when needed and there are so many things to be considered. I think you probably need to divert in JavaFX 2.0 .
Thank you for the response. The weird part is that the game runs smoothly when launched from command line or from Netbeans. Would you happen to know why rnning via JNLP or the browser would slow it down?
This does not make too much sense to me because it is the same code, jar file, and JVM. The only thing I can fathom is that when the JVM executes code via an applet or JNLP that it has access to less system resources. I have even removed stuff from the game to just test it out and still the frame rate looks less.
I am concerned that converting to javafx2.0 will not fix it unless I understand first what is going on.
Further more details of performance tweak on javafx 1.3:
- use 'def' instead of 'var'
- load the images instance initially
- less use of Effects like : Reflect, Dropshadow
- Use Two shapes objects instead of stroke on any shape object.
- Avoid the depth code tree .
- don't use smooth graphics while on animation.
- Use Multi-thread with Async Task.
- Use layout than absolute position bindings
Thank you for the valuable tips. I will go through them all and see where else I can improve performance. I just found a hidden "bind" that I didnt know was there and the performance now is up to par with the standard execution.
Would you like to see a demo of the game?