Table of Contents
Power Usage
This page describes the current power usage pattern/system and a proposal and motivation for changing it.
Introduction
With the current system all items that require monetary backing by power to be built are build in a two phase process. Firstly all required power is accrued from the player's current supply of power. Then secondly, after the required power is accrued and reserved for the item being built, de actual construction of the item starts.
Proposal
As a proposal for the next/new system the phases for the current situation should be merged. This means that construction should start immediately, regardless of whether all power for the built item can be accrued before starting construction.
Motivation
The current system has several drawbacks. I'll summarize a few of them here.
Buildings, full health
After the power accruing phase has completed a building currently has a 100% of its final health. This means that unfinished buildings, which intuitively should still be relatively weak, are in fact as strong as their finished counterparts. A proposed change in #173 for this was to make the health of a building increase in parallel with the "progress" of the construction phase. That approach would however make it so that unfinished buildings (with partial health) will already have taken 100% of the required power. As a result you can loose 100% of a building's power even when it isn't finished yet. This can, rightfully, be considered to be unfair.
Requirements
To keep the game play intact and change it only as little as is absolutely required to merge the two building phases, the following requirements should be met by an design and implementation.
Power accruing method
When building an item power should be accrued on-the-fly. This means that at all times the amount of power taken from the player, relative to the item's total cost should be equal to the relative amount of construction that has been performed. If at any given time power isn't available construction should be halted until power is available. As soon as power is available again this power should be accrued and construction should continue. As a result the construction time of an item may become limited by the amount of power a player has as its income.
Construction method for structures
When building an structure it's health should "grow" on-the-fly with the progress of the construction process. This means that at all times the amount of health points, relative to the structure's maximal amount of health points, added to the structure's total amount of health should be equal to the relative amount of construction that has been performed. Note that the total amount of health points of a structure can be less than the amount of health points that got added to it during construction. This would then be the result from that structure taking damage during construction.
Construction method for all items
When building an item it's construction progress will consume "build points" from the constructing parties. The amount of progress of the construction process should at all times be equal to the amount of "build points" consumed relative to the amount of "build points" required. Thus, similar to the power accruing process, when the constructing parties are no longer able to deliver "build points", construction should be halted until "build points" are available again. As soon as "build points" are available again they should be consumed and the construction should continue. As a result the construction time of an item may become limited by the rate at which the constructing parties can deliver "build points".
Cancelling construction
This requirement applies to droids only.
As long as construction is still in progress cancelling of construction should be possible. When the construction of an item is cancelled all power that has been accrued up until that time must be returned to the player.
Halting construction
This requirement applies to structures only.
Halting of construction can be achieved by making sure no units capable of construction are actively working on constructing the structure.
When construction of a structure is halted, the construction process shall go in reverse. This means that all power accrued up until that time shall be slowly returned by the player at a rate of X (X is currently defined in the code, but should be placed here) units of power per second. The amount of build points (and associated construction progress) should decrease in the same relative amount as the accrued power. Relative to the structure's maximal amount of health points, health points should be subtracted from the structure's total amount of health equal to the amount of decreased construction process. Note that the total amount of health points structure points can be less than the amount of health points relative to its maximum equal to the current construction process. This would then be the result from that structure taking damage during construction or "reverse construction".
When a structure's build points or health points reaches zero it shall be removed, whichever of those occurs first. As a result any power that hasn't been retrieved yet shall be lost.
Backwards compatibility
Backwards compatibility for save games should be maintained.
Design
To meet the above requirements the following design decisions have been made.
TODO: Add descriptions of design decisions
