🎨 Palette: Improve Game Loop Efficiency#12
Conversation
Refactors the main game loop to use a single, blocking `poll()` call with a dynamic timeout. The previous implementation used an inefficient busy-wait pattern with a non-blocking `poll()` and a fixed `std::this_thread::sleep_for()`. This caused high CPU usage and unnecessary wakeups. This change calculates the remaining time until the next tick and uses it as the timeout for `poll()`, allowing the process to sleep efficiently. This significantly reduces CPU consumption and improves input responsiveness, enhancing the overall user experience. Co-authored-by: aidasofialily-cmd <247843425+aidasofialily-cmd@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Adds a "Press any key to start..." prompt to improve the initial user experience. - Refactors the main game loop to use a more efficient and responsive `poll()`-based timer. - Fixes the CI workflow to correctly build and test the C++ project. Co-authored-by: aidasofialily-cmd <247843425+aidasofialily-cmd@users.noreply.github.com>
💡 What: Refactored the main game loop to use a single, blocking
poll()call with a dynamically calculated timeout. This replaces the previous inefficient busy-wait loop that combined a non-blockingpoll()with a fixedsleep_for().🎯 Why: The original implementation caused unnecessary CPU wakeups, leading to high resource consumption and potentially laggy input. The new approach allows the OS to sleep the process efficiently, reducing CPU usage and making the game feel more responsive. This is a non-visual UX improvement focused on performance and smoothness.
♿ Accessibility: While not a direct accessibility feature, reducing CPU load can improve the experience for users on low-power devices or those running assistive technologies that are sensitive to system performance.
PR created automatically by Jules for task 15303406226419221875 started by @aidasofialily-cmd