Conversation
…added to ShapeMath.cs
Feat: AdapativeFpsLimiter started Refactor: GameGameloop.cs updated to use ShapeMath time conversion functions and const members.
Refactor: GameWindow Min and MaxFramerate properties removed. Docs: GameWindow AdaptiveFpsLimiter xml summary added. Feat: AdaptiveFpsLimiter is now set up properly using WindowSettings in GameWindow constructor. Refactor: WindowSettings Min and MaxFramerate properties removed and AdaptiveFpsLimiter.Settings property added.
…t yet implemented) Refactor: GameGameloop some minor clean up.
…s in GameGameloop.cs
… frameTime based detection.
Refactor: GameGameloop clean up.
…olation calculation.
Refactor: Settings related members renamed and change to public.
… excessive delays
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an adaptive FPS limiter system that dynamically adjusts the target framerate based on measured performance. The system replaces the static MinFramerate and MaxFramerate properties in WindowSettings with a more sophisticated AdaptiveFpsLimiterSettings configuration.
- Adds a new
AdaptiveFpsLimiterclass with configurable settings for dynamic framerate adjustment - Introduces time conversion utility functions and double-precision interpolation methods to
ShapeMath - Removes fixed min/max framerate constraints from
WindowSettingsandGameWindow, replacing them with the adaptive limiter
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| ShapeEngine/StaticLib/ShapeMath.cs | Adds time conversion constants and functions (nanoseconds/milliseconds/seconds), plus double-precision lerp and exponential decay functions |
| ShapeEngine/Core/Structs/WindowSettings.cs | Replaces MinFramerate and MaxFramerate fields with AdaptiveFpsLimiterSettings configuration |
| ShapeEngine/Core/GameWindow.cs | Removes min/max framerate properties and associated validation logic; integrates AdaptiveFpsLimiter instance |
| ShapeEngine/Core/GameDef/GameGameloop.cs | Adds FrameTime property and integrates adaptive limiter updates into the game loop |
| ShapeEngine/Core/AdaptiveFpsLimiter.cs | New file implementing the adaptive FPS limiting algorithm with configurable presets and runtime adjustment logic |
| Examples/Program.cs | Updates example to use new AdaptiveFpsLimiterSettings instead of separate min/max framerate fields |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Simple system that can be enabled for a more situational aware fps limiting. Can be used in capped and uncapped fps mode. Min and Max Framerate settings were removed from the WindowSettings. AdaptiveFpsLimiterSettings now hold Min and Max limits instead.
The fps limiter tries to set the fps limit to what the current frame time (time the current frame took) allows (with some adjustable tolerances). It will reduce the frame rate if the system cant keep up and will increase it again when there enough remaining frame time that allows a safe increase. If too many consecutive slow downs happen, raising the fps limit will be on a cooldown to not have a constantly changing framerate.
This system can be completely disabled. If it does not prove useful in the future it also can easily be removed again.