-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Refund wasted production as gold #4058
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
Conversation
Just noticed a quite big bug. This only accounts for constructions that were in your queue when they became obsolete, not for ones that you had already removed from your queue. I will fix this shortly, until then this will be a draft. |
Any wasted production, from for instance a partially completed wonder or obsolete units, will now be refunded as gold (in a 1:1 ratio). We update both at the start and end of the user turn. Updating at the start to account for wonders completed after our previous turn and updating at the end to account for obsolete buildings/units as a consequence of our own turn. When obsolete units get replaced by their upgraded version (as in civ 5) this code should probably be updated.
The code has now been updated. This did however require calling |
in civ5 all of the production invested into obsoleted units is transferred to progress towards their respective upgrades. |
I am aware of this but decided not to implement this yet because the issue did not include this (and I still need to get a little more familiar with the codebase 🙃). It can always be added in a later pull request. |
I'm not convinced the original game refunded you for a lost wonder race at all. I would be fully in favour of this if the refund ratio were moddable - then we could easily make it zero in the vanilla ruleset and thereby postpone the final decision while mods could do what they want... Production for obsoleted units being preserved and applied to the successor units is IMHO a completely separate matter, as is production overflow - which Civ4 (four not five) definitely had, and Civ5 99.9% not. |
Here is a link saying it's a 1-to-1 ratio:
Actually, according to this page of the civ 5 forums, this is an extensively documented mechanic: |
I've recorded all of the cases in vanilla civ5: production.overflow.mp4production.transfer.mp4wonder.compensation.mp4anyway, the topic on civfanatics linked by @xlenstra explains production overflow really well. |
... and ravignir's input of course is beyond doubt. 👍 |
Here is what happens when an obsoleted unit has no upgrade: You get a regular production overflow and nothing more. |
So if I understand it correctly, we have observed that in Civ 5:
I suggest these points get added to #663. I can implement the first two points quite easily and then have this branch merged. The third point can then be added in a later pull request. |
yes, notice the 12 production invested into scout in the last video is lost forever. |
This looks good - I have no comments at all on the existing code! |
Didn't I read a -1 somewhere? Otherwise 👍. I could only add the reminder - If it's not too much hassle then allowing mods to change the behaviours implemented for this might be nice. |
If a wonder is built somewhere else but the user has production in this wonder, the production will be refunded as gold in a 1:1 ratio. A notification will be shown to indicate this. This reflects the behaviour in Civ 5. If a unit becomes obsolete and an upgrade is available, the production put into this unit will now be transferred to the upgraded version. If the unit is queued, the queued unit will also be changed to the new version and the user will be notified via notification.
Time to optimize the wording (not nitpicking, if this weren't so good I woudn't bother)? I feel the notifications are a bit long (I can already see the issues from people with 640x360 @ 72dpi screens) and 'has been obsolete' doesn't sound quite perfect... So, just thinking & feel free to ignore:
|
Minor note: I'm fairly sure that production put into a building that you then rush-buy is not refunded in any way. |
I totally agree but couldn't think of a shorter wording at that time. I will shorten the wording to your suggestions.
I agree but the existing notification for removing obsolete constructions was
thus I used this wording in order to be more uniform. I would personally prefer to change the old and new notification to
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for accidentally hitting the green pill instead of the white one.
The notifications have now been shortened to what's below. Should I also just change the
|
"has become obsolete" [construction] has become obsolete and was removed from the queue in [cityName] = |
yup, it is not. |
Rewording of |
happy to see this resolved |
For completeness sake, this is yet to be implemented and will require a different pull request:
|
As discussed on yairm210#4058, production (or hammer) overflow in Civ 5 is a thing and goes according to rules described on https://forums.civfanatics.com/threads/hammer-overflow.419352/ This has been added to the game. There are no visual indicators for the user yet. This will probably be added later.
As discussed on #4058, production (or hammer) overflow in Civ 5 is a thing and goes according to rules described on https://forums.civfanatics.com/threads/hammer-overflow.419352/ This has been added to the game. There are no visual indicators for the user yet. This will probably be added later.
Any wasted production, from for instance a partially completed wonder or obsolete units, will now be refunded as gold (in a 1:1 ratio). When obsolete units get replaced by their new version, this code should probably be updated.
I first added the gold refund code in
validateInProgressConstructions
, but this function is only called uponendTurn
. Hence a refund for a wonder build elsewhere would occur after the relevant turn instead of before the turn. Hence the implementation is now put invalidateConstructionQueue
.The current implementation does result in code duplication between
validateInProgressConstructions
andvalidateConstructionQueue
. Any ideas on how to neatly remove this duplication are appreciated.Another thing to consider would be a notification/popup explaining why the gold was added, but this probably clutters the interface too much.
Fixes #4047