By doing research, you'd unlock specific ship components that consist of a component type (as above) and a type version number. Components would be called something like "Mass Driver Mk. 1" through "Mass Driver Mk. 12" and so forth. Alternatively, components could be given fluffy names like "Fusion Coupling Laser (Energy Beam Mk. 2)" where the stuff in the brackets indicates the version number as above.
When you build a ship, you build it by picking a design. But the design doesn't indicate what version of the component to use, so the game always builds the highest tech version of the component you know how to build. (If we want to get fancy, we could let the player pick to use a lower-tech component if they're cheaper...).
If the player then discovers a newer version of a particular type of component, upgrading would involve replacing the older Mk. X components with newer Mk. X+1 components. The actual ship design does not change due to this upgrading, however... as the design only specifies the type of a component to include, but not the actual version number.
Thus you if you have a ship with Mk. V Shield Generators, but no Beam Weapon components, and you discover Mk. VI Shield Generators, you can upgrade the ship to use the new Mk. VI Shield generator, but the ship cannot be upgraded in any way to include a Beam Weapon component. There are no Beam Weapon components to upgrade.
In order for this to work seamlessly, all ship components will need to have a clear linear ordering of quality. Thus if you have a given version of a component, every other version of that component is either better or worse. There is no abiguity about which component you should upgrade to in any case.
Note that the linear ordering of components can be manipulated to allow things like special components that are unlocked by strategic resources. These special components would fit between the other components in the linear ordering, meaning that they'd replace a given lower tech version of a component, but eventually you'd discover another version that is better an the special unlocked version is replaced. The special unlocked components could either have a lower cost and the same effects, or better effects and a lower cost than the component they replace. The ordering could be done by the designers, or could be automated, so new components can be added to the system without reordering anything (though it would be necessary to avoid cases of equal value components, depending how the value is calculated if done algorithmically).
IMO, upgrades should cost production or other resources. I'd also prefer that it be required for the player to return ships to a shipyard you own in order to do the upgrades. If upgrades happen automatically out in the field, there's no way for the player to decide to not upgrade to save the cost for something else they'd rather build. Better would be to have upgrades done manually out in the field, allowing the player to pick which ships to upgrade (would include an all option, or all in this fleet option). I'd rather go the whole way and require the upgrading to be done at a shipyard as well, for the strategic planning and other choices that this would require. This would be some annoying micro, but could be automated to some degree. I do acknowledge the tediousness of having to shuffle ships back and forth though... but IMO upgrading in the field or only at shipyards would be a fairly simple player-settable option to impliment.
Upgrades need to have a cost associated with them, or else exploits (IMO) are created in which the player can make a bunch of low tech ships, do some fast research or trade for better advances, and then upgrade all his/her ships at no additional cost. IMO the upgrade cost should be larger than the difference between the two components being upgraded between. So if Mk. I costs 20 and Mk. II costs 80, the difference between their costs is 60, but upgrading from Mk. I directly to Mk. II would cost more, say 80 or 120. (Note that if upgrade cost is something like 2 * (newComponentCost - oldComponentCost), the upgrade cost needs to have some minimum value in case the two components cost the same, or the new one is cheaper, as otherwise the upgrade cost could be negative in such cases).
Rather than "in friendly space", I'd require them to be in a friendly system (not moving for a full turn, ala civ unit healing). Flying along a starlane wouldn't be a good time to do repairs. To further borrow from civ, having a shipyard in a system should improve the repair rate significantly (civ does barracks/harbour giving full healing in one turn, for example). The repairs should cost production as well.drek wrote:Ships ought to auto-heal, but it should take a turn or three, and the ship should either have an engineering bay or be in friendly space for it to occur.