Page 3 of 3

Re: Fuel parts auto upgrade

Posted: Tue Sep 05, 2017 4:13 pm
by dbenage-cx
Geoff The Medio wrote:Is there a difference between when a ship is in range to be resupplied and to be upgraded?
I don't see a need for distinction between ally vs own supply, but outside of both there is a difference, especially if one has some remote refuel capability larger than a ramscoop.

I understand the desire to limit the number of meters, and this particular case is probably only mildly beneficial (given the current default content).
For now I'd recommend the fluff explanation, maybe something along the lines of "storage matrix software update".

Using a check for last turn vs tech sounds like it might have other issues(a tech being complete is not necessarily the only requisite for an upgrade), so unsure how that might play out.

Re: Fuel parts auto upgrade

Posted: Tue Sep 05, 2017 5:34 pm
by Dilvish
dbenage-cx wrote:Using a check for last turn vs tech sounds like it might have other issues(a tech being complete is not necessarily the only requisite for an upgrade), so unsure how that might play out.
The point of adding FOCS support for turn-tech-acquired and turn-last-supplied was so that all the necessary conditions could be evaluated in FOCS, any other requirements you are contemplating could be as well.

Re: Fuel parts auto upgrade

Posted: Wed Sep 06, 2017 8:14 am
by Ophiuchus
A third implementation option would be to know the effect of a stackinggroup in the last turn. You could do something like the following

Code: Select all

// pseudocode antimatter tank technology - 
stackinggroup = "ANTIMATTER_TANK_STACK"
activation = And [
   Ship
   DesignHasPart name = "FU_BASIC_TANK"
   // only add to the fuel maximum if not done before
   last-turn stackinggroup ="ANTIMATTER_TANK_STACK" min = 0 max = 0
  [[CONDITION_SUPPLY_CONNECTED]]
]
I dont know if the necessary data gets serialized though (and if that gets lost if you disable effect accounting).

Re: Fuel parts auto upgrade

Posted: Wed Sep 06, 2017 9:18 am
by Geoff the Medio
Ophiuchus wrote:A third implementation option would be to know the effect of a stackinggroup in the last turn.
In addition to not being stored, what stackinggroups were previously applied isn't well-defined; it can vary during various effects applications during a turn.

Re: Fuel parts auto upgrade

Posted: Wed Sep 06, 2017 11:20 am
by Ophiuchus
Geoff the Medio wrote:
Ophiuchus wrote:A third implementation option would be to know the effect of a stackinggroup in the last turn.
In addition to not being stored, what stackinggroups were previously applied isn't well-defined; it can vary during various effects applications during a turn.
Not sure i understand you. I thought was that effects get only applied between turns and after all effects are applied there is a list of applied stackinggroups. Can you point me to code please, thank you.

Re: Fuel parts auto upgrade

Posted: Wed Sep 06, 2017 1:15 pm
by Dilvish
Ophiuchus wrote:I thought was that effects get only applied between turns and after all effects are applied there is a list of applied stackinggroups. Can you point me to code please, thank you.
My recollection is that stacking groups are taken into consideration as effects are applied. To see more about that, look at the effects code in universe/Universe.cpp. To see more about when effects get applied, I think you'll need to look at server/ServerFSM.cpp and server/ServerApp.cpp

Re: Fuel parts auto upgrade

Posted: Wed Sep 13, 2017 11:44 am
by Ophiuchus
Dilvish wrote:
Ophiuchus wrote:I thought was that effects get only applied between turns and after all effects are applied there is a list of applied stackinggroups. Can you point me to code please, thank you.
My recollection is that stacking groups are taken into consideration as effects are applied. To see more about that, look at the effects code in universe/Universe.cpp. To see more about when effects get applied, I think you'll need to look at server/ServerFSM.cpp and server/ServerApp.cpp
I had a look at the code. Universe::ExecuteEffects calculates a map from stackinggroup names to freeorion object ids. Effects of an effect group are only applied to an object, if it does not have an entry for the current stackinggroup in that map. If it gets applied the object id is added to the current stackinggroup entry.
If we serialize this map after ExecuteEffects and make it accessible the next turn we have the information which stackinggroups were applied to which objects the turn before. Based on this you could prevent applying effects and readd the stackinggroup every turn.

But probably the same could be done by adding a tag or special on the ship when the effect gets applied and checking in the condition for it. Would that be possible with FOCS at the moment?

Re: Fuel parts auto upgrade

Posted: Fri Sep 29, 2017 8:16 am
by Geoff the Medio
Dilvish wrote:...tracking the turn of last resupply (along with tracking what turn techs were acquired on)
Done:
https://github.com/freeorion/freeorion/ ... 62f9824f19
https://github.com/freeorion/freeorion/ ... 7f0d1b83bc

Re: Fuel parts auto upgrade

Posted: Fri Sep 29, 2017 7:03 pm
by Dilvish
Geoff the Medio wrote:
Dilvish wrote:...tracking the turn of last resupply (along with tracking what turn techs were acquired on)
Done:
https://github.com/freeorion/freeorion/ ... 62f9824f19
https://github.com/freeorion/freeorion/ ... 7f0d1b83bc
Great; did the parser code for TurnTechResearched accidentally get left out of the commit, or am I somehow overlooking it or misunderstanding the need for it?

Re: Fuel parts auto upgrade

Posted: Fri Sep 29, 2017 9:01 pm
by Geoff the Medio
Dilvish wrote:...did the parser code for TurnTechResearched accidentally get left out of the commit...
I think so yes; will commit something...