Tag Info

New answers tagged

0

If you keep track of the position at last frame you can also create a line from last position to current position and do line to rectangle collision detection to see if you went though the terrain.


1

Making collision detection frame rate independent is basically impossible. While you can reasonably implement frame rate independent rigid body motion and many other simulations by multiplying by dt (delta time), actual collision detection is "impossible" to do frame rate independent. To illustrate the issue let us assume you have a small cube moving at a ...


18

You're moving the circle by one pixel per frame. It should not come as a big surprise that, if your rendering loop runs at 30 FPS, your circle will move 30 at pixels per second. You basically have three possible ways to deal with this issue: Just pick one frame rate and stick to it. That's what a lot of old-school games did — they'd run at a fixed ...


8

Your code is currently running each time a frame renders. If the frame rate is higher or lower than your specified frame rate, your results would change as the updates don't have the same timing. To solve this, you should refer to Delta Timing. The purpose of Delta Timing is to eliminate the effects of lag on computers that try to handle complex ...


5

That's because you limit your frame rate, but you only do one update per frame. So let's assume the game runs at the target 60 fps, you get 60 logic updates per second. If the frame rate drops to 15 fps, you'd only have 15 logic updates per second. Instead, try accumulating the frame time passed so far and then update your game logic once for every given ...


0

Why not just use the sf::Window::setFramerateLimit(unsigned int limit) method? That should be a lot more straightforward and it works flawlessly for me. EDIT:Just read you used it before. Gonna tell you something. Basic of rule of programmers. If it works, don't fix it.


3

You can't reliably control the FPS with functions like SDL_Delay, they call the operating sleep function, which tells the operating system "Please don't give me any CPU time for at least N miliseconds", the operating system is then free to decide: At what granularity (i.e., as you said you specify 1ms and it waits for 15ms, it has a granularity of 15ms) ...


0

I found a solution to this. Conventional glReadPixels() blocks the pipeline and waits until all pixel data are transferred.Then, it returns control to the application. Thus we can overcome this by making glReadPixels() asynchronous . glReadPixels() with Pixel buffer object (PBO) can schedule asynchronous DMA transfer and returns immediately without stall. ...


1

I have an old phone, maybe 5-6 years old. It's not quite as powerful as it needs to be to run the OS I have running on it so everything just lags... it's pretty bad. I honestly don't think my phone could run a game with a fixed time-step particularly well. But I'm on an old android so you might be completely fine if you're targeting newer iPhones (much more ...



Top 50 recent answers are included