April 10, 2020, 07:39:41 AM

Author Topic: FUNGICIDE - Retro Game Competition Entry  (Read 3041 times)

Online Derron

  • Hero Member
  • *****
  • Posts: 2844
Re: FUNGICIDE - Retro Game Competition Entry
« Reply #15 on: February 03, 2018, 03:09:22 PM »
Works fine here ... constant 59fps.


@ 16.7 and 16
Keyframe :+ ... 16
nextFrame :+ ... 16.7

Every second loop you already skip one frame (16 + 16 = 32, 16.7+16.7=33.4) so input is not done with 60fps but a little different value. Should not really matter :p


Your loop seems to say: call "game.update()" as often as possible? Maybe the "jitter/lag" was coming from some logic code running recursively - or with wrong valus ("for x:int =0 to bigvalue").
To avoid cpu hogging I limit updates too - so I have two accumulators: update and render. Each fill up to their needs (if any). Also it is more common to have updates fixed rate and renders "flexible" (updates define positions for collisions, define states ... renders only define where they actually are to draw and then drawing them).


bye
Ron

Offline Scaremonger

  • Jr. Member
  • **
  • Posts: 76
    • ITSpeedway - Ramblings of a geek!
Re: FUNGICIDE - Retro Game Competition Entry
« Reply #16 on: February 03, 2018, 07:59:54 PM »
@ 16.7 and 16
Keyframe :+ ... 16
nextFrame :+ ... 16.7

Every second loop you already skip one frame (16 + 16 = 32, 16.7+16.7=33.4) so input is not done with 60fps but a little different value. Should not really matter :p

Lol. That was me trying to figure out how often I should check for keypresses and I never got around to finding the best value.

Your loop seems to say: call "game.update()" as often as possible? Maybe the "jitter/lag" was coming from some logic code running recursively - or with wrong valus ("for x:int =0 to bigvalue").
To avoid cpu hogging I limit updates too - so I have two accumulators: update and render. Each fill up to their needs (if any). Also it is more common to have updates fixed rate and renders "flexible" (updates define positions for collisions, define states ... renders only define where they actually are to draw and then drawing them).

Good point. My loop does an update of every sprite and graphic each loop and redraw (render) at 60/s. I should be limiting the updates as there is no benefit moving something a fraction of a pixel, but I think my biggest problem is glaringly obvious now. I've missed a delay in the loop which will likely be causing a bit of CPU hogging.

I will re-work the game loop before I release a revision. Many thanks for the review; Much appreciated.

Si...
Follow me at ITSpeedway.net.

Offline meems

  • Sr. Member
  • ****
  • Posts: 310
Re: FUNGICIDE - Retro Game Competition Entry
« Reply #17 on: February 28, 2018, 09:50:25 AM »
got major lag spikes, sometimes when shooting laser

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal