Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: Mike Fulton Newsgroups: scea.yaroze.programming.2d_graphics,scee.yaroze.programming.2d_graphics Subject: Re: high-res? Date: Thu, 15 Jan 1998 12:56:16 -0800 Organization: Sony Computer Entertainment America Lines: 74 Message-ID: <34BE77F0.1DFB@playstation.sony.com> References: <63vuoq$852@scea> Reply-To: mfulton@playstation.sony.com NNTP-Posting-Host: 206.41.6.40 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.0Gold (Win95; I) Xref: chuka.playstation.co.uk scea.yaroze.programming.2d_graphics:312 scee.yaroze.programming.2d_graphics:206 Clint wrote: > > Well, I haven't touched my Yaroze since summer (been busy with school and all), > but I just got the new Codewarrior so I decided to give it a go again before > break. Anyways, I'm gonna try and code a soccer game, and I'd like to do it in > the high-res mode. > > Has anyone else done any 2d games in high-res? I remember someone said that > you don't use double-buffering with high-res, and that you have to keep the > frame rate at 60fps or else everything flickers. Is this true? Would it be > hard to keep a *simple* 2d game at 60fps? > > I'll appreciate any help! > > Clint > cwk5@cornell.edu Actually, it's not absolutely necessary for the game to run at 60 fps. But first let's discuss why you'd get flicker so that we can understand how to avoid it. Also, keep in mind we're talking about big-time, whole-screen, mind-numbing flicker, not the occasional glittering pixels one normally sees on an interlaced display. On an interlaced display, the screen is alternating between odd-numbered and even-numbered scanlines every 60th of a second. The default setting for the PlayStation's graphics chip is that your drawing operations affect only the scanlines which are not currently shown. Normally when you draw at 60 fps in interlaced mode, the viewer will only see either the odd-numbered or the even-numbered scanlines of each game screen, because you're switching from one game screen to the next before all the scanlines are displayed. If you draw at rates slower than 60 fps, the problem is that you'll end up with a display where the odd-numbered scanlines come from one game screen and the even-numbered scanlines come from a different game screen, but they don't come in the proper sequence, so you get flicker and jerky movement. Let's go over that in more detail. Let's say you draw game screen #4444 and the video hardware switches to it for showing the odd-numbered scanlines of the interlaced display. But if you're not drawing at a rate of 60 fps, then when it's time to switch to the even-numbered scanlines, they still contain game screen #4443, because you have not finished creating screen #4445. Screen #4443 gets shown again instead, so you get flicker. Then when you're done creating game screen #4445, you're going ahead two screens and you get jerky movement on top of the flicker. The bottom line is, it's not pretty. However, there's another way to do it. If you set the 'dfe' field of your DRAWENV structure to 1, that will allow the GPU to draw into the scanlines currently being displayed. So both the odd-numbered scanlines and the even-numbered scanlines will be drawn, regardless of which are currently being shown. So when it comes time to switch from one set of scanlines to another, if you haven't finished creating the next game screen, then all that happens is that the viewer will see both sets of scanlines for the current game screen, instead of only one set. You'll still get your high-res display, just with a slower frame rate. The disadvantage to setting the 'dfe' field is that since the PlayStation is drawing into both sets of scanlines, the drawing operation takes longer. In some cases, it may then take longer than 1/60th second to complete, which would make running at 60 fps impossible. If this is the case, setting the 'dfe' field to 1 should be done only when you know you're not going to be running at 60 fps anyway. Mike Fulton @ SCEA