Results 1 to 9 of 9

Thread: [v 2.3.3] Frame Skipping / Jittering

  1. #1

    Default [v 2.3.3] Frame Skipping / Jittering

    Ppl, I've been trying clanlib examples but every one keeps skipping some frames or jittering for no apparent reason. This includes my own tests.
    Anyone gotta a clue for why this would happen? The skip/jitter seems periodic. Every 2 or 3 seconds.
    My pc should be able to handle it without a problem. Did compile both Release and Debug btw.

    In my benchmarks the main loop went for 16ms most of the time but had some 30+ms periodic spikes.

    Win 7 64, AMD Phenom 2, Radeon HD 5750.



    I had similar problems with SDL and never got a fix.

    Thanks.
    Last edited by Lothiack; 10-22-2011 at 10:29 PM.

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    If it both happens with SDL and ClanLib, it is not very likely that the problem is with any of the libraries. At least they share no code, so it means two independent implementations both generate the same result on your PC. Does it happen on any other computers? If not, my guess is something is broken on yours.

    You could always try upgrade your display drivers, or any other drivers that you can find. Also might want to check in the task manager whether there's some other process that is doing something. If this doesn't help, my best guess would be some hardware component is not working as it should.

  3. #3

    Default

    I'll try other computers but is there anything else that could lead to this?
    My drivers are up to date and the PC works fine with everything I run.

  4. #4
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,343

    Default

    I once had this problem and finally figured out it was caused by an activity tracker I had installed that ran in the background. It was especially noticeable in my game because of the frame independence, after a long jump delay sprites would do this little "jump" across the screen. (It's better to cap this delta time a frame can take so this doesn't happen..)

    Not sure if that's your problem but worth mentioning.
    Seth A. Robinson
    Robinson Technologies

  5. #5

    Default

    Name:  pca1.JPG
Views: 5
Size:  93.3 KBName:  pca2.JPG
Views: 16
Size:  89.8 KBName:  pcb1.JPG
Views: 4
Size:  90.5 KBName:  pcb2.jpg
Views: 5
Size:  89.5 KB

    PCA1/2 = My pc.
    PCB1/2 = Another pc.
    600 frames measuring milliseconds per frame.

    I tried a bunch of stuff. Messing with the gpu settings, windows compatibility, process killing...
    The only change was with compatibility, where I got the skipping to almost nothing, in exchange for a nice tearing.

    I'm out of ideas. Heres some pseudo for my map and loop.

    Code:
    //Draw Map to texture.
    GenerateMap(CL_GraphicContext* gc, CL_Texture* map_texture)
    {
    	CL_FrameBuffer map_texture_buffer(*gc);
    	map_texture_buffer.attach_color_buffer(0, *map_texture);
    	gc->set_frame_buffer(map_texture_buffer);
    	gc->clear(CL_Colorf::transparent);
    
    	//Draw Map
    
    	gc->reset_frame_buffer();	
    	gc->reset_texture(0);
    }
    Code:
    CL_SetupCore setup_core;
    CL_SetupDisplay setup_display;
    CL_SetupGL setup_gl;
    
    CL_DisplayWindowDescription window_desc;
    window_desc.set_title("MapTest");
    window_desc.set_size(CL_Size(640,480),true);
    CL_DisplayWindow window(window_desc);
    
    map_texture = CL_Texture(gc,80*32,60*32,cl_rgba8);
    map_rectf = CL_Rectf(map_texture.get_size());
    
    GenerateMap(gc, map_texture);			
    
    CL_Image map_image(gc, map_texture, map_rectf);
    
    //loop
    {
    	map_rectf.translate(delta_time * xSpeed, delta_time * ySpeed);
    	map_image.draw(gc,map_rectf);
    	window.flip(1);
    	CL_KeepAlive::process(0);
    }
    //loop

  6. #6
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,343

    Default

    Well, one idea is you could try a few released Clanlib games and see if they exhibit the same problem. I would suggest www.novashell.com but it uses Clanlib V1.x and I assume you're using 2.x so not a meaningful test.

    But if SDL had the same problem, yeah, that's weird, as it's known to be pretty rock solid.
    Seth A. Robinson
    Robinson Technologies

  7. #7
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    There is Examples/Display/Timing for ClanLib 2.2 and 2.3

    I created it because of similar problems in linux. That also turned out to be something else (Compiz maybe, I cannot remember)

    It shows how to time the games using timing counters instead of counting in frames. (which you should not do anyway as the frame rate depends on the user settings)

  8. #8

    Default

    Just checked the example you mentioned. Same problem.
    I had already tried timing the game this http://clanlib.org/wiki/MainDocs:Timing

    I wonder what might be wrong with my PC. Gonna try some benchmarks and see if the problem happens there.

  9. #9

    Default

    Well, I just updated my gpu drivers, which I already did when I started coding with clanlib, and there was a minor version update and it almost fixed the problem.
    My own benchmarks, same as the graphs above, are really stable, save for a skip here or there.

    Thats good enough for me now. That constant skipping was killing me and it almost made me quit. It's really annoying to see something that should run as smooth as possible doing those glitches.

    Thanks for all the help guys. I'll post the project ASA it is in a testable state.

    Will check those benchmark programs anyway. Maybe Ill get something useful from them.

Similar Threads

  1. Cleaing the frame buffer
    By catch22 in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 06-14-2009, 04:27 PM
  2. Using one frame of multi-frame image strip, and a little bit of oddness
    By Uhfgood in forum Novashell Game Creation System
    Replies: 2
    Last Post: 07-03-2008, 02:10 AM
  3. 0.8 Added support for frame buffer
    By Trigve in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 11-18-2007, 05:17 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •