Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: "Nelson Santos" Newsgroups: scee.yaroze.programming.2d_graphics Subject: Jerky graphics Date: 19 Jun 1997 05:13:34 GMT Organization: SCEA Net Yaroze News Lines: 48 Message-ID: <01bc7c89$6c62a860$6c37eccd@nsantos> NNTP-Posting-Host: ppp-annex-0626.mtl.total.net X-Newsreader: Microsoft Internet News 4.70.1155 Hello all, Does anyone know what is wrong with my game loop: ------------------------------------------------------------- for(;;) // Game loop { Pad1 = PadRead(1); MovePlayer(Pad1); if(NumHeroBullets > 0) MoveHeroBullets(); Buffer = GsGetActiveBuff(); GsSetWorkBase((PACKET *)Packet[Buffer]); GsClearOt(0,0,&OrdTab[Buffer]); GsSortFastSprite(&Hero, &OrdTab[Buffer], 0); if(NumHeroBullets > 0) { for(i=0 ; i < NumHeroBullets ; i += 1) GsSortFastSprite(&HeroBullets[i], &OrdTab[Buffer], 0); } DrawSync(0); VSync(0); GsSwapDispBuff(); GsSortClear(0, 0, 0, &OrdTab[Buffer]); GsDrawOt(&OrdTab[Buffer]); if (GameOver == TRUE) break; } ------------------------------------------------------------ This is a slimmed down version of my game loop. Whenever the ship fires any bullets (therefore having more than one sprite), the animation becomes choppy. However, if I place a printf statement anywhere in the loop before the "if(NumHeroBullets > 0)" or after the "GsDrawOt(&OrdTab[Buffer]);", no more jerkiness! With the printf statement in there I can have several sprites at once with no jerkiness. Without the printf however, 2 sprites makes the display jerky. Why? I did follow all the steps in the proper order didn't I? Please help. Nelson.