Comments (16)
yeah the draw cap's not so important. Still, it looks like it should work correctly. Since this appears to be done (unless playtesting proves otherwise, I guess), I'm closing this now.
from the-powder-toy.
Does this look good? 2cb6b96
from the-powder-toy.
Does this look good? 2cb6b96
Looks right, except for two mistakes I noticed. On line 515 you put frameStart = std::max(frameStart, ...);
but it needs to be frameStart = std::max(now, ...);
, and on line 520 you forgot a * 0.95
in the computation of correctedFrameTimeAverage
.
The first error means that if you do something laggy and drop to 10 FPS for a while, then clear the current save it’ll shoot up to 300 FPS or whatever according to your computer’s capabilities until it’s caught up on all the missing frames and then it’ll drop to 60 FPS again. By maxing with now
instead of frameStart
you keep it from holding a backlog of more than 1 frame.
The second error means that even if the FPS is stable and correct, it’ll display a completely incorrect FPS estimate that never rises, only falls, and keeps falling indefinitely, approaching zero.
Also, I like the change to use nanoseconds instead of milliseconds. Makes things a little nicer than dealing with casts/rounding between float and int.
from the-powder-toy.
Oh gosh, I accidentally hit the “close” button. Oops! Reopening now.
from the-powder-toy.
Neither of your observations is correct. frameStart
is equal to now
by the time the max-ing takes place, and the 0.95 is not needed because I converted the b * f - a * (1 - f)
-typeb * f + a * (1 - f)
-type expression to a a + (b - a) * f
-type one.
from the-powder-toy.
Might be a good idea to explain that with comments.
from the-powder-toy.
Oh, good point! In that case, both issues I mentioned are resolved, but if I’m not still misunderstanding things, then that raises a different issue. The computation of frameStartTimeBlock
relies on frameStart
equaling the time the frame started at, not now
. Computing frameStartTimeBlock
with now
means that if every frame takes about 20 ms, which should result in 50 or so FPS, it’ll actually drop to exactly 30 FPS.
from the-powder-toy.
That is correct. I shot myself in the foot by reshuffling code to make way for the fpsLimit <= 2 (no limit) case. Will fix in a bit.
from the-powder-toy.
That said, somehow, it caps to 60, not 30.
from the-powder-toy.
That said, somehow, it caps to 60, not 30.
It’ll only cap to 30 if frames don’t fit in the 16 millisecond window. If they do fit, it’ll cap to 60 instead.
from the-powder-toy.
Just changing line 513 to use oldFrameStart
instead of frameStart
should do the trick, I believe.
from the-powder-toy.
Yeah that's what I'm doing, among other things.
from the-powder-toy.
Okay yeah I won't overcomplicate it. master...LBPHacker:The-Powder-Toy:better-fps-cap
from the-powder-toy.
I guess I should add that we don't care nearly as much about the "draw cap" (RPS cap? no idea) as the FPS cap. It's fine for it to be imprecise, it's only meant to give an FPS boost when you really need it.
from the-powder-toy.
Yeah github's issue-closing mechanics are not exactly intuitive.
from the-powder-toy.
Fixed by c6d6a7d.
from the-powder-toy.
Related Issues (20)
- how do you open the game do HOT 3
- Can someone put together a working MS Visual Studio project for TPT? HOT 1
- Add new elements HOT 6
- The border offset of the Textbox component in Lua is incorrect in the latest submission. HOT 2
- Request : update iOS app HOT 1
- (macOS) HTTP Error 600: Internal Client Error HOT 1
- add exe HOT 3
- .apk on f droid HOT 2
- custom android icon theming HOT 1
- FIGH health can go negative HOT 1
- I want to make multi-gpu accelerated parallel TPT HOT 3
- stamp error HOT 4
- Why Lithium does not conduct electricity? HOT 2
- E Clone HOT 2
- curl with mbedtls not working in my project,want some help ^_^ HOT 11
- Glue HOT 1
- Adding a link to the contribution guide on the github page HOT 4
- OPS savefiles (palette key) break BSON specification, preventing interoperability HOT 8
- Nvm this accidental wrong place HOT 1
- PSP 3000 powdersandbox version? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from the-powder-toy.