hangman
almost-scientist
For a number of reasons, I would like to begin implementing code that makes use of the Map Mod Data, and I may convert this thread into a tutorial if I can make enough sense of it. But alas, my coding skills are more geared toward science applications than video games, so I'd like to start a discussion on it.
So getting started from Worldbuilder, we see that are two categories of map mod data: global data and plot data. Each can be of the types 'number,' 'boolean,' 'enumeration,' or 'text.' Numbers appear to be able to accept decimals, so they are not exclusive to integers. Enumerations appear to accept any of a predefined vector of numbers, which also don't need to be integers. Based on my limited experience with Civ4, the primary use for numbers would be for a predefined plot value, like if your mod had a variable that would decrease a unit's strength by a certain amount based on the plot it was in. By contrast, an enumeration would be of greater interest for selecting from a list of units, buildings, etc., like if settling different plots would grant you different free units. Booleans and texts seem straightforward so I won't discuss them here.
whoward69 explained here that global data is used to call map scripts. I imagine the global map mod data could also be useful for differentiating between multiple maps in the same mod, if there were some quantities that needed to be defined seperately, but I don't imagine it's terribly useful otherwise.
So how exactly do we implement map mod data? It's still a bit of a mystery to me, but looking at CvWorldBuilderMapLoader.cpp, we can get an idea of what should happen in LUA. Starting on line 1408 (in the BNW version), there is a function called LoadModData, which seems to be what we're looking for. The next function down deals with implementing the map script functionality of map mod data, but that seems pretty specific.
There don't seem to be any existing references to map mod data other than these two functions and a header file, so I guess the question is, what LUA function will read map mod data?
So getting started from Worldbuilder, we see that are two categories of map mod data: global data and plot data. Each can be of the types 'number,' 'boolean,' 'enumeration,' or 'text.' Numbers appear to be able to accept decimals, so they are not exclusive to integers. Enumerations appear to accept any of a predefined vector of numbers, which also don't need to be integers. Based on my limited experience with Civ4, the primary use for numbers would be for a predefined plot value, like if your mod had a variable that would decrease a unit's strength by a certain amount based on the plot it was in. By contrast, an enumeration would be of greater interest for selecting from a list of units, buildings, etc., like if settling different plots would grant you different free units. Booleans and texts seem straightforward so I won't discuss them here.
whoward69 explained here that global data is used to call map scripts. I imagine the global map mod data could also be useful for differentiating between multiple maps in the same mod, if there were some quantities that needed to be defined seperately, but I don't imagine it's terribly useful otherwise.
So how exactly do we implement map mod data? It's still a bit of a mystery to me, but looking at CvWorldBuilderMapLoader.cpp, we can get an idea of what should happen in LUA. Starting on line 1408 (in the BNW version), there is a function called LoadModData, which seems to be what we're looking for. The next function down deals with implementing the map script functionality of map mod data, but that seems pretty specific.
There don't seem to be any existing references to map mod data other than these two functions and a header file, so I guess the question is, what LUA function will read map mod data?