Help keep the free Atari 2600 programming episodes and code coming by supporting the channel on Patreon.
In this episode we go deeper into scan lines and their ‘ideal’ numbers, and also the design and programming of the ATARI 2600 playfield to create interesting and appealing games. We also explore how some commercial games designed their own playfields and all the different components involved in the creating rich worlds within a restricted environment.
Released:
May 19, 2021
Original Link:
Building Your Playfield on an Atari 2600
GitHub Link:
s01e05 - Building a Playfield
Welcome back everyone!
In the last episode, we talked about drawing the playfield and all the fiddly bits involved in that process. Today, we’ll continue talking about that topic, the timings involved in generating a stable screen, and differences between how the screen is rendered on a CRT television versus the Stella emulator. So let’s start with that.
As we’ve covered in a previous video, an Atari 2600 uses 192 of the total scanlines on an NTSC CRT television to display your game and 242 scanlines on a PAL CRT television, but that’s not entirely true. That’s actually just the recommended number to use for your playfield. The truth is, besides the three scanlines of vertical sync, you can generally use the rest any way you want, but there could be some issues. Just because you’re drawing scanlines doesn’t mean the television will be able to display them.
The 192 scanlines are just the recommended number because they’re generally considered to be a safe visual space for most of the CRTs in existence. In fact, all these numbers are just suggestions. If you want to add a few more or fewer scanlines to your playfield, go ahead, especially if you are only targeting your game for emulators. Emulators will display everything you give them because they don’t suffer from hardware limitations. Real CRTs, however, could become increasingly unpredictable the more you stray from the safe numbers, but you as the programmer can do your own risk assessment.
It’s not uncommon for commercial games to stray a little from safe numbers. Generally, it’s safe to produce 262 total scanlines, with 192 of those being the playfield and positioned somewhere near the centre where CRTs usually have their displayable areas. Lucky for us, the Stella emulator can display the total number of scanlines a game is generating, so we can see what we’re dealing with. Let’s open that up and run one of our example programs for this video, which is linked below.
Here you can see that we’re generating 262 total scanlines, and we have the blue box oriented in the recommended safe zone, with two periods of vertical blank as shown by the black bars at the top and bottom. Now let’s look at a few commercial games and see what they are generating.
Here we have Combat, one of my favourite games, made by Atari in 1977. It’s generating a total of 263 scanlines, so it’s well within the safe zone.
Galaxian, another Atari game made in 1983, also uses 263 scanlines.
Buck Rogers, a game made by Sega in 1983, has variable scanlines. The title screen itself sports 240 scanlines and the most annoying sound on Earth. When starting the game, the level introduction pushes out 249 scanlines and then switches to our safe 262 scanlines during actual gameplay.
This doesn’t account for the limited visible area of the screen. As we know, the safe zone on a CRT is the 192 scanlines somewhere in the middle, but many of the earlier CRTs were very curved and had large rounded corners, so you wouldn’t want to display any important information on that portion of the screen because it could be cut off or obscured. Later CRTs had more square corners, which allowed you to increase the visible portion of the playfield. However, doing so would make the game less player-friendly on those older TV sets. These days, CRTs are uncommon enough, and earlier CRTs even more so. So when making your playfield, keep your target audience in mind and design for what works for them.
I’ve included a few more basic examples demonstrating more of the playfield.
In the first example, we’re drawing a border around the safe visual portion of the screen. The top and bottom areas are much thicker than the side border. On a real CRT, the top and bottom areas would generally show up as the same thickness as the sides. Since we can’t know how many scanlines are visible on our CRT, you can extend your background colour or playfield in order to make the playfield look larger than it actually is.
For example, if your game has a blue sky, then just set the background colour to blue at the beginning of the frame, and if the top portion needs to be used for collision detection, then just draw solid lines of playfield pixels. That way, even though a lot of it won’t be visible on the screen, you generate a nice, clean, edge-to-edge playfield. Because the TIA will continue drawing whatever was last written into the registers, you don’t have to do any additional work or waste machine cycles.
However, if what you’re looking for is a boxy border, example two demonstrates how we can draw a true box around our playfield. It’s a little boring now, but add some tanks and missiles in there and you have yourself a hit game. Speaking of tanks, example three shows another feature of the TIA playfield registers used in the game Combat. In this case, we use the player colour registers to set our playfield pixels to different colours on each side of the screen. By using this technique, we don’t need to manually change colour halfway through drawing each scanline; the TIA will do that for us.
Now that we have a few examples under our belt and know a few tricks to use when drawing the playfield for a game, let’s have a look at what the professionals have done and see if we can figure out how their playfields were created. Since we’ve already talked about the game Combat a couple of times, let’s have a look at its playfield.
As you can see, the playfield is box-like, as we’ve seen in one of the examples we looked at. If we overlay some lines on the screen to represent where the 40 pixels are displayed, we can clearly see the walls are drawn in mirror mode using the 20 PF register pixels.
Now let’s have a look at Pitfall, a game made by Activision in 1982.
Right away, the only obvious use of the pixels can be seen in the placement of the tree trunks. We can see that the playfield is all in mirror mode as well. That’s not to say that the entire screen has to be in mirror mode; this can be switched with every scanline if you choose to do so. But in the case of Pitfall, it works well due to the variety of screens in quick succession. Let’s break down what’s happening on the screen a little more.
If we isolate each area of the screen we can figure out how the playfield is built.
Let’s start at the top of the screen. For now, we’ll skip past the score and timer and revisit that in another video. Here we can see that the entire top of the screen is made up of either solid green pixels or a green background. This represents the top of the trees well and remains this way on all of the different screens.
Right below that section is a thin strip creating a wavy pattern to represent the bottom of the leaves, and it includes some sprites that make use of higher resolution to draw the bottom of the tree branches.
As we’ve seen before, the tree trunks are just two pixels on a mirrored playfield giving us four trees with a bright green used for the playfield background.
Next is the surface area, and again it uses a yellow background colour and a black or blue playfield colour to build the pits and water holes. The ground is made up of a brown background with black pixels to help represent any holes visible on the surface, and for the ladder, I believe it used the higher-resolution sprites to draw the ladder.
The underground area is all black except for the occasional ladder or wall. The wall is made up of two red pixels that are changed to grey on certain scanlines, with some black sprites separating the bricks.
Moving down, we have a solid brown area to represent the surface of the underground which never changes, and below that, the Activision Copyright animation.
These screens are both simple and complex. They’re created using simple methods that are easy and quick to draw, but show their complexity in the creative way each area of the screen is built.
One interesting item that you might have missed at first glance is the two-pixel-wide black bar on the left side of the screen. This was actually used in many of the Activision games to cover up a flaw in the way the TIA draws a scanline after a horizontal move was done. In some cases, this may produce some black lines on the left side of the screen. This can be avoided in many cases, but Activision chose to obscure the problem by making that entire area black. This can be seen in many other Activision games. Personally, I think this was a great way to solve the problem, and it doesn’t take away from the quality games they produced for the Atari 2600.
One thing I think it’s important to point out here is the sheer size of the world in Pitfall. It’s amazing that it manages to fit in 255 screens in the limited memory space available on the Atari 2600. I won’t go into more detail about that in this video, but a user on Reddit has written a great article describing how it was done. I’ve added a link in the video description if you’d like to check it out.
And, well, that’s all I have for you today. I hope you found this interesting and the examples useful. As always, the code for the examples can be found on our GitHub, which is linked in the description below.
Please help out the channel by liking, commenting, and sharing this video, and if you’re new here or have not already done so, please consider subscribing to the channel to keep in touch.
Thanks for watching, and I’ll catch you next time.