Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood), 1,268 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Stuttering of fast moving objects in window mode #181396
02/01/08 09:19
02/01/08 09:19
Joined: Aug 2005
Posts: 1,012
germany, dresden
ulf Offline OP
Serious User
ulf  Offline OP
Serious User

Joined: Aug 2005
Posts: 1,012
germany, dresden
Hello,

i recently discovered, that if i move objects at a steady, high! speed in the engine while running windowed mode with a static camera, the movement is not steady but stuttering. You realise this best if the object is not animated and you have a static camera looking at it from above at a distance.
I tested various fps_max, fps_min and time_smooth values - but nothing could solve this issue.
Since i believe supporting windowed mode in a game is very important, i compiled a little demo program and ran it on different pc's and let it test some people.

The result was, that 7 pc's had the stuttering to a different extend - while only 3 did notice it a little bit.

The testprogram contained the following code:

Code:

///////////////////////////////

#include <acknex.h>
#include <default.c>

// system libs
#include <stdio.h>

// debug
#include "deb.c" // debug
#include "deb.h" // debug


///////////////////////////////

function testentity()
{

deb_print("Q to start movement | R reset position");
while(!key_q){wait(1);}
while(key_q){wait(1);}

while(1)
{


vec_accelerate(my.skill1, my.skill10, vector(5,0,0), 0.5);
c_move (me, me.skill1, nullvector ,IGNORE_YOU|IGNORE_MODELS|IGNORE_MAPS|IGNORE_PASSABLE|IGNORE_SPRITES|IGNORE_PASSENTS|IGNORE_CONTENT);


wait(1);

if(key_r)
{
while(key_r){wait(1);}
vec_set(my.x,nullvector);
}

}

}



function main()
{
level_load("test.WMB");
wait(2);

video_set(800,600, 32, 2); // init video adapter

fps_max = 60;

wait(1);

ent_create("cbabe.mdl",nullvector,testentity);
}



You can download it here: http://www.ackbytes.com/upload/fpstest.zip

You can test this program or try to recreate the behaviour with the above code. The worst result i had with a university computer, where the movement was almost like stop and go.
The problem seems to be most noticable in windowed mode under the above circumstances, in fullscreen it seems to be not so present, only if you really try to find it.
This is really bothering me, because it kind of prevents fast moving objects in window mode and will mess up the whole gameplay in this case.
If it would happen only on one pc i wouldn't mind reporting this problem, but it really happend on a lot of machines.
It's really strange that it's not so noticable on some pc's while most of the testsystems revealed an extreme behaviour with the same code.
So please look into it, maybe i just did anything wrong or there is an easy way to get around. Right now i fear this is engine specific to window mode and no one reported it because its limited to windowmode, fastmoving objects, static camera. Thanks for your understanding.

Re: Stuttering of fast moving objects in window mo [Re: ulf] #181397
02/01/08 10:30
02/01/08 10:30
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Stuttering is an often reported user problem. It won't be noticeable in a professional game with complex levels that consume lots of CPU cycles, but mostly in test games with almost empty levels and no content.

The two reasons are background tasks, like disk accesses, and coarse scheduler resolution that leads to inaccurate task start times on particular PCs. The latter depends on the memory and the number of tasks running.

You can check the first reason yourself: use diag_frame to check both time_frame and time_step. Then compare the list of values in the acklog.txt. Look for sudden high values in this list. They are due to something happening on that PC. This can't be fully compensated by your script because time_step contains the time for the _last_ frame, not for the current frame. So when a disk access occurs, you have one frame freezing and the following frame a huge motion step due to a high time_step value.

Stuttering problems are why many professional games limit the frame rate not with giving task time back to the Windows task scheduler - as fps_max does - but by really burning CPU cycles in some or the other way.

Hope this helps.

Re: Stuttering of fast moving objects in window mo [Re: jcl] #181398
02/01/08 12:11
02/01/08 12:11
Joined: Aug 2005
Posts: 1,012
germany, dresden
ulf Offline OP
Serious User
ulf  Offline OP
Serious User

Joined: Aug 2005
Posts: 1,012
germany, dresden
Yes, thanks this helped a lot. I ran a quick test with 30 actors following a path in the testproject and the noticable stuttering was reduced, although it was still there if you look close enough, but i think one can live with that.

Maybe you can give any hints or clues about how to achieve this burning of CPU cycles depending on the current gamestate. So when the game needs CPU power the burning is reduced and vice versa?

Thanks again.

Re: Stuttering of fast moving objects in window mo [Re: ulf] #181399
02/01/08 12:33
02/01/08 12:33
Joined: Jan 2003
Posts: 4,305
Damocles Offline
Expert
Damocles  Offline
Expert

Joined: Jan 2003
Posts: 4,305
Maybe you could use the currenttime=timer();
As high precision clock, and create your own timestep value.

If this value is more exact than time_step,
you can use the delta value from the last timer() to calulate the
precise position, the unit has to move.


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1