Re: Best way to make a timer in python?

That depends. The time module runs straight from the system clock, so it shouldn't lag necessarily, but lag is often caused when calculations, or the number of calculations is more than the processor can handle in a given cycle. Part of the practice of optimization is to find parts of code that take a lot of cycles and optimize them to use less or run more efficiently, thus reducing lag. The time module can be used to help you pace the number of calculations and calls being used so it doesn't run the processor full throttle, and is a common technique in engine development. You could also use the timeit module for benchmarking how long it takes a piece of code to execute in a given cycle to help optimize.

Fun fact, most older dos games didn't use time management and would use loops to go as fast as the processors could allow, so while they played fine on something like a 386 at the time, as computers became more powerful they would run unplayably fast without emulation like Dosbox to throttle the number processor cycles fed to them.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : kingzombie via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : kingzombie via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : r3dux via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : r3dux via Audiogames-reflector

Reply via email to