Fourth yield

Opera

Deity
Joined
Sep 21, 2008
Messages
4,643
Would it be hard/cumbersome/whatever to add a fourth yield to a mod?

Things I'm thinking about: how will it display on tiles?
I saw it is needed to specify a symbol path (with a .nif) in the YieldInfo xml file... but I looked to the Planetfall mod and I couldn't find any .nif file with their new yields, only the vertical_symbols.dds files.

For a more specific question: how should I proceed to add a new yield to a mod, using the "commerce" graphics from Planetfall (the small orange spheres)?
 
Would it be hard/cumbersome/whatever to add a fourth yield to a mod?

Things I'm thinking about: how will it display on tiles?
I saw it is needed to specify a symbol path (with a .nif) in the YieldInfo xml file... but I looked to the Planetfall mod and I couldn't find any .nif file with their new yields, only the vertical_symbols.dds files.

For a more specific question: how should I proceed to add a new yield to a mod, using the "commerce" graphics from Planetfall (the small orange spheres)?

It is possible, I know a mod that added a 5th commerce type. The mod was Dynamic City Development. Since Commerce is fairly similar to Yield, it would be a good place to start. But as far as changes to the game goes, this is a pretty complex one.
 
The main issue with yields is to display the fourth one correctly on tiles, whether on settler mode, city view mode or "show yields" mode. I begin adding it but it is buggy on those modes. Seems like the game doesn't want to show more than three yields at the same time on one tile. And I've got an "over-reading" effect of some sort.

On the attachment, note that the city tile should display four yields: 2 food, 1 prod, 1 comm and 1 fourth yield.

I tried playing with the vertical_symbols file (seems only that one is needed :confused:, not the symbolpaths) but in vain for now.
 

Attachments

  • Civ4ScreenShot0131.JPG
    Civ4ScreenShot0131.JPG
    49.7 KB · Views: 202
The main issue with yields is to display the fourth one correctly on tiles, whether on settler mode, city view mode or "show yields" mode. I begin adding it but it is buggy on those modes. Seems like the game doesn't want to show more than three yields at the same time on one tile. And I've got an "over-reading" effect of some sort.

On the attachment, note that the city tile should display four yields: 2 food, 1 prod, 1 comm and 1 fourth yield.

I tried playing with the vertical_symbols file (seems only that one is needed :confused:, not the symbolpaths) but in vain for now.

I would bet that it is an issue in the CvGameTextMgr. I am not very familiar with a lot of the functions in it, but searching for yields might be a start at least.
 
Sadly, it doesn't seem so. I'd bet it's handled in the exe or (hopefully) in python...

In the worst case, I could make it so no more than 3 yields ever appear on one tile, that's not a problem (and it's quite logical in fact). But I'd need to fix that "over-reading" issue :(

Edit: Couldn't find it in the python either.
 
in order to get a fourth yield
add it to enum YieldTypes (enums.h) at last position
add it to yieldinfos.xml at last position
add the symbol to the tga file after the three existing yields.

I am not 100% sure if you also need to define a new icon but it wouldn't hurt.
 
@Sephi: did that already. Working great, displaying great in panels and such, no problem. The issue comes from it not displaying correctly in the "yields overlay" displays (such as in city view). It involves the assets/art/interface/symbols/vertical_symbols.dds file.
 
hmm, I added a 4th yield for testing and all that was missing was the display on the map. The 3 already existing yields displayed correctly.

edit: yeah, looks like you have to modify that file also
 
Yes, I modified it too.

The issue is that the way the file works is very peculiar and it's hard to add a fourth yield... Because how it's read depends on its width, its height and its width/height ratio. I didn't do all the maths yet but it seems like the file was built for only three yields. At least, optimally built.

The game can display a fourth yield but it seems to be hardcoded into NOT displaying more than three yields on the same tile.

One way I could bypass that would be by "merging" two yields "icons" together so they appear as two yields but are technically one. But it would come with a lot of other issues.

So it'd seem the best way to proceed would be to not add it to the map display but then it's a bit problematic for strategic purposes.
 
Okay, so. I think one way to satisfy me would be to add a hover popup in the city screen, when you hover a tile, so you could see the 4th yield. However, I'm not sure how to do that.

An idea would also be to show a popup the first time, saying that you need to hold down, say, shift to see that hover popup. Because having it always up wouldn't be cosmetically good :p
 
Okay, so. I think one way to satisfy me would be to add a hover popup in the city screen, when you hover a tile, so you could see the 4th yield. However, I'm not sure how to do that.

An idea would also be to show a popup the first time, saying that you need to hold down, say, shift to see that hover popup. Because having it always up wouldn't be cosmetically good :p

I might be way off the track here so don't bite me for it :lol:.

EmperorFool already have codes for displaying new hover infos in city screen, though for other areas, in his BULL.
I wonder if you can look at that code and make a best guess of possible code for hover-over of the tiles in the city screen?
 
I will take a look at it. Actually, I'm counting on EmperorFool and his experience with interface modding to come and either crush my ideas or help me getting them done ;)

But, as of now, I couldn't find a way to do what I wanted. Somehow it seems the plots you see in the city screens aren't plots or something. This snippet I don't understand:
Code:
void CvGameTextMgr::getPlotHelp(CvPlot* pMouseOverPlot, CvCity* pCity, CvPlot* pFlagPlot, bool bAlt, CvWStringBuffer& strHelp)
{
	if (gDLL->getInterfaceIFace()->isCityScreenUp())
	{
		if (pMouseOverPlot != NULL)
		{
			CvCity* pHeadSelectedCity = gDLL->getInterfaceIFace()->getHeadSelectedCity();
			if (pHeadSelectedCity != NULL)
			{
				if (pMouseOverPlot->getWorkingCity() == pHeadSelectedCity)
				{
					if (pMouseOverPlot->isRevealed(GC.getGameINLINE().getActiveTeam(), true))
					{
						setPlotHelp(strHelp, pMouseOverPlot);
					}
				}
			}
		}
	}
What's its point? If I get it right, you should see something while mouseovering but there's nothing :confused:
 
Yes, I modified it too.

The issue is that the way the file works is very peculiar and it's hard to add a fourth yield... Because how it's read depends on its width, its height and its width/height ratio. I didn't do all the maths yet but it seems like the file was built for only three yields. At least, optimally built.
if you are working with dds files, you have to do the math. Don't ask me about details though, I am happy if I don't have to deal with graphics. Still using your tga file :D

The game can display a fourth yield but it seems to be hardcoded into NOT displaying more than three yields on the same tile.
I doubt it is hardcoded. Either your dds file isn't 100% correct (which to my limited knowledge on dds files can easily happen) or there is a bug in the exe.
 
What's its point? If I get it right, you should see something while mouseovering but there's nothing :confused:
the screen for plothelp is probably hidden when you are in a city (done in cvmaininterface.py)
 
The thing is: the height is divided by the width to get boxes which are read by the game. The pictures it pulls from the file are 1/16th of the total height, independently of anything else. That means that, eventually, only 16 actual pictures can be pulled out of it. Or it seems so. I'm not good at maths :p
 
the screen for plothelp is probably hidden when you are in a city (done in cvmaininterface.py)
I guess such a screen would call getplothelp. Unfortunately, nothing does that in cvmaininterface.py (and nowhere else for that matter).
 
The thing is: the height is divided by the width to get boxes which are read by the game. The pictures it pulls from the file are 1/16th of the total height, independently of anything else.
what happens if you make the file 64x2048 (without adding any grahics). Can the game still read it?

you are right, that plothelp stuff must work different :( (I always hope some easy solution exists)
 
There is a mod which did a Colonization style of Yields (Wood, Fish and a bunch of others) I think in the end they had 15 or so Yields. But there is a limitation in the graphical interface which only allows any plot to show 3 yields at a time, so they just had to ensure that each tile only ever provided any yields from 3 or fewer categories at once. So if your fourth yield never allowed Commerce (or Production or Food) on the tile with it, then it would work.

I am thinking it was WoC who had worked with it, but that doesn't sound right. I know there was a second mod who had also done it with "Spirituality" or something like that as the extra Yield type. If I had time to throw away I'd search around to see if I could spot them for you, but the basic rundown is that you can only have 3 yields per tile, though the game can handle as many yields existing globally as you desire.
 
I'm happy to chime in, but I doubt I'll be much help here.

Your reading of the C++ code snippet is correct. I don't know why the hover isn't shown when the city screen is up; I just know that the hovers are displayed by the EXE (boo!), but they are created by the DLL (and Python via a callback).

BUG doesn't use the normal hover text mechanism for the extra buttons on the city screen, but the normal game does. So the help text area is visible on the city screen. For some reason the EXE is hiding it for the plots, probably to avoid confusion. The city screen always shows the yields of the plots, and you don't want to clutter up the screen with unit/terrain information.

I'm with the others on this: double-check your DDS math. Try some other combinations of sizes to see what happens. I wouldn't be surprised at a cap of 3 yields per single tile, but I would be surprised if you can't have more yields in total. And as you said, others have done this successfully.
 
Back
Top Bottom