View Issue Details

IDProjectCategoryView StatusLast Update
0011871Dwarf FortressTechnical -- Renderingpublic2022-06-01 19:09
ReporterS0ZDATEL Assigned Tolethosor  
PrioritylowSeveritytrivialReproducibilityalways
Status acknowledgedResolutionopen 
PlatformPCOSWindows 10OS Version21H2
Product Version0.47.05 
Summary0011871: Too high FPS displayed as negative.
DescriptionIf your FPS (computational frames per second) are higher than 210000 something, it starts to display as negative and goes to lover absolute value. I got about -47500 FPS.
Steps To Reproduce1) In init.txt options set FPS_CAP to 0 to remove the cap.
2) Start the game.
3) Skip the intro since it's always capped.
4) As soon as the main menu shows up, look at your FPS counter go up to about 210000 and then going negative.
Additional InformationI'm sure it have something to do with displaying FPS counter as a signed integer. Though 210000 is a strange boundary. What integer size gives you 210000 boundary? The closest I've got is 19 bits, with maximum positive of 262143. But who stores integer in 19 bits?
TagsNo tags attached.

Activities

lethosor

2022-06-01 19:09

manager   ~0041260

Last edited: 2022-06-28 11:28

(Replaced with "FPS" per standard DF terminology.)

I was able to reproduce on Linux by editing the FPS and GFPS caps in-memory with DFHack - I also needed to increase my GFPS cap to 363 or higher to see this overflow.

This part of DF actually has its source code included in the g_src folder on Linux. The relevant calculation:

void enablerst::do_update_fps(queue<int> &q, int &sum, int &last, int &calc) {
  while (q.size() > 50 && sum > 10000) {
    sum -= q.front();
    q.pop();
  }
  const int now = SDL_GetTicks();
  const int interval = now - last;
  q.push(interval);
  sum += interval;
  last = now;
  if (sum)
    calc = (int)q.size() * 1000 / sum;
}


where "calc" is the output parameter that gets displayed on-screen. It's not a single integer that's tracked, so the conditions that cause an overflow are more complicated (but it is not due to being stored as a 19-bit integer or anything like that).

Add Note

Note

Issue History

Date Modified Username Field Change
2022-05-29 09:19 S0ZDATEL New Issue
2022-06-01 18:54 lethosor Summary Too high UPS displayed as negative. => Too high FPS displayed as negative.
2022-06-01 18:54 lethosor Description Updated
2022-06-01 18:54 lethosor Steps to Reproduce Updated
2022-06-01 18:54 lethosor Additional Information Updated
2022-06-01 19:09 lethosor Note Added: 0041260
2022-06-01 19:09 lethosor Assigned To => lethosor
2022-06-01 19:09 lethosor Status new => acknowledged
2022-06-28 11:28 lethosor Note Edited: 0041260
2022-06-28 11:28 lethosor Note Edited: 0041260
2022-06-28 11:28 lethosor Note Edited: 0041260