-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move terrainType to AtBScenario #4050
Conversation
I think terrainType needs to be convert into a mapType template. not sure if just using the terrainType works. each terrainType has multiple possible mapgen parameters. Stratcon uses setMapFile() function to set map, so it may be better move this into scenario out of AtBScenario. then call it to set the mapType from the terrainType . If doing this probably also need to move the mapTypes into its on xml out of StratconBiomeManifest.xml
|
Your suggested approach would tie vanilla scenarios into the specific logic of StratCon, which in my opinion is against design principles - the specific should not dictate to the general. StratCon assumes that the settings files in mapgen should be grouped thematically but this is not necessary for the code here to work. All of the XML files in mapgen are functionally independent from each other and there is no reason not to offer the player using a vanilla scenario approach access to them all equally. |
I also think the way AtB/StratCon handles this is non-intuitive. Why convert the values from terrainType into map? That makes the map object confusing because it can be both the name of a terrain type mapgen file or the path to an actual map file. A better approach would have been to just overwrite the existing terrainType with a new value when sampling from the possible biome values. Fixing that in the future will help work toward removing annoying discrepancies between the two types. |
if the function is moved it is no longer stractcon logic. its generic logic. each terrain type has multiple map parameters to provide more variety to the maps generated. the terrain type defines the general setting for the region. where the map is a specific area within the region. you may need to verify that all the terrain types have a mapgen parameter file setup, if you continue with your logic. |
It still is StratCon logic though because for vanilla scenarios users can specify either a fixed map or a random one. The fixed map path is what is held in
I don't understand what you mean by this. Where are all the terrain types defined? Because terrain type is not properly classed, but done in ad hoc way, there is no enum or anything defining all the terrain types. Terrain type is just literally the name of an xml file in the mapgen directory. By definition, then it exists. If it helps to resolve this, I can just another string variable name like |
I have gone ahead and done this in the most recent commit. This should help to avoid confusion about the purpose and design of the different variables. Ideally, I think the setMapType, should stop setting map and start setting mapGenerator, for consistency, but unsnarling the AtB code is beyond this PR. |
Ok I think I have a better solution to this in mind so hold off on review or merge. |
Ok, I am realizing that |
We now have
terrainType
inScenario
(I think as part of the work by @kuronekochomusuke on weather), which references the preset map generation parameters indata/mapgen
. However, the code inGameThread
will not properly apply these mapgen settings because it uses:The problem is that
scenario.getMap()
does not accessterrainType
which is what needs to be accessed. I believe this is because somewhere in the innards of AtB code, terrain type gets translated into themap
variable. However, this does not happen in vanillaScenario
.This PR fixes the problem by just switching the code above to directly call
scenario.getTerrainType()
rather thanscenario.getMap()
. It should not affect AtB because AtB uses a different game thread. I also had to update a few other things to get proper null checks into the code and to make sure we didn't erase the default map settings before we confirm that we are actually going to get new ones.