Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect some yields from overflow #181

Closed
Nightinggale opened this issue Oct 14, 2018 · 17 comments
Closed

Protect some yields from overflow #181

Nightinggale opened this issue Oct 14, 2018 · 17 comments
Labels
IDEA This is a game enhancement that is not accepted by the community yet.

Comments

@Nightinggale
Copy link
Contributor

When a colony overflows the warehouse, it loses some yields of most kinds. It would make more sense to give yields an overflow discard level, like discard cotton instead of silver/gold. Also it's really annoying to have overflown the warehouse once and then end up with 49 tools for your pioneers and no ore.

@Nightinggale Nightinggale added the IDEA This is a game enhancement that is not accepted by the community yet. label Oct 14, 2018
@LibSpit
Copy link

LibSpit commented Oct 14, 2018

Oh yes! this is a nightmare, throwing out gold and weapons because you accidentally brought in 5 more stone....

@ShadesOT
Copy link
Contributor

There is sort of code related to that in CvCity::doYields(). When a building unlocked the custom house trade settings. Then the minimum threshhold for a yield type, befor this yield is sold from the storage loss, is enforced. But only after the unlock happened.

@devolution79
Copy link
Member

devolution79 commented Oct 15, 2018

This has been discussed before on the forums and the original intention was that the loss of yields represesents general wastefulness in light of storage being filled to the brim. In other words, this is actually a feature. However, there is a real bug in this system. When rushbying, yields required for completion of the unit may spoil before the unit is produced and this should be fixed!

@ShadesOT I thought your refactoring would take care of the latter ?

@Nightinggale
Copy link
Contributor Author

This has been discussed before on the forums and the original intention was that the loss of yields represesents general wastefulness in light of storage being filled to the brim. In other words, this is actually a feature.
I missed that and I strongly disagree. Vanilla had storage per yield and hence spoiled a yield when that yield overflowed. Protecting weapons/tools etc wasn't an issue until overflowing one yield can remove another yield. In other words it's an issue introduced by RaR (or TAC?).

I don't know how much "real life" experience you have, but based on personal experience, if you ran out of warehouse space, you look at what you have stored and select what can be moved to unheated facilities and what can be placed outside. Because you know the items might be damaged from doing so, you pick based on value, how easy it is to replace, how durable it can withstand being stored in worse conditions etc. You do not move 5% of everything outside regardless of value.

To put it in WTP context, you sacrifice cotton to protect the much harder to get weapons and tools.

And now that I think about it, why can't we pile up ore outside? It can handle rain much better than say cotton, yet the game treats them equally when overflowing.

@devolution79
Copy link
Member

devolution79 commented Oct 15, 2018

Invoking the realism argument is a bit strange, this is a game after all. I'm ok with wastage being a bit harsh, why would we want to hold the player's hands like that. We might as well just remove the requirement to build storage at all and let stuff "pile up outside", right ? I guess it's called stream-lining or sumpthin' :P

@Nightinggale
Copy link
Contributor Author

The problem with spoilage being harsh is that it can be gamebreaking. You use your early units as citizens early on and want to remake those professions at some point before being well developed. If you spoiled for even one turn, then you can't because you miss one weapon or tool to do so. You can't produce them yourself early on and getting new from Europe is doable, but it cost a cargo slot and with only 2 slots, it delays import of the early colonists.

The game is supposed to be fun. Losing a weapon because the natives decides to give you a bunch of furs is no fun at all, particularly if you planned to remake the soldier profession a few turns later and then without it your plan becomes impossible.

@LibSpit
Copy link

LibSpit commented Oct 15, 2018

yeah the spoilage in this system is just silly, where you throw away really valuable stuff but keep a pile of stone. I agree just 'piling stuff up outside' takes it too far as a mechanic, but I think the point about how this mechanic changed to be a little of everything instead of too much of something is wrong, that just wouldn't be how you would approach the problem.

Maybe a pop up that asks you what you want to chuck out or something. It was an issue that got introduced by the idea of general storage rather than an equal space for each thing.

Or maybe a 'keep' button check box system of some kind, so you click the things that don't get thrown away ever (until that is all you have left to throw away).

@ShadesOT
Copy link
Contributor

I neither would argue with realism, or we would need to start talking about those poor horses ;-D

@ShadesOT I thought your refactoring would take care of the latter ?

Yeah? Because of these #87 and #75 ? You are right. And I think the refactoing will take care of that, if it advances far enough. If my speed is not fast enough, I can remove myself as assignee. I am still picking low hanging fruits to work on.

... where you throw away really valuable stuff but keep a pile of stone. ...

Hey, did you play this game? Stone is really valuable at some point. ;-)

Maybe a pop up that asks you ...

This will be unnerving.

In general, I think, if the player can decide what to keep and what will be wasted/autosold, then it only can be a priority list, not a true/false checkboxlist or something equal, because what if the players selects to keep everything. And after all it is about priorities, so ... priority list. Could be implemented via an int input for each yield or a dropdown list to select the place in the list or whatever.

The place where this could be done, could be the customs house popup. Storage loss and storage loss autoselling are closely related topics, for the player and in the code as well.

@Nightinggale
Copy link
Contributor Author

... where you throw away really valuable stuff but keep a pile of stone. ...
Hey, did you play this game? Stone is really valuable at some point. ;-)
I would ask the same thing. There are 3 yields, which doesn't count towards warehouse capacity or overflow and they are: food, lumber and stone. In other words you can't get the warehouse to overflow by piling up stone.

@LibSpit
Copy link

LibSpit commented Oct 15, 2018

ok...

throw away something worth 20 gold while keeping hold of something worth 3 gold.
(Also I saw it throw away lumber in my game I am fairly certain...)

Stone = valuable or useful? Because holding onto it for 100 turns while you wait for the stone buildings to unlock while throwing away tools and guns and silver that could be working for you right there and then is not the way I would run my cupboard.

Also on the point about checkboxes, I said until everything else is gone, so if you check everything you have basically done the same thing as check nothing.

A priorities list works fine too. I wouldn't tie it into the customs house directly (I am not sure if you were just talking code/interface or the actual building in game) as this problem can affect you early on in the game, in the weapon/tool scenario mentioned early, it can really screw up your early game progression.

@LibSpit
Copy link

LibSpit commented Oct 15, 2018

In answer to the question I haven't played all the way to the end, when I discovered that trains are no longer a thing my motivation to continue playing pretty much evaporated.

@ShadesOT
Copy link
Contributor

ShadesOT commented Oct 15, 2018

... when I discovered that trains are no longer a thing my motivation to continue playing pretty much evaporated

We are discussing the return of railroads in #98 .

Stone = valuable or useful?

Well, technically you are right, to say it is not "valuable" in terms of gold.

@Nightinggale
Copy link
Contributor Author

I have been wondering about a system for priority for how to discard yields when over the threshold while maintaining a priority to preserve the most valuable yields.

First of all, this is for after #87 where we get a function, which serves only for handling overflowing warehouses.

I have come up with the idea of adding priority to yield xml. Not a unique number to each yield, but rather a few groups of priorities.

When overflowing, we know how much is overflowing and we calculate how many yields we lose. We then count how many yields we have of priority 0 and then remove a fraction from each. If there isn't enough to lose from, then move on to priority 1 and repeat. Loop through priorities until the decay has reached the number of yields we requested from the start.

Setup of this can make use of the new array classes in the CivEffect branch. At post xml loading, make a vector of BoolArrays of length yields. Loop through yields. For each yield, set the index to true in a BoolArray and the BoolArray to set is the same as the priority.

Once done with this, in CvGlobals, add a vector of YieldTypeArrays (new class). Set the length of the vector to the same as the length of the BoolArray vector. Loop through the vector and assign the YieldTypeArray with the BoolArray of the same index.

What we end up with is arrays of YieldTypes. If we loop through the YieldTypeArray at index 0, we will get all the YieldTypes for yields, which have priority 0. This means looping the YieldTypeArray will prevent looping all yields, only those we want to loop at the priority in question.

The result will be fast code without any hardcoding as it completely adapts to xml settings. It will give the xml modder the choice of which yields to discard if the warehouse overflows and protect those weapons and whatever we need for professions while low cost "grow to sell" yields are discarded first.

If a yield can't be discarded due to warehouse overflow (like food), set it to priority -1.

@ShadesOT
Copy link
Contributor

An update from #75 :
doYields() will now properly calculate the amounts, which are "protected" by the customs house overflow protection settings (never sell checkbox and sell threshhold). After that it will calc the overflow for each yield.

@ShadesOT
Copy link
Contributor

ShadesOT commented Nov 9, 2018

#214 proposes to implement a way to destroy goods from within the city screen. This would ease this problem a little bit, I guess.

@Nightinggale
Copy link
Contributor Author

Sure it would reduce the problem, but it doesn't remove the core of the problem, which is to loose one weapon because you didn't notice your cotton is overflowing. We really should implement both solutions as they aren't mutual exclusive.

Also it would make sense to allow the user to mark yields for "first to be discarded", which has higher priority than xml settings. Imagine having 700 horses, then you might want to discard horses a bit faster than the xml settings.

@Nightinggale
Copy link
Contributor Author

Restarted the discussion in #343 with a new plan for implementation. I'm closing this one to avoid confusion and since this one has been idle for ages, odds are that it won't suddenly wake up. Also one reason why I think this went nowhere is any concept of implementation mentioned here doesn't look great meaning there is no clear goal of what to do or what we want to accomplish other than "make it better".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IDEA This is a game enhancement that is not accepted by the community yet.
Projects
None yet
Development

No branches or pull requests

4 participants