Question about more food consumption...

Quornix

Warlord
Joined
Dec 27, 2006
Messages
134
OK. I've had no trouble with increasing the food consumption per person to 4. I've had no problems with increasing food production from tiles, and adding more tech-based increases to improvements. I like a bit more granularity in this sort of thing, and it allows me to increase, say, farms by +1 at several points in the tech path.

But the system won't display more than one big loaf. Not a big deal, but its frustrating not to be able to tell the difference between a six food square and an eleven food square.

I was hoping that MAX_YIELD_STACK would solve this problem, but changing that to 10 causes all sorts of bizarre displays, like hammers instead of food and such nonsense.

Can one of you experienced modders help me out here? Thanks!

[EDIT] Is fractional food production possible? I could just cut everything in half. Back at 2 food per person, but I get the granularity I want.
 
[EDIT] Is fractional food production possible? I could just cut everything in half. Back at 2 food per person, but I get the granularity I want.
I don't think it is since most of the yield values are Ints which means whole numbers, and I would assume that the math done in the SDK would be done with the same variable types (INT) - but I might be wrong :p
 
<bump>

Yeah, I didn't think that half food would work. You can add a percentage to the integer total, which will round back to an integer, but you can't add 1/2 + 1/2 + 1/2 + 1/2 and get 2. Either 0 or 4, depending on which way it rounds it off.

Just got the VC++ 2005 running and successfully compiled the basic DLL. So if you can point me towards the location where this info is done, whether it be Python or SDK, I can probably mess around with it or something. Add a new icon for "10" or something like that, once I see how "5" was done. I just have no idea where to look for this stuff.

Thanks!

P.S. Is there any way to set the increment on things like Great General points or cottage growth? I'd like civics to be able to _decrease_ those values as well as increase, but they only seem to go up by 1 point at a time, so percentage changes get truncated (unlike GPPs which get piled together then multiplied.

I've worked around by adding +900% to each in civics (religion for town growth) and traits (+450% GG production per trait, plus whatever modifiers) and then increasing the number of points needed by a factor of 10 as well, but its clunky and clutters up the help screens. If someone can point me to where these functions reside, that would be nifty.
 
Truly? Nobody knows how to do any of these things? I've been spending the last couple of days poring over the Python looking for how it displays, and I've had no luck. Of course my absolute lack of Python experience probably has something to do with it. :(

Other than that, I've been checking out some basic SDK mods, and seeing how things have been done. At this point, I think I could find the right lines if someone would let me know what files I need to work with...

Help, PLEASE!!
 
I've done some searching through the Code and the Art files and have a general idea whats happening to create the Icon visuals. Their is a file

\Sid Meier's Civilization 4\Assets\Art\Interface\Symbols\Vertical_Symbols.dds

Which contains all the Icons, 5 for each type, they are numbered vertically and grouped by yield, MAX_YIELD_STACK is used to determine when one Yield type ends and the next begins. The SDK builds or at least instructs python to build the composite out of layers, if the total yield is greater then or equal to the MAX_YIELD_STACK (MYS) it lays down the Loaf/Anvil/Moneybag which corresponds to the 5th yield icon of each type. It then subtracts MYS and keeps laying down Icons for as many layers as necessary. If you had 12 food you would see 2 Loafs and 2 slices. The problem is the Loaves are stacked ontop of each other so you only seem to get 1.

Two solutions present themselves the art solution vs the code solution, the art solution is to simply create more icons and incresse MYS to match. Slices/Hammers/Coins could go up to around 7 with a loaf/Anvil/MoneyBag equal to 8 which would give a max of 15, their would probably need to be some shrinkage of the smaller icons to keep them from completly bloting out the large symbol.

The code solution involves a little bit of art, basicaly copying the 5 spot but shifting it slightly to the right or left and getting the game to lay that down at the right time so that a max of 14 could be displayed.
 
Impaler,

Thank you very much. I'm trying to do the artwork fix, as it seems like the easier solution at this point. Some things seem odd when I try to do this, but it's working, so I'm not complaining.

I'm using GIMP with a DDS plugin (I downloaded two, and I'm not sure what the difference is, if any). When I try to save the changes I've made, I wind up getting a warning saying "DDS: It appears your image may be a volume map, but not all layers are the same size, thus a volume map cannot be written."

When I then save, I get the option to create mipmaps (and I don't know what those are). If I select that choice, I get 11 layers, whereas if I don't, I get only one layer. When I open the original, I get two layers, one full size layer, and one labeled as mipmap that's 1/4 the size of the main layer, and has scaled down images.

Well, not willing to give up, I went ahead and put black marks on all the food on the main layer, and saved it as single layer, with mipmaps off, and Compression of DXT3, which I saw on a thread in the tutorial (about buttons, but at least it's flat images). And those holes showed up!

So, success! Now all I have to do is make the file what I want. However, if you (or someone else) could explain all that other stuff that made me think it wasn't going to work, I'd appreciate it.

Thanks again!:goodjob:
 
OK. A spot of trouble. I copied and pasted the smaller images in the second layer :mischief: to my new dds (my initial working copy). All was fine. I now had much smaller images of 1 food, 2 food, etc. Excellent.

Then I doubled the height of the stack. It took a minute to figure out how to unlink the height and width, but no problem. I now have a 64 x 1984 image (I dropped the last 64 pixels, since I assume that the open space at the bottom is for when there's nothing, and that didn't need to be doubled.) I set the layer to the size of the new file, and went to work. Images for 6, 7, 8, 9 food, then the full-sized big loaf for 10 food. Then I did the hammers and gold.

It looked pretty good. I saved it in the appropriate folder, changed MAX_YIELD_STACK to 10 in my mod, and fired it up.

Bizzareness. It's not having any trouble getting the correct graphic. It's just getting too much. It's loading a 64x128 section of the image, and then crunching it back down to 64x64. So, for example, if my image for 2 and 3 food were:

FF
FF


FFF
FFF

and 3 lines = 64 pixels, what's displaying for 2 food is:

FF

FFF

The same thing happens with all three yields. On the plus side, it's getting the right starting location for every single yield, so it's incrementing by 64 pixels every time it gets the next image. It's just getting too tall of an image.

Any idea what's wrong?
 
Throw some screen shoots at me, its a bit hard to visualize whats happening here, also post your edited Icons. I'm thinking the solution may be to stretch the image out some how to compensate. I found the smaller sub set you refered too, I think its for the city view or the "not harvested" icons
 
OK. Here's a screenshot of the city view (cropped to just the tiles). I thought those smaller icons were the unused city tiles too, but they're not. They had the black circles I put on to test changing things at the very first.

SquishedYields.jpg


I'm not sure where to host the dds. I'll see what I can do about that.

Ah. I can use the site! HERE.

[EDIT] The yields are based on my four-food mod. Don't be alarmed at how high they are. Grassland should be 4 food, plus 2 commerce on rivers. As you can see, that's what the top row of icons is. My five food icon is, in fact, five slices of bread. Also, the angles aren't right on the images. There should be more slope to the diagonals (which is part of how I figured out that it was pulling 128 pixels worth).

[EDIT2] OK. Now I went to see what happened if I fiddled with the width a little bit. Changing the file to 128x1024 (and moving the bottom to the side) gave me nice 128x128 icons (which covered 4 images), which progressed at 128 pixels (so everything except 1 food was off). Also, nothing past 8 food even showed (since that hit the end of the file when counting that way). The images were half-sized in each direction.
 
OK. Now there seems to be a second problem, which occurs when I go over 10 of any yield.

Yields2.jpg

:eek:
The quarry in the foreground is supposed to be 2F, 13P, 7C. If you look hard, you can see that it is displayed correctly in the top row -- underneath the random 6P image. Likewise, the offshore rig in the background should be 3F, 11P, 12C. That only gets the random hammers on the food, the only thing not over 10. Let's try another.

Yield3.jpg

OK. The unimproved squares are all right (ignoring the 64x128 issue). The sawmill is fine, since nothing goes over 10 (4F, 6P, 9C). The town up front is 0F, 9P, 14C. Overlay hammers on the production because the commerce is over 10. Pigs are 10F, 1C. Hammers over the food even though the food is what's putting it over 10. First item that's happened to.

So yeah, things are messed up for my mod. But this is certainly PROGRESS!!:D

Interestingly enough, 6P is where there would normally be a blank image, as the 16th slot. Dollars to donuts, that's involved.
 
OK. This is odd. This is what I get when I used DDS converter to turn it into a .jpg

Orig Edit1 Edit2 ---Edit3--- Edit4 ---Edit 4.1---
Spoiler :

Vertical_Symbols.jpg
Vertical_Symbols2.jpg
Vertical_Symbols2.png
Vertical_Symbols.png
Yield4.jpg
Yield4-1.jpg

But in GIMP, I only have one layer, and it just shows the small icons. I don't have a ton of GIMP experience, much less with .DDS stuff, so I must be missing something big. It looks like it has images from everything that I used Ctrl-K (clear) for. Did I just make them clear, not erase them? And then the .jpg doesn't support invisible stuff?

[EDIT] The second image is after I copied all into a new DDS file, to get rid of any artifacts I had. It looks like it worked.

[EDIT2] And, as a .png, as you did.

[EDIT3] And, last but not least, the original file as a .png
So, why is the original larger than my other ones? They're the same length, even though I thought I adjusted it. This would appear to be part of the problem. Each of my coins, hammers, or bread slices should be 1/4 the size of the original, but instead, they are 1/16th. I didn't do anything but move the larger icons, but they wound up being 1/4 the size. Am I not allowed to double the height of the file? Did I do it the wrong way? Please, give explanations, rather than simply answers. I want to know why, not just what.

[EDIT4] OK. Using DXTBmp, I was able to make this last image by importing into Paint, then just saving as a .jpg. This should be the correct sizing. Still shows up the same in the game, though. OK. Is there some reason why that would be the wrong size still? Some sort of forced shortening for displaying online or something? I'm trying again, this time with the bottom half side-by-side with the top half. That's all that I've done, is move the bottom half to the side of the top half. And it worked. What the heck is going on here???
 
Don't take this the wrong way, but you dumped me an executable, and said it will help. What on earth is it? What happened to my files, that screwed up the scale? How do I use this new tool, and for what purpose?

At least a link to a "how to use this tool" thread?

Thanks.

[EDIT] Well, not surprisingly, it's some sort of image editor. What? I open strange executables from mysterious strangers all the time! And it shows me the alpha channel and such. So.... what do I do with it?

[EDIT2] And apparently it uses MS Paint as its editor. Which may not be cool for a lot of people, but I rock at pixel-by-pixel Paint editing. At my last job, it was the only non-work related program I didn't get shouted at for using. And I've used it for pixel-by-pixel D&D map images for ages. This should actually be much easier for me than GIMP, as I have no artistic talent, and either use copy/paste or a one-pixel brush. Still have no idea what went wrong with GIMP, though.

[EDIT3] Well, at least I know what a mipmap is. It's nice that the help screen gives some of this basic information. And this program, like GIMP, will happily display my image as the right size.

[EDIT4] OK. So it looks like the scaling had more to do with posting it here than with the actual file. Maybe. So that leaves the issue of the double-display and the virtual hammers within Civ IV itself.
 
New post, since I think I understand the virtual hammer problem, even if I have no idea what the solution is.

Slot #16 is traditionally blank. it is now filled with 6 hammers. #31 is now my blank slot. When it draws a big chunk (10 right now), it draws a 10 in each yield display that should have one, and whatever is in #16 in each yield display that doesn't have 10 or more. Then, it draws any singles in each yield display, or #16 in each yield display that is used, but does not have any singles. That explains the pigs. They had one 10 and zero 1s, so it drew #16 for its 1s count.

I presume that this call to slot #16 will be defined in one of: SDK, Python, Warlords.exe

I have no idea which one.

It should be defined based on MAX_YIELD_STACK (yields * MAX_YIELD_STACK + 1) but, despite them putting MAX_YIELD_STACK in the GlobalDefines, I don't think they tested it to see if changing it worked.

So, that leaves tracking it down, and figuring out what is going on with the double-display. Another assumption that there are 15 images in the list (divide the height by 16 to get the number of pixels to display per image)? While separately assuming that each image is 64 pixels tall (for picking the right image out of the list)? Together, those two make anything other than 15 images impossible. And then they make MAX_YIELD_STACK in global defines to make me assume this was all doable using just XML? :crazyeye: :D
 
hmm...impaler and i were looking at this in the wee hours last night. grrr my kid woke me up this morning and i only got 5 hours :sleepy:

i think that the civ4 is taking essentially a 128X64 slice of yours, but compressing it to normal size (hence the crushed symbols)
 
hmm...impaler and i were looking at this in the wee hours last night. grrr my kid woke me up this morning and i only got 5 hours :sleepy:

i think that the civ4 is taking essentially a 128X64 slice of yours, but compressing it to normal size (hence the crushed symbols)

I really appreciate you two taking the time to work on this. That said, while I may tend to be long winded, you might want to take a look at what I've posted. I said it was taking a 64x128 slice as soon as I mentioned the crunching of the images. I haven't slept. I've been gnawing on this all night. I do think I've got some insights as to what is going on, particularly with respect to the Hammer overlays.

If I could find the places these things are called, I know what needs to be done. I'm just not that good at tracing the code. It's all over the place, and I don't have a map or any working knowledge of the terrain. I've found the bits in the SDK that Impaler mentioned in post #4 (I followed MAX_YIELD_STACK), but can't follow the trail to where it goes to get the images.

Sorry if I come off grumpy. I've just been watching this thread and searching for the last 12 hours straight. I really do appreciate the help. I'd just like to be part of the search.
 
I think you have all necessary icons in Vanilla Vertical icons.dds, The trick should be to create food06.nif and food06.dds ( first, rename food05 to food10 for both files ) nif files would serve to decal loaf . the same for 07, 08, 09 and new 05 ; as well as for hammer and commerce. PM me for more details on that hypothesis. I also think the code should be fixed but I can't help with that.
 
Bwahahaha!!

OK. It's not what I was going for originally, but this works, and it works properly.
FixedYields.jpg


Basically, since I couldn't find the code where it loaded the symbol images, and I couldn't find the code where it drew the images, all I could access was how it chose which image to draw.

So, I dropped back down to 5 pictures per yield. Then I basically made it binary. The first image was for 1, the second image for 2, the third image for 4, the fourth for 8, and the fifth for 16. Since I haven't actually written any code for a decade, it's ugly, and it took a bit of debugging, but it works.
Spoiler :

Vertical_Symbols-1.png


Spoiler :
Code:
		int iLayer[NUM_YIELD_TYPES][5];
		for (int iYieldType = 0; iYieldType < NUM_YIELD_TYPES; iYieldType++)
		{
			int iYieldAmount = yieldAmounts[iYieldType];
			if (iYieldAmount > 15)
			{
				iYieldAmount -= 16;
				iLayer[iYieldType][4] = 5;
			}
			else iLayer[iYieldType][4] = 0;
			
			if (iYieldAmount > 7)
			{
				iYieldAmount -= 8;
				iLayer[iYieldType][3] = 4;
			}
			else iLayer[iYieldType][3] = 0;

			if (iYieldAmount > 3)
			{
				iYieldAmount -= 4;
				iLayer[iYieldType][2] = 3;
			}
			else iLayer[iYieldType][2] = 0;
			if (iYieldAmount > 1)
			{
				iYieldAmount -= 2;
				iLayer[iYieldType][1] = 2;
			}
			else iLayer[iYieldType][1] = 0;

			if (iYieldAmount > 0)
			{
				iLayer[iYieldType][0] = 1;
			}
			else iLayer[iYieldType][0] = 0;
		}

		CvSymbol *pSymbol= NULL;
		for (int i = 4;i>=0;i--)
		{		
			pSymbol = addSymbol();

			for (int iYieldType = 0; iYieldType < NUM_YIELD_TYPES; iYieldType++)
			{
				if(yieldAmounts[iYieldType])
				{
					gDLL->getSymbolIFace()->setTypeYield(pSymbol,iYieldType,iLayer[iYieldType][i]);

Um, I feel stupid for asking this, but it would have made things so much cleaner...

How do you express 2 to the n in C++? I thought it would be 2^n, but in looking ih the help, ^ seems to be XOR. Man, am I rusty at this. Heck, even better would be log base 2. I could do ln (assuming math.h is included), but didn't see any way to change the base. That would have dropped the whole thing down to one line of code or so.

Still, I feel I did a pretty good job on my first project. More to come! (eventually):king:
 
Back
Top Bottom