Creation/Dev/Terrain Generator

From Graal Bible
Revision as of 05:49, 25 November 2009 by Cyan3 (talk | contribs)

The terrain generator tool can be used to generate maps for Graal which use 3D terrain.

Terraingenerator.png

Usage

Start TerrainGenerator.exe and click on 'Generate World' to see a map generated using fractal algorithms. To make an island click on the 'Islands' preset button first. For a more detailed view click on 'Show level details'. You can also directly edit the terrain by clicking on the grid and moving the mouse up/down.

Random seeds

For finding the best map you will need to click several times on the 'Generate World' button. Once you have found a good one, you can write down the random seed that is displayed in the upper right corner of the window. Using that number you can always generate the map again - click on 'random', then enter the number.

Export

Click on the save button (disc-icon) to save the generated world as .gmap file. If you enable 'Generate Graal levels' then the terrain generator will also generate all the needed level files and save them in the same folder.

Enable the map in Graal

For offline tests, add the gmap name into a file loadgmaps.txt, and put that text file into the Graal folder. Next time you are starting Graal it will automatically load the gmap if it is in the current folder or in the Graal folders. To see nice tiles you must add a tile definition: add a line

picso.png,LEVELSTART,5,0,0

to levels/tiledefs/tiledefsoffline.txt. LEVELSTART is the first part of the map name, e.g. 'myworld' in 'myworld.gmap'.

Using it online

Upload the gmap, and add a line

 gmaps=LEVELSTART

to the serveroptions. You can put several maps into the same line, separate their names with commas. You can also add several gmaps= lines. Afterwards upload the sublevels. Now you should be able to enter the map. To set the good tiles you need to call the 'addtiledef' command in a weapon script. Add a weapon called '-Initialization' (the minus for not displaying it in the weapon list), set the script to this:

//#CLIENTSIDE
function onCreated() {
  addtiledef("picso.png", "LEVELSTART", 5);
  loadmap("GMAPNAME");
}

The 'loadmap' command is not really necessary, but can speed up the entering of maps because the map is preloaded. To add that weapon script to each player, add following script to the 'Control-NPC' of your server:

function onActionPlayerOnline() {
  addweapon("-Initialization");
}

Using different graphics

If you want to replace picso.png with new tiles then just change the tiledefsoffline.txt file (for offline testing) and the '-Initialization' weapon to use your new tiles instead of 'picso.png'. Don't forget to upload the tiles to the server. Do '/find filename' on RC to see if the folder configuration is correct and people can download the file.