Game Development

October 4, 2020

image/svg+xml Hey Isaac!Whats up? I'm replicating an oldXLib.h based game I madeusing web languages. I can't figure out whyit only does a single frameevery twenty seconds. Maybe itsa performanceissue? Wait - Did you justtransplant the value forusleep into the microsecondsvalue of setInterval? Yeah. Do you have anyqualifications for coding anything in anylanguage except Python?

Actually, the difference is a factor of one thousand. Usleep (c++) takes a value in microseconds (millionths), whilst setInterval (ECMAScript) takes a value in milliseconds (thousandths). This is why Xlib applications go way to fast if you don't multiply by one thousand. Because C++ is incredibly fast, recommended interval in Xlib is 20,000. Javascript being much slower, divide by 2000 rather than 1000 to get 10.

Comments

Post a comment:
Username (always anonymous!):
Content: