Skip to main content

Lag issues caused by behaviors/alpha's

4 replies [Last post]
Brambopaus
Offline
Joined: 2011-05-19
Points: 0

Hi all,

Im a student 1st year,
And for my education, i have to make a game with wii controllers in java.
This already is quite diffecult.
But since we are this period only allowed to use java, and want a 3d game.
We came at java3D
And it works quite nice, although i had to write my own behaviors and such for implementing wiimote into it,
We use the wiimote for looking/walking around in game,
And we also use particles in our game (Particle system made by : Mike Jacobs : http://java.sys-con.com/node/99792?page=0,2) which use different alphas to run smoothly.

Now my problem is:
At the moment i want to move/look around, and particles are beung rendered,
The particles keep on running smoothly but the screen lags,
Instead of moving like 10cm in-game like without particles,
It moves like 2 m in-game with particles, and refreshes only every 10 sec, instead of every refreshcount

Is there anyway to get this running smoothly?
Like some scheduler like there is for threads or something?
Hopefully you can help me,

Greetings. Bram Goderie

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Goddard Jiri Guest
Offline
Joined: 2011-05-13
Points: 0

Hello,

please check your scene graph for any issues and possible code
optimizations.
Next, you can take a look at where's your program spending most of the time
and try to optimize it.
Also, you can check garbage collection (how much and how frequent it is).
I suppose you're using Sun/Oracle JVM, therefore it should be possible to
see this in VisualVM tool that's part of SDK (I think)

Good luck, Jiri

On Thu, May 19, 2011 at 11:39 PM, wrote:

> Hi all, Im a student 1st year, And for my education, i have to make a game
> with wii controllers in java. This already is quite diffecult. But since we
> are this period only allowed to use java, and want a 3d game. We came at
> java3D And it works quite nice, although i had to write my own behaviors
> and
> such for implementing wiimote into it, We use the wiimote for
> looking/walking
> around in game, And we also use particles in our game (Particle system made
> by : Mike Jacobs : http://java.sys-con.com/node/99792?page=0,2) which use
> different alphas to run smoothly. Now my problem is: At the moment i want
> to
> move/look around, and particles are beung rendered, The particles keep on
> running smoothly but the screen lags, Instead of moving like 10cm in-game
> like without particles, It moves like 2 m in-game with particles, and
> refreshes only every 10 sec, instead of every refreshcount Is there anyway
> to
> get this running smoothly? Like some scheduler like there is for threads or
> something? Hopefully you can help me, Greetings. Bram Goderie
>

Brambopaus
Offline
Joined: 2011-05-19
Points: 0

yeah i also got that idea from a teacher,
Except for the carbage collection, and that helped alot, it was taking alot of time ,.. but now we improved it, it worked,
and cleaning up the whole thing also worked, changing the behavior for the wiimote worked the best.
i did tried the jmonkey, but it was quite complex to start with a new engine, while only having 4 weeks left :S
but still thx for all the help :D

tmilard
Offline
Joined: 2004-03-25
Points: 0

Hello Bram,
I have not used java3d so much latelly but it seems anyway you have a Framerate issue.
As if the overload of work between Frames was too long for your machine/windows/OpengL.

I am aware you can change the "framerate" in java3D. I would say "slow the java3D" framerate a lot to see you application successfully manages better the overload of your particule ( done betwween each frame).
- Now how do you slow/accelerate the java3d rendering framerate ?
I am not sure anymore. I think it is in this class View
Pehaps in this function setMinimumFrameCycleTime(long minimumTime)
If I remember well, minimumTime is the inverse of Framerate.
Hope it helps a bit
Thierry

Ps:
I also found those threads that could maybe help you :
http://www.mail-archive.com/java3d-interest@java.sun.com/msg22493.html
http://www.mail-archive.com/java3d-interest@java.sun.com/msg16805.html
http://www.mail-archive.com/java3d-interest@java.sun.com/msg16039.html

darwinjob
Offline
Joined: 2004-11-16
Points: 0

>But since we are this period only allowed to use java, and want a 3d game.
I think you'll be much happier with this one:
http://jmonkeyengine.com/