Monday, 7 April 2014

timeGetTime Revealed

Work

Even though I had no power in the house until late evening, I did have the foresight to charge my mobile and my Ultrabook, plus top up my UPS to get some extra hours. Using these temporary stores of electrons, I proceeded to confirm the theory that timeGetTime() is broken. And it was!

It seems you are NOT GUARANTEED to get 1ms granularity when you call timeGetTime() and trying to get this information from the official documentation was like pulling teeth. After much ado, I discovered the granularity can be as rough as 10-15ms which means your physics would essentially freeze for 15ms before stepping to the next count. Insanity I know!  Anyhoo, long story short, I replaced this with QueryPerformanceCounter() and QueryPerformanceFrequency() and presto, I got my fine grain timer working in the microsecond range (i.e. 1 millionths of a second).  As soon as I added this, all stuttering I was able to produce on a low end laptop and a high end gaming rig completely disappeared. 


For kicks, I had also charged the Windows Surface Tablet (so I could surf the net during my emergency power session) and put the latest version of the demo on it, dialed out some (well most) of the features and was able to get a full screen 1024x768 scene running at 33 fps, complete with rendered animation and all the back-end.  Bear in mind this has a GPU score of just 112 and I managed to get a frame rate that allowed me to run around smoothly. Shocking I know, especially when you consider my previous run only got as far as 2 fps.  Naturally, I would have to do a SERIOUS amount of hacking and slashing to get Reloaded to run on such a device, but it shows the feat is 'possible'. Whether this is something to community wants to see is another matter, and we have already got early grumblings from at least one community members that 'enough is enough on performance' and that we should be adding features now.  I am pretty sure this is a minority view, and perhaps highlights one of the difficulties of coding in a democracy :)

Despite no power and little team comms, I achieved a substantial fix today making Monday a pretty good day.  Also getting some nice reports from the internal alpha testers so all the signs are good for a great next beta.  Have a meeting Tuesday morning so time for an early night (as soon as these emails are dealt with).

17 comments:

  1. Sounds great Lee.nice fix.

    ReplyDelete
  2. In a democracy the grumblings of one counts for....well...nothing, and to be honest the majority are very pleased you took it on to work on performance. It appears to have paid off...well done guy's. This will continue to pay off for you now in future.

    ReplyDelete
    Replies
    1. Indeed! Has definitely paid off. Can't wait for the next beta!

      Delete
  3. I just won a slice of pizza... then read this blog. Too much good news happening to me this week already! lol

    ReplyDelete
  4. I know I should be in the majority here that love the work that is being done to performance and I can wait for the best of the best to be complete. No rush on quality.

    ReplyDelete
  5. This is awesome news! Keep up the good work!

    ReplyDelete
  6. I hope the 1024x768 will not be a pre set for a screen resolution like the way fpsc was.I still say the screen resolution has nothing to do with the performance. if anything it does is make things on a bigger screen look blurry or fuzzy.

    ReplyDelete
    Replies
    1. oh it does affect performance actually. Hence why in most games lower resolution screens always ran faster when adjusted to a lower res.

      Delete
  7. "I still say the screen resolution has nothing to do with the performance."

    It DOES make a difference, but the difference is minimal.

    "if anything it does is make things on a bigger screen look blurry or fuzzy."

    Of course it does. It's having to smear the virtual backbuffer pixels across the larger physical screen pixels. I really don't know how anyone can NOT understand the importance of running at native resolution. Running at a lower res than native makes game look like crap.

    ReplyDelete
  8. I have always run reload with my desktop set at 1920x1080 and the graphics are great. On the latest Fri test exe which is set in setup.ini to run at 1024x768 I turned the full screen variable off for a true 1024x768 image as it would appear on a smaller monitor. I challenge you to discern the difference in the clarity of the graphics.
    With a reasonable gpu the higher resolution has no impact on the detail of the graphics. Don't look for problems that don.t exist...

    ReplyDelete
    Replies
    1. Are you serious? If your monitor's native res is 1920x1080, then running the game at 1024x768 will make it blurry and running it at 1920x1080 will make it crisp and clear. Let me demonstrate:

      http://i1130.photobucket.com/albums/m534/Clonkex/Borderlands22014-04-0909-37-09-20.png
      http://i1130.photobucket.com/albums/m534/Clonkex/Borderlands22014-04-0909-36-52-54.png

      This is the difference between running Borderlands 2 at 1360x768 (my native res) and 1024x768. Aside from being stretched, the second image is also blurry when viewed at full res.

      Delete
  9. Going by the fpsc reloaded website the beta won't be out until MID april...ooohhh the waiting.I think once all the performance issues are dealt with we'll have a solid base for all the really cool stuff to run on.I'm hoping we get support for xbox controller at least with the standalone also.

    ReplyDelete
    Replies
    1. I too would love xbox controller support... and im not talking about just setting inputs. I love how when playing fallout or skyrim as soon as i turn on my controller... it starts working right away without making any inputs.

      Delete
  10. OI leave me alone, I don't grumble :p I Usually sit with both feet in my mouth it just happens when, I need to breath that my hands are free and accidentally slip on the keyboard and punch random grumblings :p

    I am sad I can't get my hands on the conkit.

    ReplyDelete
    Replies
    1. WHAT. Was that comment meant to make sense? ;)

      Delete
  11. In my weird politically incorrect hypothetically incoherent contradicting obscured world definitively maybe

    ReplyDelete