One line per (dis-)liked building

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.
Message
Author
User avatar
Grummel7
Space Dragon
Posts: 335
Joined: Mon Oct 09, 2017 3:44 pm

One line per (dis-)liked building

#1 Post by Grummel7 »

In master, now you get a bonus for every build that the species likes:
longStability.png
longStability.png (112.96 KiB) Viewed 2944 times
If this shall remain, the display should probably combine identical values in one line like:
Dislikes Gloom I building Gas Giant Generator: -2.00
Dislikes 5x remote building Gas Giant Generator: -2.05
Likes Gloom II building Interstellar Lighthouse: +4.00
Likes 11x remote building Interstellar Lighthouse: +2.97

I am not sure this can be scripted, but without it the list may become too big to be displayed for large empires. Any ideas?

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

Re: One line per (dis-)liked building

#2 Post by Geoff the Medio »

The "11x" part is difficult without substantial C++ code changes. The effects of multiple buildings could be refactored into a single effect attached to the species, rather than having each building generate its own effect, with just FOCS changes.

User avatar
LienRag
Cosmic Dragon
Posts: 2148
Joined: Fri May 17, 2019 5:03 pm

Re: One line per (dis-)liked building

#3 Post by LienRag »

We'll need a way to expand this view one way or another in order to be able to find the Disliked buildings when a planet's stability tanks...

User avatar
Grummel7
Space Dragon
Posts: 335
Joined: Mon Oct 09, 2017 3:44 pm

Re: One line per (dis-)liked building

#4 Post by Grummel7 »

Well, the 11x is not so important. When attaching it to the species however, I don't see how to make it one line per building type.

But than maybe combining all disliked building in other system into one effect is okay. They are all far away after all. It definitely keep the list from getting too long.

I have almost done it, except that I haven't figured out the condition for (dis-)like from the species context. It should be something like this, I guess:

Code: Select all

Statistic Count condition = And [
    Building
    OwnedBy empire = Source.Owner
    Not InSystem id = Source.SystemID
    (SpeciesContentOpinion species = Source.Species
                           name = LocalCandidate.??? > 0)

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

Re: One line per (dis-)liked building

#5 Post by Geoff the Medio »

Grummel7 wrote: Tue May 25, 2021 6:11 pmWell, the 11x is not so important. When attaching it to the species however, I don't see how to make it one line per building type.
I guess that's a bit trickier than I initially thought, as you have no easy way to generate separate effects for each disliked building type if it's not using one of those buildings as the source of the effect, without explicitly writing an effectsgroup in the species script for each disliked building type, which I don't want to do.

You could perhaps rewrite the effect on the building to determine the size of the meter adjustment by counting all the buildings of the same type and that meet the location requirements for the current target planet object(s), and then use a stacking group so that the effect for each building type is only applied once per planet.

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: One line per (dis-)liked building

#6 Post by Vezzra »

I wonder if adding a feature to the effects accounting which allows for merging/accumulating multiple effect accounting entries into one...?

o01eg
Programmer
Posts: 2004
Joined: Sat Dec 10, 2011 5:46 am

Re: One line per (dis-)liked building

#7 Post by o01eg »

I'm not sure about feature but I think it would be nice to see total merged effect which could be expanded to detailed UI.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-03-15.b3de094.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

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

Re: One line per (dis-)liked building

#8 Post by Oberlus »

Stringtable entries, including accounting labels, can have parameters, like the following:

Code: Select all

# %1% name of empire
# %2% name of policy
DISLIKES_POLICY_LABEL
Dislikes %1% policy %2%
Currently, building's (dis)like effect is based on square root of number of the building in the empire:
https://github.com/freeorion/freeorion/ ... os#L63-L82
So it makes sense to see the total value regardless of listing or not each of the planets that have the buildings.

Being able to see in the tooltip the name of the planets or systems that have each of the many instances of a building which we need to cull doesn't seem helpful to me.
Why not just show the total bonus/malus with the name and number of offending buildings, and let the player use the Objects Window to pinpoint the planets that have the buildings? I have never tried to use the Objects Window to filter planets per buildings though, maybe it can't be done...

User avatar
LienRag
Cosmic Dragon
Posts: 2148
Joined: Fri May 17, 2019 5:03 pm

Re: One line per (dis-)liked building

#9 Post by LienRag »

Oberlus wrote: Thu Jun 03, 2021 3:39 pm Why not just show the total bonus/malus with the name and number of offending buildings, and let the player use the Objects Window to pinpoint the planets that have the buildings? I have never tried to use the Objects Window to filter planets per buildings though, maybe it can't be done...
If that was possible, why not. But AFAIK it is not : I have tried to do that to find Transformers or Stargates and never succeeded.

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

Re: One line per (dis-)liked building

#10 Post by Oberlus »

LienRag wrote: Thu Jun 03, 2021 5:38 pm If that was possible, why not. But AFAIK it is not : I have tried to do that to find Transformers or Stargates and never succeeded.
Try harder, click on Filters and report back if you have any doubt.

User avatar
LienRag
Cosmic Dragon
Posts: 2148
Joined: Fri May 17, 2019 5:03 pm

Re: One line per (dis-)liked building

#11 Post by LienRag »

Of course I tried that with Filters.
But I tried to use some Filter criteria on the Planets, I actually never noticed that there was a "Building" category for objects, so thanks.

Actually I had asked for this possibility some time ago, and never received answers, so I believed it to be impossible (well, it was impossible the way I was trying to do it).

Indeed since it's possible to find (with the Filters) the buildings that doesn't spark joy, it's less relevant to have the planet name in the display.

wobbly
Cosmic Dragon
Posts: 1878
Joined: Thu Oct 10, 2013 6:48 pm

Re: One line per (dis-)liked building

#12 Post by wobbly »

I'm going to suggest a simpler solution. No stacking, just a single bonus/penalty for closest building.

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

Re: One line per (dis-)liked building

#13 Post by Oberlus »

wobbly wrote: Tue Jun 08, 2021 11:41 am I'm going to suggest a simpler solution. No stacking, just a single bonus/penalty for closest building.
It is intended that more buildings in the empire cause bigger effect on stability. It helps with building spamming: if your species dislike orbital drydocks, you won't be able to spam them everywhere without making all your population too unstable to get most bonuses or even rebellious.

I think a line per in planet or in system building (that usually won't be more than one in system) and a single line per in empire buildings ("3 BuildingName in empire: x.xx").
If UI is improved to allow unfolding the list of planets with the buildings, great. Meanwhile, player can use Objects Window filtering by owned, present buildings.

Currently, each building will trigger the effect without any stacking group, so each colony will get one penalty per each building with information on the planet that caused it.
https://github.com/freeorion/freeorion/ ... macros#L63
The formula is max(1,#blds)^(-0.5), that multiplied by all the buildings that trigger it gets us a total of max(1,#blds)^0.5
So it could use a stacking group and remove the negative sign of the exponent, and adjust accounting label to not show the name of the planet.

User avatar
Grummel7
Space Dragon
Posts: 335
Joined: Mon Oct 09, 2017 3:44 pm

Re: One line per (dis-)liked building

#14 Post by Grummel7 »

Vezzra wrote: Thu Jun 03, 2021 2:21 pm I wonder if adding a feature to the effects accounting which allows for merging/accumulating multiple effect accounting entries into one...?
I think this would be the best solution. Could prepare a pull request for it.

An easy solution is to change the scripting for buildings in other systems to result in a text like:
Dislikes remote building Gas Giant Generator 0.41
The GUI then simple combines consecutive effects with the same text an produces:
5 x Dislikes remote building Gas Giant Generator 2.05
Of course there is no way to unfold this.

When the scripting stays like it is, the GUI must explicitly handled building effects and produces a text like:
Dislikes 5x building Gas Giant Generator 2.05
5x could then unfold into a list of planets via mouse over or click, but for that I'd need help.

Regards,
Frank

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

Re: One line per (dis-)liked building

#15 Post by Geoff the Medio »

Grummel7 wrote: Thu Jun 10, 2021 6:49 amWhen the scripting stays like it is, the GUI must explicitly handled building effects and produces a text like:
Dislikes 5x building Gas Giant Generator 2.05
5x could then unfold into a list of planets via mouse over or click, but for that I'd need help.
Unfolding would be a bit of UI coding, but just merging related effects could probably be done by adding a call to a function to pre-process the effects accounting info here: https://github.com/freeorion/freeorion/ ... d.cpp#L329 before creating the labels.

Post Reply