Java game stutters faster on processor

I read a book about programming games for Android (a beginner's guide to developing Android games), and I kind of started to make my own game.

This is a java game using the frame of a book. (The book starts with creating games in java before moving to Android).

In any case, I made my game, and it runs smoothly on my laptop, which has a modest i3 2.4GHz processor, I pretty much did all my encoding and testing on it.

I got a new desktop with a 3.3 GHz i5 processor, so I decided to try my game there.

However, on my apparently much faster desktop, the game seems very volatile. It seems like a stutter, and I have no idea what causes it because I did not change any code.

My deltas are consistent on both machines, I should get smooth ~ 60 frames per second, but on the desktop it's just not smooth.

I noticed that reducing the maximum sleep time (mainly increasing the frame rate) seemed to help a little, but all my functions are based on a maximum of 60 frames per second.

I'm not so good at this level of programming (you know, with threads, etc.).

Any ideas on what might be the problem, I want to think that this has something to do with the game loop and a faster processor.

+4
source share
2 answers

, , - updateAndRender(...). , , , , , .

, , " " " beahind" .

, , " ", - . , . , , , , , .

, , "" . , , , . , , , , "". "" (4 - ), , , (15 ).

+2

Thread.sleep . - System.currentTimeMillis() , Thread.sleep(1) , System.currentTimeMillis() .

. .

+1

Source: https://habr.com/ru/post/1610526/


All Articles