initialization of empire owned object counts

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

Moderator: Committer

Post Reply
Message
Author
User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

initialization of empire owned object counts

#1 Post by Dilvish »

Currently (r7688) the empire owned object counters are simply updated at the end of every turn, leaving the game-start values wrongly at zero, which throws off first-turn ship production cost calcs and allocations resulting in a one turn delay for the first ship being built. I propose the attached patch to initialize these counts at game start.

**edit: also, to be clear, this is *not* an issue for 0.4.4
Attachments

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

If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

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

Re: initialization of empire owned object counts

#2 Post by Geoff the Medio »

Looks reasonable.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: initialization of empire owned object counts

#3 Post by Dilvish »

ok, committed, r7689
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

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

Re: initialization of empire owned object counts

#4 Post by Geoff the Medio »

Incidentally, this changes will hopefully help a bit with delays while updating the production queue, as it substantially simplifies the calculation of fleet / colony upkeep costs based on counting the numbers of those owned by an empire. Some reports on whether it makes any perceptible difference would be nice.

It might not actually help much, if the results were being cached anyway, which is possible.

It might also create a potential micro exploit because the numbers of ships owned by an empire only changes once per turn now, instead of every time a ship is created during production queue updating. Consequently, multiple ships produced on the same turn would cost a bit less than producing them over several turns now, even if not in a batch build. Lost ships due to combat would also possibly not take effect on the same turn. This issue could be worked around, though, by adding some updates to the numbers before / during production.

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

Re: initialization of empire owned object counts

#5 Post by MatGB »

Downloading the new test now (sighs with relief), at what point is the number being set? At the start of turn, or after all production is done?

Because yes, it will make a difference, but I suspect a more stable fleet upkeep thing will be more useful, having ships die that turn making fleets finish a turn earlier than it just said at the end of the previous turn is something I understand, but find harder to explain &c.
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: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: initialization of empire owned object counts

#6 Post by Geoff the Medio »

MatGB wrote:...at what point is the number being set? At the start of turn, or after all production is done?
It's one of the last things before updates are sent to players.

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

Re: initialization of empire owned object counts

#7 Post by MatGB »

Which in theory means that all production estimates I see saying "1 turn" or "2 turns" for ships at the end of a turn wont be changed for that turns production, regardless of scrapping, combat or random effects like PsyDom. That's almost certainly better, will keep an eye on it.

Aside: has something been done to make the tech window/tree render significantly faster/better? It seems a LOT smoother to me but it may just be I'm on a smaller game at the moment.
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
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: initialization of empire owned object counts

#8 Post by Dilvish »

MatGB wrote:regardless of scrapping, combat
Hmm, I had liked it that scrapping ships would serve to reduce ship construction costs on the same turn as the ships were scrapped. Re combat it was a bit of a silver lining to the cloud of having lost a ship/ships. On the other hand, it will be nice like this that a colony ship that was about to complete won't get delayed because of a planet that just got captured at the start of that turn.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Post Reply