Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - antoine2509

Pages: [1]
1
General / Re: Stutter Occurs In Application
« on: April 27, 2022, 04:48:15 pm »
Actually my initial problem comes from a game where I used a fixed time step for the physics update, and render each frame using the current time got from the globalClock and doing a linear interpolation between the previous physics state and the current one.

When reproducing the stutter problem with the little example I gave in this post, I tried to limit it to 60 fps while my computer is able to run it at 1000+ fps. When I print the fps in the terminal, they are perfectly stable, between 59.995 and 60.005, and there are no jumps in time at all. So I guess the problem can't come from there, or maybe I miss something here that you could explain?

However, today I tried to look at this bug again, and it seems to have disappeared. I can't reproduce it even with NVIDIA performance mode, that's really strange...

2
General / Re: Snake Game, detecting collision help!
« on: April 22, 2022, 10:48:30 pm »
Hello!

Could you please give some details about what is not working properly?

One thing I could guess is that the collision can be detected a bit too early because the global bounds of the sprite is a bounding rectangle around your sprite (and you can't see it if your apple texture has a transparent background).

So it means :
1) the rectangle is a rough approximation of an apple shape so you'll touch the bounding rectangle slightly before you'll touch the apple inside, especially in the corners.
2) if your sprite is not tightly fitted to the apple (there is free space between the apple and the side of the sprite), it will be even worse since the bounding rectangle is defined around the sprite.

You can either resize the rectangle of your sprite when you set the texture to better fit the apple, or define your own function for colliding the apple by approximating it with a circle for example, it will be better than a rectangle.

3
General / Re: Stutter Occurs In Application
« on: April 22, 2022, 06:03:13 pm »
(Re)hello everyone! :)

After 3 days of trying everything and right after having decided to post a first comment here, I finally got a slight amelioration...

I decided to go to Ubuntu settings > About > Software Updates > Additional Drivers

I had the last recommended driver for my graphic card :
Using NVIDIA driver metapackage from nvidia-driver-470 (proprietary, tested)
I changed it to :
Using NVIDIA driver metapackage from nvidia-driver-510 (proprietary)

After rerunning my SFML app, I noticed that the stuttering was still there, but way less frequent. Before it was happening once or twice a second, now it's about once every 5 or 6 seconds.

I continued to investigate and noticed in the NVIDIA X SERVER settings (equivalent of control panel but on Linux I suppose), that my driver modification had changed the option from NVIDIA (Performance mode) to NVIDIA On-Demand in the PRIME Profiles tab.

So I tried to revert my driver changes, came back to the initial and recommended one (470) and switched from NVIDIA Performance mode to NVIDIA On-Demand in the NVIDIA X SERVER Settings. And this has the same result, the stuttering is 10 times less frequent than before, but still there...

4
General / Re: Stutter Occurs In Application
« on: April 22, 2022, 04:08:11 pm »
Hello everyone,
I'm struggling exactly with the same issue, and for very basic lines of code. This draws a rectangle with a rectilinear uniform trajectory (analytical position based on the current frametime).

#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(1600, 900), "SFML works!");
    sf::Clock globalClock;
    sf::RectangleShape rectangle({100, 100});

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
        }

        rectangle.setPosition(globalClock.getElapsedTime().asSeconds()*sf::Vector2f(600,300));
        window.clear();
        window.draw(rectangle);
        window.display();
    }

    return 0;
}
 

I won't post any video or gif but it's exactly like what you see in these links :
https://en.sfml-dev.org/forums/index.php?topic=16449.0
http://streamable.com/9ajq63

Enabling/disabling vertical sync or setting a frame limit doesn't solve the problem.

My config is :
OS Name : Ubuntu 20.04.4 LTS
OS Type : 64 bit
GNOME Version : 3.36.8
Windowing System : X11
Processor : Intel® Core™ i9-9880H CPU @ 2.30GHz × 16
Gaphics : NVIDIA Corporation TU117GLM [Quadro T2000 Mobile / Max-Q]

I've read on different posts that it could be due to threaded optimization of Nvidia, but it seems it is off by default on Linux. At least there is no direct access to this option for all applications in NVIDIA X SERVER Settings, but if I try to set an application profile for my game I can see there is a boolean GLTHREADEDOPTIMIZATIONS and its value is false by default...

I really don't know what to do and any help would be useful :)
Thank you!


Pages: [1]
anything