UPS and FPS, Interpolating movement

Hello,
my game loop used to be
update
draw
paint
60 times per second
sleep till next frame
in case of oversleep skip frames, update more

It used to be smoother

now I have read that the proper way to do it is to lock UPS and do as much FPS as possible while interpolating movement
I decided to limit fps to 60 since there is no point to have more anyway, ( screen refresh rate, etc)

Now my game feels sluggish and unresponsibe
what can I do?

Code?

Using sleep to limit frames is not generally a good idea. At least that’s what most people say here.

Use sleep so that your app doesn’t hog resources.

With interpolation, you need to save the old positions of all your entities and interpolate between the old and the new positions based on normalized dt (0 to 1).

This article might be of use:

http://games.freebasic.net/BASICGaming/Issue9/index.html#tutorial1

I think the issue is that since I reduced the number of UPS from 60 to 30 the game behaves differently, even IF I change the values.
well I have to sleep to not hog resourced, But when should I sleep?
I usually sleep till the next update or render ( whichever is sooner)

I modified my moveable interface into an abstract class and made it that if you set X/Y or do MoveX/MoveY it automatically saves the previous
as well as doing lerp and stuff
It works rather good, at least movement isn’t worse than before but still not optimal, I will try to provide 2 versions, unfortunately I didn’t use a version control system, so I don’t have older code, stupid of me I know…

I have read that article, I thought interpolation was using during rendering not during updating?
I didn’t quite understand some things from that article. he claims you can use dt in fixed dt loop, but that is the way it is usually done
the alternative is to not pass a dt since it is considered constant.

The idea is to have a dt-based gameloop that updates at 60fps thereby allowing you to code in a framebased manner.

If you tried to run the examples, you’ll notice that the last part has a demo of all the 4 systems running simultaneously.

I’ve used the last type on my latest game. The caveat is that you can’t do interpolation.

Speaking of which, you interpolate during logic, store that value in a variable and use it come rendertime.

Btw, I wrote that article.

during logic you store previous x/y? and during rendering you interpolate between them no?
I still don’t understand a dt-based gameloop … allowing to code in a framebased manner.
if you update at regular intervals you have a fixed dt so it’s not frame based? am I missing something? (it’s frame based if you do exactly one render for each update and don’t interpolate I guesS)

The examples in the article has sources. You might wanna try to read them.

Here it is in java:

Note that it uses java2d so depending on your setup, things might get a little jittery.