I can't find where the code for HullType::Fuel is located or where the value that that method returns is determined.Geoff the Medio wrote: ↑Mon Oct 14, 2019 8:15 amWhat do you mean by "stuff" and "coming from in the code"?I can't seem to find where the hull->Speed(), hull->Fuel(), etc stuff is coming from in the code.Do you mean you can't find the HullType class definition? Or where the code for HullType::Fuel is located? Or where the value that that method returns is determined?I can find a lot of places hull_type->Fuel() gets used (where hull_type is a const HullType*) but when i search for HullType* i'm having difficulty following the thread to where these methods are defined.
New Fuel Settings?
Moderator: Oberlus
Forum rules
Always mention the exact version of FreeOrion you are testing.
When reporting an issue regarding the AI, if possible provide the relevant AI log file and a save game file that demonstrates the issue.
Always mention the exact version of FreeOrion you are testing.
When reporting an issue regarding the AI, if possible provide the relevant AI log file and a save game file that demonstrates the issue.
Re: New Fuel Settings?
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13586
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: New Fuel Settings?
Hull base fuel add-subtract is ok to me. I suggested that option in the PR discussion, without getting an answer. I also said that in my comment above.Geoff the Medio wrote: ↑Mon Oct 14, 2019 10:46 am Perhaps compromise by doing both the tag check and hull base fuel add-subtract, then?
Tag check is unrelated. Not sure where the compromise is.
The main work for hull base fuel add-subtract that is that all but the average fuel efficiency the hulls have to be changed accordingly (can be speed up with bash magic). Anyway I will probably not get around to do that in the next two weeks.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Look, ma... four combat bouts!
Look, ma... four combat bouts!
Re: New Fuel Settings?
I can do that, if you like.
Re: New Fuel Settings?
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Look, ma... four combat bouts!
Look, ma... four combat bouts!
Re: New Fuel Settings?
I'll give it a day or two to see if there are any objections to this approach, then i'll go ahead with it.
Done: https://github.com/freeorion/freeorion/pull/2596
Everything looked okay after a skim through Pedia/Hulls in game and adding a fuel tank to a smattering of hulls in the Shipyard.
Done: https://github.com/freeorion/freeorion/pull/2596
Everything looked okay after a skim through Pedia/Hulls in game and adding a fuel tank to a smattering of hulls in the Shipyard.
Re: New Fuel Settings?
Looks like there are a number of things to do yet here. I'm confused about some of them, so i'll try to summarize.
Original issue: https://github.com/freeorion/freeorion/ ... -543218868
Pull request thread: https://github.com/freeorion/freeorion/pull/2596 (Pull request changes formula to
effects = SetMaxFuel value = (Value - HullFuel name = ThisHull) * @2@ + HullFuel name = ThisHull
and adjusts base fuel values of hulls to compensate.)
What still needs to be done:
Original issue: https://github.com/freeorion/freeorion/ ... -543218868
Pull request thread: https://github.com/freeorion/freeorion/pull/2596 (Pull request changes formula to
effects = SetMaxFuel value = (Value - HullFuel name = ThisHull) * @2@ + HullFuel name = ThisHull
and adjusts base fuel values of hulls to compensate.)
What still needs to be done:
- Geoff, you said we can put the fuel efficiency into the hull's description text in the stringtable. You are talking about editing each e,g, SH_ROBOTIC_DESC, right?
The HULL_DESC template we can't use is that correct?
Requires the C++ codeCode: Select all
HULL_DESC '''[[metertype METER_SPEED]]: %1% [[metertype METER_FUEL]]: %2% [[metertype METER_STRUCTURE]]: %4%'''
https://github.com/freeorion/freeorion/ ... 1363-L1367? And we "aren't allowed" / "shouldn't" access FOCS from C++ so there's no way to add the fuel efficiency into the HULL_DESC in the stringtable. Is that correct?Code: Select all
detailed_description += UserString(hull->Description()) + "\n\n" + str(FlexibleFormat(UserString("HULL_DESC")) % hull->Speed() % hull->Fuel() % hull->Speed() % hull->Structure());
- Testing replacing Object id = Source.ID with just Source. What exactly am i testing for? How will i know if it breaks?
Should i just leave this part to someone else? I don't really understand what to do.And I didn't really understand the purpose of the HasTag name = "@1@_FUEL_EFFICIENCY" other than it was a safety check for scripting errors
You understood the purpose. Only the emphasis on hard-to-catch scripting errors is missing in your description.
, but could that condition be put into the activation condition of the effectsgroup instead?
@agrrr3 ?
As with this PR base fuel is gone, the check is not really helpful anymore. Without base fuel modified by efficiency you only see the discrepancy if you have additional fuel effects and care about those.
So I would rather put it in the activation condition of another effect writing a sitrep. The feature I am trying to emulate is a fail-fast assert which checks the condition after loading the FOCS files and stops the game from starting - but we do not have such a feature.
Re: New Fuel Settings?
Yes. That is the most simple implementation at this point.
I think "aren't allowed" / "shouldn't" does not apply. In my opinion there is only a technical reason, it is currently impossible to do this from FOCS only. You need to change C++ code a bit so this works.alleryn wrote: ↑Sat Oct 19, 2019 11:10 am The HULL_DESC template we can't use is that correct?
..? And we "aren't allowed" / "shouldn't" access FOCS from C++ so there's no way to add the fuel efficiency into the HULL_DESC in the stringtable. Is that correct?Code: Select all
HULL_DESC '''[[metertype METER_SPEED]]: %1% [[metertype METER_FUEL]]: %2% [[metertype METER_STRUCTURE]]: %4%'''
I think it would be valid to iterate through the hull tags and add sitrep information if you find *_FUEL_EFFICIENCY e.g. UserString("GREAT_FUEL_EFFICIENCY_LABEL" for tag "GREAT_FUEL_EFFICIENCY"). To make this work there needs an intermediate decision though:
hardcoding looking for fuel efficiency tags in c++ would allow to write stringtable entry like (This implementation we probably do not want):
Code: Select all
HULL_DESC
'''[[metertype METER_SPEED]]: %1%
[[metertype METER_FUEL]]: %2%
[[metertype METER_STRUCTURE]]: %4%
Fuel Efficiency: %5%'''
or
looking for generic tag information in c++ and pass a list of looked up descriptions would allow to write stringtable entry like (this may be good enough)
Code: Select all
HULL_DESC
'''[[metertype METER_SPEED]]: %1%
[[metertype METER_FUEL]]: %2%
[[metertype METER_STRUCTURE]]: %4%
Additional Features: %5%'''
looking for dynamic, specific tag information in c++ as given in FOCS would allow to write stringtable entry like (we want probably something like this)
Code: Select all
HULL_DESC
'''[[metertype METER_SPEED]]: %1%
[[metertype METER_FUEL]]: %2%
[[metertype METER_STRUCTURE]]: %4%
Fuel Efficiency: [[tag *_FUEL_EFFICIENCY %TAG%_LABEL]]'''
So thats why adding the fuel efficiency manually to the hulls is considered KISS at this point.
Had a look again at the FOCS code, it still makes sense without applying fuel efficiency to hull/base fuel. The idea is that if the right fuel efficiency tag is missing, the ship max fuel gets set to zero so you see something is wrong. Without this the AI will miscalculate without us noticing.alleryn wrote: ↑Sat Oct 19, 2019 11:10 am Testing replacing Object id = Source.ID with just Source. What exactly am i testing for? How will i know if it breaks?
...Should i just leave this part to someone else? I don't really understand what to do.HasTag name = "@1@_FUEL_EFFICIENCY" ... safety check for scripting errors
Moving the guard to the activation condition does not suffice - the hull would show the base fuel instead of zero fuel.
The theory is that if you replace "Object id = Source.ID" with "Source" it should behave exactly the same.
You could test it by putting a wrong _FUEL_EFFICIENCY tag on a hull - the ship should always have zero fuel.
In your list of TODOs one is missing: rewrite FUEL_REFUEL_EFFICIENCY_TEXT and METER_FUEL_VALUE_DESC so it fits the calculation (fuel efficiency only applies to additional fuel effects like fuel tanks, species modifiers, metabolism tech)
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Look, ma... four combat bouts!
Look, ma... four combat bouts!
Re: New Fuel Settings?
I guess i just don't understand the difference between these two statements. What is it sufficient (or at least 'reasonably sufficient') to test to ensure that this doesn't break anything? Is verifying that the fuel values are displaying correctly in the pedia enough, or are there other things likely to break?
Also the suggestion is referring only to the "Object id = Source.id" in HULL_FUEL_EFFICIENCY_EFFECTSGROUP, right? (There are also similar tags in other ship_hulls.macros, namely Object id = Source.FleetID in UNOWNED_MOVE and Object id = Source.SystemID in REFUEL_MESSAGE.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13586
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: New Fuel Settings?
The Source version is simpler and possibly slightly (but insignificantly) faster. Just testing that the effects still do the same thing is a sufficient test.alleryn wrote: ↑Mon Oct 21, 2019 1:44 pmI guess i just don't understand the difference between these two statements. What is it sufficient (or at least 'reasonably sufficient') to test to ensure that this doesn't break anything? Is verifying that the fuel values are displaying correctly in the pedia enough, or are there other things likely to break?
Those aren't checking that an object is the source; they are checking if an object is the source's system or fleet. The Source condition just works to replace Object id = Source.id.Also the suggestion is referring only to the "Object id = Source.id" in HULL_FUEL_EFFICIENCY_EFFECTSGROUP, right? (There are also similar tags in other ship_hulls.macros, namely Object id = Source.FleetID in UNOWNED_MOVE and Object id = Source.SystemID in REFUEL_MESSAGE.
Re: New Fuel Settings?
Should a 200% fuel efficiency hull have twice it's standard fuel?
Check out attached screenshot. The symbiotic hull has 2.0 + 0.0 from 200% fuel efficiency. Seems counter-intuitive. Or is this a bug?
Check out attached screenshot. The symbiotic hull has 2.0 + 0.0 from 200% fuel efficiency. Seems counter-intuitive. Or is this a bug?
- Attachments
-
- fuel_efficiency.png (399.37 KiB) Viewed 1626 times
Re: New Fuel Settings?
This looks like the result of the change i made to try to fix the Pedia in https://github.com/freeorion/freeorion/pull/2596. Basically the old fuel efficiency modifier only affects fuel parts now. It no longer affects hull fuel. Instead the base hull fuel values were all manually adjusted. (E.g. the base fuel of the scout was 2, with 400% fuel efficiency. Now the scout has 8 base fuel.)
The base fuel of the symbiotic hull before the change was 1. So you are seeing twice the (old) base fuel.
The +0.0 being reported in the fuel meter is an unintended consequence.
Re: New Fuel Settings?
Probably we can skip the effect if there are no fuel effects. Somebody please open an (UI) issue.
Anybody knows if we can move base hull fuel effect to be after fuel efficiency effect?
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Look, ma... four combat bouts!
Look, ma... four combat bouts!
Re: New Fuel Settings?
Thank you for the answers.
Well, not a real problem, now I realise the hull I should be using for this is the Protoplasmic (3 internal slots, plus +10 stealth).
Before fuel efficiency was introduced, syb. hull had 2 fuel (actually, there were no hulls with less than 2 fuel). I'm wondering. Is it the point of giving the hull less base fuel as well as good fuel efficiency to make fuel tanks more relevant or something. That could make sense, but it is a problem for me in this case because the symbiotic hull only has two internal slots, so I can't have appropriate stealth as well as fuel reach on a symbiotic coloniser.
Well, not a real problem, now I realise the hull I should be using for this is the Protoplasmic (3 internal slots, plus +10 stealth).
Re: New Fuel Settings?
I know this is a bit confusing. We have four levels of fuel efficiency and the average fuel efficiency should be 100% for consistency. As a rule of thumb the small hull(s) are great efficiency, many of the hulls are "medium sized" which translates now to good fuel efficiency (fluff: that is what military uses, civilian ships usually have average fuel efficiency), so the large hulls are average efficiency and the huge ones are bad efficiency.
So symb. hull has effective fuel 2 as "always". Fuel tank without extra research also gives 1 fuel on a good efficiency hull as it was. So the symbiotic hull is like it was.
Anybody knows if we can move base hull fuel effect to be after fuel efficiency effect?
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Look, ma... four combat bouts!
Look, ma... four combat bouts!