Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!

Day x+3: Project Universal Secret. Fixing Phantom

Posted by Night Lone, 14 October 2013 · 285 views

Programming C++ Game Development Irrlicht Profiling
Well, I was really Lazy on Day X+3; Fixing Phantom wasn't as hard as I figured. It is still in the code of course, but it doesn't crash the whole system. I gave the system to my mother to test it (she crashed it the first minute last time I showed her, so it seems she's a VERY good beta tester) She actually didn't crash it this time...Next step: Sister...she breaks everything she touches! :D

I took a few hours "rest" (not really but I wasn't programming) I got back and decided to see if the Phantom is making my code really slow...about 75 microseconds? according to QueryPerformanceCounter...well, I don't think that's really slow...since the standard clock() and the C++11 <chrono> kept telling me it was 0 seconds... Rendering was at a constant 1.2-0.6 milliseconds. Remember People, pre-optimizations are EVIL and this just proves to you; code that I thought would take a very long time (Phantom/collision detection) was actually really short compared to rendering a few blocks on the screen!

I had a suggestion from a friend so I think I'll spice my Journals up a bit with some generic code.
Using QueryPerformanceCounter for those who don't know how (It's really good on windows!)
//printDebug is set to True every second according to a clock() function above.
if(printDebug)QueryPerformanceCounter(&t1); //t1,t2,freq is a LARGE_INTEGER type.
evtRec->processCam(cam, clock());//This moves the camera (cam) by input of 
                                 //keyboard and mouse
vDriver->beginScene(true, true, SColor(255,100,101,140)); //generic Irrlicht Call.      
processPieces();  //Phantom Lies in here (code is a big mess in here)
   double time_span = (((double)t2.QuadPart-(double)t1.QuadPart)/freq.QuadPart)*1000000;
   //the *1000000 is to bump it from seconds to Mircoseconds
   cout<<"Cam/Pieces processes took "<< time_span<< " Microseconds \n"; 
If anyone likes reading snippets of what I did (as above) then comment! Or maybe a way to make this more entertaining for readers?