Showing posts with label Game Video. Show all posts
Showing posts with label Game Video. Show all posts

Thursday, September 25, 2014

Classic DOS Pinball Games, Mode X and What they can Teach Us about Aspect Ratios

During the early to mid 1990s, several highly regarded pinball games were released for PC compatible computers running DOS.  Three prominent series of Pinball games were released during the years 1992-1995.  The first, developed by Digital Illusions, includes Pinball Dreams (1992), Pinball Fantasies (1992) and Pinball Illusions (1995).  All these were developed on the Commodore Amiga and ported to the PC by Frontline Designs.  The second series was developed by Epic Megagames, and consists of Epic Pinball (1993), Silverball (1993) and Extreme Pinball (1995).  A third series was developed by Spidersoft, and includes Pinball Dreams II (1994), Pinball Mania (1995) and Pinball World (1995).  There are also a few other notable pinball games that are not distinguished by coming from a single developer or publisher around this time.  These include Psycho Pinball (1995) and Absolute Pinball, which share the same style of gameplay as the other titles.

These games always supported non-standard VGA modes, sample-based music and were often heavily influenced by the demo-scene and European programmers who were still focused on the Commodore Amiga.  They all used an in-game display that used the full width of the screen and most of its height, with a portion of the height reserved for a display.  The tables were much taller than one screen could display.  They did not use a pseudo 3-D perspective, but all supported a high frame rate for fast, exciting action.  Most supported the Gravis Ultrasound as the ideal sound output device.

There has been debate over the proper aspect ratio for DOS games using the standard 320x200 resolution.  That resolution, as I outlined in a previous post, was a BIOS standard resolution for no less than the five (out of seven) major DOS game graphics display adapters, CGA, TGA, EGA, MCGA and VGA.  Using square pixels, the aspect ratio is 1.6:1, and this gives a letterbox effect on standard 4:3 ratio CRT monitors at the time.  If you stretch the monitor vertically, you can fill the screen but the pixels become 1.2 times as tall as they are wide.

VGA BIOS Display Mode 13h, which most VGA DOS games used, used the 320x200 resolution with an ability to display 256 colors from a palette of 262,144 colors.  The pixel information for the graphics is stored sequentially, with one pixel = one byte.  However, in addition to the aspect ratio issue, Mode 13h had its limitations, namely the fact that it could only support one full page of graphics in RAM.

A VGA card has 256KB of RAM, so the card could support four graphics pages at this resolution.  However, to do this, the card's registers had to be programmed directly.  Also, the registers that made up the display resolution could also be changed, but the values had to be reasonable lest the programmer destroy his or his user's monitors.  VGA, in its various official modes, supported 320, 360, 640 or 720 horizontal pixels and 200, 350 or 480 vertical pixels.  240 and 400 vertical pixels could be easily obtained by writing to a few registers.

Mode X, a custom VGA mode obtained by programming the registers, canonically has a 320x240 resolution at 256 colors.  The term eventually became to be appropriated for any non-standard resolution VGA mode.  320x240 was very popular for the pinball games identified above.  It is especially useful to obtain a reference for what the graphics should look like with square pixels.  Other modes like 320x350, 320x400, 320x480 and 360x480 were also popular, especially with shareware games.

360x480 at 256 colors was the maximum resolution a programmer could hope to achieve with 256KB VGA and keep to some degree of compatibility.  While it may have the RAM to display a 640x350 or 640x400 resolution at 256 colors, other technical limitations on the VGA prevent it from doing so.  Any graphics displaying in 640x350x256, 640x400x256 or 640x480x256 is always using some kind of SVGA or VESA mode.

DOSBox will stretch certain modes horizontally and this functionality cannot be totally disabled.  If no scalers in DOSBox are used, 320x200, 320x240, 360x200 and 360x240 resolutions are not scaled.  Other resolutions are stretched as follows :

320x350 to 640x350
320x400 to 640x400
320x480 to 640x480
360x350 to 720x350
360x400 to 720x400
360x480 to 720x480

If a screenshot is taken of any of the horizontally-stretched modes, the stretch effect can be removed by reducing the horizontal resolution by half using nearest neighbor interpolation.  This will eliminate every second column of pixels.  Resizing by doubling the horizontal resolution using nearest neighbore interpolation will restore those pixels.  In the screenshots below, I have eliminated any stretching by this method.

Digital Illusions' Pinball Series

Pinball Dreams and Pinball Fantasies offer two resolutions, 320x240 and 320x350.  Take a look at these screens from each game :

Pinball Dreams 320x200
Pinball Dreams 320x350
Pinball Fantasies 320x200
Pinball Fantasies 320x350
Both modes give the same amount of screen area to the status display, only the text is off-center (in relation to the status display area), in the 320x350 mode.

The great advantages of pinball games is that they almost always have a ready supply of circles which you can judge whether the aspect ratio is correct.  If a circular object looks like its diameter is the same regardless of the points of the circle measured, you are on sure ground to assume that the aspect ratio is correct.  If the object looks like the diameter is shorter between certain points compared other points, looking more like an oval, then the aspect ratio is probably incorrect.

For Pinball Dreams and Fantasies, the only difference between the 320x200 and 320x350 graphics is that the 320x350 graphics show 1.75x more of the pinball table.  Pinball tables, by their very nature, tend to be much taller than they are wide.  This will be an important point when I go on to discuss the final game in this series, Pinball Illusions.  However, this is what DOSBox displays in the 320x350 mode :

Pinball Fantasies Stretched
The game does not give the pixel dimensions of its high resolution mode in numbers.  However, comparing the two screenshots, it is apparent that no extra detail is given in the stretched screenshot.  Instead, the pixels are much more prominent and the circular objects have become ovals.  It should be clear that stretching is not correct for this mode.

If any further confirmation is required, look to the original games for the Commodore Amiga.  Pinball Fantasies (OCS/ECS PAL version) for that system uses an effective 320x262 resolution.

Pinball Fantasies Amiga OCS/ECS
Pinball Fantasies Amiga OCS/ECS
Pinball Illusions is by far the most demo-scene inspired of these three pinball games, using numerous odd-ball resolutions in its pre-game sequences.  However, for VGA cards, the pattern is almost the same.

Pinball Illusions 320x240
Pinball Illusions "360"x350 (only 336 horizontal pixels used)
If you look carefully, you can see that the right side of the screen is slightly cropped in the 320x240 mode compared to the "360"x350 mode.  The SVGA/VESA Modes follow the 360x350 mode, but only the vertical resolution is increased :

Pinball Illusions "640"x480 (only 336 horizontal pixels used)
Pinball Illusions "800"x600 (only 336 horizontal pixels used)
By the time you get to 800x600 pixels, the screen barely needs to scroll, you can see almost the whole table. On a real CRT monitor, these tables will appear centered in a narrow portion of the middle of the screen with large black borders on either side.  For all these pinball games, no stretching should be done.  If necessary, you should decrease the horizontal size on your CRT monitor until the circular objects look like circles.

Epic Megagames Pinball Series

For the first two games in Epic's series, Epic Pinball and Silverball, they are easy to deal with because they each only use a 320x240 resolution for their tables.  

Epic Pinball 320x240
Silverball 320x240
For the final game, Extreme Pinball, it only uses a 320x400 resolution, and the situation is quite different.  

Extreme Pinball 320x400
As you may have noticed, the ball and the chutes do not look like spheres.  If we stretch this resolution, we get the following : 

Extreme Pinball "640"x400

Now the ball and chutes look like spheres.  Therefore, for one set of games, stretching is not desirable, but for this game, it is.

Spidersoft Pinball Series

Pinball Dreams II was intended as the sequel for Pinball Dreams even though Spidersoft had no connection to Digital Illusions.  Since it was built using the same engine, the same graphical issues appear in it.  Pinball Mania uses the same graphics modes as Pinball Fantasies, and the same comments apply.  In short, they all look correct at their native aspect ratios, no adjustments or stretching required :

Pinball Dreams II 320x200
Pinball Dreams II 320x350
Pinball Mania 320x240
Pinball Mania 320x350
Pinball World uses a standard 320x200 mode or a 320x240 mode.  However, the ball is perfectly "circular" in the 320x200 and 320x240 modes (15x15 pixels) without any aspect ratio correction.  Unlike the earlier pinball games, Pinball World uses huge tables that are wider and taller than the screen resolution.  The ball is the same size in both modes, so the higher resolution just shows more of the table :

Pinball World 320x200
Pinball World 320x240
Other Pinball Games

Although Psycho Pinball uses a 320x240 or an odd 320x368 resolution, it follows the same pattern as Pinball Dreams.  The extra resolution merely shows more of the table, although this time more of the status bar is displayed.  No stretching should be done to its graphics.



For the final game to be detailed in this blog post, Absolute Pinball, the comments made for Psycho Pinball apply.  It offers three modes, 320x240, an odd 360x270 mode and a 320x400 mode.  First, the usual modes :

Absolute Pinball 320x240
Absolute Pinball 320x"400" (only 384 vertical pixels are used)
Like Psycho Pinball, the 320x400 resolution merely adds more visibility to the table and a larger dstatus display.  The circular objects are circular without any stretching.  For the 320x400 resolution, this is in marked contrast to Extreme Pinball, which uses the same resolution.  Last, let's consider the oddball 360x270 resolution.

Absolute Pinball "360"x270 (only 320 horizontal pixels are used)
First, despite the larger number of horizontal pixels offered by the mode, only the middle 320 pixels are used.  The status display uses a 320x62 pixel box.  This is essentially the size of the status display in the 320x400 mode.  The purpose of this mode was to allow for the same status display as enjoyed by users of the highest display resolution with more modest system requirements instead of the smaller status display.  Again, no particular stretching is required for this mode.  

Wednesday, September 17, 2014

CGA 16 Color RGB Graphics Modes

CGA RGB 16-Color Graphics Modes Introduction

The IBM Color/Graphics Display Adapter could output 16 colors via a digital color monitor connector. Because the monitor connection was digital and not encoded into an NTSC video connection like composite video, separate chroma and luma (essentially S-video) or through an RF modulator, the colors would be displayed without any demodulation.  The result was the best video quality a 13" CRT monitor could produce.

The CGA supports 40 and 80 column text, 320x200 resolution and 640x200 resolution graphics.  Even though the adapter had 16KB, the maximum number of RGB colors it could display in a graphics mode was 4 colors from the available 16 color palette.  In addition, those colors were not freely selectable because IBM used off-the-shelf TTL logic chips in its board design, which limited the board's capabilities.

That being said, CGA could show all 16 colors with the text modes.  Each text cell has a character byte and an attribute byte.  The character byte determine the pattern to show on the screen, like an A or a &.  The attribute byte determines the foreground and background color of each character.  Each text cell can show any of the two colors available (you need to turn off the blink attribute to show 16 background colors).  The new banner for this blog demonstrates the available text colors other than black (using VGA text characters).

The CGA has a ROM chip that contains the pattern data for 256 characters, originally called IBM Extended ASCII and later known as DOS Codepage 437. (Actually, it has two sets of patterns, a thin font and the default, thick font, which can be selected via jumper.)  These are the patterns contained in ROM :


These patterns get fetched and displayed by the Motorola 6845 CRTC. The BIOS programs the CRTC to display either 40 columns by 25 lines or 80 columns by 25 lines.  Each cell is 8x8 pixels, giving effective 320x200 and 640x200 resolutions.  However,  the 6845 can be programmed to show any number of columns and rows and cell size.  Even at 80x25, with 8x8 text cells, the graphics potential is very limited.

However, if you were to reduce the cell size to 8x2 pixels, you can obtain a lot more detail.  At this point, you have a 40 or 80 column screen by 100 rows.  Fortunately the CGA card and monitors of the day can handle this without breaking.  Using the ASCII characters 221 or 222, which have a pattern that is half on, half off, you can designate each cell to have to two independent colors by use of its attribute byte.  Thus ASCII character 221 or 222:



Becomes colored :



And reduced to this :


Each cell becomes the equivalent of two pixels, and with the 40 column mode, you obtain an effective 80x100 screen resolution.  However, such a mode lacks detail, so more often the 80 column mode would be used to give an effective 160x100 resolution.

One of the advantages of these modes is the ability to use multiple graphics pages.  Each 40 column screen requires 2K of video memory and each 80 column screen requires 4K of video memory. As the CGA has 16K of video memory, 8 pages are available in 40 column mode and 4 pages are available in 80 column mode.  This can eliminate screen tearing when the screen scrolls.  Unfortunately, few games actually used a scrolling screen.

The disadvantage with the 80-column mode on a true IBM CGA card and many clones is the visibility of CGA snow.  CGA snow is the random flickering lines shown on the screen.  It happens when the CPU and the CGA try to access the video RAM at the same time.  In the 40 column and graphics modes, the CGA properly interleaves CRTC and CPU accesses, but in the 80 column mode it lacks the bandwidth to seamlessly separate the two types of accesses.  The result is the IBM CGA does not read the byte correctly and some garbage is shown.

Although it doesn't require the whole amount of RAM like a graphics mode, 80-column mode requires the most bandwidth of all the modes because it is similar to a 640x200x16 color mode.  CGA snow can be avoided by only writing to RAM during the vertical retrace period (the time where the raster beam goes from the bottom to the top of the screen), but that is painfully slow with a 4.77MHz 8088 CPU.  No other video adapter generally suffers from snow.

IBM made a vague mention of a 160x100x16 mode in its PC Technical References, but did not introduce it as a BIOS mode and did not document how to use it.

All Known Games using the 16-Color CGA RGB Graphics Modes with Screenshots

Windmill Software

Windmill Software was one of the first game developers that focused on the IBM PC platform, and while their games are clones of popular arcade games, they were always done well and pushed the CGA card to its limits.  It released three games that used the 160x100 resolution mode, The Exterminator, Moon Bugs and Styx.  The Exterminator is Centipede, Styx is Klax and Moon Bugs is Phoenix with a little Defender mixed in.  While not made by Windmill, Bricks and Round 42 evoke the same spirit.  Bricks (a.k.a. Wrecking Ball) is a Breakout clone, and Round 42 is highly reminiscent of Gorf, but it is not quite as varied.

All these games were intended to be run on an IBM PC or PC/XT running at 4.77MHz with an IBM CGA card and PC Speaker sound.  They also expect the IBM PC 83-key Keyboard.  The use of F1 to fire makes much more sense when the key is at the side of the keyboard instead of at the top.  Bricks uses Caps Lock and Ins to move the paddle, and while those keys are far apart on modern keyboards, on the 83-key PC/XT and the 84-key AT keyboards they are next to each other.  While they will run on a Tandy 1000, do not expect any of them to run on an EGA or VGA card.

Most of the title screens for these games use a standard 320x200x4 CGA graphics mode or a text mode, but the real in-game gameplay uses the 160x100x16 graphics mode.

Styx








The Exterminator










Moon Bugs














Bricks

















Macrocom

Macrocom released two action-adventure games, ICON : Quest for the Ring and The Seven Spirits of RA They use a 40-column based mode, and the effective resolution is 320x200x16.  For these Legend of Zelda-like games, ASCII other than 221 was used, allowing for greater detail in the graphics.  Unfortunately, they rely on the patterns on the ROM of the IBM CGA card, clone cards often tweak the patterns slightly, and Tandys also use slightly different patterns, making the graphics look wrong when the games are played on these systems.  The games are still playable despite the errors.

The extra detail comes with a price, the programmers were limited to the top two lines of each ASCII character, and had to pick the best choice from the limited patterns available.  The Seven Spirits of RA uses the regular 320x200x4 CGA graphics mode for certain screens because it provides finer resolution.  These games should run on a PCjr., a Tandy 1000 or even with an EGA card, but will fail on a VGA card.

ICON: Quest for the Ring










The Seven Spirits of RA

















Macrocom also released a demo, one of the earliest known demos for the PC, demonstrating its graphics modes.  The pictures in these modes use both the 40 and 80 column 16 color modes.  The demo is a slideshow of static pictures, and here are all the pictures.  Pictures 7-10 use the 80 column mode, and is one of the only two known programs known to use an ASCII pattern other than 221.  The other pictures use a 40-column mode with multiple ASCII character patterns.

ICON Demo















An extremely basic game called Bandit was released, and it was a slot machine game and nothing more.

Miscellaneous Games

Bandit







An Edutainment game called Kids on Keys was released by Spinnaker Software for several systems, and when Tandy released the Tandy 1000, it licensed the game from Spinnaker and released it for the Tandy 1000.  The games included is supposed to help children learn the keys on the keyboard.  The program also contains a feature where you can edit the graphics characters used.  Instead of using a Tandy graphics mode, it used the 160x100x16 CGA mode, most likely because Tandy also released the CGA-based Tandy 1200 computer around the same time.  However, on a Tandy 1000, the game supports 3-voice music.  On a PC, it supports PC speaker sound.  Although the graphics are very blocky, they do not use an 80x100 mode.

Kids on Keys





















Level 9 Computing

Two text-based adventure games developed by Level 9 Computing, Lancelot and Scapeghost, use the 160x100 mode for graphics.  They also support other graphics adapters and show graphics in a window with the text with them, but for the 160x100x16 CGA mode, the graphics are full screen.  Essentially these games alternate between text and full color CGA graphics.  Level 9 was a U.K. company and its CGA modes were intended for the Amstrad PC-1512, a very popular PC compatible in the U.K. with a more-or-less CGA compatible video adapter.  They seem to work fine on the real CGA.

Lancelot









Scapeghost







The Final Games

The last game, from 1991, known to support 160x100x16 graphics back in the day was a shareware game called Tunneler.  In this Tank-inspired game, you had to search for your opponent with a limited view of the surrounding area.  If you look at the screenshots in detail, you will see that ASCI 176 is being used for the border around the E and S gauges.  Due to this, it is not totally a 160x100x16 game.

Tunneler












Twenty years after Tunnler, which is the last known game to use 160x100x16 CGA mode, Paladin Systems North released a Pac-Man clone for the PC called Paku Paku that uses the mode.  Originally intended as a retro computing challenge for the IBM PC, the software is free and the code is open source.  Since its release in 2011, it has gone through six revisions, adding support for the PCjr. and Tandy Graphics Adapters, EGA, MCGA and VGA.  In addition, it supports sound devices beyond the PC speaker, including PCjr/Tandy 3-voice sound, Game Blaster, Adlib and MT-32.  While it is quite a bit easier and more lenient with extra lives than the arcade original, it is still a very nice implementation that works on the IBM PC.  You can download it here : http://www.deathshadow.com/pakuPaku

Paku Paku



















Programming on the early PC platform and with the CGA card is a challenging endeavor.  A promising demo has been made recently of a game called MagicDuck.  I have found the graphics to be very impressive and the gameplay to be fairly fluid, despite the limited view and early nature of the software.

Aspect Ratio

The above screenshots use a 1.6:1 aspect ratio, although the monitors that CGA was designed to use are 1.33:1.  Fortunately, the low 160x100 resolution can scale to 800x600 and maintain a 4:3 aspect ratio without introducing unsightly artifacts.  Here is an example of these graphics as a CGA monitor or TV would show them :


Click on the image to get the full resolution.