One topic that often comes up in Playstation newsgroups is the issue of frame rate and border problems that often occur on US and Japanese games converted to run on European Playstations. This mini FAQ describes a range of frame rate related issues, including why these problems occur, and what can be done to avoid, or reduce them.
There are a few terms which need to be defined before embarking on a description of frame-rate issues. If you are happy with terms like PAL, NTSC, Frame rate, Hz, VSync/Vertical Retrace and so on, then skip this section. Otherwise, read on...
The animating pictures on a TV are created by drawing loads of still images many times per second to give the illusion of movement. The picture is drawn row by row from left to right, starting at the top left of the screen and going to the bottom, as shown by the ASCII picture below:
+-------------------------------+ |*------------1st-------------> | |-------------2nd-------------> | |-------------3rd-------------> | | | | etc. | | | | | | | |-------------last------------> | +-------------------------------+ *=Start point
After the picture has been draw, the TV moves back to the top left, and starts again. A single picture is called a "Frame". Each row is made up of loads of individual dots called "Pixels".
The refresh rate of a TV is the number of times it draws a new picture every second. It is measured in Hertz, these being, basically, "per seconds" - ie 25Hz means 25 per second.
There are 2 main formats for TV pictures in the world - these are PAL and NTSC. PAL is the format used in Europe (except France, who use a similar standard called SECAM) and Australia, and NTSC is used in America and Japan (obviously they are used in other places, but these are the places we are mainly interested in here).
A PAL TV has 312 horizontal lines in each frame and a refresh rate of 50Hz. An NTSC TV, on the other hand, has only 262 lines, but has a refresh rate of 60Hz.
After the TV has drawn a whole frame, there is a small pause while it moves back up to the top left again. This is known as the vertical retrace, and its importance will become clear soon. I'll also use the word VSync to mean pretty much the same thing.
So, what do we actually mean by frame rate? Well, for the terms of this discussion, I'll use frame rate to describe the rate at which your PlayStation draws pictures onto the TV. This is often not the same as the refresh rate of the TV, but is closely tied to it, as we shall see.
The PlayStation, like most other computers, has an area of memory called video memory. This memory isn't used by the CPU to store data, but is used by the graphics chip to determine what is displayed on the screen, so when the TV is drawing a particular pixel on the screen, the graphics chip will read the corresponding bit of video memory, and use that to set the colour of the pixel. This chunk of video memory is called a "buffer".
The vertical retrace is very important to drawing images on the screen. If your game just ran at any old frame rate, not taking the refresh rate of the TV into account, you end up with a problem - you'd get out of sync.
An example: Imagine you had a box on the screen, which you decided you wanted to move a little bit to the right. When you move it, the TV happens to be drawing a line half way through the image of the box (since you aren't taking the refresh rate of the TV into account, and are just moving it when you want). This is what the picture on the TV screen will look like...
+-------------------------------+ | | | | | +--------+ | | | | |/__ The box was moved while the TV was | | | |\ drawing this line to the screen. | +--------+ | | | | | | | +-------------------------------+
Why does this happen? Well, since you moved the box while the TV was halfway through drawing it, the first half of the box is where it was before the move, but the last half is drawn as it is after the move. This results in a really horrible "tearing" effect that will ruin the look of the game.
What to do about it, then? Well, basically you need to draw your image in video memory while the TV isn't drawing anything to the screen. So, you draw it during the TV's vertical retrace. Problem solved...
...But we have a problem here. Today's games are big, complex affairs with loads of 3D graphics and things moving about all over the place. The problem is that the vertical retrace isn't anywhere near long enough to draw all that to video memory.
The solution to this, then, is to have a second bit of video memory, the same size as the first, and draw into this - since this isn't being displayed, you don't have any problems with tearing. Then all you have to do during the vertical retrace is to point the graphics chip to your prepared bit of memory, which will then get drawn next frame, while you now use the memory for the frame which has just been drawn.
This draw-swap-draw-swap cycle is called double buffering.
So, to draw the pictures on your TV, the Playstation does the following:
As we have seen, the redrawing of the game screen must be done during the vertical retrace of the TV. On an NTSC TV, this happens 60 times per second, and on a PAL TV, it happens only 50 times per second. So, any game must update the screen at some rate which is a fraction of these figures.
For example, if your (NTSC) game always takes 1/40th of a second to draw its screen, then the game must run at 30 frames per second. It can't run at 40Hz, as that isn't an exact fraction of 60Hz.
If you now take the same game and run it in PAL, then instead of redrawing 30 times per second, it can now only do 25 frames per second (a half of 50Hz). So, if you change nothing else about the game, it will run nearly 20% slower. This is what causes the slow down in PAL conversions from US and Japanese games.
There are a few ways to get around this problem, some more preferable than others.
The most obvious solution to the problem is for the PAL version to simply skip over every 5th frame, thus getting back the 20% speed loss. Visually, however, this doesn't look very nice - a definite twitching is visible in smooth moving objects, and the flow of the game is ruined.
This is a much better way to increase a game's speed. Take, for example, a racing game. Each frame, your car moves a certain distance in the 3D scene, based upon the speed of the car. If you change the relationship between speed and distance moved, you can speed the game up, by moving the car slightly further each frame. Thus the slowdown can be countered. How successful this is, is mainly down to the type of game. You can't easily do this with a beat-em-up, for example, where animation frames and movement are very finely tuned, and should be exactly tied to each other.
The most complex way to avoid the slowdown is to totally decouple the game's logic (AI, control, movement and so on) from the graphics rendering system. Instead of keying updates of the 3D world to each screen refresh, you use a different system timer and fix the logic to run at that rate. The graphics system is then free to redraw the screen as often as it can (within the vsync limits).
There are several befefits to this solution. Firstly, if your game for a time has more or less detail on screen, the frame rate can change to accommodate (getting smoother, or more jerky), without actually slowing down or speeding up the game action. Secondly, of course, it means that you can change the TV format of the game without affecting game speed. In fact, in some situations, this technique could result in a smoother game on PAL systems, since there is slightly longer to draw the frame, so you might get inside a vsync, which would be missed on an NTSC system.
Most modern PC games use a system like this, so that they can be run on many different speed PCs, with monitors which refresh at different rates, and still remain the same logical speed. It would be quite an advantage in a Quake deathmatch, if the guy with the P2 400 could move 3 times faster than the guy with the P133.
As you'll recall, PAL screens are made up of 312 lines, and NTSC screens are made up of 262 lines. Therefore, if you put a NTSC image on a PAL screen, you have quite a few lines left over. The easiest thing to do when porting NTSC games to PAL is to shift the image to the centre of the screen, and leave these extra lines at the top and bottom black.
Depends on the game. In a 2D game, avoiding the borders is a lot of work. You'd pretty much need to redraw all the graphics to be a little bit higher, or rescale them vertically slightly (but this would probably look rather nasty). In general, then, you'll find that 2D games tend to suffer from very bad border problems (take a look at the Capcom beat-em-ups and Castlevania, to see what I mean). Since the graphics no longer fill the screen, they will also tend to look a bit squashed (PAL and NTSC screens are the same physical dimensions).
In 3D, though, the problem is less severe. Since 3D images are stored as sets of points in space which get projected onto the 2D screen in real time, it is possible simply to stretch the image vertically without a loss of quality (actually, you gain quality, since you have a higher resolution filling the same space). If you've used a structured drawing or CAD package, you'll understand that you can zoom in on or stretch the image there without it getting pixelated - the same is true of 3D images.
If this is taken into account at the start of writing a game, and you make sure that you don't rely on the screen being a certain size, then it is fairly trivial to do a good PAL conversion of a game, without any borders. Unfortunately, many games aren't written like this, and retro-fitting the necessary conversions into the code is often more trouble for the software developers than it's worth. Also, of course, a PAL screen takes slightly more video RAM, and is slightly slower to render (since you're doing more pixels) than its NTSC counterpart, and so in some cases a conversion may be very tricky.
Here are a few questions that sometimes pop up on the newsgroups.
This is a question that is often asked. I've seen figures for what the eye can detect ranging from 15 to 70 images per second. I don't know what is right, but I can say that you can definitely see the difference between 30 and 60 frames per second, so I assume that anything lower than that must be incorrect.
The long answer to this question is too complex to go into in depth here. The short answer is that most video games aren't interlaced - they have a lower vertical resolution than regular video images. Therefore, you can draw a complete frame in one field, and hence get 50 fps on a PAL TV.