Hey guys! its been awhile 8)
So lets get into the meat of the problem as the title mention
I still didnt get it about making good game loop and heres the project
https://github.com/hadezbladez/DodgeThis_project/tree/master :point:
and heres the code
private void gameLoop(int loopingPreferences){
long now = 0; long lastTime = System.nanoTime();
long deltaTime = 0; long deltaFixComb = 0; long nanoSecond = 1000000000l;
threadSleeping(1);
while(running){
if(loopingPreferences == COMBINE_updateAndRender){
now = System.nanoTime();
deltaFixComb += ((now - lastTime) * fps) ;
lastTime = now;
systemControls(); //<< this thing handle the input from system or controller
if(deltaFixComb >= nanoSecond){
updateMechanism(loopingPreferences, 0);
renderMechanism(loopingPreferences, 0, false);
deltaFixComb -= nanoSecond;
}
if(loop_memoryProcess_Model == memorySafe){threadSleeping(1); Thread.yield();}//<< doesnt cause frameRate drops
threadSleeping(1);
}
else if(loopingPreferences == LIMITupdate_MAXIMUMrender){}
else if(loopingPreferences == SEPARATE_updateAndRender){//using this does change fps
//timings
now = System.nanoTime();
deltaTime = now - lastTime;
lastTime = now;
systemControls();
updateMechanism(loopingPreferences, deltaTime);
renderMechanism(loopingPreferences, deltaTime, false);
if(loop_memoryProcess_Model == memorySafe){threadSleeping(1); Thread.yield();}//<< optional and causing frameRate drops
}
}
}
yes, i make the game loop that doesnt catch any decimal point. at first, I thought that thing are making the game lags but, it still didnt solve anything. The green box still can get jaggy and it did look like something was off. Was the problem the render itself, my computer specification, that was the limit of java or something? i dont know. at this point, i dont have any idea fix the jaggy box thingy ??? ??? ??? ??? ???