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

Clarify customs house mechanics #219

Closed
ShadesOT opened this issue Nov 14, 2018 · 4 comments
Closed

Clarify customs house mechanics #219

ShadesOT opened this issue Nov 14, 2018 · 4 comments
Labels
Discussion A topic to be discussed. Question Further information is requested

Comments

@ShadesOT
Copy link
Contributor

I want to ask what your understanding of the customs house mechanics is. We need to clarify this game rule, as a discrepancy of my understanding and Rays understanding (manifested in code written by Ray), already lead to a bug (#196).
Maybe there are even more than two understandings. I give you a resume of Rays and mine.

You all know the customs house settings with its options of never selling a yield and setting a sell threshold for a yield.

Ray coded it, so the customs house would sell part of everything that is over the sell threshold. No matter if there is overflow or not. Basically enabling the player to use the customs house instead of ships to export to europe, whenever the player choses to.

I started to make changes, with the understanding, that the customs house settings tell what NOT to sell if the warehouse overflows. In other words the customs house settings only take effect, IF there is overflow. Then they say "If possible, never throw muskets into the overflow" or "only throw tools into the overflow, if there are more than 200."

The reasoning for my understanding is the colopedia text (TXT_KEY_BUILDING_CUSTOM_HOUSE_STRATEGY): "Customs house ... allows you to sell sureplus goods at 80% of their selling price in europe. You can manage the Custom House through the Custom House Screen of the settlement, where you can allow or disallow the Custom House to sell a certain good, and determine the minimum quantity of each good under which it will not be sold. ... "

But which can be understood both ways.

The questions are now, what is your understanding of the customs house mechanic and which mechnic should be in the next release. The old mechanic or my new implementation.

Fun fact: I already finished rewriting the customs house mechanic as to my understanding of it (thinking Rays implementation was faulty), so the code for this totally new game mechnic is already there. We actually could - with a few additions - use them side by side in a later release. I am proposing this, because my implementation would solve all the issues of this type (Protect some yields from overflow #181) which are popping up periodically.

@LibSpit
Copy link

LibSpit commented Nov 14, 2018

I would say your understanding is the right one, that is sells from the overflow. My understanding was that it was always meant to be a 'safety net' that is better than just losing the goods.

As you get a better rate if you do it manually from ships.

As you say having both mechanics available would be good, as you could potentially have an auto trade building/s that get progressively more efficient or could sell larger amounts of goods in a turn, etc.

As well as a building that handles the overflow to convert from lost goods into sold goods.

@Nightinggale
Copy link
Contributor

Ray's approach matches the custom house in classic colonization and as such is likely what people would expect. It's also better from a gameplay perspective. The goal is a high end building, which allows trading during the war of independence. Classic colonization allowed building custom houses during any era, but the trading functionality only worked after declaring independence. Ray didn't add the independence era check though.

However the real question is not how some other people did something in the past. The real question is what do we want?

I would say the custom house should be able to sell not just overflow, but everything over the threshold, but we should alter how the payment calculation is done.

iMoney = price in Europe * number of yields sold
money gained = (iMoney * custom house sale price) - (iMoney * tax rate)

Currently you get 80% of the price through a custom house. If we turn that around, it's a 20% fee for paying somebody else to do the shipping. You still pay the taxes of the full price meaning you will always have to pay for somebody else to do the shipping and moving cargo with your own ships will always grant you more money.

Declaring independence can then remove the tax part, meaning custom houses becomes more profitable during woi than before it starts. In fact we should make CivEffects take care of the tax rate modifier and the calculation becomes:

iMoney * tax rate ->
iMoney * iTaxRate * iTaxModifier / 10000

10k = 100 * 100, meaning this is the same as multiplying one number, divide by 100, multiply and divide, but it's faster because it cuts away a division and it is less prone to int rounding errors.
iTaxModifier is then 100 by default, but it adds the modifier from each owned CivEffect, meaning woi era will grant a -100 modifier to end up with 0.


Next question is how to set this up. I'm not happy with the "never sell" approach as it sells everything by default. I don't want the default setting to sell tools and weapons. We should have an xml tag in CvYieldInfo to tell if it's a goods to be sold by default. Perhaps also a default threshold for normal speed. Other speeds can then apply one of the speed modifiers, most likely the same as is used for warehouse capacity.

And the first 3 shouldn't show up in the GUI since they can't be sold anyway. It would be nice if it will only display yields, which can overflow using warehouse capacity, something which should be configurable in CvYieldInfo.


As for controlling which yields to overflow, I say my proposal in #181 would likely be the way to go.

In short: add a priority to YieldInfo where each yield ends up in a priority group.
When overflowing, calculate how many yields should be lost. Calculate the amount of yields stored in group 0. if you store 100 and need to lose 10, then lose 10% of each yield in the category (deal with int rounding to ensure you lose 10). If more than 100% of group 0 is lost, move on to group 1 and repeat.

Now we should combine this with the custom house (and likely your branched code, which I haven't read yet). Group -1 would be yields marked by the player as the first to go. Last group would be yields marked by the player as protected. Marked yields are skipped when doing the normal groups.

We need some way of dealing with "overflow, but only over X stored". It's a nice feature because you can breed horses, but if you don't look and suddenly have 900, you might want to overflow horses while you want to not overflow horses if you have 30. The question is how to fit this into the system.

One issue to look out for is the player setting all yields to keep 999 when the colony can store 300. All yields are below the threshold, but something needs to overflow. It shouldn't become an exploit to create an artificially large storehouse.

@raystuttgart
Copy link
Collaborator

Hi guys, as I see whe have issue #344

Do we still need this issue here as well?
Or would it be solved by #344 and can thus be closed?

@raystuttgart
Copy link
Collaborator

This was just a discussion.
There is nothing to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion A topic to be discussed. Question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants