> From: "Pascal Debarge" <[EMAIL PROTECTED]>
> 
> I am currently updating the position and the behavior of each
> character (about 40) 15 times per second.
> The problem is that the renderer seems to be stucked every 1 or 2
> seconds during
> 200 or 300 milliseconds. Even if I reduce the update rate to 1 per
> second,
> the problem is the same.

So, if I understand you right, the renderer is displaying frames at a reasonable 
rate, but every one or two seconds you get a 200-300 millisecond pause?  This 
sounds like the garbage collector is running. Try running java with 
"-verbose:gc" to see if the gc messages coincide with your pauses. 

If gc is the culprit, then you can speed things up by reducing your memory "burn 
rate".  Try to reuse objects instead of creating them with each frame. Since you 
are modifying transforms with each frame, make sure you re-use the transforms 
instead of creating new ones.  

Early in the Java3D development process the team was able to significantly 
increase frame rates and decrease "jitter" by carefully managing memory.

Also, increasing your initial heap size using the -Xms option can reduce the 
problem by making the gc have more room to cleanup. Try "-XmsXXXm -XmxXXXm" 
where XXX is the maximum amount of real memory your Java application can use.  
Note that this doesn't reduce the amount of time spent in GC (unless your 
application is just a bit smaller than the max heap size), but instead makes 
your do fewer GCs, each of which takes longer. 

BTW, how many frames a second are you getting (use View.getFrameStartTimes() or 
View.getLastFrameDuration() to tell).  It doesn't make much sense to update the 
scene more often than the renderer can render it.

Doug Gehringer
Sun Microsystems

=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to