# Graal Levels Generator

The Graal Levels Generator is a tool for generating worlds for the online RPG Graal. It converts an image where you draw the outline of the world (blue for water, green for trees etc.) into levels which are already correctly linked and aligned. This saves a lot of work because you can now concentrate on adding NPCs and implementing the story.
On the picture you see the example image which is included in the levelgen.zip file, and a map of the generated levels. You can see that you doesn't get everything 1:1 converted because the generator uses a grid-based algorithmen to map the pixels to object types. Follow these steps to generate your own world:
1. Draw the map image
First see at the included example image levelgen.png. You need to draw an image which has a width of 64*x and a height of 64*y when you want to make a world of x*y levels. The image must be saved as *.gif file or 8-bit colored *.png to get it work in the levels generator program.
For each object type there is one color:

Green - RGB(24,140,24) |  | Normal grass (not drawn)
Light green - RGB(181,239,189) |  | Green trees / forest
Blue - RGB(0,0,255) |  | Water (sea, rivers)
Maroon - RGB(128,0,0) |  | Mountains
Red - RGB(255,0,0) |  | Flowers
Light brown - RGB(150,110,0) |  | Sand
Brown - RGB(113,82,0) |  | Small sand stones
Dark gold - RGB(83,61,0) |  | Big sand stone
Dark green - RGB(0,106,0) |  | Swamp
Dark dark green - RGB(0,66,0) |  | Bushes
Cyan - RGB(0,255,255) |  | Puddle
Dark cyan - RGB(0,179,179) |  | Puddle stone

2. Generate the levels
Start GraalLevelGen.exe, select the image, output folder and worldname, and click on the [Generate World] button. If the selected image file was a correct formatted image then you should now find new levels in the output folder, named worldname_a-01.nw - worldname_z-99.nw (depending on how big the image file is).
You will also find a file worldname.gmap, this is for connecting your levels so they appear as one huge world instead of single levels. To enable that map in the offline mode you need to add an npc that calls the script function 'loadmap' like this:
`if (created) loadmap worldname;`
Another way of loading the map in offline mode is to create a file 'loadgmaps.txt' in your Graal folder and add the name of your map there, then Graal will try to load the map at startup.
To enable the map in online mode, add the name of the map to the 'gmaps=' line (comma-separated) of the server options.
3. Level editing / another round of adding stuff with the level generator
The levels generator is mainly for making an outline, after generating the levels you will need to add houses and npcs.
Because it is not possible yet to add trees & other stuff on top of mountains directly you might also want to do another round of running the levels generator program. If you run the program to generate levels that already exist then the program will read the existing levels and just add the new stuff instead of replacing the old. That way you can also add trees and bushes on top of mountains.
This image shows 3 generating steps: In the first one you make the first level of mountains, in the second you add some trees on top of the mountains, and a second level of mountains in the right upper part of the first level mountains. The last generating step adds trees on top of the second level mountains.

    ---
    Last update: 7th of March 2003