Just out of curiosity, what is the reason that interpolation is always -1 in SimpleGame?  I know it's hard-coded, I'm just trying to understand why it's not used?


Eg. check FixedLogicrateGame or VariableTimestepGame.

edit: To be more clear: simple game uses a timer to see how much time elapsed between frames, and uses that to update the scene. Other games might choose different techniques. Simple is "simple" cause it tries to reach a high fps, and a smoothed timer to try and prevent choppiness in movement and such, so it gives you a good idea about perfomance. But that's by no means automatically the best way to run a game.

Agreed, but since SimpleGame does use that technique wouldn't it make sense to go ahead and provide the fps for SimpleGame and leave the others to whatever they wish to use?


Well they are free aren't they? Like I said,  FixedLogicrateGame and VariableTimestepGame are examples of game types that do use it. Or am I missing something?

Sorry, I was just trying to understand why -1 is being passed to SimpleGame instead of the fps…I'm not trying to be difficult I just expected there to be some issue with passing the fps added calculation time or some other good reason why it's explicitly not there.

Not a big deal, just a curiosity. :slight_smile:


Well the interpolation value is not used, and the contract for the method is pass -1 if not used. I don't know why you'd pass the fps… maybe you mean time per frame? That'd be kind of redundant since BaseSimpleGame deratives already use the Timer class for the reason already given, and they make the render() and update() final to keep things simple, giving you no acces to these values in the first place (thus keeping things simple).

So I guess the reason to pass -1 is because it's rather useless to pass anything else, considering it'd both redundant and unusable. Need any more reasons? :smiley:

Well, one of the main reasons I brought this up was because I was looking at the flagrush tutorial and saw this:


That's just reusing a variable. It has nothing to do with the update/render system defined in AbstractGame. BaseSimpleGame doesn't do that (reusing the variable like in flagrush) because it puts it in a field value (tpf) so that classes extending it can read it too (simplegame uses it, and if you extend simplegame, so can you). The tpf is the same for updating the scene and rendering it, so the Simple* classes only use this single value rather than the render/update system.

The timer class (in the way it's used for Simple*) is not the only way to meassure the tpf. It's hardly the best way way either, nor is it always the easiest if you build a complex game. A fixed logic rate update could make things a bit easier. If you do lot's of threading in the background, you might want to go with a capped framerate. etc. It's these more advanced models, where update and/or render interpolation comes into play. You can build all these and more by extending AbstractGame (and some are already in jME), the update/render system can help you with that.

However if you want, you can start from scratch as well. I'm sure there's even weirder models people can think up, escp with multiple (virtual) cores and CPUs becoming all the rage now.

That's helpful, thank you.  I've actually written my own extension of AbstractGame and had been passing -1 since it was what SimpleGame does and was just trying to determine if there's specific performance reasons for doing so.

Thanks again,