Fuel parts auto upgrade

Creation, discussion, and balancing of game content such as techs, buildings, ship parts.

Moderators: Oberlus, Committer

Message
Author
dbenage-cx
Programmer
Posts: 389
Joined: Sun Feb 14, 2016 12:08 am

Re: Fuel parts auto upgrade

#31 Post 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.
Any content posted should be considered licensed GNU GPL 2.0 and/or CC-BY-SA 3.0 as appropriate.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Fuel parts auto upgrade

#32 Post 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.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Fuel parts auto upgrade

#33 Post 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).
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!

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Fuel parts auto upgrade

#34 Post 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.

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Fuel parts auto upgrade

#35 Post 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.
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!

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Fuel parts auto upgrade

#36 Post 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
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Fuel parts auto upgrade

#37 Post 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?
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!

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Fuel parts auto upgrade

#38 Post 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

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Fuel parts auto upgrade

#39 Post 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?
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Fuel parts auto upgrade

#40 Post 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...

Post Reply