About me

Vladimir Nabokov

Books
Programming
Biochemistry
Aim | Communicate

Search
 


 
   
Letters from Terra - Life in water warmed by sunlight
 
 

     
 
 

     
An example of the Trooper II MCGA enigne (hard) at work
 
 
     

Development History

When I first began programming in Pascal some years ago, I had several long term goals that I hoped would eventually be combined into a game that at the time I could only dream of making: a generalised game engine with fully functioning 8 bit graphics, integrated sound and cotrols, and mouse control. All of these I eventually realised, and the eventual product, and I still maintain my finest and epitomising creation, was Trooper II. However, the individual stages of this ambition, quite disparate, only yielded solutions quite individually and precluded most of my early work from ever achieving the grandiosity and scale of the final game. The hardest task, and the one that inspection of other's source code least prepared me for, was the establishment of a simple graphics engine. BGI graphics were incredibly frustrating, with regimented colours and puny sprite support: and I dreampt of constructing a fully functioning 8 bit sprite engine. The answer came in some simple programs (now forgotten) that I downloaded off of the web. This demonstrated that, with the correct interupts and a knowledge of the segment the graphics display resides on, a sprite engine that was fast enough for simple displays could be constructed entirely in pascal. I immediately began to experimrent with this engine, establishing in myself the basis of the workings of the palette, and how to construct sprites for oneself. I used a simple raw image editor, and built an even simpler compiler that gathered the images into uncompressed libraries. Loading the images was a simple business, reading the files character by character off of the disk and storing them in data segment arrays, greatly limiting the number that could be stored. With the combination of a simple PCX loading routine, I converted the palettes of some simple sprites to a background PCX image by eye (the original function of Canvas I) and displayed them above the background, storing the displaced image as a seperate sprite. This engine, which was tempramental and rather slow, did infact sufffice for the creation of Trooper I, my earliest non-BGI game in Pascal. Small sprites moved over the background PCX, and simple keyboard control was used to make an arcade style game. But this was far from satisfactory. The number of sprites, not to mention their size, was severely limited, and the concept of full screen drawing on every cycle of the game engine was unimaginable at the speed the engine ran at. What was required first, therefore, was the creation of a new format that would allow any size of images to be stored, palette independent. Hence, Canvas II was constructed from the original engine of Canvas I, allowing PCX images to be imported, and images drawn from scratch. The resulting designs were then saved as my own format, the .IMG standard, that I have used ever since. This consists simply of a version number byte, followed by the dimensions stored as words, and the raw image after this. Originally; and this was maintained until version 2.3; the images had a new line character after each row of data, until it was realised that this added to the size of the files and procluded loading of the images through blockread.

Next Page | Back to Graphics Engines

 
 
Letters from Terra | Updated 15th December 2004 | By Jonathan Ayling