Change fps while app is running

I thought it was possible to change the fps of an app while it was running without needing to restart the application, but I have not had luck doing so. Is this possible?

I am running: app.getContext().getSettings().setFrameRate(fps)

Thanks,
Trevor

Curious what you are actually trying to do.

I think frame rate is the nearly useless setting, isnā€™t it? Just making JME randomly sleep for you (and not well as I recall).

it is just a fps limiter. I am using it server side to prevent my server fps from being over 200. But it would be nice to be able to change it live on the server for testing.

It is not supper accurate. set to 60, my fps stays at 58. Set to 200 my fps stays at 188. It has some timing issues, but it gets the job done.

Ah, you are one of the folks that boots the entire JME mostly-visualization infrastructure just to have a timing loop.

Yeah, I donā€™t know then. I abandoned that approach about 5 minutes into using JME 9 years ago. I understand why folks do itā€¦ I just donā€™t agree with it. :slight_smile:

I guess I do not follow. Just using JME core, Minie physics and spider monkey.

And apparently JME ā€œApplicationā€ā€¦ the part that is not necessary.

JME math, physics, spider monkeyā€¦ can all be used without being a headless SimpleApplication.

Are you using a scene graph on the server, too?

Yes, I use the scene graph heavily on the server.

I guess it is possible to use everything outside of a SimpleApplication, but that would required building my own scene graph when one already exists.

Yeah, I never had a need for a visualization graph on the server. Just game objects. The server doesnā€™t care what things look like so I get to cut out like 70% cruft.

I mean, even as it stands, you have now spatials and rigid bodies and constantly copying values between themā€¦ when you probably could have just had the rigid bodies.

Hmmm. Is it possible to run an animation directly on a rigid body? I am using physics against animated models.

Interesting. Is that something minie provides? Is it a ā€œmesh accurateā€ sort of thing or based on bones and collision shapes?

you can mix rigid body + animation in Minie project.

1 Like

Yes, it takes a bit to setup, but you can do mesh ā€˜accurateā€™ collisions in several ways. There are restrictions as to what you can collide them with, but it works reasonably well performance wise.