Hey guys, so I am developing my multiplayer game but I found out that my playe sprite while'st moving tends to get stuck sometimes.. not flickering but rather just CPU context switch is really long & obvious, is this makes any sense..

so I made just a rectangle which you can move with keys but it is not smooth moving, sometimes IT seems like vsync decides to drop few frames(it's just assumption, I dont know what exactly is going on..)

I have tried many high precision timers and different ways, here is the code:

Can anybody check out and see what could be possibly wrong or provide me code which renders really nicely and doesnt randomly 'lag'..I really suspect this might be the because of my Java version or maybe OS(Win7 64 bit)

I couldnt make it display with dates tho, seems like date option doesnt exist in new VM or is placed with something new :\

also I tried few others game which are in internet(Space inwaders for example) and they all seem to have same problem as me.So I tried with my other computer(has vsync disabled) and it had exactly the same problem..so Im just thinking that java doesnt suit my needs for player movement, I think it is inevitable and every java game has it, it does not affect playing game but it sure does annoy my eye..

I also used VM flags to make my heap 512 mb by default, my program used 20mb so I dont think the GC was problem anyways..it just seems that the faster player moves, the more obvious the random jittering is..the few games I played were pretty okish, I could definitely see the jittering but it wasnt that annoying.(althought characters in those games were moving slower by like 35% or so.)

I think this is why they say that Java isnt the best option for game development.. works well for simple games such as card games, I havent yet chance to get look at java3D library but it sounds like it is programmed using native libraries(C or so)..

I feel the same problem, a small unidentifiable hitch now and then, but i dont see it in puppygames games... hmmm. Theres must be a trick hidden somewhere.Perhaps as riven suggested, with the debug console open, does the gc spout material during the hitches? I havent yet tried this being busy with another project but will definitely investigate more, as i presume android games will have similar gc processes behind the scenes. Perhaps the answer is to make sure we are not allocating/deallocating anything during gameplay?I refuse to believe Java should just be ditched as unsuitable for gaming on a feeling, hard data is needed.. As another thread, showed, there are starting to be over a dozen marketquality games made in Java, and they have gotten around these hitches surely.

I experience the same problem in all of my games. I don't think it is due to GC pauses because once in fullscreen exclusive mode, everything runs smooth. I'm still hoping for a Java update that magically eliminates that problem. Hoping for many years now...

I experience the same problem in all of my games. I don't think it is due to GC pauses because once in fullscreen exclusive mode, everything runs smooth. I'm still hoping for a Java update that magically eliminates that problem. Hoping for many years now...

nice, I was under the impression that full screen would work better(i dont know why but just had feeling lol), I shall try it soon and tell how it goes.thanks

I have never had any issues like this when using LWJGL (which PuppyGames uses also). In general if you want good graphics performance you'll want to switch to OpenGL. If you want good performance without having to sign your JAR, try out PulpCore, I've only seen beautiful stuff from it.

I tested your games hansdampf and couldnt get a glitch for 10-15 minutes ( quite good stuff too) ...but it's not fullscreen mode, so the magic is/isnt in the full screen exclusive mode?

The problem is very obvious in my game 'CaveCopter', a sider-scroller. The Applet version has framedrops from time to time. There is a Webstart link below the Applet and you can go fullscreen with F11 -> runs very smooth for me. You can press F2 to see the uncapped fps. I have around 130 fps, so there should be lots of time left, but the Applet version is still jerky.

I have never had any issues like this when using LWJGL (which PuppyGames uses also). In general if you want good graphics performance you'll want to switch to OpenGL. If you want good performance without having to sign your JAR, try out PulpCore, I've only seen beautiful stuff from it.

I want to live in your world, Demonpants.I remember there was a guy defending C over Java here on this forum and asking for a simple loop to animate a moving rectangle SMOOTHLY. There was nobody here on this forum who could deliver such a loop with plain java2D and non-fullscreen. The praised Pulpcore is great, but it suffers from the same problem. Just try the http://www.interactivepulp.com/pulpcore/tilemap/ demo. I can see glitches. I remember (90% sure) a version of that tilemap demo with the possibility of scrolling with cursor keys, when the glitches were more obvious. Now it is hard to detect because the movement is so quick.

The problem is very obvious in my game 'CaveCopter', a sider-scroller. The Applet version has framedrops from time to time. There is a Webstart link below the Applet and you can go fullscreen with F11 -> runs very smooth for me. You can press F2 to see the uncapped fps. I have around 130 fps, so there should be lots of time left, but the Applet version is still jerky.

There may be some slowdowns at start on windows machines, but with linux it is quite a smooth all the way.you may should choose the "Q" key for Air Pilots 1917 to see the best and smoothest for purpose, it is still to set only for 25 fps.

( Edit. I also use scale for smooth movement, 1500-15000 pixels applet height, and 4:3 or 16:10, seems to be enough for me. )

Last week I tried to vote for this bug, but the voting-processlooked broken then, the site was real sloooow and nothing happendwhen voting.Now I was attempting to try again, but the bug is no longer there ...(The site says 'This bug is not available').

Does anyone remember the title or the keywords for this bug, so we can search the bug database for it ?

I would like to give you my AllBinary Platform to make life easier, but I need to find funding first.

What I can say is lots of things can cause it, but in general it is a code performance issue(s) in your own code. The problems include:

Thread.sleep needs to change to lower times when you have longer running frames and suchCreating to many objects causing gc to run during gameplayGetting the system time to many timesLong running paint methodsLong running frame processing

Note: Applets are a little slower so if the lag is barely noticeable then you might remove what little lag you have left by just using JNLP or getdown.

As stated in another thread (that's lost for me), switching from Thread.sleep to Thread.yield has solved this problem for several people.Also, small stuff, if you're running in a JFrame, use an empty RepaintManager (since you'll be using active rendering anyway),

- which pipeline are you running with? I just booted some old Java2D games I wrote some years ago, and I have no stuttering. (They use the OpenGL pipeline for Java2D). Beyond that, and the fact that I use Thread.yield instead of Thread.sleep, the games wary hugely in both design and form, yet none of them stutter.

If ten more persons come and claim they can animate a moving circle/rectangle without stuttering... I think I have to believe it. Why it is so complicated just to prove it and give a minimal example so that we all can learn from the rendering loop?Doesn't seem to be that simple...

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org