Happiness required for production/research is super annoying

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: 5760
Joined: Mon Apr 10, 2017 4:25 pm

Re: Happiness required for production/research is super annoying

#46 Post by Oberlus »

o01eg wrote: Fri Apr 17, 2020 7:48 am Does merged PR https://github.com/freeorion/freeorion/pull/2863 solve case with colony ships too?
IIRC what swaq told me in the chat, yes.

Only case that would still work as the original PR discussed in the OP (i.e. new colony set to happiness 0) is for NO_STOCKPILE species, which are the Exobots.
I am OK with that (it will be a problem for my current situation in ninth game, but I can live with it).

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

Re: Happiness required for production/research is super annoying

#47 Post by Oberlus »

Geoff the Medio wrote: Fri Apr 17, 2020 8:46 am
Geoff the Medio wrote: Thu Apr 16, 2020 3:13 pm
Ophiuchus wrote: Thu Apr 16, 2020 12:50 pmI think there is currently no backend support/valueref/condition like TurnColonyEstablished.
I'll probably add something.
An issue: what counts as colonization? For colony ships, it calls an internal Colonize function. But colony buildings use the SetSpecies and SetPopulation effects. These can also be used on already-colonized planets, but should probably not always count as a new colonization event. I'll probably modify a planet's SetSpecies function to set the colonization turn if the species was previously empty.
Would it make sense to change how colony ship parts work so that their colonization effect is processed in FOCS? Something to make the Planet::Colonize() function call/trigger a FOCS effect.
If I understood it correctly, one of the problems encountered while trying to fix this FOCS-only (via specials) was that the colonization through the Planet::Colonize() function kicked in one turn earlier.

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

Re: Happiness required for production/research is super annoying

#48 Post by Geoff the Medio »

Geoff the Medio wrote: Fri Apr 17, 2020 8:46 am
Geoff the Medio wrote: Thu Apr 16, 2020 3:13 pm
Ophiuchus wrote: Thu Apr 16, 2020 12:50 pmI think there is currently no backend support/valueref/condition like TurnColonyEstablished.
I'll probably add something.
An issue: what counts as colonization? For colony ships, it calls an internal Colonize function. But colony buildings use the SetSpecies and SetPopulation effects. These can also be used on already-colonized planets, but should probably not always count as a new colonization event. I'll probably modify a planet's SetSpecies function to set the colonization turn if the species was previously empty.
https://github.com/freeorion/freeorion/ ... 04be90a46c provides a LastTurnColonized property for planets in FOCS (and the objects list). For loaded saves, it is set to the previous turn for already-colonzied planets (ie. those with a non-empty species). Otherwise the default is INVALID_GAME_TURN, which is a big negative number.

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

Re: Happiness required for production/research is super annoying

#49 Post by Ophiuchus »

swaq wrote: Thu Apr 16, 2020 9:21 pm I could not figure out how to remove a special from a planet that had just lost its population without creating a new dedicated special that required a graphics file. Also, because of the difference in the way that colonies are formed by colony buildings versus colony ships I was finding that I had to account for two possible turns requiring not one but two specials to keep track of the state. It was getting really messy and I had spent hours on it before I found the much cleaner stockpile hack.
I am pretty sure the second special is not necessary.
You would have had to anchor the removal effect not on species (because that does not exists anymore), e.g. you could have added it to a starting tech (like it is done for sitreps). Or you would have to move the check from the Source/activation to the targets.

AFAIU you would not have to do anything special for the buildings case (you could just ignore it). Just add the AddSpecial and happiness effect to an effectgroup used in the species (so this would get checked for every planet and ship of the owner), filter the activation by Planet/PopulationCenters which do not have the Special already (maybe check for positive population).

Note this does not have a relevance for the current issue anymore as geoff the implementation for a lasting implementation - this is just general FOCS talk/explanation.
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!

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

Re: Happiness required for production/research is super annoying

#50 Post by Ophiuchus »

Geoff the Medio wrote: Fri Apr 17, 2020 9:47 am
Geoff the Medio wrote: Fri Apr 17, 2020 8:46 am
Geoff the Medio wrote: Thu Apr 16, 2020 3:13 pmI'll probably add something.
An issue: what counts as colonization? For colony ships, it calls an internal Colonize function. But colony buildings use the SetSpecies and SetPopulation effects. These can also be used on already-colonized planets, but should probably not always count as a new colonization event. I'll probably modify a planet's SetSpecies function to set the colonization turn if the species was previously empty.
https://github.com/freeorion/freeorion/ ... 04be90a46c provides a LastTurnColonized property for planets in FOCS (and the objects list). For loaded saves, it is set to the previous turn for already-colonzied planets (ie. those with a non-empty species). Otherwise the default is INVALID_GAME_TURN, which is a big negative number.
Hm, I think depopulation and recolonisation is not covered? Don't have the brains currently to suggest something useful though. Something like INVALID_GAME_TURN on depopulate()/setPop(0).
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: 5760
Joined: Mon Apr 10, 2017 4:25 pm

Re: Happiness required for production/research is super annoying

#51 Post by Oberlus »

Ophiuchus wrote: Fri Apr 17, 2020 11:15 am
Geoff the Medio wrote: Fri Apr 17, 2020 9:47 am https://github.com/freeorion/freeorion/ ... 04be90a46c provides a LastTurnColonized property for planets in FOCS (and the objects list). For loaded saves, it is set to the previous turn for already-colonzied planets (ie. those with a non-empty species). Otherwise the default is INVALID_GAME_TURN, which is a big negative number.
Hm, I think depopulation and recolonisation is not covered? Don't have the brains currently to suggest something useful though. Something like INVALID_GAME_TURN on depopulate()/setPop(0).
Could it be circumvented FOCS-only by checking population along with LastTurnColonized or sth like that?

Also, what is recolonization? When you colonize a planet with no species that had one before, right?
If it's being recolonized by a Colony Ship, it shall work with Geoff patch, isn't it?
If it's being recolonized by a Colony Building... can we have a SetLastTurnColonized keyword to invoke in that case?

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

Re: Happiness required for production/research is super annoying

#52 Post by Geoff the Medio »

A planet that depopulates was still last colonized at the same time as it was before the depopulation, so nothing needs to happen.

As indicated above, when SetSpecies is called, it sets the last colonized value to the current turn, if the species was initially empty, so both colony ships and the SetSpecies effect should set the last colonzied turn for an initially not-populated planet.

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

Re: Happiness required for production/research is super annoying

#53 Post by swaq »

Geoff the Medio wrote: Fri Apr 17, 2020 9:47 am
Geoff the Medio wrote: Fri Apr 17, 2020 8:46 am
Geoff the Medio wrote: Thu Apr 16, 2020 3:13 pmI'll probably add something.
An issue: what counts as colonization? For colony ships, it calls an internal Colonize function. But colony buildings use the SetSpecies and SetPopulation effects. These can also be used on already-colonized planets, but should probably not always count as a new colonization event. I'll probably modify a planet's SetSpecies function to set the colonization turn if the species was previously empty.
https://github.com/freeorion/freeorion/ ... 04be90a46c provides a LastTurnColonized property for planets in FOCS (and the objects list). For loaded saves, it is set to the previous turn for already-colonzied planets (ie. those with a non-empty species). Otherwise the default is INVALID_GAME_TURN, which is a big negative number.
Thanks! I'll play around a little with this today.

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

Re: Happiness required for production/research is super annoying

#54 Post by swaq »

swaq wrote: Fri Apr 17, 2020 2:31 pm
Geoff the Medio wrote: Fri Apr 17, 2020 9:47 am
Geoff the Medio wrote: Fri Apr 17, 2020 8:46 am An issue: what counts as colonization? For colony ships, it calls an internal Colonize function. But colony buildings use the SetSpecies and SetPopulation effects. These can also be used on already-colonized planets, but should probably not always count as a new colonization event. I'll probably modify a planet's SetSpecies function to set the colonization turn if the species was previously empty.
https://github.com/freeorion/freeorion/ ... 04be90a46c provides a LastTurnColonized property for planets in FOCS (and the objects list). For loaded saves, it is set to the previous turn for already-colonzied planets (ie. those with a non-empty species). Otherwise the default is INVALID_GAME_TURN, which is a big negative number.
Thanks! I'll play around a little with this today.
This works great! I made a new pull request to use the new property instead of the stockpile hack.

ThinkSome
Psionic Snowflake
Posts: 460
Joined: Sun Mar 29, 2020 11:13 pm

Re: Happiness required for production/research is super annoying

#55 Post by ThinkSome »

What is the meaning of happiness for Exobots? Shouldn't they always have max happiness (or not have this property at all), as they are just semi-autonomous robots following orders?

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

Re: Happiness required for production/research is super annoying

#56 Post by swaq »

ThinkSome wrote: Wed Apr 22, 2020 8:24 pm What is the meaning of happiness for Exobots? Shouldn't they always have max happiness (or not have this property at all), as they are just semi-autonomous robots following orders?
Robots have feelings too!
Attachments
marvin.jpg
marvin.jpg (39.53 KiB) Viewed 1234 times

User avatar
labgnome
Juggernaut
Posts: 833
Joined: Mon Mar 02, 2015 5:57 pm

Re: Happiness required for production/research is super annoying

#57 Post by labgnome »

ThinkSome wrote: Wed Apr 22, 2020 8:24 pm What is the meaning of happiness for Exobots? Shouldn't they always have max happiness (or not have this property at all), as they are just semi-autonomous robots following orders?
There has been discussion of changing "Happiness" to the broader idea of "Stability", but I don't know if that's still in the works.
All of my contributions should be considered released under creative commons attribution share-alike license, CC-BY-SA 3.0 for use in, by and with the Free Orion project.

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

Re: Happiness required for production/research is super annoying

#58 Post by Ophiuchus »

labgnome wrote: Fri Apr 24, 2020 1:14 pm
ThinkSome wrote: Wed Apr 22, 2020 8:24 pm What is the meaning of happiness for Exobots? Shouldn't they always have max happiness (or not have this property at all), as they are just semi-autonomous robots following orders?
There has been discussion of changing "Happiness" to the broader idea of "Stability", but I don't know if that's still in the works.
Probably after introducing influence we will pick it up again. Whatever the thing will be called then - probably having a low value means rebellion is likelier to happen.
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!

Post Reply