[Patch] Unarmed fleets should not be aggressive by default

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
Vegavis
Space Squid
Posts: 71
Joined: Sun Jan 12, 2014 7:04 am

[Patch] Unarmed fleets should not be aggressive by default

#1 Post by Vegavis »

It's annoying that scouts and colony ships are aggressive by default. Doesn't everyone lose ships now and then because they forget to tell them not to be suicidally brave?

Here's a simple patch that fixes this by making new fleets aggressive only if they're armed.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]


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

Re: [Patch] Unarmed fleets should not be aggressive by defau

#2 Post by Geoff the Medio »

I think there are a few more appropriate places to do this. Including:
* In Empire::CheckProductionProgress, after the "// create new fleet for ships" line in Empire.cpp
* In the CreateNewFleet function in Effect.cpp
* By adding an auto-aggression setting to the FleetWnd new fleet drop panel. This might use an icon such as this. This would probably require adjusting the NewFleetOrder to have cases where it is intended to auto-pick an aggression.

Just setting it in the AddShips function is prone to missing cases, being overwritten, or overwriting when this is not the intended behaviour.

Vegavis
Space Squid
Posts: 71
Joined: Sun Jan 12, 2014 7:04 am

Re: [Patch] Unarmed fleets should not be aggressive by defau

#3 Post by Vegavis »

OK, here's a patch that sets aggression at places that create fleets: newly produced fleets in Empire::CheckProductionProgress, effect-created fleets in CreateNewFleet, and initial fleets in PythonUniverseGenerator's CreateShip (not CreateFleet, because fleets are created before their ships).

An auto-aggression setting would seldom matter, because fleets rarely change whether they contain armed ships.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]


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

Re: [Patch] Unarmed fleets should not be aggressive by defau

#4 Post by Geoff the Medio »

The point of the auto aggression suggestion was to set the aggression automatically when creating a new fleet by dropping ships onto the new fleet drop target in the fleetwnd... It has nothing to do with changing the aggression of existing fleets. Currently the new fleet drop target can be set to passive or aggressive, and switched between these options manually. The auto setting would pick for itself what to do for any new fleet based on the dropped ships.

jenschou
Space Krill
Posts: 9
Joined: Sat May 03, 2014 6:53 pm

Re: [Patch] Unarmed fleets should not be aggressive by defau

#5 Post by jenschou »

While on this subject: What irritates me the most regarding this is the opposite, that the automatic setting always reverts to 'Hide'. I frequently have ships sent to catch enemies just to let them go instead of fighting them.

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

Re: [Patch] Unarmed fleets should not be aggressive by defau

#6 Post by Geoff the Medio »

jenschou wrote:While on this subject: What irritates me the most regarding this is the opposite, that the automatic setting always reverts to 'Hide'. I frequently have ships sent to catch enemies just to let them go instead of fighting them.
Note that you can currently click on the icon on the new fleet drop panel in the fleets window to toggle between hide and control system. This will make all new fleets aggressive (or hidden) when dropped onto that panel.

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

Re: [Patch] Unarmed fleets should not be aggressive by defau

#7 Post by Geoff the Medio »

Committed.

Would be nice to have an auto option for the new fleet drop target as well. The same logic would seemingly suffice (ie. does the fleet have any armed ships).

jenschou
Space Krill
Posts: 9
Joined: Sat May 03, 2014 6:53 pm

Re: [Patch] Unarmed fleets should not be aggressive by defau

#8 Post by jenschou »

Geoff the Medio wrote:
jenschou wrote:While on this subject: What irritates me the most regarding this is the opposite, that the automatic setting always reverts to 'Hide'. I frequently have ships sent to catch enemies just to let them go instead of fighting them.
Note that you can currently click on the icon on the new fleet drop panel in the fleets window to toggle between hide and control system. This will make all new fleets aggressive (or hidden) when dropped onto that panel.
yes, that is what I was referring to: If I set the new fleet stance icon to aggressive, when I split ships from the fleet, they stay aggressive, nice. Next turn the new fleet stance icon has usually changed to passive again, and If I miss it newly split ships/fleets will be passive. So I have to check for this every time I split a ship from a fleet. I have not really checked what exactly triggers it since it happens so often I assumed everyone would know what I was talking about.

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

Re: [Patch] Unarmed fleets should not be aggressive by defau

#9 Post by Geoff the Medio »

It's not changing when the turn updates; it's changing when a different system's fleets are selected, or the fleets window is closed and reopened. It (probably) shouldn't do that (and instead should stick to a particular setting).

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: [Patch] Unarmed fleets should not be aggressive by defau

#10 Post by MatGB »

Geoff the Medio wrote: It (probably) shouldn't do that (and instead should stick to a particular setting).
Agreed, when I'm splitting off scout ships or similar I always remember to check they have the right stance, when I'm splitting off combat ships I regularly forget. Which is daft because it's always defaulted to non-aggressive for splitting fleets so why I have it the wrong way around I don't remember.

I rarely bother to change the setting because it's never remembered, I just try to remember to change the individual fleets afterwards (it is used more these days since you implemented the merge/split fleet by design options, they're really useful.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Vegavis
Space Squid
Posts: 71
Joined: Sun Jan 12, 2014 7:04 am

Re: [Patch] Unarmed fleets should not be aggressive by defau

#11 Post by Vegavis »

Geoff the Medio wrote:Currently the new fleet drop target can be set to passive or aggressive, and switched between these options manually. The auto setting would pick for itself what to do for any new fleet based on the dropped ships.
Oh, I see what you mean now.

Rather than have a separate setting, shouldn't all new fleets set aggression automatically? This is safe, since the user can immediately see the result and override it if they want. This means there's no need for the new-fleet aggression toggle.

Here's a patch that does that. Minor uncertainty: should splitting a fleet keep the original aggression or choose based on armament? (This is not very important.)
Attachments

[The extension patch has been deactivated and can no longer be displayed.]


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

Re: [Patch] Unarmed fleets should not be aggressive by defau

#12 Post by Geoff the Medio »

Vegavis wrote:Rather than have a separate setting, shouldn't all new fleets set aggression automatically? This is safe, since the user can immediately see the result and override it if they want. This means there's no need for the new-fleet aggression toggle.
I think being able to control the aggression before a new fleet is created, without having to find and open that fleet in the UI to check and make the change is a useful feature. If MatGB or someone else disagrees and thinks it would be of no use, I could probably be convinced otherwise, though.

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: [Patch] Unarmed fleets should not be aggressive by defau

#13 Post by MatGB »

I definitely want it to auto select based on whether it's armed or not, beyond that I can see a use for deciding otherwise but for me, at the moment, it would be an edge case issue.

There might be exceptions-for example Dilvish has the AI make armed colony ships, which I can sorta see the point of on occasions but I never bother, you might still want them to default to hide, but until/unless we see a lot more stuff done with the stealth mechanics (ie mostly with scripting different things to actually do) I'm not seeing a point myself.

New fleets are launched after combat is resolved for the turn, and changing the setting on a fleet does affect pinning of enemy units for the next movement, so on the occasions that it might possibly be useful to predetermine for a specific fleet you can do it during the turn I'd have thought.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

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

Re: [Patch] Unarmed fleets should not be aggressive by defau

#14 Post by Geoff the Medio »

I've implemented the auto aggression setting myself, with the function that tests if a set of ships contains an armed ship mostly based on Vegavis' equivalent.

Post Reply