Changing the MainGameLoop

Hello,



is there a way to change the main Loop of the game?

I’d like to have a static updaterateframe as descriped here: http://www.koonsolo.com/news/dewitters-gameloop/

I have seen ther was this feature in jm1 with a special class.



Is there a simple way to modify the behaviour of the main loop or do i have to change it dirty in the core?



regards,

starx

Make an AppState and keep track of the time yourself, trigger updates at regular a interval.



Your game loop should not depend on the rendering speed…

Asked the same question some moth ago:

http://hub.jmonkeyengine.org/groups/development-discussion-jme3/forum/topic/advancedapplication/



The solution is to implement it on your own in your class which extends simple aplication.

Just set the fixed framerate you want in the appsettings, no need to extend anything. To get access to the update() call, use AppStates like @kwando says.

Btw: do you intend to depend on the framerate so that e.g. 60 update calls are always one second? If yes, thats not a good way to do this, use the tpf variable to make the game framerate independent.

yes i try to have fixed internal update rate for my controllers and appstates.

i agree to the argumentation of the link I mentioned earlier.

especially with a varying framerate with high peaks und low peaks i had good results with the “fixed-update, flexible render” method in lwjgl.

but if you tell me that tpf is more usefull in jm3, I stay with that :wink: