Animation runs slower on faster Computer !?
A game applet which I have written runs well on my slow pentium 166 MMX and on one of my firends 166 MMX with doublebuffering and sounds, but it runs slower and the sounds play with cuts on faster computers like P2 333, P3 550 and P2 266.
How can this happen?
Another interesting point is that on these fast computers if I run on the background another game like "Championship Manger 2001" the sounds play fine?!!
Any ideas?
I am in desperate condition. Please help.
P.S: I tried many times by putting out some code parts but the game runs faster on slower computer. Refresh is done better. For example a rocket is fired at the same time in both computers but the one on the slow computer flies much faster. (more than x2)
Thanks a lot.
zwartan@hotmail.com
[819 byte] By [
Zwartan] at [2007-9-26 13:32:23]

Could this be a video card related issue?
I dont think so. Because on 5 different computers. 2 166 MMX, where it runs fine and the other faster ones, which are faster computers like p2 p3 etc. And all of them have different graphic cards.
If it's the exact same JDK/runtime version you're using on all of them then that is really weird. But if you're using 1.1.x on the other and 1.2.x on the faster machines, then I believe you're experiencing the Java image routine slowdowns in the Java 1.2. I believe 1.3.x and 1.4.x solve this to a certain extent (by using DirectDraw which unfortunately, introduces a flickering desktop problem, although the speed up is great).
The later versions refine animation nicely by introducing VolatileImage as a new way to store images, too.As for why the animation runs slower .. how are you doing the animation? What are you using as the timer, the swing timer or your own one?
I thought that jre version could be the problem and installed never version on the faster computer, but it did not help. The other slow computer where the animationand its sounds run fine is totally different from mine.
At last to be sure I will soon remove my harddisk and install it on the faster computer and run the applet to see if faster means slower. :)
For now what I know is as I said before if I slow down the fast computer by running a game or something in the background then the sound plays fine, the animation is still slower but it may be because of the background game eating too much resources. But how can it be that the sound plays better?!
How I do the animation:
running a thread
in the run method sleep for (XXX) millis and call the paint method.
In the paint method drawings are done with double buffering method.
The game is on its final demo phase and that problem really bothers me.
It really is a mystery.
Although, I can't say I haven't seen this phenomenon with other systems. I remember the days when Unreal was released, and it ran faster on a P166MMX/Voodoo1 than it did on a PII-300/TNT. But that was probably driver related. Surely anything Java is going to do is only 2D, and drivers for that are bound to be mature for any video card.
It sounds a lot like a memory issue.. is the hard drive light on the machine flickering while the animation is going on? That might indicate some swap thrashing, though I can't see why it would be breaking through that much memory.
How do you calculate the (XXX) milliseconds? Maybe it's turning out to be too big on the faster machine?
PROBLEM SOLVED FRIENDS!!!
Finally I found it what caused this.
There are 2 things which slows down the faster computers (only faster ones)
1- drawImage(img, x, y, problem, problem, this);
If you use that drawImage method with the 2 problem bringing arguments which are there for resizing then the FPS decreases incredibly on the fast computers.
When I resize the images manually and draw them with drawImage(img, x, y, this) then everything is fine.
2. The second problem causing situation was something like this: If you have an extra canvas for drawings on your main drawing area and you draw an intersecting transparent image with these canvas but not on that canvas then it slows down the fast computer too.
I solved this by changing the image to a non transparent one.
As you see these are definitely bugs in Java 2D. I will report them as soon as possible.
I am happy to have solved this problem and to share the solution with you.
have you tried replacing the cpu in your test system with a faster one of the same company make. I find it odd that more transisters is causing your programs to run slower. My guess is it's something to do with the software on the system, and not the faster cpu.
There were quite a few Java 2D resize bugs in the Java Bug Parade. I thought they had all been solved by now. Even then, these should be version specific only meaning that as long as you are using the same JDK version the faster computer will still always cause it to run faster.
Perhaps your applet (if it is an applet) ends up calling the MS JVM instead of the Sun one (or different version) on the other computers?
There were quite a few Java 2D resize bugs in the Java Bug Parade. I thought they had all been solved by now. Even then, these should be Java-version specific only meaning that as long as you are using the same JDK version the faster computer will still always cause it to run faster.
Perhaps your applet (if it is an applet) ends up calling the MS JVM instead of the Sun one (or different version) on the other computers?