Excruciating FOCS doubts

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

Moderators: Oberlus, Committer

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

Re: Excruciating FOCS doubts

#121 Post by Geoff the Medio »

Oberlus wrote: Tue Dec 07, 2021 1:16 am Is there a way to make a policy require this OR that policy?
Not as a prerequisite, but sort of via unlocking.

From the last dev call, the plan is to try removing prereqs, though.

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

Re: Excruciating FOCS doubts

#122 Post by LienRag »

Is it possible in FOCS to have a Species Trait that makes Ship building cheaper or more expensive ? Also quicker or slower ?

How do Likes and Dislikes work ? Do they need to be added to each Species or to each Policy/Building or are they two-way ?

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

Re: Excruciating FOCS doubts

#123 Post by Ophiuchus »

LienRag wrote: Wed Dec 22, 2021 4:39 pm Is it possible in FOCS to have a Species Trait that makes Ship building cheaper or more expensive ? Also quicker or slower ?
probably possible but a lot of work
LienRag wrote: Wed Dec 22, 2021 4:39 pm How do Likes and Dislikes work ? Do they need to be added to each Species or to each Policy/Building or are they two-way ?
they are part of the species definition
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
LienRag
Cosmic Dragon
Posts: 2146
Joined: Fri May 17, 2019 5:03 pm

Re: Excruciating FOCS doubts

#124 Post by LienRag »

Ophiuchus wrote: Wed Dec 22, 2021 6:24 pm
LienRag wrote: Wed Dec 22, 2021 4:39 pm How do Likes and Dislikes work ? Do they need to be added to each Species or to each Policy/Building or are they two-way ?
they are part of the species definition
So if I propose a new Building or Policy I have to change the FOCS file of all Species that would like or dislike it ?

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

Re: Excruciating FOCS doubts

#125 Post by Ophiuchus »

LienRag wrote: Wed Dec 22, 2021 6:38 pm
Ophiuchus wrote: Wed Dec 22, 2021 6:24 pm
LienRag wrote: Wed Dec 22, 2021 4:39 pm How do Likes and Dislikes work ? Do they need to be added to each Species or to each Policy/Building or are they two-way ?
they are part of the species definition
So if I propose a new Building or Policy I have to change the FOCS file of all Species that would like or dislike it ?
yes
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
LienRag
Cosmic Dragon
Posts: 2146
Joined: Fri May 17, 2019 5:03 pm

Re: Excruciating FOCS doubts

#126 Post by LienRag »

That renders simple tinkering and testing very, very complicated...
Could there be a way to automate that ?

That would explain though why so many Policies have likes/dislikes either existent or stub-like.

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

Re: Excruciating FOCS doubts

#127 Post by Ophiuchus »

LienRag wrote: Wed Dec 22, 2021 7:59 pm That renders simple tinkering and testing very, very complicated...
Could there be a way to automate that ?
python script i'd say
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
LienRag
Cosmic Dragon
Posts: 2146
Joined: Fri May 17, 2019 5:03 pm

Re: Excruciating FOCS doubts

#128 Post by LienRag »

I know some python (for low value of "some") and I've worked with (very basic) text alteration.
If I find time to do such a script, it could be useful for other tinkerers I guess...

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

Re: Excruciating FOCS doubts

#129 Post by Geoff the Medio »

LienRag wrote: Wed Dec 22, 2021 7:59 pm That renders simple tinkering and testing very, very complicated...
I would say it makes simple tinkering simple, and more complicated adjustments more complicated. How should an automated system know which species should like or dislike your arbitrary new building or other content?
Could there be a way to automate that ?
You can add a macro to like / dislike lists and add your building to the macro definition.
That would explain though why so many Policies have likes/dislikes either existent or stub-like.
Not sure what that means, but most species were semi-randomly given a few policies to like or dislike, along with various other types of liked or disliked content.

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

Re: Excruciating FOCS doubts

#130 Post by Oberlus »

I can't find FOCS code to increase MILITARY_CATEGORY_NUM_POLICY_SLOTS when empire kills 5 ships, so I guess that is controlled by backend.

If we wanted to add a military policy when an empire invades its first planet, could it be done with FOCS or it requires backend changes?

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

Re: Excruciating FOCS doubts

#131 Post by Ophiuchus »

Oberlus wrote: Thu Dec 23, 2021 4:19 pm I can't find FOCS code to increase MILITARY_CATEGORY_NUM_POLICY_SLOTS when empire kills 5 ships, so I guess that is controlled by backend.
it is in default/scripting/buildings/MILITARY_COMMAND.focs.txt
Oberlus wrote: Thu Dec 23, 2021 4:19 pm If we wanted to add a military policy when an empire invades its first planet, could it be done with FOCS or it requires backend changes?
query if there are invaded planets in the empire and add the slot

also JFYI the game does not remember the number of slots, slots have to be "re-added" every turn.
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
Oberlus
Cosmic Dragon
Posts: 5713
Joined: Mon Apr 10, 2017 4:25 pm

Re: Excruciating FOCS doubts

#132 Post by Oberlus »

Thank you.

So it would be adding this to the Military Command effects, after the one for ShipsDestroyed:

Code: Select all

        EffectsGroup
            scope = Source
            activation = (1 <= SpeciesPlanetsInvaded empire = Source.Owner)
            stackinggroup = "MILITARY_COMMAND_SLOT_METER_EFFECT2"
            effects =
                SetEmpireMeter empire = Source.Owner meter = "MILITARY_CATEGORY_NUM_POLICY_SLOTS" value = Value + 1
Hmmm... what's different between

Code: Select all

SpeciesShipsDestroyed empire=Source.Owner
and

Code: Select all

EmpireShipsDestroyed empire=Source.Owner
?

Other interesting stats for effects: ships produced, scrapped, lost; buildings produced, scrapped; planets bombed, depopulated (all seen in scripting/empire_statistics/Empire.focs.txt).

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

Re: Excruciating FOCS doubts

#133 Post by Ophiuchus »

Oberlus wrote: Thu Dec 23, 2021 6:14 pmHmmm... what's different between

Code: Select all

SpeciesShipsDestroyed empire=Source.Owner
and

Code: Select all

EmpireShipsDestroyed empire=Source.Owner
?
second one exists, first one doesnt
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
Oberlus
Cosmic Dragon
Posts: 5713
Joined: Mon Apr 10, 2017 4:25 pm

Re: Excruciating FOCS doubts

#134 Post by Oberlus »

Ophiuchus wrote: Thu Dec 23, 2021 6:33 pm second one exists, first one doesnt
It must exist, it's used in Military Command building to count destroyed ships to activate the +1 slot effect.
https://github.com/freeorion/freeorion/ ... cs.txt#L32

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

Re: Excruciating FOCS doubts

#135 Post by Geoff the Medio »

Oberlus wrote: Thu Dec 23, 2021 6:14 pmHmmm... what's different between

Code: Select all

SpeciesShipsDestroyed empire=Source.Owner
and

Code: Select all

EmpireShipsDestroyed empire=Source.Owner
?
Both have an additional parameter that's not being used in those examples.
https://github.com/freeorion/freeorion/ ... er.cpp#L49
https://github.com/freeorion/freeorion/ ... er.cpp#L86

SpeciesShipsDestroyed can take a name of a species and return how many ships of that species the specified empire has destroyed. EmpireShipsDestroyed takes two empires, and returns how many ships owned by one of the empires that the other empire has destroyed. First empire should be the destroyer, second the owner.

Post Reply