Lode Runner(TM) 2 Level Generators
by Anthony Kozar (the "Analog Kid")
<anthony.kozar@utoledo.edu>
<akozar@sbcglobal.net>

First Public Preview Release
February 18, 2005


This archive includes 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.

If you are not a programmer and just want to see what all the fuss is about, try loading the files in the "example levels" folder.  These demonstrate what the typical output of these programs look like for now.  These levels may be distributed freely but may not be sold under any circumstances.

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

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.

There is a project file for Mac CodeWarrior in the "Maze Generator" folder (LodeRunner.mcp).  If you are using CW on Windows, you could use this project but would have to change the target settings appropriately.  (It probably would just be easier to start with a fresh console project file and add the files).  On other compilers (such as Visual C++), just add all of the source files to a new C++ console project.

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).


KNOWN ISSUES

Maze Generator does not seed the random number generator yet, so you always get the same level for any given dimensions.  (And levels of close sizes are similar).

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

In Maze Generator, the exit can sometimes be placed in a corner, making it inaccesible.

Byte order issues may exist on Windows.

While the code is commented, there is probably not enough information to infer how to create other types of levels yet.

I do not understand everything about the LR2 level format, so there may be errors.


POSSIBLE FUTURE DIRECTIONS

Improve the maze gen algorithm to make the levels harder to solve.

Use different types of blocks and different worlds.

Allow batch generation of maze levels.

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


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 and is exclusively licensed.  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.
