This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changes between Version 17 and Version 18 of Random_Map_Generator_Internals


Ignore:
Timestamp:
05/28/24 21:35:39 (3 months ago)
Author:
phosit
Comment:

Describe the generator based interface and mark some functions as deprecated because of [28093]

Legend:

Unmodified
Added
Removed
Modified
  • Random_Map_Generator_Internals

    v17 v18  
    5555== Engine-script interface ==
    5656
    57 The CMapGenerator provides a minimal interface to the random map scripts. One is a global variable `g_MapSettings` which specifies all the map settings as created by game setup. CMapGenerator also exposes some JavaScript functions:
     57After the script file is run the engine calls `GenerateMap`. `GenerateMap` is searched in the global object. The argument to `GenerateMap` is an object containing the map settings. The map settings are created by the game setup.
     58When `GenerateMap` `yield`s a it's progress (an integer from 1 to 100) the progress bar is updated accordingly.
     59The (final) `return`ed map eitherhas to be of the format described below or have a function `MakeExportable` which returns an object of that format. This is done so that libraris can do some cleanup in `MakeExportable`.
     60
     61The engine exposes some !JavaScript functions:
    5862 * `Engine.LoadLibrary(name)` - load a library, choosing the API to which a random map script will have access, e.g. "rmgen".
    59  * `Engine.ExportMap(data)` - export generated map data from the scripts to the engine.
    60  * `Engine.SetProgress(percent)` - set the map generation progress percentage, so the loading screen progress bar can be updated. Percentage must be an integer 1-100.
    6163 * `Engine.GetCivData()` - returns an array of civilization data from {{{/civs/*.json}}}, which is useful for determining civ-specific units and structures.
    6264 * `Engine.GetTemplate(templateName)` - returns an array containing the data of the requested template.
    6365 * `Engine.MaybeGC()` - possibly run the garbage collector.
     66
     67The use of this functions is deprecated. The generator based interface described above should be used.
     68 * `Engine.ExportMap(data)` - export generated map data from the scripts to the engine.
     69 * `Engine.SetProgress(percent)` - set the map generation progress percentage, so the loading screen progress bar can be updated. Percentage must be an integer 1-100.
     70There is also a global `g_MapSettings` which is also deprecated.
     71
    6472
    6573== Data format ==