How to make a proper server tick?
问题 I am trying to make a game server which updates after a certain period. import time last_time = time.time() tick = 1 time_since_last_update = 0 while True: new_time = time.time() dt = new_time - last_time time_since_last_update += dt last_time = new_time if time_since_last_update > tick: print(\"Magic happens\") time_since_last_update = 0 When I do this thing, python consumes 100% computing power on one of the cores. I don\'t really understand why is this happening and how to fix this if