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

fuel efficiency maybe gets wrong values for BAD_FUEL species #2620

Open
agrrr3 opened this issue Oct 29, 2019 · 23 comments
Open

fuel efficiency maybe gets wrong values for BAD_FUEL species #2620

agrrr3 opened this issue Oct 29, 2019 · 23 comments
Labels
category:bug The Issue/PR describes or solves a perceived malfunction within the game. component:content scripting The Issue/PR deals with the FOCS language, turn events or the universe generator.

Comments

@agrrr3
Copy link
Contributor

agrrr3 commented Oct 29, 2019

With the newest patches a negative fuel bonus looks like it scales the wrong way (being better means less max fuel).

E.g. so the base malus (-0.5) gets smaller for bad efficiency hulls and higher for better efficiency hulls.
It is the expected value for good efficiency hulls (-1 max fuel).

I am not sure what the solution to this is - I am contemplating following

  • do not apply fuel efficiency to species fuel bonus; this means shifting FOCS effect after fuel efficiency scaling and doing some exception in AI code
  • somehow handle negative bonus differently from positive bonus in FOCS and AI (this most certainly leads to uncooked spaghetti code)
  • shift species fuel bonus so BAD_FUEL is a +0 bonus and GOOD_FUEL +0.5 ; For keeping game balance that means all hull fuel should be decreased (so for a average/good/great efficiency hull -0.5/-1/-2)

I probably prefer the third one (shift the species fuel bonus) - it makes for the lowest number of exceptions in code and is also similar to other values (e.g. BAD_SUPPLY 0 AVERAGE_SUPPLY 1...)

Edit1: I do not anymore think this is a functional issue; following shows the current values

Max fuel for BAD_/AVERAGE_/GOOD_/GREAT_FUEL_EFFICIENCY hull for old style max fuel ~4
0.9/1.5/3/6 - BAD_FUEL species (e.g. Scylior)
1.2/2/4/8 - AVERAGE_FUEL species  (e.g. Human)
1.8/3/6/12 - GREAT_FUEL species (e.g. Fulver)

Bad fuel species always is reasonably worse than average fuel species (you have to add one fuel tank on starting tech to get to average level). It is just the UI that saying there is a negative bonus and then its multiplied.

@agrrr3
Copy link
Contributor Author

agrrr3 commented Oct 29, 2019

Or maybe we want it to be the way it is. Hm...

@agrrr3
Copy link
Contributor Author

agrrr3 commented Oct 29, 2019

The more I think of this I think it is already working the right way. Solution number 3 would actually only change the UI (no negative bonus, only positive scaling) but the result would stay the same.

We do not want a fixed bonus and we probably want linear scaling bonus along the BAD/AV/GOOD/GREAT axis.

Implementing solution 3 only for different/nicer UI is not worth it in my opinion.

So I will leave this shortly opened and close in a few days if nobody opposes.

@agrrr3 agrrr3 changed the title fuel efficiency gets wrong values for BAD_FUEL species fuel efficiency maybe gets wrong values for BAD_FUEL species Oct 29, 2019
@Morlic-fo
Copy link
Contributor

One solution is to use the same approach as is already done for bad population
Instead of simply multiplying likeValue = Value * factor, use the formula Value = Value + (factor-1) * abs(Value) instead.

@geoffthemedio geoffthemedio added category:bug The Issue/PR describes or solves a perceived malfunction within the game. component:content scripting The Issue/PR deals with the FOCS language, turn events or the universe generator. labels Oct 29, 2019
@Vezzra
Copy link
Member

Vezzra commented Nov 1, 2019

That is a bug I strongly prefer to be fixed for 0.4.9.

@Vezzra Vezzra added this to the v0.4.9 milestone Nov 1, 2019
@agrrr3
Copy link
Contributor Author

agrrr3 commented Nov 1, 2019

@Morlic-fo i am not sure what that approach achieves. Does it lead to a different display of the effect? Max fuel is never below zero currently so i do not see what taking the absolute does.

edit1: also tried the suggested change and i did not see the effect in game

@Vezzra what is the bug you would like to see fixed? The UI issue?

@agrrr3
Copy link
Contributor Author

agrrr3 commented Nov 2, 2019

For the UI issue I found three approaches:

  1. make the meter effect coming from the hull very late (later than fuel efficiency scaling), so there is no need for the subtraction/effiency/re-add triad (not sure if that is possible though)
  2. split the effect in its three parts and use different accountinglabels so if you multiply the 60% with the sum of the effects above it fits the fuel efficiency effect value (and in the last line, you add the hull fuel value)
  3. Show the effects as relative application instead (i.e. -40%, +0%, +100%, +300%) (this can be combined with 2)

@agrrr3
Copy link
Contributor Author

agrrr3 commented Nov 3, 2019

I think regarding approach 1) that Universe::UpdateMeterEstimatesImpl adds the starting meter value with cause ECT_INHERENT as the first entry to the m_effect_accounting_map[<object_id>][<meter_type>] vector. Afterwards it executes the effects and does the account and as a last step it writes another entry if there is a discrepancy between the calculated and the expected final value.
There is not really a place to hook in there.

It should be possible to switch order before writing the accounting values out though. Somewhere in the FleetDetailWnd probably.

@agrrr3
Copy link
Contributor Author

agrrr3 commented Nov 4, 2019

So having spent some time in the code, the right approach is to move the meter effect from the hull max fuel meter to be very late. The hackaround in FOCS ( (val-hullfuel) * efficiency )+hullfuel) becomes unnessecary and the order in the UI is also fine.

The other options are much more hackish.

@agrrr3
Copy link
Contributor Author

agrrr3 commented Nov 5, 2019

Should be reasonably fixed by #2632 by shifting the base effect to the end.

@Vezzra
Copy link
Member

Vezzra commented Nov 7, 2019

@agrrr3,

@Vezzra what is the bug you would like to see fixed? The UI issue?

Well, I have to admit I don't fully understand what's going on, but what you said here sounds pretty serious to me:

With the newest patches a negative fuel bonus looks like it scales the wrong way (being better means less max fuel).

If that means that having any of the XX_FUEL species traits will cause negative fuel boni scale the wrong way, then this is a game mechanic bug which needs to be fixed. If it's only a display bug, then it's not quite as serious, but still something I'd like to see fixed for 0.4.9.

@agrrr3
Copy link
Contributor Author

agrrr3 commented Nov 7, 2019

If that means that having any of the XX_FUEL species traits will cause negative fuel boni scale the wrong way, then this is a game mechanic bug which needs to be fixed. If it's only a display bug, then it's not quite as serious, but still something I'd like to see fixed for 0.4.9.

"Scaling the wrong way" was the impression i got by looking at the IMO confusing UI.
Else it means that the linear steps are simply higher for the better efficiency hulls which is OK IMHO (I put the results into an update of the original post)

@Vezzra
Copy link
Member

Vezzra commented Nov 10, 2019

@agrrr3,

Should be reasonably fixed by #2632 by shifting the base effect to the end.

Oops, must have overlooked that statement... so can we close this as resolved?

@agrrr3
Copy link
Contributor Author

agrrr3 commented Nov 10, 2019

@agrrr3,

Should be reasonably fixed by #2632 by shifting the base effect to the end.

Oops, must have overlooked that statement... so can we close this as resolved?

As soon as #2632 is merged.

@Vezzra
Copy link
Member

Vezzra commented Nov 15, 2019

Argh, of course... I'm obviously somewhat confused... 😉

@Vezzra Vezzra removed this from the v0.4.9 milestone Nov 15, 2019
@l29ah
Copy link
Contributor

l29ah commented Nov 19, 2019

I observe myself playing on the @o01eg's longturn server as a species w/o the fuel efficiency specified in focs.txt file (i guess that means i should be average?), and the ship designer tells me that the large/medium/small hull carry 1.5/3/8 fuel. WTF?!

@geoffthemedio
Copy link
Member

Could you be specific and perhaps attach a screenshot of the fuel meter accounting breakdown?

@l29ah
Copy link
Contributor

l29ah commented Nov 21, 2019

I'm as specific as possible. There's no breakdown in the ship designer.

@geoffthemedio
Copy link
Member

What species?

@l29ah
Copy link
Contributor

l29ah commented Nov 21, 2019

Chato.

@agrrr3
Copy link
Contributor Author

agrrr3 commented Nov 21, 2019

I observe myself playing on the @o01eg's longturn server as a species w/o the fuel efficiency specified in focs.txt file (i guess that means i should be average?), and the ship designer tells me that the large/medium/small hull carry 1.5/3/8 fuel. WTF?!

What exactly is the WTF? The base values changed in order to stress differences in fuel (small hulls almost no restrictiions, large hulls very dependent on supply network).

@l29ah
Copy link
Contributor

l29ah commented Nov 22, 2019

The description mentions the small hull having one unit of fuel more than the rest of the crowd. Also WTF is the 1.5 fuel value: it's effectively 1.

@agrrr3
Copy link
Contributor Author

agrrr3 commented Nov 22, 2019

The description mentions the small hull having one unit of fuel more than the rest of the crowd.

Thank you! The description is wrong and I fixed it for the coming weekly build. Fuel efficiency is a big change, if you find more inconsistencies please share.

Also WTF is the 1.5 fuel value: it's effectively 1.

If you are stranded with 0.5 fuel and have 0.1 refuel it takes only 5 turns to be able to make a jump instead of 10 turns.
Also a fuel tank part at start tech will give 0.5 fuel for average fuel efficiency, so adding one to your large hull will give you 2 jumps.

@Vezzra
Copy link
Member

Vezzra commented Nov 24, 2019

The description is wrong and I fixed it for the coming weekly build.

Please keep in mind that the coming weekly build will already be based on the release branch, which is going to be created in less than 4 hours (as of the time of this post).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:bug The Issue/PR describes or solves a perceived malfunction within the game. component:content scripting The Issue/PR deals with the FOCS language, turn events or the universe generator.
Projects
None yet
Development

No branches or pull requests

5 participants