[XML] Farmers

I'm not so interested in building swarms of pastures or plantations in the hopes of spreading a resource, just the farm effect. Will both versions be available?

I also do not have the capacity at the moment of modding the SDK or even recompiling it. I've always meant to look into that, but have never done so.
 
What about give to the farmers the ability to plant some resources, like wheat if your Civ has a farm + wheat on your Civ territory ?

And the ability to buy a resource like rice from China, or Corn from Incan, and then be able to plant it on your Civ territory.
And the same about other resources like sheeps, cows, etc...

Or maybe make it a mission for a Spy located on a rival plant resource to steal seeds or something like that. If successful, the seeds get planted in one of your cities' BFC and then you wait x number of turns for the resource to appear (maybe give it a % chance of appearing)?
 
One of the more interesting mechanical additions to the game that I've seen.

I was wondering though, doesn't having wheat, corn, bananas or even cattle simply mean that the tile is extraordinarily fertile, and that "regular" tiles may have wheat and/or cows, but just not to the degree that a bonus tile allows due to the health of the tile? This would almost be tantamount to "adding" extra fish to the ocean on a whim, which would seem to be the logical next step.

Especially, since these resources aren't required for building units or wonders in MOST cases.

How would "stealing" any of these resources allow a civ to increase the health of a given tile? I would think that would be the luck of the draw. Even on Earth, there are FEW places that really are so fertile... the Nile Delta and areas of the Ukraine to name a couple.

Perhaps, some agronomy improvements or techs would be more suitable? Fertilizers? Bio-engineered plants? etc...

Or, a more interesting solution might be, say you have corn and cattle near your city. Two extraordinarily healthy tiles. You run into a civ that has horses. Perhaps you could "allow" the player to "exchange" the cattle tile for a Horse tile since the animals are not too dissimilar in eating habits. In essence, having to REDUCE food production, so you can build cavalry units.

I think this kind of thing would be FAR more balancing than say allowing wheat to pop up everywhere. Considering it's the TILE not the resource that should have any bearing on production in this case.

*Only certain types of resources found in a tile should be eligible for an exchange. Allowing someone to exchange gold for Iron is just, well dumb. Didn't think I needed to add that, but just in case.
 
I think that currently it's vanilla only. :(
 
I was under the impression it worked for Warlords, although I could be mistaken. I do know it is not yet BtS-capable, unless Navy Seal has put in some extra work and hasn't posted here.
 
Here's the SDK version, from BTS 3.13. It should work with Navy Seal's ModComp minus the Python script. At a minimum, it will require the farm improvement to have a chance to discover wheat, corn, rice or any custom resources you have. It can also work for pastures, fishing boats, etc (any health resource) provided you mod in a way for those improvements to be built on 'empty' terrain. You will also never discover a resource if the tile has an existing reourc that you just can't see yet, so for instance if you have a farm on a tile that has horses but you don't have animal husbandry yet you don't need to worry about destorying the horses with your new source of corn.

In addition to that I also added in a similar check for mines that ensures the discovered resource can exist on that terrain type, so no discovering gems on tundra hills. This was important to me in my mod to keep resource seperated by climate regions. Discovering these resource (ones without health bonuses) does NOT require existing access to that resource, so you can discover iron in a mine even if you don't already have it just like before, you just won't discover iron in a mine built on terrain where iron can't naturally appear.

Also, just as the vanila game will only discover resource in mines that are currently being worked this will only discover health resource in farms that are currently being worked. So simply building a bazillion farms won't do you much good, you need your cities to be working them. This is also likely to break the corporations in BTS by making Ceral Mills insanely potent if you put any degree of effort into spreading the resources like manually switching which plots are worked so your cities are always working the 'empty' farms rather than the ones with corn, rice or wheat.

Anyway, on to the SDK code, this replaces the entire doImprovement() method in CvPlot.cpp:
Code:
void CvPlot::doImprovement()
{
	PROFILE_FUNC();

	CvCity* pCity;
	CvWString szBuffer;
	int iI;

	FAssert(isBeingWorked() && isOwned());

	if (getImprovementType() != NO_IMPROVEMENT)
	{
		if (getBonusType() == NO_BONUS)
		{
			FAssertMsg((0 < GC.getNumBonusInfos()), "GC.getNumBonusInfos() is not greater than zero but an array is being allocated in CvPlot::doImprovement");
			for (iI = 0; iI < GC.getNumBonusInfos(); ++iI)
			{
// ----- Seven 05 Begin -----
/*Here we're going to make a slight change to the chance of discovering bonuses on
improved plots.  What we want is to limit food resources so they will only appear if the civ
already has that resource. And 'fix' it so resources can only be discovered on the appropriate
terrain.*/
				if (GET_TEAM(getTeam()).isHasTech((TechTypes)(GC.getBonusInfo((BonusTypes) iI).getTechReveal())) &&
					GC.getBonusInfo((BonusTypes) iI).isTerrain((unsigned int) getTerrainType()))
				{ // If this bonus type is allowed on this terrain and we have the tech needed
					if (GC.getImprovementInfo(getImprovementType()).getImprovementBonusDiscoverRand(iI) > 0)
					{ // If this bonus can be 'discovered'
						if (GC.getGameINLINE().getSorenRandNum(GC.getImprovementInfo(getImprovementType()).getImprovementBonusDiscoverRand(iI), "Bonus Discovery") == 0)
						{
							if(GC.getBonusInfo((BonusTypes) iI).getHealth() > 0)
							{ // This next check should only happen with food resources
								if(GET_PLAYER(getOwner()).hasBonus((BonusTypes) iI))
								{	// If we have this one already
									setBonusType((BonusTypes) iI);
								}
								else
								{ // We don't have this one yet, bail out
									break;
								}
							}
							else
							{ // Non-health bonuses can be discovered without having one already
								setBonusType((BonusTypes)iI);
							}
// ----- Seven05 End -----

							pCity = GC.getMapINLINE().findCity(getX_INLINE(), getY_INLINE(), getOwnerINLINE(), NO_TEAM, false);

							if (pCity != NULL)
							{
								szBuffer = gDLL->getText("TXT_KEY_MISC_DISCOVERED_NEW_RESOURCE", GC.getBonusInfo((BonusTypes) iI).getTextKeyWide(), pCity->getNameKey());
								gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_DISCOVERBONUS", MESSAGE_TYPE_MINOR_EVENT, GC.getBonusInfo((BonusTypes) iI).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_WHITE"), getX_INLINE(), getY_INLINE(), true, true);
							}

							break;
						}
					}
				}
			}
		}
	}

	doImprovementUpgrade();
}

The XML change is an easy one, just look at the mine improvement and do the same for farms. The probability is a 1 in 'this number' chance, so if you use 10000 you will have a 1 in 10000 chance of spreading the resource. In testing a probability of 100 is a bit too easy, 250 worked well if I wasn't trying to exploit it 500 is very safe but also very slow as it's likely that you may only get the new resource in a small handful of farms by the end of the game.
 
Why was python needed? IIRC railroads need coal to be produced so couldn't just have a wheat farm that needs wheat and then has a random chance of discovering wheat. Then if you have a corn or wheat farm, it should require both. i'm sure this may require a lot of duplicate entries but it would get around doing sdk and python.
 
Mostly for balance. Say you have a 'wheat farm' that requires wheat to build and produces +1 :food: compared to a normal farm. If you have wheat naturally or by trade, you effectively get +1 :food: per farm even though it takes a little time to get there. That's a huge jump in food production, especially if you allow combined farms for corn, wheat and rice. And what happens if you loose your access to wheat, do your farms still function? shouldn't those farms still provide you with wheat resources?

You could do it with XML, but with the compromises it wouldn't balance well, ending up either too good or pretty worthless.
 
Well I was going to do the sheep and horse ect appearing but it's hard because I don't want you to be able to build a pasture wherever and having it randomly pick a spot is hard to do.
How about you have them randomly appear on a farm? Then the player can retool the land into a pasture if they want.
 
Top Bottom