< code

TALOD Vertex Reduction November 21, 2002

What if we could dynamically change the level of detail for 3D objects? A Hardware-optimized dynamic LOD method.

IonCreation January 01, 1992

A platformer game written using Microsoft QuickBasic 4.5 for MS-DOS. Download and play it using DOSBox!


If you'd like to try it out, go here.

IonCreation Screenshot

This platformer game was written using Microsoft QuickBasic 4.5 for MS-DOS.

It features 256 color hand drawn pixel graphics. To make the sprites I created a simple pixel drawing program.

Transparency issues

This game was made in a time when we didn't have an alpha channel. Transparency was a big issue and most games simply used a flat color background. Ideally I would have used a color key, but QuickBasic didn't have that option. It did support logical operations, and that gave me an idea. If we create a mask bitmap, we can use the AND operation to clear out space for the opaque pixels followed by an OR operation to draw them in.

AND Mask
OR Mask
Mask example Sprite

The next issue was what to do when the character moved, because the background needed to be restored. To get around this problem it saves off the rectangle, using the Get function. So it looks something like:

Put (oldx%, oldy%), spriteBG ' restore the old background
Get (x%, y%)-(x+width, y+height), spriteBG() ' capture the background
Put (x%, y%), andMask, AND ' mask off the sprite
Put (x%, y%), orMask, OR ' draw opaque sprite
oldx% = x%
oldy% = y%

This meant that the sprites would flash a lot and therefore it would only move one sprite at a time to minimize the time when the background was being shown. This meant that if two sprites collided they could leave some junk on the screen. You can see it if you rush an enemy.

Palette issues

A big issue for a long time was setting up the palette. 256 color graphics is indexed, meaning the 8-bit value of the pixel is used as an index into a color palette that defines the level of red, green, and blue. To set the palette you could use the SetPalette function.

The trouble with the SetPalette function is that it was incredibly slow. This is because it waited for a vertical retrace to set the palette for a single color.

The old cathode ray tube monitors that we had back then worked by firing electrons at a phosphor screen. An electron gun would trace its way across the screen, left to right and top to bottom. When it got to the right side of the screen it would move down to the next line in a move called the horizontal retrace. When it finished the last line it would return to the top left corner in a move called the vertical retrace.

If you set the palette while the electron gun was firing at the screen it caused a conflict, which resulted in white specs flashing up on the screen. This phenomenom was creatively referred to as 'snow'. To avoid snow you had to wait for a horizontal or a vertical retrace. If you waited for a horizontal retrace then you could end up in a situation where the top half of the screen has a different color for a fraction of a second, so QuickBasic waited for the vertical refresh. In 256 color mode, that refresh happened every 1/70th of a second, about 14ms.

The problem is that if you have 256 colors to set, that meant it took at least about 3.7 seconds just to setup the colors. It wasn't until much later that I discovered the OUT command, which let me set the palette without waiting for a refresh. That's what the version that you can run in this browser uses.

You can find the color palette register reference here (external link)

Level design and operation

Going from room to room, the player's coordinates are preserved. When the player presses the down arrow while standing on a door tile, it replaces the background tiles, removes any enemies and loads the new enemies.

The switches work in a horizontal field, replacing any electric zapper tiles with background tiles. Energy potions and powerup balls add to player health and then get replaced by a background tile. Chests only get replaced if the player has at least one key in their inventory.

Enemy behavior is trivial, they move left or right until they hit a wall or the edge of the screen. If it is a Bog (the porcupine looking creature), it has gravity applied to it. If it finds itself falling, it turns around. The other enemy is called a Shilbeird and isn't subject to gravity.

If the player or a Bog intersect with a solid tile, they get teleported up on top of that tile. This works well enough for most of the platformer feel.

Tiles are 32 pixels by 20 pixels, for a total of 10x10 on screen. The 256 color mode, SCREEN 13, has a resolution of 320x200 pixels.


There is no font support, but QuickBasic did have the DRAW command, which is essentially a turtle. To have a nice variable sized font I painstakingly traced out the commands for each character, such as

W$ = "bunu3fenu2feu3bd4"
x x
x x x
x x x
x x

Each letter had to return the turtle to the bottom right point. Drawing text consisted of iterating through a string and calling the DRAW command for each letter. It would advance a pixel between each letter. This whole process wasn't very quick, which encouraged brevity.

Level Editor

Level Editor Screenshot

As a follow up project to the IonCreation game, I made this tool to make levels. The intention was that people could build out some neat levels for their friends to explore.

It was also written using Microsoft QuickBasic 4.5 for MS-DOS. It used the mouse through some third party library that added mouse support. To make it work I shrunk all the tiles to be 16x10, so the editor could display them.

If you choose the "Opponents" menu item, you can set up to four opponents. Click the mouse on the header to go back to the main editor.

You can play IonCreation directly in your browser here! You will need a keyboard to play

  • Arrow keys to move
  • Spacebar to "shoot"
  • down arrow to use switches and doors

Copyright © 2021