Implementing stockpile "project" build item

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

Moderator: Committer

Message
Author
User avatar
Dilvish
AI Lead, Programmer
Posts: 4685
Joined: Sat Sep 22, 2012 6:25 pm

Re: Implementing stockpile "project" build item

#16 Post by Dilvish » Sat Feb 24, 2018 3:02 am

dbenage-cx wrote:From what I've followed so far, there are two different options proposed for this new item type...
These may not be mutually exclusive options, but the later would be my first choice.
My understanding of the discussion is that while the former was first contemplated, the latter is the only one really still being considered, so you are in luck! :Dedit: Whoops! Somehow misunderstood dbenage-cx there.

Regarding infinite repetition, when we first put in repetition I think we felt that a repeat of 99 was close enough to infinite that trying to support an actual infinite was not a good use of time or UI space. How many times in a game could you have to redo your 99-count repeat? Not too many.

As for defaulting to some high number of repeats (infinite, or 99, or whatever), I don't think I'd really like that either. Putting PP into the stockpile delays it being available for a turn, I generally only force PP into the stockpile for short periods of time for specific purposes. Defaulting to a large number would not suit my playstyle, though I'll grant that reasonable people could differ on that.

But an aspect that doesn't involve personal playstyle, or at least to a lesser degree, is just the issue of consistency-- right now it is a clean consistent rule that all builds default to just a single build-- to have something follow a different rule would need to have a compelling reason it seems to me.
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: 12249
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Implementing stockpile "project" build item

#17 Post by Geoff the Medio » Sat Feb 24, 2018 7:55 am

Dilvish wrote:Since it is only a single item I don't think that anyone needs to be able to obsolete it, or even should be able to, really. It would be fine with me if it were just always visible regardless of any of the ship/building/available/unavailable buttons, but it seemed simplest and most logical to just consider it always 'available' and lets its display be subject to the state of the 'available' and 'unavailable' buttons.
It probably shouldn't be obsoleteable, but it might be not available (ie. unable to receive PP allocation) in some cases, so I'd plan for the possibility.

Ophiuchus
Vacuum Dragon
Posts: 506
Joined: Tue Sep 30, 2014 10:01 am

Re: Implementing stockpile "project" build item

#18 Post by Ophiuchus » Sun Feb 25, 2018 5:49 pm

Dilvish wrote:
dbenage-cx wrote:From what I've followed so far, there are two different options proposed for this new item type...
These may not be mutually exclusive options, but the later would be my first choice.
My understanding of the discussion is that while the former was first contemplated, the latter is the only one really still being considered, so you are in luck! :D
My understanding was actually the opposite :shock: . But maybe one of us misunderstood dbenage-cx post.

What is currently considered most is the version where you specify an amount and a number of turns exactly like with ship built items. Only difference to a ship would be that we dont wait for the projects to be finished, but the spent amount of PP gets always transferred to the stockpile at the end of the turn.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Ophiuchus
Vacuum Dragon
Posts: 506
Joined: Tue Sep 30, 2014 10:01 am

Re: Implementing stockpile "project" build item

#19 Post by Ophiuchus » Sun Feb 25, 2018 5:54 pm

Geoff the Medio wrote:
Dilvish wrote:Since it is only a single item I don't think that anyone needs to be able to obsolete it, or even should be able to, really. It would be fine with me if it were just always visible regardless of any of the ship/building/available/unavailable buttons, but it seemed simplest and most logical to just consider it always 'available' and lets its display be subject to the state of the 'available' and 'unavailable' buttons.
It probably shouldn't be obsoleteable, but it might be not available (ie. unable to receive PP allocation) in some cases, so I'd plan for the possibility.
@geoff Could you elaborate how it becomes unavailable? I dont see any case where you would want to hide it for availability reasons. I certainly would want it to be available if the local supply group has spent all its PP. And the other one I could think about is that the local supply group does not have industry at all which would be rather rare and hiding would also not help here IMHO. Or did you mean possible future additions to the mechanism?
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, Programmer
Posts: 4685
Joined: Sat Sep 22, 2012 6:25 pm

Re: Implementing stockpile "project" build item

#20 Post by Dilvish » Sun Feb 25, 2018 7:55 pm

Ophiuchus wrote:My understanding was actually the opposite :shock: . But maybe one of us misunderstood dbenage-cx post.
I have re-read his post and I am pretty sure I did not misunderstand him. I am having a bit of trouble interpreting your new words below, so perhaps we are all in agreement or perhaps not.
What is currently considered most is the version where you specify an amount and a number of turns exactly like with ship built items. Only difference to a ship would be that we dont wait for the projects to be finished, but the spent amount of PP gets always transferred to the stockpile at the end of the turn.
With ships (and my stockpile item proposal) we do not specify a number of turns, we specify a repeat count. Specifying a number of turns sounds more like your first proposal.
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: 12249
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Implementing stockpile "project" build item

#21 Post by Geoff the Medio » Sun Feb 25, 2018 8:21 pm

I don't mean it is possible now, but rather that in future it might be possible to have government or other reasons why an empire could be disallowed from srockpiling.

Ophiuchus
Vacuum Dragon
Posts: 506
Joined: Tue Sep 30, 2014 10:01 am

Re: Implementing stockpile "project" build item

#22 Post by Ophiuchus » Mon Feb 26, 2018 1:57 pm

From dbenage-cx second proposal:
dbenage-cx wrote:Another is for the item to complete each turn (when not paused and has some progress) with the value altered to the amount of progress.
I interpret this as: a 50PP stockpiling item getting 10PP is finished at the end of the turn. (with 10PP being added to the stockpile)
Dilvish wrote:
Ophiuchus wrote:
What is currently considered most is the version where you specify an amount and a number of turns exactly like with ship built items. Only difference to a ship would be that we dont wait for the projects to be finished, but the spent amount of PP gets always transferred to the stockpile at the end of the turn.
With ships (and my stockpile item proposal) we do not specify a number of turns, we specify a repeat count. Specifying a number of turns sounds more like your first proposal.
Sorry, the "number of turns" was my mistake. Let me rephrase:

What is currently considered most is the version where you specify an amount and a repeat count exactly like with ship built items. Only difference to a ship would be that we dont wait for the projects to be finished, but the spent amount of PP gets always transferred to the stockpile at the end of the turn.

Thinking a stockpile project in terms of ship build item would have the following properties:
  • the build item costs 1PP and needs 1turn to build
  • it would not be affected by upkeep costs
  • specifying an amount: 50 and repeats: 3 means that completing this takes at least 3 turns and costs exactly 150PP
Would blocksize be the correct technical term for "amount"?
Last edited by Ophiuchus on Mon Feb 26, 2018 2:35 pm, edited 1 time in total.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Ophiuchus
Vacuum Dragon
Posts: 506
Joined: Tue Sep 30, 2014 10:01 am

Re: Implementing stockpile "project" build item

#23 Post by Ophiuchus » Mon Feb 26, 2018 2:35 pm

Added a PR-2023

I think I need help with the next step: ability to add this stockpile project to a build queue.

Regarding UI where should I start looking? Also suggestions for testing would be welcome....
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, Programmer
Posts: 4685
Joined: Sat Sep 22, 2012 6:25 pm

Re: Implementing stockpile "project" build item

#24 Post by Dilvish » Mon Feb 26, 2018 4:40 pm

Ophiuchus wrote:I interpret this as: a 50PP stockpiling item getting 10PP is finished at the end of the turn. (with 10PP being added to the stockpile)
Yes, you are right, I somehow managed to misread his words both the first two times. Third time is a charm!
What is currently considered most is the version where you specify an amount and a repeat count exactly like with ship built items. Only difference to a ship would be that we dont wait for the projects to be finished, but the spent amount of PP gets always transferred to the stockpile at the end of the turn.
Right
Thinking a stockpile project in terms of ship build item would have the following properties:
  • the build item costs 1PP and needs 1turn to build
  • it would not be affected by upkeep costs
  • specifying an amount: 50 and repeats: 3 means that completing this takes at least 3 turns and costs exactly 150PP
Sounds right to me.
Would blocksize be the correct technical term for "amount"?
Yes
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: 12249
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Implementing stockpile "project" build item

#25 Post by Geoff the Medio » Mon Feb 26, 2018 10:34 pm

Ophiuchus wrote:I think I need help with the next step: ability to add this stockpile project to a build queue.

Regarding UI where should I start looking?
Before you can do much in the UI, you need to set up orders to add / manipulate the projects on the queue. Then look in ProductionWnd.pp and BuildDesignatorWnd.cpp.

Ophiuchus
Vacuum Dragon
Posts: 506
Joined: Tue Sep 30, 2014 10:01 am

Re: Implementing stockpile "project" build item

#26 Post by Ophiuchus » Fri Mar 02, 2018 2:07 pm

"make it work" is implemented and i think its useful. actually i would love to get playtesting from you guys. (so probably we should have merged it in the next test builds) .

General next steps:
* Fix issue: encyclopedia entry for stockpiling (not sure what i did wrong, help wanted)
* code review, cleanup, squash, merge (discussion on github)
* playtesting (help wanted)
* maybe refactor build item structure (suggestions welcome)

For "make it right" - I am not completely happy with having another overloaded version of build item type on so many different levels. Open for suggestions.

Finetuning questions:
* sitrep if a stockpiling project runs out (all repetitions finished) or not??
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, Programmer
Posts: 4685
Joined: Sat Sep 22, 2012 6:25 pm

Re: Implementing stockpile "project" build item

#27 Post by Dilvish » Fri Mar 02, 2018 4:58 pm

Ophiuchus wrote:For "make it right" - I am not completely happy with having another overloaded version of build item type on so many different levels. Open for suggestions.
I'm not understanding what you are talking about, could you clarify?
Finetuning questions:
* sitrep if a stockpiling project runs out (all repetitions finished) or not??
I personally am doubtful I'd want a sitrep on that, although I guess sitreps in general are easy enough to turn off that there is little harm in providing one if you find it helpful.
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
Dilvish
AI Lead, Programmer
Posts: 4685
Joined: Sat Sep 22, 2012 6:25 pm

Re: Implementing stockpile "project" build item

#28 Post by Dilvish » Fri Mar 02, 2018 5:58 pm

Ophiuchus wrote:actually i would love to get playtesting from you guys. (so probably we should have merged it in the next test builds) .
I've made one substantive comment to the PR just now that I think needs to be addressed before we merge it. I'll also look it over a bit more and give the PR a bit of playtesting (I'll put that fix in locally until you get it into the PR).
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Ophiuchus
Vacuum Dragon
Posts: 506
Joined: Tue Sep 30, 2014 10:01 am

Re: Implementing stockpile "project" build item

#29 Post by Ophiuchus » Fri Mar 02, 2018 11:51 pm

Dilvish wrote:
Ophiuchus wrote:actually i would love to get playtesting from you guys. (so probably we should have merged it in the next test builds) .
I've made one substantive comment to the PR just now that I think needs to be addressed before we merge it. I'll also look it over a bit more and give the PR a bit of playtesting (I'll put that fix in locally until you get it into the PR).
As I have implemented the project, the PP spent on stockpile projects are not available in the same turn, but change the next turns' stockpile.
If I correctly understood your post you'd rather have the PP available in the first turn.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Ophiuchus
Vacuum Dragon
Posts: 506
Joined: Tue Sep 30, 2014 10:01 am

Re: Implementing stockpile "project" build item

#30 Post by Ophiuchus » Fri Mar 02, 2018 11:57 pm

Dilvish wrote:
Ophiuchus wrote:For "make it right" - I am not completely happy with having another overloaded version of build item type on so many different levels. Open for suggestions.
I'm not understanding what you are talking about, could you clarify?
I'm following "make it work/make it right/make it fast".

"make it work" should be the easy implementation to make it work. Code can be really ugly, you dont care in this step about it.

With step 2 "make it right" meaning cleanup and refactorings to do the good thing (and probably skipping on step 3).


Before we had two versions of build projects: those with a string name as id (building name) and those with a int id (ship design id). Now there is a third version without any id (because its global).
The question is if there really should be a third version which doesnt have a id or we should use e.g. the functions for building projects just with a unused string name. If we would we would save a lot of functions.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Post Reply