Programs - Designer
Game Designer Pack for
MS-DOS™
Contents
Introduction
Accessing Source Code
Program Execution
Game Play Unit
Designing Units
Other Units
System Dependence
Welcome to the world of Game Designer Pack from Darkskies.
This guide outlines the programming techniques used in Game
Designer Pack and how they are implemented.
The source code is supplied on a disk labelled Game
Designer Pack Source Code. It is contained in a .zip file.
This standard is well known and any unzipper such as PKUNZIP or
WinZip will read the file format. The program is arranged into
several units. Each unit has its own task which it must perform.
The program starts by running the initialization procedure. It
then displays the welcome screen and displays the menu. Nothing
more is executed until after the menu and therefore the program
is ended and the exit procedure installed during initialization
is executed.
This procedure is responsible for setting up everything
required for the program to run. It does the following:
- Scan drives for the I/O unit.
- Enter graphics mode and set-up colours
- Initialize mouse, set sensitivity and limits and
cursor
- Installs exit procedure.
- Allocate memory for data structures
Display the welcome message along with the copyright
message on the screen and waits for the user to press a key
or button.
The entire menu procedure does very little. It sets up a
pointer to a menu structure that is composed of a linked list
created by procedures in the menu unit. It then uses the menu
unit to display the menu and act on the users choice.
It then de-allocates the menu structure to save memory and
returns to the main program.
Most of the sub-units have complex entry procedure
requirements and it is not possible to pass them from the
menu unit therefore wrappers have been written
that will allow the menu to execute the procedures.
The menu options basically are:
- Play Game
- Edit Game
- Edit Sprites
- Edit Mappings
- Edit Rooms
- Edit Plans
On execution the procedure clears up all allocated
structures and returns the user to text mode.
This unit allows the user navigate around the worlds that have
been created, exploring them, collecting the artefacts and
fighting monsters.
Obviously more than a single type of game could be played
user must select one to play.
Clears the screen and uses the get file function in the
I/O unit to retrieve the name of a game file. This file is
then loaded using the load game procedure.
This procedure opens the file whose name is passed as a
variable. It then verifies that the file is of the correct
format and reads the version number from it. It then reads
the relevant information from the file and uses the load plan
and load sprite map procedures to further populate the data
structures.
Progress Display
- The routine facilitates the passing through of the
pointer to the progress display procedure, which will
be discussed later in the plan and sprite maps
loading procedures.
Before the game can proceed the user needs to select which
icon they will be using as their character.
- Starts by clearing the screen and setting up text
displays.
- Collect all available player icons and remember what
we have.
- Repeat
- Check for key presses
- Act on key pressed
- Check for mouse movement and if applicable
select the icon that the mouse is over.
- Check for buttons pressed
- Until selection has been made or play cancelled
This is the entry that allows the user to actually play
the game.
- Check whether the user has selected an icon to play
with, if not run the choose player procedure
- Repeat
- Check for key presses
- Act on keys pressed
- Check for mouse movement
- Check for buttons pressed and move character
to that position
- Until End of Game
- Display totals screen
Go
A procedure that is passed a direction and processes that
request to find out what the program must do. Operations
include:
- Move on the current screen
- Move between screens
- Going up and down stairs only if it is
possible to traverse them.
- Collecting objects and update inventory
Refresh
This incorporates the following procedures:
Draw Frames
Draw Sprite
- Processes the whole room to draw it in its
totality
Inventory
- Updates the title and list of objects collected
- Allow the user the option of saving a game that he is
halfway through.
These units incorporate everything needed to edit an existing
game or to create a new one.
These are the little graphics that will be used to
animate the game.
e.g. the main character, walls, doors, stairs,
animals, stuff to collect
Sprite Unit
This unit
is designed to edit sprites. That is the part of
the sprite that you can see will be stored in a
separate file.
Load Image
- Opens the file specified by the parameter passed
- Checks the header and file version
- Allocates the required memory for the image
- Reads the image header
- Reads the image
Save Image
- Opens the file specified by the parameter passed
- Write header and file version
- Write image with header
Edit Sprites
The header of this procedure contains
lots of constant variables that are
defined as rectangles. This is so that
drawing and detecting whether the mouse
is in one of the rectangles is very much
easier.
- Set-up data structures.
- Check if pre-load is needed
- Repeat
- Check for key presses
- Act on any keys appropriately
- Check for mouse movement
- Check for mouse in editing areas and buttons down
and if so alter image to reflect users
directions.
- Check for mouse button click and act accordingly
- Update display of mouse position over editing
areas, or colour palette
- Until user presses escape or clicks on exit
- Update passed file name
Pre-Load
This procedure is called if the
edit sprite procedure is passed a
file name. It will load the image
from the file and refresh the
screen to indicate that the file
has been automatically loaded.
Refresh
This
procedure draws all the frames
around the drawing and editing
areas. It also draws the buttons
and the colour palette at the
bottom of the screen.
This refreshes the indicator
that shows the currently selected
colours. It also prints the
colour numbers.
This takes the small image and
repeats it many times so that a
mosaic effect is created. This
shows the user what the image
would look like when titled
together.
This reads the small image and
enlarges it to the main editing
window. This is only used in
those procedures that only change
the small image. I.e. normal
editing handles both small and
enlarged images.
Load / Save
Both of these procedures provide
an interactive interface to the
user so that he or she is able to
load or save an image easily.
-
Load Image
- Clear screen and set-up load
frames
- Save current image to memory
- Get name for file to load
- Load new image from file
- Clear screen and redraw editing
frames
- Display new image or old image if
load failed
- Enlarge and tile new image
- Update name of image on screen
-
Save Image
- Clear screen and set-up save
frames
- Save current image to memory
- Ask for file name to save as
- Save image to file
- Restore screen editing frames and
image
- Re-enlarge and tile image
- Restore name of image on screen
Editing
- Clear Pattern
Clears
the screen and all related image
data, resets the name of the
currently edited file.
- Move Image
This procedure is used to move
the entire image one pixels
worth in a certain direction.
- Save current image, except for
one pixel width on the leading
edge
- Clear current image
- Load image back, but now in the
new position.
Draw Sprites
- This is a generic procedure to draw a
table of sprites at any position on the
screen with any number of columns and
rows.
Convert BMP
- This procedure asks the user for the name
of a bitmap file and the name of a
destination sprite file and proceeds to
convert the bitmap image into a sprite.
This is so that the user could use an
alternative editor to edit images and
then import them into Game Designer.
Mapping Unit
Each game will have a resource of 255 separate
sprites there images stored in separate
files. Each separate sprite in the game will have
different properties. This means that a sprite
can be used for more than one thing in more than
one game without storing the image twice.
Load Sprite Map
Opens the file referred to by the parameter
passed
Read the file header and version
Loop for each sprite
- If a call back procedure was specified, call it
now.
- Read the sprites file name
- Load the sprites image using load image
- Read the sprites name
- Read the sprites properties
Return success or failure
Call-back procedure
This is another example of
procedures being passed as
pointers. The calling procedure
can write a procedure and pass
this procedure its address. Every
time this procedure starts to
load a new sprite it will call
the procedure pointer to by the
variable passed. This enabled the
calling procedure to display a
percentage bar of some sort. The
call back procedure need not even
exist let alone be the same for
all loading and therefore much
flexibility is extended.
Save Sprite Map
- Opens the file referred to by the parameter
passed
- Save file header and version
- Loop for each sprite
- Write the sprites file name
- Write the sprites name
- Write the sprites properties
- Return success or failure
Edit Sprite Map
- Set-up data structures.
- Repeat
- Check for key presses
- Act on any keys appropriately
- Check for mouse movement
- Check for mouse in property areas and buttons
down and if so alter properties to reflect
users directions. When appropriate call
another procedure to facilitate the altering of
the property
- Check for mouse button click and act accordingly
- Update display of mouse position over sprite
table
- Until user presses escape or clicks on exit
Properties
E.g.
a wall
The player can collect these
things, and can put them down
later
The user will be able to
navigate around the game using
one of these sprites.
The user uses this object to
make this sprite disappear
These allow the user to
navigate up or down
The user must have this object
to be able to go past, over,
through, up, down this sprite
If the player touches one of
these they can die
This object will protect the
player from being killed. I.e. if
players try to pass this point
without the object they
will die.
Refresh
Clears the screen, draws the
frames, draw the table of
sprites, updates the currently
selected sprite and draw the
current sprite maps
filename.Draw
Frames
Draw the borders and buttons
onto the screen. Draw the titles
of the sprites properties.
Update
Selected Sprite
Draw the currently selected
|