Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Matias Goldberg

Member Since 02 Jul 2006
Offline Last Active Yesterday, 04:18 PM
*****

Posts I've Made

In Topic: Making a "Busy Loop" not consume that much CPU (without Sleep)

18 May 2013 - 10:14 AM

Win32 threads: Sleep(0)

No God, NO!

Use SwitchToThread to yield (supported since Win XP)

Sleep( 0 ) is a terrible way of yielding. If you're looking to avoid consuming CPU cycles (i.e. lower power usage) prefer Sleep( 1 ) over Sleep( 0 )


In Topic: TCP's 3-way handshake... why not 2-way?

13 May 2013 - 02:22 PM

Ahhhhhh thanks a lot. That explains everything.

In my simplified layer both A & B start their sequence at 0. I knew tcp randomized the start, but I didn't realize both A and B (not just B) need to send their start.

 

Yeah, that answers my question. I knew I was missing something obvious.

 

Thank you very much!


In Topic: Movement speed vary on different machines

09 May 2013 - 10:45 AM

60fps in milliseconds stored as 'long' truncates to 16 from 16.666 which is highly inaccurate

Also, long(16/16.666) = 0

Anything above 60fps wouldn't be able to move (bug), anything between 58.82fps and 29.41fps would be multiplied against '1', which means the fast machine running at 58.82fps would move almost twice as fast as the machine running at 29.41fps (bug)

 

That time scaling code is completely broken.

Also, fix your timestep, and represent your time delta as a 32-bit long in microseconds, not milliseconds, and once you're multiplying/dividing, keep it as a float, not as integer.


In Topic: Is this bad?

06 May 2013 - 10:44 PM

I'd recommend using floor() rather than casting to int back and forth. The casting can be several times slower (if performance is an issue)

 

Note that floor( -3.3 ) = -4; while (int)-3.3 = -3; but floor's behavior is usually how you want snapping to work if negative numbers are possible.


In Topic: Which linux distro for 2GB HDD laptop?

30 April 2013 - 02:28 PM

What frob said.

Except for the HDD, that HW can take Debian 3.0 with KDE 3 just fine.

Also Mandrake was a good distro in it's time (now Mandriva).


PARTNERS