[SOLVED]Documentation unclear on code for "Hello Input System" tutorial

I’m really happy with the Jmonkey tutorials in the documentation but sometimes they’re a bit unclear for beginners.

I was going through the Hello Input System tutorial(link beneath) and the code has an analogListener and an actionListener.

When i look into the method for analogListener it has three parameters and they are String name, float value, and float tpf. But if you look inside the method it uses another variable called Speed. Its not instantiated anywhere in the code so I though it might be something like the built-in tpf variable.

I just need some understanding on what that speed variable is, the documentation does talk about it.

https://jmonkeyengine.github.io/wiki/jme3/beginner/hello_input_system.html

You have it because you extend SimpleApplication and it’s the global speed of the game.

what is the speed of a game?
is it like the frames per second?
i havent programmed any games at all so i’m a beginner.

It’s like the speed of the simulation, you multiply movements etc for speed so you can have effects like slow motion by reducing the value of speed.

If you are not interested in this, you can simply ignore it and don’t use it in your code.

1 Like

Thank you!

Lol after two years i learned something new :joy:
I thought i have to Change the tpf to fake values :smiley:

Same here :smiley:

Erm… I mean technically you can, it’s protected, but I don’t know of the ramifications of changing it. But in code it’s just multiplying tpf by 1.0 - so you could super easily reproduce this yourself without playing around with things I’ve never even heard of, are undocumented, and probably intentionally written that way as to avoid people doing this. My thinking is that if this was a thing, it would have a public method exposing it with said missing documentation.

tldr; If you want to adjust your game speed, multiply tpf by a speed float. 1.0f being “normal”, 2.0f being 2x (fast-forward) and 0.5f being half speed (slow-mo).

Well… i believe it’s fine to modify it, but anyway tpf is multiplied by speed, so you can simply use tpf and still be able to change speed to do slowmo, also because you usually want to have frame independant movements.

I’ve never really wanted to speed up or slow down a game yet, but I agree a centralised setting would make things a lot easier in that situation. Maybe one of the core devs can chime in.

Going to ping @Momoko_Fan if he doesnt mind, because im actually curious about this. Is this an effective proposition for speeding up and slowing down game-time?

I think its just a relic of jME 1/2 … Probably best not to use it

1 Like