Interstellar Logistics not affecting new ships until next turn

Describe your experience with the latest version of FreeOrion to help us improve it.

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.
Post Reply
Message
Author
User avatar
Oberlus
Cosmic Dragon
Posts: 5715
Joined: Mon Apr 10, 2017 4:25 pm

Interstellar Logistics not affecting new ships until next turn

#1 Post by Oberlus »

Is there a way to make newly built ships to benefit from the Interstellar Logistics speed boost in the same turn the ships are available?
It's annoying that you can't send them with the same speed than others ships that were there from previous turn, forcing you to wait for one turn if you want to make them all to arrive at same turn.

This is the effect run by the tech:

Code: Select all

    effectsgroups = EffectsGroup
            scope = And [
                Ship
                OwnedBy empire = Source.Owner
                Speed low = 1 // Immobile objects do not get the starlane speed boost.
                WithinDistance distance = 50 condition = And [
                    Planet
                    OwnedBy empire = Source.Owner
                ]
            ]
        effects = SetSpeed value = Value + 20
There is no particular condition that could explain the 1-turn delay for the effect to kick in.
Other techs with effects affecting ships do not have this problem (e.g.: weapons), some other effects do have the same problem (e.g.: Robotic Interface: Shields; new ships won't work for the shield's cumulative effect until next turn).

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

Re: Interstellar Logistics not affecting new ships until next turn

#2 Post by Geoff the Medio »

In Empire.cpp after this line (around 1976):

Code: Select all

                ship->SetShipMetersToMax();
Try adding

Code: Select all

                // set ship speed so that it can be affected by this that check for non-zero speed
                if (auto* design = GetShipDesign(elem.item.design_id))
                    ship->GetMeter(METER_SPEED)->Set(design->Speed(), design->Speed());
The logistics scope has a test so that it doesn't apply to immobile ships, ie. those with speed less than 1, so making sure the newly produced ships have a base speed set before meter effects are executed should hopefully let that scope condition pass and thus the extra speed boost be applied. Might have quirky issues if there are cases where a ship's only source of speed is something other than its design, though.

User avatar
Oberlus
Cosmic Dragon
Posts: 5715
Joined: Mon Apr 10, 2017 4:25 pm

Re: Interstellar Logistics not affecting new ships until next turn

#3 Post by Oberlus »

This worked perfectly.
New PR#2896.

Magnate
Space Dragon
Posts: 425
Joined: Sat Nov 08, 2014 3:44 pm

Re: Interstellar Logistics not affecting new ships until next turn

#4 Post by Magnate »

Yay! Thanks Geoff, I've been mildly irked by this for years!

Magnate
Space Dragon
Posts: 425
Joined: Sat Nov 08, 2014 3:44 pm

Re: Interstellar Logistics not affecting new ships until next turn

#5 Post by Magnate »

Never mind, I've forgotten that the IL bonus only applies within 50uu of a colony or outpost. Ooops.
Last edited by Magnate on Mon Apr 27, 2020 6:15 pm, edited 1 time in total.

User avatar
swaq
Space Dragon
Posts: 384
Joined: Tue Aug 20, 2019 1:56 pm

Re: Interstellar Logistics not affecting new ships until next turn

#6 Post by swaq »

Magnate wrote: Mon Apr 27, 2020 6:11 pm Ok I just found another bug with this, 9th MP game, turn 72. Last turn my fleet of robotic hulls, all at speed 95, attacks a system with no star, defeats Oleg's fleet, and claims the system - it turns yellow with my supply. Yet this turn my fleet has speed 75 instead of 95. Really quite an important bug. I will open it on the tracker.
Isn't that in deep space? Interstellar Logistics only works when you're within 50 uu (?) of a system with an owned planet.

Magnate
Space Dragon
Posts: 425
Joined: Sat Nov 08, 2014 3:44 pm

Re: Interstellar Logistics not affecting new ships until next turn

#7 Post by Magnate »

You beat me to it.

User avatar
swaq
Space Dragon
Posts: 384
Joined: Tue Aug 20, 2019 1:56 pm

Re: Interstellar Logistics not affecting new ships until next turn

#8 Post by swaq »

Magnate wrote: Mon Apr 27, 2020 6:15 pm You beat me to it.
I feel like Interstellar Logistics should increase your speed anywhere in supply, not just around planets. Would help differentiate it from the interstellar lighthouse speed bonus too.

Post Reply