I've got a thread (gameloop) in my game that is super complicated, and is built with the help of tutorials when I was still a beginner. But now that I understand a bit more, I find myself wondering why I use over 300 lines of code in my thread when this is enough:
While(true){
paint();
update();
thread.sleep(17)
}
Obviously this isnt the exact code one would use, but you probably get my point. I just dont like having something in my game that I dont understand 100%, and I hate cluttered classes that could be done with much simpler code.
So my question is, are there any downsides to using a simple loop like this? Because to me it looks like it does the job, but why would then tutorials have much more in theirs?
update()before youpaint(), that way what you see isn't 17+ milliseconds behind the game state. \$\endgroup\$