Buildings Model Quickpad

From FreeOrionWiki
Revision as of 19:07, 19 February 2006 by Geoff the Medio (Talk | contribs) (Conditions)

Jump to: navigation, search

This is a draft pseudo-brainstorming attempt to resolve some issues with the current buildings model. Nothing (new) here has been passed.

As an aside, some of the suggested additions discussed here would be useful for things discussed on the SpecialsEvents page that Drek made. Also see Talk:SpecialsEvents for some discussion that lead to some of the ideas presented here.

Issues

The non-effects details of the buildings model need to be worked out. Some isses to consider include:

Prerequisites (non-Tech)

Besides the technologies that unlock a particular building, we may want to be able to restrict where and when a building can be produced. Possible restrictions include:

  • Requiring the presence of another building at the build location
  • Requiring a particular special to be present at the build location
  • Requiring a particular planetary environment, star colour, minimum population, meter values, etc. at the build location
  • Requiring the empire to be in control of planets or systems that contain
    • Specific special(s)
    • Specific building(s)
    • Certain numbers or combinations of the above
  • Requiring the empire to have access to a special resource and be able to supply that resource to the build location (ie. not being blockaded) See User:Geoff_the_Medio/Musings#Strategic_Resources.

Limits

We will want to be able to limit on the number of buildings of a particular type on or in a planet, system, empire or galaxy, or within a certain distance of other (same or different?) buildings.

It may also be desirable to prohobit a building from being placed at or within a range of a non-building object or special.

If limits are not met, it is (presumably) already possible to disable the offending building(s) effects groups for those conditions which are already available. It should be similarly possible to disable effects due to any added limits.

Maintenance

We can already specify the maintenance cost for buildings, as indicated in the Effects page, but this idea needs to be extended to cover what happens if maintenance is not paid. This may be integrated with the following section, Building Enabling.

Building Enabling / Disabling

Buildings mostly (exclusively?) do their jobs through their effects groups, which already have activation and scope conditions. These are very useful and versatile, but they have some limitations that are problematic for buildings. In particular, we need ways to enable to enable or disable or change buildings' effects groups for reasons such as:

  • unpayed maintainance
  • player choice (requiring UI integration)
  • technology prerequisites (new ones gained or previously known ones lost)
  • non-tech prerequisites, as discussed above
  • unmet limits, as discussed above
  • after a fixed delay, or at a certain time

Refinements

tzlaine is has added the ability to add additional effects groups to buildings, in order to "refine" them. This should be extended to allow removal or deactivation of effects groups as well.

Solutions?

A mix of new effects and conditions and non-effects methods will likely be needed to impliment the desired functionalitly.

New Condition: TechKnownToEmpire

This condition would match all objects owned (exclusively or not) by an empire which knows a particular tech. This would allow effects groups to be activated or not, or their scopes to include or not based on whether they or other empires know a particular tech. This would be useful for:

  • specials that only work if you know a particular tech, such as space anomalies that give bonuses
  • making buildings obsolete / partly obsolete after discovering a particular tech. A building could have one function, then stop the old or start new functions when a particular tech is discovered
  • having effects that fire on other empires than the source's owner if the other empire does/doesn't have a particular tech

Production Prerequisites

Conditions

There should be a "BuildLocation" condition for buildings, similar to scope conditions for effects. This condition would have to include all valid production locations for the building.

There should also be some way to determine whether buildings are available to be built, regardless of location. This could be done by incorporating some additional effects into the location condition, or could be done as a separate "Availiblity" condition, similar to activation conditions for effects. This would start with just the homeworld of the empire who is trying to produce the building in its scope, and would apply the condition indicated. If the homeworld is matched by the condition, then the building is available to that empire.

Every turn, if a building is prioritized high enough on the queue to receive PP, its BuildLocation and Availiblity conditions is checked, and if the build location and producer's homeworld meet their conditions, then the building receives its PP for that turn. If either condition is not met, the PP are passed to the next item on the queue for (potential) use.

Consequences for Production

Buildings may be placed in the build queue (enqueued) at any time, regardless of whether their prerequisites are currently met. If a building has been enqueued, and its prerequisites are not met, it remains on the queue.

PP may be spent on a building (and a turn of its build time completed) only if the building's prerequisites are met on a given turn. There is no distinction between the first or subsequent turns, and no distinction between player-paused, pasued due to underfunding on previous turns, or paused due to prerequisites not being met; any of these causes the building to not have any PP spent or build time completed for a given turn.

If a building has been partly finished, and it is paused due to player choice, insufficient funding or prerequisites not being met, the spent PP and completed turns are retained. If in future, the prerequisites are met, there is suffient funding and the player so choses, the building is resumed from where it was when building was halted. No spent PP are lost due to pausing, underfunding or unmet prerequisites.

Note that this does not preclude the possibility of sabotage or accidents destroying a partly built building (all production lost) or setbacks in production (one or more turns toward completion time lost).

Note about Tech Condition

Regarding the above mention of a building prerequisite based on "Techs Known to Empire doing building (New TechKnownToEmpire condition)": This is distinct from the idea of a tech which unlocks / locks a particular building. With lock / unlock, the availablility of a building is set by an effect, and is on/off.

This prerequisite would be an additional requirement above and beyond being unlocked. A particular technology would be required to be researched in order for the building ot be built. An unlocked building could not be built if this, or any other, prerequisites are not met.

New Effect: ResetTimer, New Condition: TimerValue

Note: This section may be redundant with the tzlaine's events system. Based on his description of that system however, this effect and condition seem like they would still be useful.

ResetTimer: Sets building property: Timer, to 0

Each turn, timer is increased by 1 automatically

TimerValue: Works like MeterValue conditions. Has <max> and <min> fields. UniverseObjects with Timer properties between <min> and <max> are matched.

The timer value gives the number of turns since it was last reset. The TimerValue condition could be used to determine if a fixed number of turns has passed, or to schedule a series of effects groups on different turns.

New Condition: GalaxyTurn

The galaxy would have a property: CurrentTurn, which would return the integer number of the current game turn. This could be referenced in effect magnitude expressions.

The GalaxyTurn condition would match any object if the CurrentTurn number was within the range specify in the condition, using <max> and <min>, similar to MeterValue.

New Effect: SetEnabling, New Condition: Enabled

Objects would have a new binary property "Enabled".

The SetEnabled effect would set Enabled to true or false (1 or 0).

The Enabled condition would match all objects which have Enabled = True.

The Enabled flag of an object would be altered in a manner similar to the meter values of production centres through various non-effects mechanisms. For example, if a building's maintainance is not paid, or a player uses the UI to disable a building, then Enabled would be set to false. The activation condition for the building's effects would have <Condition::Enabled/>, meaning the effects would only work for enabled buildings.

Sidenote: Turn off Maintainance

It would also be useful to be able to turn off or alter maintainance fees for buildings that the player has disabled through the UI. This could be done via fields in the building description like <enabledmaintainance> and <disabledmaintainance>, or through a more complicated effects-based system. The enabled / disabled flags should be sufficient, though.

Other Ideas

Building Visibility

Being able to set whether a building is visible to non-allied empires of the owner would be useful. This would ideally be separately settable while the building is under construction, and after it is finished. This would mean that some buildings are always visible to empires that can see into a system (before and after the buildigns are completed), but some are visible only when complete (not while under construction), or are never visible, or visible while under construction but not when complete. This could also be represented as a visibility rating, rather than just on/off, similar to the proposed starlane visibility system.

Having buildings be invisible would be useful for setting traps, or honeypot-systems, that look tempting, but which have major negative consequences for any invaders who capture it. Having buildings be visible while under construction and not when finished, or vice-versa, could make for interesting / fun races against the "clock" to keep something hidden, or sudden surprises when a finished building pops up unexpectedly... and also makes for a strong justification for espionage and detection technology, like with starlanes.