FixedLogicrateGame?

I tried to use this fixed logic rate game type today.



I took the "HelloSimpleGame" and replaced the "extends BaseGame" with "extends FixedLogicrateGame"



after "app.start();"

I set "app.setLogicTicksPerSecond(1);"





Then i inserted a

"System.out.println(timer.getTimeInSeconds());"

in the simpleUpdate() function to test the fixed frame rate.

I also tried putting it in the update() function.



As far as i understand it, this should generate one console output per second.



But:

in both cases, the application started, the HelloWorld cube appeared, but the console still generates hundreds of output lines in a few seconds.



Seems like logic is still executed every frameā€¦



What did i do wrong?

I don't use that particular app type myself, but what happens if you reverse those two app lines so that you set the tick first, then start?


   public static void main(String[] args) {
      SimpleFixedGame app = new SimpleFixedGame();
      app.setDialogBehaviour(SimpleGame.ALWAYS_SHOW_PROPS_DIALOG);
      app.setLogicTicksPerSecond(1);
      app.start();
   }



|
V

Exception in thread "main" java.lang.NullPointerException
at com.jme.app.FixedLogicrateGame.setLogicTicksPerSecond(Unknown Source)
at SimpleFixedGame.main(SimpleFixedGame.java:38)



Docu says about setLogicTicksPerSecond():
"This should not be called prior to the application being start() -ed."

LOL, heh, ok. nvmd me then.  :slight_smile:

As far as I understand the start function of FixedLogicrateGame it updates as fast as it can but renders only tps times per second where tps is ticks per second you set.



The effect you want is implemented in FixedFramerateGame according to the source.



Note: This is pure theory. I never used one of them :slight_smile:

I think the effect i want is, that the graphic is rendered as fast as possible, but the game logic is only executed at a fixed rate (i.e. 20 or 50 times per second)



And this is pretty exactely what stands in the FixedLogicrateGame description :wink:





Fixed frame rate would be, that you never have more than 100 fps for example

Paigan said:

Docu says about setLogicTicksPerSecond():
"This should not be called prior to the application being start() -ed."


did you try to set the ticks per second internally (i.e. in the initSystem()  method) ? note that prior of calling the start() method the timer isn't initialized. actually i think the setLogicTicksPerSecond() should be protected if it isn't intended for external use.