Make buildings only be buildable once at a planet default

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

Moderator: Committer

Post Reply
Message
Author
User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Make buildings only be buildable once at a planet default

#1 Post by Vezzra »

Currently, if we want to prevent a player to build the same building multiple times, we do this by adding certain conditions to Location and EnqueuedLocation. As the way buildings are designed and used in FO (special, not build-on-all-colonies, etc.), that's actually the default case, if not even more - is there any case where it makes any sense to build one type of building multiple times on the same planet? I actually can't think of any, there is only one exception where you might want to queue the same building several times: the terraforming building, to speed up the terraforming process - which is actually an exploit.

So I wonder if it wouldn't make sense to simply hardcode that case, so that buildings generally can only be built once at a planet. And if we want to preserve the possibility to be able to make the odd exception, we can add a "CanBuildMultiple" (or something like that) flag to the buildings definitions.

Thoughts?

User avatar
andrewthehammer87
Space Floater
Posts: 15
Joined: Wed Aug 05, 2015 2:35 pm
Location: Hungary/UK

Re: Make buildings only be buildable once at a planet defaul

#2 Post by andrewthehammer87 »

Your idea can improve the way players use game-strategy, in my opinion. Looking forwards the improvement.
Last edited by andrewthehammer87 on Sat Jan 09, 2016 7:50 am, edited 1 time in total.
All my work released for FreeOrion is licensed under 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: Make buildings only be buildable once at a planet defaul

#3 Post by Geoff the Medio »

Having default auto-added conditions (unless there's a specific flag to prevent it, similar to NoDefaultCapacityEffect for ship parts) that prevent multi-building on the same location seems reasonable.

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

Re: Make buildings only be buildable once at a planet defaul

#4 Post by MatGB »

I have no objection to this overall, it does seem daft that virtually all buildings need extra scripting just to stop players making mistakes.

Caveat: I don't consider multiple terraforms at once an exploit, I consider the current building based system a stopgap system until we can come up with a better way of handling terraforming. Dilvish recently fixed a few holes in the code to make the current queue multiple at once system work better and I definitely appreciated those changes. Being able to queue however many that I need is a massive reduction to micromanagement issues over having to go back repeatedly every time one completes. I do want to, at some point, work on a better method, perhaps involving focus settings or a galactic terraforming headquarters building, but it's a low priority currently.

Idea I had awhileback inspired by something you said that's relevent: "Megastructure" tag, that in some way increases costs and/or makes it harder to build multiple important buildings in the same place, if a lot of our buildings are meant to be planet spanning galactic centres, it'd make sense to encourage players to have them in different places, partially for strategic challenge reasons and partially for flavour/emphasis reasons. Currently the default of putting the Industrial Centre, Genome Bank, Palace, Enclave, Thought Network etc all in the most defensible position seems, well, against spec to me. If all buildings with the tag were given a cost multiplier (or something) based on the number of other megastructures already on that planet or enqueued it'd spread them out fairly effectively.
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: Make buildings only be buildable once at a planet defaul

#5 Post by Geoff the Medio »

MatGB wrote:If all buildings with the tag were given a cost multiplier (or something) based on the number of other megastructures already on that planet or enqueued it'd spread them out fairly effectively.
Infrastructure minimum requirements and reductions from buildings would also accomplish this...

Edit: The above said, is something in C++ special needed? Macros can be used to add a the relevant conditions fairly simply...

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

Re: Make buildings only be buildable once at a planet defaul

#6 Post by MatGB »

True, I've always found that use for infrastructure to be, well, unsatisfactory. Plus, some of the buildings (Palace, Megalith) currently give Inf bonuses and I'm workign through other ways of using it that this could clash with (linking Inf to vision range boosts granted by techs is really satisfactory, need to finish that work and commit it I think).

Either would work, both would work, but a clear "doing this in the same place too often is costly" indication would hopefully make it clearer, especially to newer players, and I suspect would be easier for the AI to be able to code for.
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
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Make buildings only be buildable once at a planet defaul

#7 Post by Vezzra »

andrewthehammer87 wrote:Not all buildings can be considered exploits, in my opinion.
I don't know what you mean by that, I didn't say anything about considering all buildings exploits. I was merely referring to the specific case of the Terraforming building, which could be queued several times instead of waiting for one to be finished before queueing it again to continue the terraforming process, which of course greatly speeds up terraforming.

The reason why I consider that an "exploit" is because I think the way it is set up indicates that whoever designed that mechanic apparently intended the whole process to have to be done step by step. If that's a good idea is another question. Personally I agree that doing it this way makes terraforming too tedious to manage, and taking far too long.

However, the solution should not be to just keep the "exploit" of being able to queue the building multiple times, so several "steps" can be worked on simultaneously, but to make the build costs and/or time dependent on how many steps the current type is away from the target type. Simpler and more intuitive for the player.
Shipyards and Drydocks shouldn't be hardcoded or they may be, unless there's this CanAddMultiple flag, as you mentioned. I can't imagine building ships only at the Homeworld.
I think we have a misunderstanding here. My point is to allow the same type of building only once per planet, not per system or per empire. You surely should be able to build e.g. shipyards on as many of your colonies as you want. But it doesn't make any sense to build more than one Basic Shipyard on the same planet.

And as that applies to practically all buildings (even to Terraforming if we change it the way I suggested above), we can as well hardcode that default, instead of requiring content scripters to add the necessary conditions to the definitions of each and every building. And for the potential case that someday someone might come up with a building that actually would make sense to have multiple times on the same planet, we can introduce the CanBuildMultiple flag I mentioned.
there's still a long list of buildings with CanAdd Multiple flag to give
Just to make sure I understand you correctly: you mean, there are a lot of buildings you might want to build multiple times on the same planet? Or that you want to build on more than one colony?

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Make buildings only be buildable once at a planet defaul

#8 Post by Vezzra »

MatGB wrote:Caveat: I don't consider multiple terraforms at once an exploit, I consider the current building based system a stopgap system until we can come up with a better way of handling terraforming.
What about my suggestion in my post above? Making build costs/time depend on how much terraforming steps are required to reach the final target planet type? AFAIK FOCS should provide already all necessary conditions/effects required for that.

Would still require to build that building on each planet you want to terraform, so wouldn't be the final solution either, but already better than what we have now.

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

Re: Make buildings only be buildable once at a planet defaul

#9 Post by Geoff the Medio »

Vezzra wrote:...make the build costs and/or time dependent on how many steps the current type is away from the target type.
Part of the original idea was, I think, to make it possible to do partial terraforming... so you'd produce terraforming once to move one step towards the optimal planet type, without needing to go all the way to the final goal. Perhaps that's an unnecessary player choice in practice, though?

Also, having to produce several instances of the building means that the planet transitions gradually towards the final state, instead of jumping instantly to it. If there's just one building, it will need some additional scripting to preserve that

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Make buildings only be buildable once at a planet defaul

#10 Post by Vezzra »

Geoff the Medio wrote:
MatGB wrote:If all buildings with the tag were given a cost multiplier (or something) based on the number of other megastructures already on that planet or enqueued it'd spread them out fairly effectively.
Infrastructure minimum requirements and reductions from buildings would also accomplish this...
I still have a soft spot for that idea, and would like to see it implemented.
The above said, is something in C++ special needed? Macros can be used to add a the relevant conditions fairly simply...
We already have a macro for that in place for EnqueuedLocation, so you don't have to copy the entire chunk into each building script, but adding that macro you'd still have to do for each building. And you also have to add a line to Location (which is too simple to bother with another macro).

The point of my proposal was to avoid just that, because it can and often is forgotten by content scripters, and is needed for all buildings anyway. IMO the typical case where you hardcode the default case in the backend code, and require the extra scripting (by using a simple flag in this case) for the (currently only potential, because not even existing yet) rare exception. I think that will need some special case handling in the C++ code, the auto-generation of the required effects if the CanBuildMultiple flag isn't present sounds like a good approach to me.

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Make buildings only be buildable once at a planet defaul

#11 Post by Vezzra »

MatGB wrote:True, I've always found that use for infrastructure to be, well, unsatisfactory. Plus, some of the buildings (Palace, Megalith) currently give Inf bonuses and I'm workign through other ways of using it that this could clash with
Hm, buildings that give an inf bonus wouldn't consume inf, I see no problem with that. They are just a type of building that don't need infrastructure to support it, they are the special exceptions that provide infrastructure.

And I don't see that approach "clashing" with those other ways you work on using inf, on the contrary, I see that making things more interesting. A colony that needs to support the massive structures/plants/facilities which are represented by the FO buildings consume a lot of infrastructure support that could otherwise be used for planetary shield installations, defence networks, detection facilities etc. That way a player has even more reason to carefully decide about wether and where to place buildings, as they will reduce a colonies capabilities in these other areas. I actually like that idea :D

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Make buildings only be buildable once at a planet defaul

#12 Post by Vezzra »

Geoff the Medio wrote:Part of the original idea was, I think, to make it possible to do partial terraforming... so you'd produce terraforming once to move one step towards the optimal planet type, without needing to go all the way to the final goal. Perhaps that's an unnecessary player choice in practice, though?
I've thought of that too, but in all the games I ever played I never saw any reason for doing only partial terraforming. So, IMO, yes, that's an unnecessary player choice in practice.
Also, having to produce several instances of the building means that the planet transitions gradually towards the final state, instead of jumping instantly to it.
IIRC, isn't that delay just one turn in practice? Provided you have sufficient PP of course, all the enqueued Terraforming buildings are worked on in parallel, and finish right after each other. Not something interesting enough to keep it IMO.
If there's just one building, it will need some additional scripting to preserve that
The required scripting will be a bit complicated I guess (something along several specials that implement each step, and each special creating the next one until the final planet type is reached), but I assume doable. If we want to preserve that "gradual transformation", IMO the more interesting way to do it than enqueueing the same building several times.

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

Re: Make buildings only be buildable once at a planet defaul

#13 Post by Geoff the Medio »

Vezzra wrote:The required scripting will be a bit complicated I guess (something along several specials that implement each step, and each special creating the next one until the final planet type is reached), but I assume doable. If we want to preserve that "gradual transformation", IMO the more interesting way to do it than enqueueing the same building several times.
I don't think it needs to be complicated... Can't the building, once per turn, set the planet's type to one closer to the optimal, and then delete itself when the optimal is reached?

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Make buildings only be buildable once at a planet defaul

#14 Post by Vezzra »

Geoff the Medio wrote:I don't think it needs to be complicated... Can't the building, once per turn, set the planet's type to one closer to the optimal, and then delete itself when the optimal is reached?
Err... you're very probably right. Sometimes my brain just insists on seeing things as more complicated than they are :lol:

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

Re: Make buildings only be buildable once at a planet defaul

#15 Post by MatGB »

andrewthehammer87 wrote:Terraforming as I observed is throttled at some level, at least I couldn't terraform an Inferno planet into a Terran planet, only into Barren.
I must have missed when you've mentioned this before, if you've had that as a problem it's not intentional and there may be a bug, I've taken worlds all the way around the circle more than once. If you can replicate it, please open a Support thread and we can look into it as it's definitely not meant to work that way (the costs go up per level terraformed already).

I've thought about recosting terraforming as is more than once but never got around to it, I tend to only take huge and large worlds to Good.

I'd actually like to have terraforming be done without the need to build them everywhere, a coordination centre to open a focus setting then scripted based on turns since focus change should work.
Vezzra wrote:IIRC, isn't that delay just one turn in practice? Provided you have sufficient PP of course, all the enqueued Terraforming buildings are worked on in parallel, and finish right after each other. Not something interesting enough to keep it IMO.
No, if they're all enqued together, the first one completes and prevents the others from doing so, at that point the cost of future terraforming goes up so the remaining are all half completed so you have to wait 5 turns per level. (4 turns as it's half an 8 turn building and one turn because it doesn't get work done on the turn the other building is in place doing its work).
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Post Reply