29
Dec
13

Adding CGA to Bob’s Fury

Bob's Fury Title Screen

Bob’s Fury Title Screen

As a small project I decided to add CGA graphics capability to my DOS platform game, Bob’s Fury. I have already implemented EGA, VGA (mode 13h) and VESA (640×400) modes. I had hoped to be able to run the game on older machines including 286 class machines as a minimum specification. The trouble being that the EGA mode tends to be a bit slower because of the way its video memory is laid out (planar mode). VGA mode 13h works quite well, but machines of that vintage do not necessarily have a VGA card.

Bob's Fury gameplay

Bob’s Fury Gameplay

Early 286 machines were about 6-8Mhz, but had speed advantage over 8086/8088 machines because of being a more advanced processor. Later 286 machines got to about 16-20Mhz on average, but as high as 25Mhz about the time the 386 came out. This makes the 286 class an interesting beast as performance can vary quite a bit not only based on the processor, but also the speed of the RAM and chipset. It also spanned quite a change in graphics capability as it started when CGA was standard and lived until the early days of VGA.

Hence my desire to add CGA support.

EGA Screenshot

EGA Screenshot

I haven’t written my own graphics drivers for the game, partly because that’s tones of work especially if you want to support multiple video cards. I’m using Borland’s Turbo Pascal 6.0 and I used the Graph unit built-in. It uses drivers stored in BGI files so you can write an application that works with a number of video cards and modes. This has made the programming relatively easy to add new graphics modes, which is part of the reason I started adding support for older cards. I have heard the disadvantage of the BGI/Graph system is that is can be slower performance wise compared with assembly code.

My main problem adding CGA support is the same as before, converting my existing VGA artwork to a 4 colour palette. I had solved this problem for 16 colours when I initially added EGA support with a horizontally doubled resolution, but because the only CGA modes with colour are 320×200 I wasn’t going to be able to do the exact same thing again.

CGA in game.

CGA in-game.

I eventually worked out technique that I’m happy with. It’s a little bit more complex than the technique for EGA because of the very limited number of colours. I allocate CGA colours to the most commonly used VGA ones, then using the neighbouring pixels work out what the best CGA colour would be for the remaining VGA colours.

Whoa thats a lot of green!

Whoa that’s a lot of green!

The end result is ok for CGA, but clearly not as good as the other modes. After testing I found it was quite a bit faster than EGA, but not as fast as VGA as expected. It means the game should run on a 286 of pretty much any type now. Whether they are slow or fast and have CGA,EGA, or VGA.

Advertisements

0 Responses to “Adding CGA to Bob’s Fury”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Blogs I Follow

Enter your email address to follow this blog and receive notifications of new posts by email.


Mister G Kids

A daily comic about real stuff little kids say in school. By Matt Gajdoš

Random Battles: my life long level grind

completing every RPG, ever.

Gough's Tech Zone

Reversing the mindless enslavement of humans by technology.

Retrocosm's Vintage Computing, Tech & Scale RC Blog

Random mutterings on retro computing, old technology, some new, plus radio controlled scale modelling.

ancientelectronics

retro computing and gaming plus a little more

Retrocomputing with 90's SPARC

21st-Century computing, the hard way

lazygamereviews

MS-DOS game reviews, retro ramblings and more...

%d bloggers like this: