Lode Runner(TM) 2 Level Generators
by Anthony Kozar (the "Analog Kid")
http://akozar.spymac.net/loderunner/
<anthonykozar@sbcglobal.net>
<akozar@sourceforge.net>

Version 1.1 Release
May 14, 2005


This package includes executables and the ANSI C++ source code for two programs
I've written that create game levels for Lode Runner 2.  I've written the
programs on a Mac using CodeWarrior Pro 4, but I hope that they will compile on
any modern C++ compiler.  There are two versions of this package.  One is a ZIP
archive containing Windows executables and the other is a Stuffit archive with
Macintosh applications.

The first program, "Square Creator", is the earliest working program I have for
writing LR2 levels.  It creates a square platform of the size requested with an
exit in the center and a gold piece in each corner.  Not very interesting, I
know.  But it was the first program I am aware of that demonstrates how it is
possible to *programatically* create a LR2 level.

The second program, "Maze Generator", is hopefully more exciting (if only
marginally so).  It generates a random maze of size MxN and saves this maze as
a LR2 level file.  M and N *must* be odd integers in this version (because the
algorithm counts the walls in and around the maze as part of the width and
length).  They also each should be smaller than 200.  This is a limitation in
the game itself.  Levels bigger than 200x200x200 blocks will crash LodeRunner
2.

Versions 1.0 and higher of Maze Generator add the ability to generate sets (or
"batches") of mazes in one operation.  Minimum and maximum sizes can be set for
both the column width and row height of the mazes.  And you can choose whether
each maze has a random size or whether the size increases with each level.  A
log file is written in batch mode with information and a print out of each
level created.

A final parameter -- the random seed value -- can be entered allowing the same
set of levels to be generated more than once.  If zero (0) is entered for the
seed, then the current clock time is used to seed the random number generator
instead.

There is a project file for the Metrowerks CodeWarrior compiler in each folder
(MazeGenerator.mcp and SquareCreator.mcp).  Each of these project files has
targets for building a Mac and a Windows binary.  On other compilers (such as
Visual C++), just add all of the source files to a new C++ console project, and
it will hopefully work.

LR2 level files use a different byte order on MacOS and Windows ("big endian"
vs. "little endian").  The Mac version of LR2 has no problems reading Windows
files.  But I have no idea if the reverse is true.  My programs create files
with Macintosh (big endian) byte order.  If you cannot open these files on
Windows, then please let me know, and I will rewrite the code to swap bytes
when compiling for Windows.  (There are two or three places where the code must
be changed for those who might attempt to do it themselves.  And please note,
that AFAIK, all values are 16-bit integers (2 bytes) and thus swapping each
pair of bytes turns a Mac file into a Windows file; *EXCEPT* for the first four
bytes (the "magic code") 0xD87E1B17 should all be reversed together).

Please send any feedback, bug reports, or suggestions for new algorithms or
other improvements to one of the email addresses above!


KNOWN ISSUES

The same "blue builder-world" block is used for all blocks in the levels.  This
is hard to navigate sometimes and just aesthetically unpleasant :)

While the code is commented, there is probably not enough information to infer
how to create other types of levels yet.  (Feel free to ask if you have
questions about the level file format).


POSSIBLE FUTURE DIRECTIONS

Improve the maze gen algorithm to make the levels harder to solve.  Adding
monks, gold, or obstacles/goals may make them more interesting.

Write new programs with more complex algorithms that will hopefully create
levels that are actually fun to play ! :)


VERSION INFO

1.1:
Reversed the Entrance/Exit placement in MG, making the levels considerably more
interesting and challenging.
Added license info and some error checking to SC.
Mac and Windows binaries added to archives.

1.0: (not released)
Added batch generation of levels, menu system, license info, log file in MG.
Added random seeding and fixed several problems with exit placement in MG.

Preview release (2005 Feb 18):
First public release.
Source code only.
Added #ifdefs for Mac-specific code to both MG and SC.


LEGAL INFORMATION

Basically, these programs are copyrighted by me but free to use for all
purposes.  Feel free to modify them and redistribute them as you wish as long
as you give me credit (see exact terms below).

Also, you MUST follow the requirements in the Lode Runner 2 license for
redistributing game levels.  And please DO NOT under any circumstances bug
Presage or GT Interactive about these programs !  

THESE PROGRAMS ARE NOT MADE BY OR SUPPORTED BY GT Interactive Software Corp.,
The WizardWorks Group, Inc., or any of such parties affiliates and
subsidiaries.

COPYRIGHT AND TRADEMARK ACKNOWLEDGEMENT

Lode Runner 2 Copyright (c) 1996, 1998 Presage Software Development Company.  
All rights reserved.  Lode Runner is a registered trademark owned by Douglas 
E. Smith.  Copyright (c) 1983 Douglas E. Smith.


LICENSE

Square Creator
Maze Generator
Copyright (c) 2005 Anthony M. Kozar Jr.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1.	Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer. 
2.	Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. 
3.	The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission. 

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
