[SDK MODCOMP] Binary Yield Display (31 max yield displayed)

Quornix

Warlord
Joined
Dec 27, 2006
Messages
134
[EDIT] I decided to link to this in my signature, and figured I'd mention that there's a version that looks mostly normal in post #25, uses the "big" image every five, and handles up to 19 points per yield. Hopefully this workaround won't be needed in BTS.[/EDIT]


Heh. My first modcomp. Originally, I wasn't even going to post this, because it's harder to see what the yield is at a glance. But since it works, and I haven't seen any solution to the display limit of 9 of a yield, I figured I might as well. A picture is worth a thousand words, so:


Each small slice/hammer/coin represents 1 yield, each large slice/hammer/coin represents 4 yield, and each loaf/anvil/bag represents 16 yield. So the pastured sheep is 16/4/4, while the windmill on the tundra hill is 6/6/10.

This actually works quite nicely if you set the food consumption to 4, as that means that every large slice feeds 1 person. It brings back a bit of the intuitiveness that gets lost when you leave base5 for base4.

Not sure what else to put here, except the files. I'll post the code changes if requested, but it's pretty simple, so I haven't included them. Actually, they're in this post.

And Binary_Yields_for_2.08.zip is now available. It includes the CivGameCoreDLL.dll and the VerticalSymbols.dds files, in their appropriate folders.

Let me know what you guys think!
 
Yeah. Unfortunately, I wasn't able to get an expanded image selection, so I had to work with the five images for each yield (1,2,3,4,5) plus the generic zero. I made them 1,2,4,8,16, set them to overlap nicely, and changed the logic behind which image was displayed -- which is possible in the SDK. I could have done 5, but then I'd have had to do 1,2,4,5,10 for a max of 19. Hardly the end of the world, but this is at least vaguely more elegant -- although they way I wound up writing the code means that the code wouldn't have been any sloppier.

As for different graphics, well... I really suck at drawing. I'll see what I can do.
 
Would you mind to do the aternative 1, 2, 4, 5, 10 version because I think to have choice is always better. Don't worry for graphics, you just have to ask in the graphic request thread and someone could do it for you !
 
I was thinking of something like these to represent the others. My only issue with this system is that it is hard to read some of the bigger numbers. Could do two fours for an 8 or even just another 8.

Bare with me as I am at work and only had paint brush to work with.

EDIT: Forgot to crop them.
 

Attachments

  • 4.PNG
    4.PNG
    2.9 KB · Views: 946
  • 16.PNG
    16.PNG
    2.8 KB · Views: 935
Well I messed with it until I got it to compile, but it shows everything as max..., what exactly am I supposed ot replace with your code, I thought it was obvious, but apparently I was mistaken. :)
 
OKay now I feel stupid. I altered the graphics...still generic and made everythign slightly larger. But when I convert it to DDS and try it in game everything has a black background. I am sure I am forgetting something as I have alter the graphics before, it just has been a long time.
Spoiler :



I made them larger because I am using the 3 city tile mod also and that makes everything slightly smaller.
 
Great thanks. BTW, you aren't gonna believe this. I FOUND IT!

To change the way civ reads the graphics for the yields goto globaldefines.xml

<Define>
<DefineName>MAX_YIELD_STACK</DefineName>
<iDefineIntVal>5</iDefineIntVal>
</Define>

THis controls how far down the file civ will go before it starts stacking.

I changed it to 10 and did a test run, a farm that gave me 9 food showed 4 hammers for food.

SO we can make it anythign we want. Now, how do I import the alpha mask again...
 
Yes, you can tell it go to MAX_YIELD_STACK + 1 for the second yield type, and 2 * MAX_YIELD_STACK + 1 for the third type. Unfortunately, there are some rules to the drawing of the images that, so far as I can tell, you just can't get around.

0) The 16th pulled image is always used for 0, regardless of the size of the file.
1) The drawn picture will always be square.
2) The distance it skips down to get the next image is equal to the width of the Vertical_Symbols.dds file.
3) The image it pulls from Vertical_Symbols.dds is always one 16th the height of the total file.

Composite rule from the first three rules:
4) (1 + 3) If the image pulled from VerticalSymbols.dds is rectangular, it will shrink the image in one dimension until it is square, then display the square picture.

So, in order to increase MAX_YIELD_STACK to, say, 10 (which I wanted to do on my first attempt), you would have to double the height of VerticalImages.dds, making it 64x2048 pixels. From rule 2, you can pull 32 different images, as it skips down 64 pixels for each successive image. Unfortunately, each of those images would be 128 pixels tall (1/16th of 2048). These will then be squished into 64x64 pixel pictures to be displayed.

I did try to do another workaround, which should be possible. Basically, I quadrupled the height of the Vertical_Symbols.dds file, then (I'll display this horizontally, and only for food) drew the following images:

00011110005555000

So, since it will pull four of those images for each picture (by rule 3), and step down by one image (by rule 2), the "one food" picture is 0001, the "two food" picture is 0011, 3F = 0111, 4F = 1111, then the logic of the draw calls can jump the 5F picture to 0005.

However, I never got the logic to work fully, and the output was quite ugly. I had to stretch the initial images 4x vertically, which meant that I had to keep each one quite narrow to fit them into their 64x64 "box". And it would display 14 food as:

1F
1F
1F 5FOOD
1F 5FOOD

with no overlap. It just wasn't that nice. Actually, my failure to do that workaround well is the reason I posted this when I did. I thought I might have had a better solution, but it just wasn't that hot.

I haven't worked on modding much of anything since my initial post, so I'm going to get around to some of the requests this weekend. Thanks for all the feedback. I'd expected this to sink like a stone (as much as anything does in this forum with some January posts still being on the first page).
 
Top Bottom