Creation/Dev/Terrain Generator: Difference between revisions

From Graal Bible
No edit summary
(fixed page to reflect new tutorial)
Line 7: Line 7:
==How To Generate and Use a Terrain Map Offline==
==How To Generate and Use a Terrain Map Offline==


'''Guide by Fowlplay4'''
‘’’Guide by [[Users:Fowlplay4|Fowlplay4]], with additional information from [[User:Stefan|Stefan]].


You can replace yourworld with anything you want below.
‘‘’Note:’’’ You can replace ‘’yourworld’’ (below) with anything you want; typically it should be set as the name of your server, unless you are developing for Graal Kingdoms.
* '''Step 1:''' Download and Run Terrain Generator
 
* '''Step 1:''' Download (On Login Server), and run the Terrain Generator (Terrain Generator.exe)
* '''Step 2:''' Change the Generator Options to your liking. (See Image Below)
* '''Step 2:''' Change the Generator Options to your liking. (See Image Below)
** Click ‘’Generate World’’ to generate a map.  (Map is generated using fractal algorithms.)
** To make an island, click on the ‘’Islands’’ present button.
** For a more detailed view, you can click on ‘’Show Level Details’’.
** To directly edit the terrain, move the mouse up and down will clicking and holding the grid.
** You may need to click ‘’Generate World’’ several times in order to find the best map.
** After you find the best map, you can take note of the random seed that is shown in the top right corner of the window.
** You can use this number / random seed to re-generate the same map in the future.  (Click on ‘’random’’, and enter the number.)


[[Image:Terraingenguide1.png|300px]]
[[Image:Terraingenguide1.png|300px]]


* '''Step 3:''' Check off "Generate Graal levels"
* '''Step 3:''' Check off "Generate Graal levels".
* '''Step 4:''' Click 'Generate World'
* '''Step 4:''' Click ‘’Generate World’’.
* '''Step 5:''' Create a Blank Folder for your New Overworld Map (See Image Below)
* '''Step 5:''' Create a Blank Folder for your New GMap (See Image Below).


[[Image:Terraingenguide2.png|300px]]
[[Image:Terraingenguide2.png|300px]]


* '''Step 6:''' Save yourworld.gmap in your new folder.
* '''Step 6:''' Save ‘’yourworld.gmap’’ in your new folder.
* '''Step 7:''' Navigate to your new overworld's folder, if done correctly you should see all the levels in the folder. (See Image Below)
* '''Step 7:''' Navigate to your new overworld's folder; if done correctly, you should see all the levels in the folder. (See Image Below)


[[Image:Terraingenguide3.png|300px]]
[[Image:Terraingenguide3.png|300px]]


* '''Step 8:''' Open yourworld_aa-01.nw
* '''Step 8:''' Open ‘’yourworld_aa-01.nw’’.
* '''Step 9:''' Lay an empty NPC on the level. (See Image Below)
* '''Step 9:''' Lay an empty NPC on the level. (See Image Below)


[[Image:Terraingenguide4.png|300px]]
[[Image:Terraingenguide4.png|300px]]


* '''Step 10:''' Give it the following script:
* '''Step 10:''' Open the NPC and copy and paste the following script:


<pre>
<pre>
Line 43: Line 51:
</pre>
</pre>


* '''Step 11:''' Close the script.
* '''Step 11:''' Make sure to change ‘’yourworld_’’ to the name of the gmap you used earlier.  Close the NPC Window / Script.
* '''Step 12:''' You should see the terrain properly with the default GK/terrain tileset.
* '''Step 12:''' You should see the terrain properly with the default [[Worlds/Graal Kingdoms|GK]] Tileset. (‘’picso.png’’)
 
To edit the terrain in the level editor, just click and drag the + symbol up or down to manipulate the elevation.
 
The overworld can then be uploaded to your server and be set up like any other gmap!
 
 
==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==
To manipulate the terrain in the level editor, just click and drag the + symbol up or down.
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
<pre>
picso.png,LEVELSTART,5,0,0
</pre>
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:
 
<pre>
//#CLIENTSIDE
function onCreated() {
  addtiledef("picso.png", "LEVELSTART", 5);
  loadmap("GMAPNAME");
}
</pre>
 
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:
 
<pre>
function onActionPlayerOnline() {
  addweapon("-Initialization");
}
</pre>


==Using different graphics==
The GMap can then be uploaded to your server and be set up and used like any other GMap!
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.

Revision as of 23:15, 16 April 2011

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

Terrain Generator.png

How To Generate and Use a Terrain Map Offline

‘’’Guide by Fowlplay4, with additional information from Stefan.

‘‘’Note:’’’ You can replace ‘’yourworld’’ (below) with anything you want; typically it should be set as the name of your server, unless you are developing for Graal Kingdoms.

  • Step 1: Download (On Login Server), and run the Terrain Generator (Terrain Generator.exe)
  • Step 2: Change the Generator Options to your liking. (See Image Below)
    • Click ‘’Generate World’’ to generate a map. (Map is generated using fractal algorithms.)
    • To make an island, click on the ‘’Islands’’ present button.
    • For a more detailed view, you can click on ‘’Show Level Details’’.
    • To directly edit the terrain, move the mouse up and down will clicking and holding the grid.
    • You may need to click ‘’Generate World’’ several times in order to find the best map.
    • After you find the best map, you can take note of the random seed that is shown in the top right corner of the window.
    • You can use this number / random seed to re-generate the same map in the future. (Click on ‘’random’’, and enter the number.)

Terraingenguide1.png

  • Step 3: Check off "Generate Graal levels".
  • Step 4: Click ‘’Generate World’’.
  • Step 5: Create a Blank Folder for your New GMap (See Image Below).

Terraingenguide2.png

  • Step 6: Save ‘’yourworld.gmap’’ in your new folder.
  • Step 7: Navigate to your new overworld's folder; if done correctly, you should see all the levels in the folder. (See Image Below)

Terraingenguide3.png

  • Step 8: Open ‘’yourworld_aa-01.nw’’.
  • Step 9: Lay an empty NPC on the level. (See Image Below)

Terraingenguide4.png

  • Step 10: Open the NPC and copy and paste the following script:
//Tutorial by fp4 
//#CLIENTSIDE 
if (created) { 
  removetiledefs; 
  addtiledef picso.png,yourworld_,5; 
  loadmap yourworld; 
}
  • Step 11: Make sure to change ‘’yourworld_’’ to the name of the gmap you used earlier. Close the NPC Window / Script.
  • Step 12: You should see the terrain properly with the default GK Tileset. (‘’picso.png’’)

To manipulate the terrain in the level editor, just click and drag the + symbol up or down.

The GMap can then be uploaded to your server and be set up and used like any other GMap!