wheat irrigation bug

algol

Chieftain
Joined
Feb 17, 2008
Messages
10
Hello,

I posted a question here some days ago, whether or not it would be possible to fix a bug in the tile graphics handling (farms on wheat resources show no visual effect after irrigation/access to fresh water whereas farms on corn resources do) of the game by editing the (appropriate??) xml-files.

http://forums.civfanatics.com/showthread.php?t=263742

Yet I got no reaction so far. As I am new to the forum, maybe this is the wrong section for my request?

Any comments, anybody?

greetings
Gerald
 
Absolutely no comments?

Does that mean you haven't even noticed the bug, or that you simply do not care? - Or do you think it is a "feature"?

greetings
Gerald
 
what version do you use? I'm pretty sure on BtS that doesn't happen. If it does, I've never noticed it.
 
Thanks for replying after all.

Running BtS 3.13 here and the bug is alive and well since the original vanilla.

You can even see a "bleaked out" irrigation grid across the wheat resource after farming as would be the case with any farm, also on "corn", when without access to water. But as opposed to the latter the "bleaked out"-grid doesn't turn light blue when fresh water access is present.

Since there seems to be no simple "icon" to change for irrigated farms vs. dry ones the color of the irrigation grid is obviously determined by some value hidden deep within some .xml files. If I knew how and where this change is correctly triggered on e.g. "corn"-farms, I presume I could make an analogous change for the "wheat"-farms. Or is my understanding of how this works wrong altogether?

greetings
Gerald
 
It's in the PlotLSystem.xml file (in the buildings folder), wheat (and rice incidentally) use different rules than normals farms and farms with the corn resource. I believe there isn't a different set of rules for irrigation with the wheat farms but I'd have to look again to be sure.
 
Sorry for the delay.

@ripple01: here are the requested screenshots. From left to right we have wheat_irr., wheat_dry, corn_irr. and corn_dry.

@seven05: Thanks for the file_names and locations. I will look into that matter. And you are absolutely right, things with rice are a little bit different. After farming there seems to be some "development" until the farm reaches its final visual appearance.

Although, now that you mention it, there seems to be no difference between "mature" rice-farms with or without access to water either.

But at least those do not show a "bleaked out"/dry irrigation_grid when in fact irrigated. Yet, of course the visual appearance of farmed rice should change with irrigation, too. - As is the case with normal and "corn"-farms.

greetings
Gerald
 

Attachments

  • wheat_irr.jpg
    wheat_irr.jpg
    197 KB · Views: 84
  • wheat_non.jpg
    wheat_non.jpg
    177.5 KB · Views: 77
  • corn_irr.jpg
    corn_irr.jpg
    195.7 KB · Views: 65
  • corn_non.jpg
    corn_non.jpg
    177.2 KB · Views: 65
It's in the PlotLSystem.xml file (in the buildings folder), wheat (and rice incidentally) use different rules than normals farms and farms with the corn resource. I believe there isn't a different set of rules for irrigation with the wheat farms but I'd have to look again to be sure.

Ok, there is GLeaf_2x1/_2x2/_2x3/_4x2 and also BLeaf_something.

And there is crops_w/_uw/_i_w/_i_uw.nif.

I'll admit, I don't have the slightest clue where it says "when there is access to fresh water then let us draw a blue grid" or even how this irrigation grid is triggered or invoked. Is it some kind of .nif-file or just an attribute you can simply set "1" or "0"?

Never seen such a cryptically structured graphics concept - but then I'll also admit, I have never tried to "retro-engineer" any other game before. Old times disassembling couldn't have been more cryptic as there were at least tools for it, just my impression.

greetings
Gerald
 
Well here is one set of leafs for the 'crops' (the rectangular field looking graphics for the farmland):

Code:
		<ArtRef Name="art:crop">
			<Attribute Class="Scalar">NIF:Art/Structures/Improvements/Farm/crops_w.nif::2x1</Attribute>
			<Attribute Class="Improvement">IMPROVEMENT_FARM</Attribute>
			<Attribute Class="Bonus">NO_BONUS,BONUS_ALL,!BONUS_WHEAT</Attribute>
			<Attribute Class="Scalar">bApplyRotation:1</Attribute>
			<Attribute Class="Scalar">bZMode_Ground:1</Attribute>
			<Attribute Class="Scalar">bCutTrees:1</Attribute>
			<Attribute Class="Scalar">bForceGround:1</Attribute>
			<Attribute Class="Scalar">bImprovementWorkedOnly:1</Attribute>
			<Attribute Class="Scalar">bIrrigatedOnly:0</Attribute>
			<Attribute Class="Scalar">szBatchGroup:farm_crop</Attribute>
			<Scale>0.5</Scale>
		</ArtRef>
		<ArtRef Name="art:crop">
			<Attribute Class="Scalar">NIF:Art/Structures/Improvements/Farm/crops_uw.nif::2x1</Attribute>
			<Attribute Class="Improvement">IMPROVEMENT_FARM</Attribute>
			<Attribute Class="Bonus">NO_BONUS,BONUS_ALL,!BONUS_WHEAT</Attribute>
			<Attribute Class="Scalar">bApplyRotation:1</Attribute>
			<Attribute Class="Scalar">bZMode_Ground:1</Attribute>
			<Attribute Class="Scalar">bCutTrees:1</Attribute>
			<Attribute Class="Scalar">bForceGround:1</Attribute>
			<Attribute Class="Scalar">bImprovementWorkedOnly:0</Attribute>
			<Attribute Class="Scalar">bIrrigatedOnly:0</Attribute>
			<Attribute Class="Scalar">szBatchGroup:farm_crop</Attribute>
			<Scale>0.5</Scale>
		</ArtRef>
		<ArtRef Name="art:crop">
			<Attribute Class="Scalar">NIF:Art/Structures/Improvements/Farm/crops_i_w.nif::2x1</Attribute>
			<Attribute Class="Improvement">IMPROVEMENT_FARM</Attribute>
			<Attribute Class="Bonus">NO_BONUS,BONUS_ALL,!BONUS_WHEAT</Attribute>
			<Attribute Class="Scalar">bApplyRotation:1</Attribute>
			<Attribute Class="Scalar">bZMode_Ground:1</Attribute>
			<Attribute Class="Scalar">bCutTrees:1</Attribute>
			<Attribute Class="Scalar">bForceGround:1</Attribute>
			<Attribute Class="Scalar">bImprovementWorkedOnly:1</Attribute>
			<Attribute Class="Scalar">bIrrigatedOnly:1</Attribute>
			<Attribute Class="Scalar">szBatchGroup:farm_crop</Attribute>
			<Scale>0.5</Scale>
		</ArtRef>
		<ArtRef Name="art:crop">
			<Attribute Class="Scalar">NIF:Art/Structures/Improvements/Farm/crops_i_uw.nif::2x1</Attribute>
			<Attribute Class="Improvement">IMPROVEMENT_FARM</Attribute>
			<Attribute Class="Bonus">NO_BONUS,BONUS_ALL,!BONUS_WHEAT</Attribute>
			<Attribute Class="Scalar">bApplyRotation:1</Attribute>
			<Attribute Class="Scalar">bZMode_Ground:1</Attribute>
			<Attribute Class="Scalar">bCutTrees:1</Attribute>
			<Attribute Class="Scalar">bForceGround:1</Attribute>
			<Attribute Class="Scalar">bImprovementWorkedOnly:0</Attribute>
			<Attribute Class="Scalar">bIrrigatedOnly:1</Attribute>
			<Attribute Class="Scalar">szBatchGroup:farm_crop</Attribute>
			<Scale>0.5</Scale>
		</ArtRef>
You can see the bIrrigatedOnly value (0 being not irrigated). However, also note the !BONUS_WHEAT, the crop fields aren't used at all when wheat is present, instead a different version of the wheat bonus graphics are used. Like this:
Code:
	<LNode Name="Leaf_Farm_4x4">
		<!-- pointed at by two Farm_4x4 production -->
		<Width>4</Width>
		<Height>4</Height>
		<Attribute Class="Scalar">bNotBFS:1</Attribute>
		<!-- ancient and classical farms -->
		<ArtRef Name="goal:IMPROVEMENT_FARM">
			<Attribute Class="Era">ERA_ANCIENT,ERA_CLASSICAL</Attribute>
			<Attribute Class="Bonus">NO_BONUS,BONUS_ALL,!BONUS_RICE,!BONUS_WHEAT,!BONUS_CORN</Attribute>
			<Attribute Class="Scalar">NIF:Art/Structures/Improvements/Farm/an_eu_farm01.nif</Attribute>
			<Attribute Class="Scalar">KFM:Art/Structures/Improvements/Farm/an_eu_farm01.kfm</Attribute>
			<Attribute Class="Scalar">szExtra:art:IMPROVEMENT_FARM1</Attribute>
			<Attribute Class="Scalar">szExtra:art:IMPROVEMENT_FARM2</Attribute>
			<Attribute Class="Scalar">iCropAreaMultiplier:12</Attribute>
			<Attribute Class="Scalar">bCutTrees:1</Attribute>
			<Attribute Class="Scalar">bZMode_Ground:1</Attribute>
			<Attribute Class="Scalar">fTwist:-0.7853981633</Attribute>
			<Attribute Class="Scalar">bIsPartOfImprovement:1</Attribute>
		</ArtRef>
		<ArtRef Name="goal:IMPROVEMENT_FARM">
			<Attribute Class="Era">ERA_ANCIENT,ERA_CLASSICAL</Attribute>
			<Attribute Class="Bonus">BONUS_CORN</Attribute>
			<Attribute Class="Scalar">NIF:Art/Structures/Improvements/Farm/an_eu_farm01.nif</Attribute>
			<Attribute Class="Scalar">KFM:Art/Structures/Improvements/Farm/an_eu_farm01.kfm</Attribute>
			<Attribute Class="Scalar">szExtra:art:IMPROVEMENT_FARM1</Attribute>
			<Attribute Class="Scalar">szExtra:art:IMPROVEMENT_FARM2</Attribute>
			<Attribute Class="Scalar">iCropAreaMultiplier:10</Attribute>
			<Attribute Class="Scalar">bCutTrees:1</Attribute>
			<Attribute Class="Scalar">bZMode_Ground:1</Attribute>
			<Attribute Class="Scalar">fTwist:-0.7853981633</Attribute>
			<Attribute Class="Scalar">bIsPartOfImprovement:1</Attribute>
		</ArtRef>
		<ArtRef Name="goal:IMPROVEMENT_FARM">
			<Attribute Class="Era">ERA_ANCIENT,ERA_CLASSICAL</Attribute>
			<Attribute Class="Scalar">NIF:Art/Structures/Improvements/Farm/an_eu_farm01.nif</Attribute>
			<Attribute Class="Scalar">KFM:Art/Structures/Improvements/Farm/an_eu_farm01.kfm</Attribute>
			<Attribute Class="Bonus">BONUS_RICE,BONUS_WHEAT</Attribute>
			<Attribute Class="Scalar">szExtra:art:IMPROVEMENT_FARM1</Attribute>
			<Attribute Class="Scalar">szExtra:art:IMPROVEMENT_FARM2</Attribute>
			<Attribute Class="Scalar">bZMode_Ground:1</Attribute>
			<Attribute Class="Scalar">bIsPartOfImprovement:1</Attribute>
			<Rotate>-45</Rotate>
		</ArtRef>
That section is telling it how to generate the farm itself, which is to place some buildings and if not wheat or rice to place the crops (that show ittigation or lack thereof) with this tag: <Attribute Class="Scalar">iCropAreaMultiplier:10</Attribute>. It would probably look like crap if you used the base crop fields beneath the wheat or rice graphics which is probably why they don't in the first place. It may also be because that you can't have a rice paddy without water and wheat that wasn't yellow and dry looking wouldn't look like wheat to most people :)
 
Well here is one set of leafs for the 'crops' (the rectangular field looking graphics for the farmland):

You can see the bIrrigatedOnly value (0 being not irrigated). However, also note the !BONUS_WHEAT, the crop fields aren't used at all when wheat is present, instead a different version of the wheat bonus graphics are used. Like this:

That section is telling it how to generate the farm itself, which is to place some buildings and if not wheat or rice to place the crops (that show ittigation or lack thereof) with this tag: <Attribute Class="Scalar">iCropAreaMultiplier:10</Attribute>. It would probably look like crap if you used the base crop fields beneath the wheat or rice graphics which is probably why they don't in the first place. It may also be because that you can't have a rice paddy without water and wheat that wasn't yellow and dry looking wouldn't look like wheat to most people :)

Thanks a lot for the effort.

May I translate for dummies: "Leaf" is just the ordinary game-square and an exclamation mark in the definition means "with the exception of"...

But what then means "GLeaf_2x1/_2x2/_3x2/_4x2"?

And why is the "art:crop"-definition repeated 4 times with the only difference of 4 .nif-files as mentioned above? What is the difference between those .nif-files (_w/_uw/_i_w/_i_uw)?

And then we suddenly have Leaf_farm_4x4 (4x4 meaning what actually?). First we have the general definition with the exception of rice, wheat and corn. Below that comes bonus corn with the same .nif and .kfm-files, differing only in the AreaMultiplier being 12 for standard and 10 for corn-farms (10 and 12 meaning what?).

And then we have the _same_ definition for wheat and rice (visually looking totally different) wit the _same_ .nif and .kfm-files (so these can only contain the buildings?) and then we have the same szExtra.. , yet no fTwist, no CutTrees and no CropAreaMultiplier.

You are probably right, the standard irrigation grid would look silly on those, _but_ wheat farms _can_ be built without fresh water access (at least later in the game/tech-tree) and it _does_ make a difference in food production, whether the farm is irrigated or not. So this has to be reflected visually - again, as is the case with standard- and corn farms. If you enlarge my wheat-screenshots you can even see part of a dry grid underneath the wheat-farm. At least for rice-farms there is no dry grid visible at all (again making no difference between irrigated or not).

So the origin of the dry grid becomes even more mysterious, now that you've pointed out that wheat and rice use the same definition. Very strange indeed but an obvious bug nonetheless.

greetings
Gerald
 
Update: This is becoming stranger by the hour!

I have downloaded the .nif viewer plugin to look into some .nif-files.

Surprise! Nowhere on my PC, neither in the game-folder, nor in my profile ("MyGames"), not in any archive, nor on the Game DVD can those mystic files crops_w/_uw/_i_w/_i_uw.nif be found! My theory was, this might stand for worked/unworked/irr.worked/irr.unworked until finding out that those files actually aren't there at all!

Nothing for corn or rice, zip, nada! _Only_ for wheat - and _only_ within a BtS-mod called "Rhye's and Fall of Civ..s", which I never used btw., did I find an \Art\Terrain\Resources\Swamp-subfolder containing two files "wild_wheat_base.dds" and "wheat_farm_base.dds" that contained the actual graphics for the wheat-tile with and without farm (and regardless of irrigation).

Now if you don't play "Rhye's and fall...", those graphics should never be invoked, right?

Again I don't have the slightest clue where those basic terrain/bonus graphics like wheat, rice or corn in a standard- or normal BtS-game actually do come from. Weird!

greetings
Gerald
 
You have to unpak the fpk files to see the models and textures used on them :)

Leafs aren't full game tiles, a leaf is a grid of smaller sections. A good example is the 'generic' buildings in cities, the city has leafs based on its size and then each generic building has a size of it's own that needs to fit within the leaf. Its easier to see in cities since you can see the way the buildings line up and which ones are of the various sizes (1x1, 2x1, 1x2, 2x2, etc).

The various crop nifs are different appearances, the 'w' crops are more green than brown/yellow and the 'i' crops have the blue 'water' showing irrigation. Corn uses fewer crop nodes, if you look at a corn farm next to a farm without corn you'll see the difference, hense the multiplier being 10 instead of 12 :)

The farm nodes (GLeaf...) contain only the buildings and then the possible definition for crop graphics, which as you saw are missing from wheat and rice farms. To see how it handles wheat and rice you need to look for the wheat and rice bonuses themselves since the nif used for them is different depending on whether the tile has a farm. None of the examples I showed do anything with regards to displaying the actual bonus itself, only the improvement parts (this includes corn, if you look you won't see any reference to the corn bonus nifs).

Needless to say the LSystem code is pretty complex and not for the feint of heart. My experience with it is limited to changing artstyles and era data around and not much else so you're rapidly apraocing the parts that I don't know much about at all. :)
 
Needless to say the LSystem code is pretty complex and not for the feint of heart. My experience with it is limited to changing artstyles and era data around and not much else so you're rapidly apraocing the parts that I don't know much about at all. :)

Still, in particular your last clarification was one "hammer" of an express tutorial. Thanks so much!

As for unpacking those .fpk-files I will also need the SDK-package?

And judging from that ominous "Rhye's and fall"-mod the basic bonus_graphics seem to be contained in some .dds files which I couldn't find either - and that I considered particularly unfortunate, because in the "wheat_farm_base.dds" I finally was able to locate the "dry grid" in wheat farms.

But maybe some general bonus.dds files are in that packed file as well. I was already wondering about the missing corn bonus folder. But your remark of corn being just handled as an improvement finally shed some light on this irregularity, too.

Seems an underlying logical base_structure wasn't one of the primary design_goals here.

Btw, what size of Leaf would make up a full game_tile? 4x4?

Thanks again and greetings
Gerald
 
Back
Top Bottom