engine: sleep between frames and fix 100% core usage