Thứ Hai, 7 tháng 4, 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).

Không có nhận xét nào:

Đăng nhận xét