View Full Version : [SDK MODCOMP] Binary Yield Display (31 max yield displayed)


Quornix
Feb 18, 2007, 11:16 AM
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.


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:
http://i172.photobucket.com/albums/w8/Quornix/FixedYields.jpg

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. (http://forums.civfanatics.com/showpost.php?p=5086941&postcount=19)

And Binary_Yields_for_2.08.zip (http://forums.civfanatics.com/uploads/107257/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!

snipperrabbit!!
Feb 18, 2007, 05:31 PM
I think it would be even better with numbers for 4, 8 and 16. A nice addition would be a third artstyle for each yield representing 16 : a chcken leg for food, a safe for commerce, ....

Elucidus
Feb 20, 2007, 11:40 AM
This is great, why 4 and not 5 though? 5 seems a little more evenly spread? Can it be changed to 5? Either way, great job, I have been looking for something exactly like this.

snipperrabbit!!
Feb 20, 2007, 01:10 PM
it's said in title : binary yield display

Quornix
Feb 20, 2007, 04:42 PM
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.

Elucidus
Feb 20, 2007, 05:33 PM
Sorry, I understand. This is still pretty great. I will work on some graphics for this...thank you for this.

Elucidus
Feb 20, 2007, 05:48 PM
Hey what files were the code changes made too?

Quornix
Feb 20, 2007, 09:04 PM
Hey what files were the code changes made too?

CvPlot.cpp

Search for MAX_YIELD_STACK to find the proper location for the changes.

snipperrabbit!!
Feb 21, 2007, 02:42 AM
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 !

Elucidus
Feb 21, 2007, 06:53 AM
Okay great thanks, I'll probably write instructions and then post them here, I'll probably, also do the 1, 2, 4, 5, 10 for you and post that with the instructions.

Elucidus
Feb 21, 2007, 10:10 AM
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.

snipperrabbit!!
Feb 21, 2007, 10:48 AM
Try to work with PaintDotNet or The Gimp and play with layers and transparency.

Elucidus
Feb 21, 2007, 11:56 AM
Oh don't worry, I'll do that at home, just wanted to know what peoples thoughts are on this type of a format.

Elucidus
Feb 23, 2007, 12:02 AM
Hmm, not sure what I am doing wrong, but it doesn't compile, gives a bunch of illegal local definitions or something like that.

Elucidus
Feb 23, 2007, 12:24 AM
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. :)

Elucidus
Feb 23, 2007, 09:19 AM
Nevermind, I started over this morning and now everythign works, must have dorked something up.

Thanks.

Elucidus
Feb 23, 2007, 07:50 PM
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.http://forums.civfanatics.com/uploads/13499/Vertical_Symbols.jpg


I made them larger because I am using the 3 city tile mod also and that makes everything slightly smaller.

snipperrabbit!!
Feb 24, 2007, 02:52 AM
I think it is related to the alpha mask :

- you forgot to import your alpha mask

or

- you save it to dds dxt1 (no alpha )

Elucidus
Feb 24, 2007, 12:12 PM
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...

Quornix
Feb 24, 2007, 12:58 PM
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).

Elucidus
Feb 24, 2007, 01:07 PM
hmm, there has to be some other work around. Is there a way we can use a different .dds for each of the three resources?

Elucidus
Feb 24, 2007, 01:12 PM
Have oyu tried messing with this:

<Define>
<DefineName>RAND_YIELD_PRESENCE_DIE_ROLLS</DefineName>
<iDefineIntVal>16</iDefineIntVal>
</Define>

I can't get my images to work, so I can't mess with it.

Quornix
Feb 24, 2007, 01:23 PM
hmm, there has to be some other work around. Is there a way we can use a different .dds for each of the three resources?
I just gave a quick look, because that would be an excellent solution, but with a file search, I can't find any reference to Vertical_Symbols.dds anywhere in the XML, Python, or SDK files. So it doesn't seem like there's any way to define which file is used.

I'd imagine that it would be possible to completely disable the standard display commands, and create an new pile of code to display yields from whole cloth, but that is so far beyond me, that I can't even imagine where to start.

snipperrabbit!!
Feb 25, 2007, 02:46 AM
I thinks sometimes that Vertical_Symbol.dds is just an atlas that we can get rid of but I'm not sure. When I unpack my fpk, I obtain food01.dds and tutti quanti ... I explore the nif file and it refers to the same food01.dds ...

Quornix
Mar 29, 2007, 06:09 PM
OK, I've gone ahead and finished the base 5 version of the mod.

http://i172.photobucket.com/albums/w8/Quornix/BinaryYield.jpg

I'm still not fully happy with the display -- things are a bit cluttered, and it's sometimes hard to see the 1s over the 5s, or the 5s under the 1s. But it is fully functional, and displays up to 19 of each yield type.

CvPlot.cpp and VerticalSymbols.dds attached (I don't have a clean copy of the .exe, although I can make one if there are requests).

http://forums.civfanatics.com/uploads/107257/BinaryYield.zip

snipperrabbit!!
Mar 29, 2007, 06:25 PM
Very good ! it just need some artistic creativity now !

ollj
Apr 05, 2007, 03:47 PM
Definitely useful code.
The Icons need more different forms in the same color and not just different sizes.

1 food = normal bread slice slightly turned to the side, maybe a corner bitten off.
2 food = 2 normal bread slices, maybe buttered
4 food = normal bread
8 food could be 2 donuts (8-shape) or a muffin or shortcake
16 food could be a large cake for a 16th birthday (count candles).

1 hammer could be a gray rock
2 hammer could be 2 (crossed) metal sticks
4 hammer = normal hammer (size 4) or 4 tools
8 hammer = normal anvil with an "8" welded on it
16 hammer could be a roll of steel or a H-shaped steel frame with a "16" printed on or cut out of it.

1 gold = normal coin slightly turned to the side.
2 gold = 2 normal coins (or a larger coin of the value "2") or 2 gold nuggets.
4 cold could be four stacked coins seen from the side (not to mess up with 4 coins of the value 2, that would be 8).
8 gold = normal gold sack with an "8" printed on it
16 gold could be some yellow paper money (or a credit card) with a "16" printed on it. (they have paper money in weird units)

Even though humans are used to base5 due to 5 fingers per hand a binary code is still more efficient and all that is needed for math.

snipperrabbit!!
Apr 05, 2007, 04:48 PM
I think the only working version is 1,2,4,5,10 !

Elucidus
Dec 03, 2007, 10:39 PM
So has this changed with Beyond the Sword?

Elucidus
Mar 05, 2008, 09:36 AM
What are the changes to the numbers to make this a 31 yield display. I know it has to go:
1, 2, 4, 8, 16.

But I am unsure exactly what the changes to the source would be. Any help would be appreciated. I plan to make some new graphics for this, I'll try to base it off of ollj's suggestion