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
Oberlus
Cosmic Dragon
Posts: 5715
Joined: Mon Apr 10, 2017 4:25 pm

Re: One line per (dis-)liked building

#16 Post by Oberlus »

Geoff the Medio wrote: Thu Jun 10, 2021 7:52 am
Grummel7 wrote: Thu Jun 10, 2021 6:49 am 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
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.
The merging labels thingy could be done already FOCS-only (I think):
Oberlus wrote: Tue Jun 08, 2021 11:53 am 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.
... and adding the number of buildings for the 5x.

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

#17 Post by Geoff the Medio »

Oberlus wrote: Thu Jun 10, 2021 7:59 am
Geoff the Medio wrote: Thu Jun 10, 2021 7:52 am 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.
The merging labels thingy could be done already FOCS-only (I think):
Yes; both are options.

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

Re: One line per (dis-)liked building

#18 Post by LienRag »

Grummel7 wrote: Thu Jun 10, 2021 6:49 am 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.
It's not a priority but it indeed would be nice to have.

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

Re: One line per (dis-)liked building

#19 Post by Grummel7 »

Oberlus wrote: Thu Jun 10, 2021 7:59 am The merging labels thingy could be done already FOCS-only (I think):
Didn't we already figure out that it cannot be done via FOCS?
So far we can have an effect for a building (that's what we have now) or per species (that would combine all liked building into one effect).
We'd need an FOCS evaluation for a building type, that would allow scripting the combined effect.

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

Re: One line per (dis-)liked building

#20 Post by Oberlus »

Grummel7 wrote: Thu Jun 10, 2021 6:45 pm
Oberlus wrote: Thu Jun 10, 2021 7:59 am The merging labels thingy could be done already FOCS-only (I think):
Didn't we already figure out that it cannot be done via FOCS?
I think the trick is what I say in the older comment: use a stacking group:
- First building that is evaluated adds up the value for all the buildings in the empire, #buildings^(0.5) = #buildings*#buildings^(-0.5), and uses a label with a parameter for number of buildings.
- Following buildings don't the the effect again because they are in the same stacking group.

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

Re: One line per (dis-)liked building

#21 Post by Grummel7 »

Geoff the Medio wrote: Thu Jun 10, 2021 7:52 am
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.
To pre-process the vector, I'd have to extend AccountingInfo and still handle the additional information in the loop.
I've done it for buildings only with a little look-ahead within the loop. That was not too complicated. It can easily be extended to other types, but so far I see no other effects that need such a combined view.

The unfolding however could be tricky, since the whole list is only shown via mouse-over and is closed as soon as I move the mouse.

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

Re: One line per (dis-)liked building

#22 Post by Grummel7 »

Oberlus wrote: Thu Jun 10, 2021 6:59 pm I think the trick is what I say in the older comment: use a stacking group:
- First building that is evaluated adds up the value for all the buildings in the empire, #buildings^(0.5) = #buildings*#buildings^(-0.5), and uses a label with a parameter for number of buildings.
- Following buildings don't the the effect again because they are in the same stacking group.
Well, that would almost work, except the label parameters are not defined by FOCS and I do not see a way to pass down the number. Effects would need to get a new parameter to do that. And then there is still no way to unfold the number because the effect would not contain the list of planets neither.

Post Reply