Fisheries terrain mod
Posted: Fri Oct 26, 2018 3:11 pm
				
				I am posting this with two aims.  First because I need help and second because it might be helpful to other modders to see the steps I have taken.
Hence it is probably a little longer than it really needs to be for those who understand modding sufficiently to answer my question. So apologies to them in advance.
The problem.
The Peloponnese is mainly hills and so my scenario is currently very short of food. I want to increase food production in limited areas.
Farms in the sea?
The vanilla mod provides (under <terrainAttributes> ) <terrainExtensions> which increase food ie fields (aka TerrainExtension.AgriculturalLand) and farms. Why not farms for the sea like the Holland mod has (though the Holland mod uses basin and nets for fish not food of course)
But then I will have to get into the tech tree etc. And I want the food boost to be fixed. I don’t want players (human or AI) so filling the seas with terrain extensions that there is quickly a glut of food.
Creating a new <terrainProperties>
There are ten fundamental terrain types from grass thru water 4 to swamp (10). So I copied the water TerrainPropertiesMemento and stuck it in my changing the name from water to name="Terrains.FISHERY", replacing the ProductMemento <ProductMemento id="5" perTurns="1" value="3.6" /> (before it had value="0.6" ) and the id from 4 to 11.
And it worked - sort of. The cities with fishery tiles next to them did start using them and so had a greatly enhanced supply of food. But boats couldn’t go into them.
So I looked at the definition of boats which is defined as <UnitModelMemento id="57" parentModelId="0" scripting="Boat" name="Units.Boat" etc.
Each unit definition has this section:
<terrains inheritsFromParent="false">
<terrainBehaviors>
<TerrainBehaviorMemento
and there are 10 TerrainBehaviorMemento all have movementConsume="-1" except the 4th down (and water is id 4 of course) which has movementConsume="1".
“Ah-ha, all I have to do is add and 11th with movementConsume="1" and boats (and galleys aka Units.NavalTransport and Triremes) will know they can go onto the tile.
But when Aggressors tried to load my mod it crashed.
So my question is what is the cause.
It could be a silly error in my xml code but my xml editor says the file is “well formed”. Also when I have made an error in the xml the crash is instant. Now Aggressors hangs for a minute or two and then crashes.
It could be there is yet something else I need to define, but what?
It could be that Aggressors is only set up to have terrain types and in that case I must look at farms in the sea or maybe replacing a terrain type instead of adding one.
Any pointers?
			Hence it is probably a little longer than it really needs to be for those who understand modding sufficiently to answer my question. So apologies to them in advance.
The problem.
The Peloponnese is mainly hills and so my scenario is currently very short of food. I want to increase food production in limited areas.
Farms in the sea?
The vanilla mod provides (under <terrainAttributes> ) <terrainExtensions> which increase food ie fields (aka TerrainExtension.AgriculturalLand) and farms. Why not farms for the sea like the Holland mod has (though the Holland mod uses basin and nets for fish not food of course)
But then I will have to get into the tech tree etc. And I want the food boost to be fixed. I don’t want players (human or AI) so filling the seas with terrain extensions that there is quickly a glut of food.
Creating a new <terrainProperties>
There are ten fundamental terrain types from grass thru water 4 to swamp (10). So I copied the water TerrainPropertiesMemento and stuck it in my changing the name from water to name="Terrains.FISHERY", replacing the ProductMemento <ProductMemento id="5" perTurns="1" value="3.6" /> (before it had value="0.6" ) and the id from 4 to 11.
And it worked - sort of. The cities with fishery tiles next to them did start using them and so had a greatly enhanced supply of food. But boats couldn’t go into them.
So I looked at the definition of boats which is defined as <UnitModelMemento id="57" parentModelId="0" scripting="Boat" name="Units.Boat" etc.
Each unit definition has this section:
<terrains inheritsFromParent="false">
<terrainBehaviors>
<TerrainBehaviorMemento
and there are 10 TerrainBehaviorMemento all have movementConsume="-1" except the 4th down (and water is id 4 of course) which has movementConsume="1".
“Ah-ha, all I have to do is add and 11th with movementConsume="1" and boats (and galleys aka Units.NavalTransport and Triremes) will know they can go onto the tile.
But when Aggressors tried to load my mod it crashed.
So my question is what is the cause.
It could be a silly error in my xml code but my xml editor says the file is “well formed”. Also when I have made an error in the xml the crash is instant. Now Aggressors hangs for a minute or two and then crashes.
It could be there is yet something else I need to define, but what?
It could be that Aggressors is only set up to have terrain types and in that case I must look at farms in the sea or maybe replacing a terrain type instead of adding one.
Any pointers?