Lap Master Development Notes: 8/2/2014

Graphical Elements

My development process is a bit ad hoc. Once I have a concept, I start asking myself how to create the various graphic elements. For lapmaster, I obtained a low poly 3d model of an old fashioned race car from a web-site called 3dcadbrowser and used poser 5 to create a series of 360 overhead views to represent the orientation of the car as it turns through 360 degrees. Each bitmap is 64 by 64 pixels.

Here is code to read in a numbered series of bitmaps and store them in an array in python using pygame:

images = []   # an empty array to contain the bitmap images
NF = 360      # The total number of images to import
path = 'red'  # The folder in which the bitmap images are stored.
for f in range (NF):
    nv = len(str(f+1)
    name = path+'/fr_'
    if nv == 1:
        name += '000'
    if nv == 2:
        name += '00'
    if nv == 3:
        name += '0'
    images += [pygame.image.load(name+str(f+1)+'.png')]

To create the track, I used paintshop pro and drew a brown track on a green background. The bitmap containing the track is 1800 pixels wide and 1600 pixels high. One of the nice things about modern computers is they are very fast and have lots of memory. It is a far cry from the limitations of the commodore 64 and the Apple II days, it does not take long to blit a large bitmap onto the screen and you can let pygame do the clipping for you.

Actually, the track bitmap is not shown to the player in the game. A second version of the image is displayed. The track bitmap is used to determine when the car is on the track and when it goes off. This is done by looking at the pixel underneath the car. If it is green, we are off the track and if it is brown, we are on the track.

A second version of the track image with visual enhancements is displayed on the screen.

The second version of the track can be textured and landscape details added. The original track image serves as a "walkable mask." The detail above shows the visual track in which texture has been added. The black line across the track represents the finish line.

Program Architecture

Lapmaster 1.0 contains only two modules, main ( and car ( The car module implements a class that contains all the sprite images of the car in its various orientations. The reason for using a class is to allow for future expansion to more than one car on the track. This would be useful for a multiplayer version, or a "race against the computer" version. There are a lot of problems to be solved first, such as how to detect collisions between cars or how to implement an AI driver for the human player to race against.