Creation/Dev/Level Generator

From Graal Bible

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.

Levelgendoc1.png

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 don't get everything 1:1 converted because the generator uses a grid-based algorithm to map the pixels to object types. Follow these steps to generate your own world:

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

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 add the gmap name to the text file 'loadgmaps.txt' in your Graal folder (create the file if it doesn't exist yet), 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.

Level editing

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.

Levelgendoc2.png

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.