Jme gameplay responds slowly when fps is lower than 60

As the title says, jme gameplay will give a slow response to mouse, keyboard and other input hardwares when the fps is lower than 60.

Example: I’m running a game that has flycam enabled and the fps is under 60. when I try to move the camera ( with my mouse ofc) , it moves, but moves after 500 milisecs after I started moving my mouse

Edit: I’m not using Vsync, and this can be happen on JmeTestProjects.
I’m using sdk 3.0

How do i fix this?

Can you post a code snippet for how you are testing slowness?

No… it happens to all of my projects, and it sometimes happen on some jme games i downloaded.

Edit: im using sdk 3.0

Do you use vsync? Cause then 59 fps could cause the game to feel like 30.

If input is lagging then either the game is not written properly to deal with tpf or the frame drop is also just a symptom of a more significant internal slow down (say lots of garbage collection).

Else input should not drag anymore than one would expect from having a slower frame rate.

(Note: if you somehow have situations where input is not applied until the following frame then obviously a slower frame rate will exacerbate that problem.)

Do you use vsync? Cause then 59 fps could cause the game to feel like 30.

I’m not using Vsync

If input is lagging then either the game is not written
properly to deal with tpf or the frame drop is also just a symptom of a
more significant internal slow down (say lots of garbage collection).

Else input should not drag anymore than one would expect from having a slower frame rate.

(Note: if you somehow have situations where input is not applied
until the following frame then obviously a slower frame rate will
exacerbate that problem.)

Don’t know, I just knew this could happen too on jmetestprojects.

also for some reason if I use setFramerate() of appSettings, I got the response quickly :confused:

I don’t see a reason why there is “only” a slow response to your inputs. Maybe the whole application is lagging?

On my Mac I experience this problem when the JME frame rate is higher than the hardware can handle it. This causes the operating system to stutter. Try setting your frame rate to a safe level. I.e. my application is working at 20 FPS maximum, so I had to set it to 16 FPS. Now the problem is gone.

You post is too vague.
How do you know its slow ?
Are you trying to move objects and they are not moving as expected ?
Maybe you are using physics to move your objects and they are not moving ?
Did you calculate the fps on the mouse listener or something to say that ?
As I said, your post is too vague, need more information.

If you reproduce it with jmeTestProjects, I guess you can share a sample project (or simple file App) that reproduce the probleme. That will help a lot you to isolate the issue, and us to reproduce and help to fix.

@wagfeliz i’m sorry if my post is hard to be understood, I was creating this topic when I was busy.

How do you know its slow: it moves after 500milisecs after I started action that has to be moving them
Are you trying to move objects and they are not moving as expected: yes, they dont move instantly when I started the action
Maybe you are using physics to move your objects and they are not moving: they moves, but after 500 milisecs after I started the action
Did you calculate the fps on the mouse listener or something to say that: I knew the fps from the log on left bottom of the jme window.

@david_bernard_31 this testSSAO I changed gives me instant response

/*
 * Copyright (c) 2009-2012 jMonkeyEngine
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 * * Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 *
 * * Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the distribution.
 *
 * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
 *   may be used to endorse or promote products derived from this software
 *   without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package jme3test.post;

import com.jme3.app.SimpleApplication;
import com.jme3.light.AmbientLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor;
import com.jme3.post.ssao.SSAOFilter;
import com.jme3.scene.Geometry;
import com.jme3.system.AppSettings;
import com.jme3.texture.Texture;

public class TestSSAO extends SimpleApplication {

    Geometry model;

    public static void main(String[] args) {
          AppSettings settings = new AppSettings(true);
  settings.setFrameRate(30);
  TestSSAO app = new TestSSAO(); 
  app.setSettings(settings);
  app.start();
    }

    @Override
    public void simpleInitApp() {
        cam.setLocation(new Vector3f(68.45442f, 8.235511f, 7.9676695f));
        cam.setRotation(new Quaternion(0.046916496f, -0.69500375f, 0.045538206f, 0.7160271f));


        flyCam.setMoveSpeed(50);

        Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
        Texture diff = assetManager.loadTexture("Textures/Terrain/BrickWall/BrickWall.jpg");
        diff.setWrap(Texture.WrapMode.Repeat);
        Texture norm = assetManager.loadTexture("Textures/Terrain/BrickWall/BrickWall_normal.jpg");
        norm.setWrap(Texture.WrapMode.Repeat);
        mat.setTexture("DiffuseMap", diff);
        mat.setTexture("NormalMap", norm);
        mat.setFloat("Shininess", 2.0f);


        AmbientLight al = new AmbientLight();
        al.setColor(new ColorRGBA(1.8f, 1.8f, 1.8f, 1.0f));

        rootNode.addLight(al);

        model = (Geometry) assetManager.loadModel("Models/Sponza/Sponza.j3o");
        model.getMesh().scaleTextureCoordinates(new Vector2f(2, 2));

        model.setMaterial(mat);

        rootNode.attachChild(model);

        FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
        SSAOFilter ssaoFilter = new SSAOFilter(12.940201f, 43.928635f, 0.32999992f, 0.6059958f);
        fpp.addFilter(ssaoFilter);
        SSAOUI ui = new SSAOUI(inputManager, ssaoFilter);

        viewPort.addProcessor(fpp);
    }

    @Override
    public void simpleUpdate(float tpf) {
    }
}

I used setFramerate(30) of appSettings

You must be doing something wrong.
You didnt awsner if you are using physics thought.
Can you post an test case or just the lines you are using to move the objects ?

@wagfeliz it also happens on Hello Collision (with unedited version)
object (player) moves after a milisecs when the fps is under 60

If you are using hello collision I guess you are moving the objects using forces right ?
If so, I agree with you, there is something wrong with the bullet x fps, I have an old post talking about it, and I still have this same problem, the only think I could do to fix it was to use vsync and put the bullet thread at max ( 60 ).
I guess i thas something to do with the qtd of objects it has to deal in the physics tick…