fixes for stuttering?

Posted By: Kartoffel

fixes for stuttering? - 07/24/17 19:55

Is anyone else experiencing any stuttering?

I noticed that A8 drops some frames here and there resulting in stuttering. In windowed mode this is more severe than in fullscreen mode. It seems like A8's and Window's framerate go in and out of sync periodically. Not sure if this can be fixed as the frame times don't seem to show a spike.

In fullscreen mode it's better (no periodic desync) but there's still constantly 1 frame dropped per second. I tried it with both, triplebuffer enabled and disabled, but this has no effect.

Does anybody know a way to fix this problem? In case you want to try it yourself:

Code:
#define PRAGMA_POINTER
#include <acknex.h>

void main()
{
	//d3d_triplebuffer = 1; // doesn't affect the stuttering
	
	byte UseFullscreen = false;
	
	//
	
	wait(1);
	
	if(UseFullscreen)
	{
		video_set(sys_metrics(0), sys_metrics(1), 0, 1);
	}
	else
	{
		video_set(1280, 720, 0, 2);
	}
	
	fps_max = 60;
	
	vec_set(&screen_color, vector(40, 32, 30));
	
	draw_textmode("Segoe UI Light", 0, 30, 100);
	
	//
	
	var width = 1;
	var height = screen_size.y;
	var speed = 4;
	
	VECTOR Pos;
	Pos.x = -width;
	Pos.y = 0;
	Pos.z = 0;
	
	while(!key_esc)
	{
		draw_quad(NULL, &Pos, NULL, vector(width, height, 0), NULL, vector(230, 225, 30), 100, 0);
		draw_quad(NULL, vector(cycle(Pos.x - speed, 0, screen_size.x), Pos.y, 0), NULL, vector(width, height, 0), NULL, COLOR_BLACK, 100, 0);
		
		draw_text("frametime in milliseconds:", 10, 10, vector(232, 205, 159));
		draw_text(str_for_float(NULL, dtimer() / 1000.0), 10, 40, vector(232, 205, 159));
		
		// move to the right at constant rate
		
		Pos.x += speed;
		
		while(Pos.x > screen_size.x)
			Pos.x -= screen_size.x;
		
		wait(1);
	}
	
	//
	
	sys_exit(NULL);
}


regards, Kartoffel
Posted By: Quad

Re: fixes for stuttering? - 07/25/17 20:53

It looks pretty much stable on my machine but how do you diagnose figure out frame drops?

Frame rate obviously never going to be stable, also second while is kind of useless, it can just be an if. You are going to have occasional frame rate drops and even spikes in a real world scenario, thus enter the time_step to make things look smoother.

i see a solid 16.66xxxx something frame time in your demo in both fullscreen and windowed modes.
Posted By: Quad

Re: fixes for stuttering? - 07/25/17 21:02

also it appears draw_quad calls actually draw stuff at the end of the frame, not exactly at the point where you call them, this might also appear to be causing the dropping problem.
Posted By: jumpman

Re: fixes for stuttering? - 07/26/17 01:58

Hi, if the stuttering is "consistent", meaning it always stutters at a seemingly constant rate (every 6 seconds, etc), you may want to check if any hard drive business is going on. Ive had stuttering before, and after disabling a backup software that was copying/sending data to the cloud at the time, and restarting, the stuttering stopped.
Posted By: Kartoffel

Re: fixes for stuttering? - 07/26/17 14:43

Thanks for the feedback. In my code I'm always using the time passed since the last frame for anything time-based so thats not really a problem.

I just thought maybe someone knows a way to counteract that problem. Especially the stuttering in windowed mode seemed a bit strange to me as a lot applications work very fluid in windowed mode (similar to vsync but without as much inputlag).

Does anyone know if gsync/freesync require any software specific implementation or is this a gpu & monitor only thing?
Posted By: Error014

Re: fixes for stuttering? - 07/27/17 23:33

I have noticed stuttering too on some systems I've tested Dungeon Deities on, though it does not occur on most systems.

I have no idea why that is, so I can't really help you here, but I figured maybe you'd like to hear that you're not all alone with this.
Posted By: Superku

Re: fixes for stuttering? - 07/28/17 14:47

I experience stuttering as well every now and then when my game is locked to 60fps while it could refresh at a much higher framerate. I set fps_max to let's say 90 then which makes it go away in windowed mode.

There's something in the manual about that as well:
Quote:
Some hints for decreasing the frame rate in your games
Why would you want to decrease the frame rate? There are three reasons. Your script functions might only work properly within a certain frame rate range, and fail at 1000 fps. You won't want your application to consume all the CPU cycles. And most important, you want to avoid stuttering. Stuttering means a camera and actor movement that appears unsteady. It won't be noticeable in a game with complex levels and medium frame rate, but mostly in games with almost empty levels, little content, and consequently very high frame rate that is then capped by fps_max.

The main reason for stuttering is a coarse PC scheduler resolution that leads to inaccurate task start times, especially when many tasks are running on a particular PC. This problem can be avoided by limiting the frame rate not only with fps_max that just gives task time back to the Windows task scheduler, but by really burning CPU cycles in some or the other way. Fortunately, this is easily done. If your game experiences stuttering, just place some more details in your levels for avoiding a too-high frame rate.
Posted By: Error014

Re: fixes for stuttering? - 07/29/17 16:05

Fair enough.

Btw, since I own a 144Hz-monitor: May I humbly request you set the arbitrary cap to that, so that I can enjoy your game running as smooth as possible? laugh
© 2024 lite-C Forums