29 | | The next step is to initialize the library. This may vary, but for rmgen, you would call `InitMap()`. |
30 | | |
31 | | === Save the results === |
32 | | |
33 | | The random map script should end with a call to `Engine.ExportMap(data)`, which returns all the map data back to the engine. In rmgen this is abstracted by a call to `ExportMap()`. For the exact format of the data see [wiki:Random_Map_Generator_Internals Random Map Generator Internals]. |
34 | | |
35 | | '''Note:''' The export map function does a coordinate conversion from the 2D used in the rmgen libs to 3D for the engine. You should only use it once, only after the map is fully generated. |
| 29 | The script has to implement a generator with the name !GenerateMap (like: `function* GenerateMap(mapSettings)`. Normally the whole map computation is done in this function. The function get's the map settings as an argument and has to `return` the map. It can repeatetly `yield` the progress (a number from 1 to 100) to update the progress bar. See [wiki:Random_Map_Generator_Internals Random Map Generator Internals] for more details. |