home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
new
/
gfx
/
misc
/
mazetest
/
readme
< prev
next >
Wrap
Text File
|
1994-11-26
|
3KB
|
75 lines
Maze Test
As an experiment to find an easy way to program a maze map
for a game, I came up with a method to store a maze without the
use of an array.
A database for a simple maze map requires just two numbers,
0 for walls and 1 for a passageway.
A single element in an array in Basic requires 4 bytes or 32
bits of memory. a simple maze requires one bit per element.
Therefore, a 100x100 array ties up 40k of memory and takes
several minutes to load in Amos. It is also a pain to program.
The same maze can be done in 2 colors on D-Paint, loads as an iff
file in Amos, and uses 1.25k of memory.
What a difference in memory savings.
How can the program read the data when stored as iff
bitplanes? Easy. Amos contains commands for reading the color
number of a location on the screen.
This demo uses an 8 color bitmap. The maze map is 320x200.
An array of this size would require 256k of memory and disk space
to store. The 8 color picture, 24k max.
You can use D-Paint to create your own maze from the demo
map. Just remember, you start at the upper left corner and don't
get closer then 5 pixtals to the edge or you will crash the
program.
There is no size limit on the maze other then chip ram. This
demo program can handle a maze of 10x10 or 10,000 x 10,000 chip
ram permitting. Just be sure that you maintain a 5 pixtal border
of color 0 to avoid a data error.
In this demo colour 0 is used for walls. Colour 7 is used to
display where you have been. The other colors are used to code
for things like doors, keys, and the dreaded robocop.
Amos can also plot colors to the screen as well as read
them. Therefore, this demo will update the map to show where you
have been.
To run the demo;
Use the mouse on the control icon to move in the maze. Look
will bring up the map. To take a key, select Get and click the
mouse on the key. It will then disappear. If you move past a key
you will lose it. To open the door select Use. You will use up a
key as the door is opened. You can also use keyboard commands
such as l,r,f,m,g,u, etc...
If you run into Robocop, turn around and go the other way.
Otherwise, the demo will end in the next move.
You are free to use the idea in programming your own dungeon
or other maze games.
Source code in ascii and AMOS are included. Sample ABK file
included as the 3-D maze is drawn from shape table data. (Bob
shapes).
Iff, contains pictures used to create ABK file in Amos. 18
strips of graphic data can be used to create any combination of
hallways that your maze map may generate.
Rooms can also be part of the maze. They will just look
weird.
Demo program by Ron Picardi.