V3 ScratchPad

From FreeOrionWiki
Revision as of 15:24, 13 July 2004 by 63.246.166.179 (Talk)

Jump to: navigation, search

[b]TO-DO: I'm going to almost comletely rewrite this to make it clearer and conform to suggestions from various sources. ETA: Wend. --drek [/b]

Meters

Meters are variables attached to planets, representing the production capabilities and social attributes of each colonized world. Future Note: There will be “meters” attached to ships, ship parts, empires, and perhaps the galaxy itself.

Meters always range from 0-100. For greater granularity, meters can be modified in fractions of a full step (for example, a current meter value might grow by +.25 during a turn). However, the effects of a building or technology on a meter are always integers (+1, -24, not -5.292 or +0.02) when described to the player (eg. "Superlabs gives +4 to research"), and the value of a meter is always rounded to the nearest integer on the UI.

TO-DO: On going dicussion as to the scale of meters. 0-100, 0-10, 0-255? This may mean a hard cap on meter levels, above which additional bonuses have no effect, or it may mean that the set of possible bonuses in-game are only sufficient to reach a certain level when all applied simultaneously (or as much as stacking allows). Might need a public review.

Meters have both a Max Value and a Current Value. Production calaculations and conditional tests use the Current Value. Current meter values slowly increase towards the max meter value (see Infrastructure for more information). Bonus, penalty and focus effects generally manipulate the Max Value, which may or may not alter the current value. Unusual, catastrophic or good random events may permanently modify the Current Value (until it regrows).

Resource Meters

Resource meters govern the production of resources by a world. Resources are Nutrients/Food, Minerals, Production Points, Research and Money. For each resource,

(Amount of Resource Produced at Planet) = (Resource Meter value) / 10 * (Planet Population)

TO-DO: There is ongoing discussion pertaining to the value of each meter level. That is, does the amount prorduced depend on the meter value, or some other factor that is a function of the meter vavlue? Might need a public review.

v0.3 Resource Meters

Farming: Farming determines the amount of Nutrients (TO-DO: aka "Food"?) a world produces. It is heavily modified by poor environment. [b]Each population point requires one unit of food every turn to not die of starvation.[/b]

Mining: Mining determines the number of Minerals produced.

Industry: Industry determines the Production Points (PP) generated by a world. TO-DO: Gravity (ie, Planet Size) effecting Industry, as a balance for larger planets. Been discussed before, at length when NF and I were assembling v.2 stuff.

Science: Science determines the Research generated by a world. In the future, government picks will probably have a significant influence on this meter.

Trade: Trade determines the Money extracted from a world. In the future, government picks will probably have a significant influence on this meter.

Planet Focus

There is a Primary and Secondary Focus for every colonized planet, representing what resource(s) the planet is "focusing" on producing. The Max Values of resource meters are heavily influenced by Focus settings. Both Focii can be independently set to one of the five resource meters or the "Balanced" setting.

New colonies (including the Homeworld at the beginning of the game) begin with Primary Focus set to Balanced, and Secondary Focus set to Farming. (With these focus settings, a planet is food self-sufficient when its current farming meter equals its max farming meter, unless other modifications change the max farming meter. Each unit of population needs 1 unit of food, and the combination of primary balanced and secondary farming gives the bonuses necessary to produce this amount of food at a single planet)

Focus Effects on Max Resource Meters

At the start of the game (before tech or building modifications), focus settings have these effects on max meter values:

  • Primary Focus adds + 12 to one max resource meter
  • Primary Balanced Focus adds +4 to all max resource meters
  • Secondary Specialized Focus adds +6 to one resource meter
  • Secondary Balanced Focus adds +2 to all max resource meters

TO-DO: There is on going dicussion pertaining the value of each focus setting. Might need a public review. This could change the minimum setting for food-self sufficiency, which might necessitate changing the starting/default focus settings for a planet. The current values have properties discussed on the talk page, so read that if you object to these values and wish to suggest alternatives.

Legacy Note: Once upon a time, in version .2 , each Focus setting would add to every meter, so that every colony would produce a little of each type of resource. That role now belongs to technologies and buildings. Worlds still produce a little of everything, once the proper techs are researched and buildings constructed. TO-DO: This has been mentioned in Infra and Effect threads in Design, and implied in the public review for Infrastructure, though not explictly passed yet.

Techs/buildings can independently add or subtract to the bonus for any of the 4 focus type for each meter. (This can alternative be described as giving a bonus to the max resoure meters at worlds with certain focus) Example: WonderFarms adds +5 to the farming bonus for worlds with farming specialed primary focus, +2 to farming on balanced primary focus, +2 to specialized secondary focus, and +1 to balanced secondary focus, and no bonus (+0) to worlds with focus settings that are neither balanced nor specialized farming.

Social Meters

Social meters govern the properties of a world not directly related to producing resources.

v0.3 Social Meters

Health: Health governs the growth rate of population. (TO-DO: Does a low heath meter mean -ve growth or just no or very slow growth?) (TO-DO: Does food supply influence this meter?) (TO-DO: Famines may or may not work through the health meter. Famine may be an event or just a cap on population equal to the supply of food/nutrients.)

Infrastructure Infrastructure governs the growth rate of Meters, and can modify the costs of build projects. See Infrastructure for more details. (TO-DO: Name for this meter under discussion. Could be "Construction")

Future Social Meters

Happiness: Happiness guards against unrest events. It is not used in v.3.

Security: Security lowers the duration of unrest events, guards against piracy events, and guards against enemy espionage. It is not used in v.3

Infrastructure

On each colonized planet, meters determine the quantity of resource production and the rate of growth on the planet. Each meter has a Max Value and a Current Value.

Effects modify the Max Meter. The exception is destructive events: for example, earthquakes, riots, and enemy bombings act on the Current Meters.

New colonies start with all Current Meters set to 0, with the exception of the Homeworld, which starts with current meters equal to its starting max meter values.

Each turn, if a Current Meter is greater than it's associated Max Meter, the Current Meter is reduced to match the Max Meter. For example, if the player switches a focus from Farming to Mining, the Max Farming Meter will be reduced. As a result, the Farming Current Meter would also reduce to match (if its current value before the change was larger than its max value after).

Each turn, every meter (aside from the Infrastructure Meter) increases via the following formula:

(Meter Value Change) = (Infrastructure Meter + FocusBonus) / ( (Current Meter Value) + 1)
(New Meter Value) = Min( (Meter Value) + (Meter Value Change), (Max Meter Value) )

In the above forumula, FocusBonus is equal to 30 if Primary Focus is set to the meter being incremented and FocusBonus is 15 if Secondary Focus is set, but Primary Focus is not set. These bonuses do not stack: 30 is used if both foci are set to the meter in question. Balanced Foci provide no bonus.

TO-DO: Geoff's forumla. I want Powercrazy and a few other eyes to take a look at this formula.

The Current Infrastructure Meter increases based on the Max Infrastructure Meter: (Meter Value Change) = (Max Infrastructure Meter) / ( (Current Meter Value) + 1)
(New Infrastructure) = Min( (Meter Value) + (Meter Value Change), (Max Meter Value) )

If a Build Project (including Terraforming but excluding Ships) is currently in progress on a planet, growth to the Infrastructure meter is halted for the duration of the project.

The Current Resource Meters are divided by ten, then multiplied with population to determine the quantity of each resource produced by the planet. The results of these operations are not rounded off to intergers internally, however they are displayed to integers to the user.

On the UI, each meter should be represented by: a: Filled in boxes or icons for each point in the Current Meter b: Greyed out boxes or icons for each point of the Max Meter above the Current Meter's value. c: A numeric and/or iconic display of the total resources produced by the planet. d: An indication of which resource meter is enjoying the benefits of the Primary and Secondary Foci. (Player should be able to manipulate this indication to change the Focus of the world.) e: In addition, meters should expand and contract to fit available space. Once meters reach higher levels, the indivdual boxes or icons might have to be quite small. TO-DO: or some other solution

Infrastructure Labels

Infrastructure Labels have no gameplay effect. They represent a rating to allow players to easily judge the progess of colonies.

The average of every Current Meter is determined. Based on this average, a Label is selected from the list below:

  • 1-10:
  • 11-30: Developing World
  • 30-60:
  • 60-90:
  • 90-100: Metroplex

To-DO: Think up better Labels. Can't use Nascent Colony, for example, because low infra might be due to destructive events.


Actors & Effects

Definition

Effects are changes/modifications to game objects. Actors are lists of Effects that function as a group.

Theory & Practice

Actors are of particular "types" (or "classes"). When actors are created, their type determines the effects that they contain, and any variable details of how each effect functions. Effects are also of particular types, and the details needed to specify how they function depend on their type. The description of an actor type contains a list of effect types and anys needed to specify how the effects will work.

All existing actors are iterated through several times while processing a turn. On each iteration, a particular effect may or may not be fired, depending what time during the turn it is set to fire. Effects are also given a chance to fire that is applied individually to each object in the effect's scope/restrictions.

Buildings, specials, techs and game mechanisms like a random event generator could all be treated as actors, or associated with a particular actor.

Description Actors

(Programmer comment/tweaking encouraged.)

Types of actors probably described in an XML file. Description contains data such as name, duration, number and list of descriptions of effects.

For Duration, may want to use values in this manner:

  • -1 -> infinite duration -> never goes away on its own (may be destroyed by an effect in future versions. Remains forever in v0.3)
  • 0 -> instant -> effects of actor fire immediately at time actor is created, but actor does not continue to exist for rest of turn (ie. if made in pre-movement phase, does not still exist or fire effects in post-movement. if made in post-movement, does not exist in next turn's meter accumulation or pre-movement)
  • 1 or more -> limited lifetime -> disappears after # turns (at end of turn, or start... whichever)

Actors with nonzero, noninfinite duration disappear after their duration (in turns) is up.

Description of Effects

(Programmer comment/tweaking encouraged.)

Effects descriptions are parts of Actor descriptions. Each contains data such as the effect type, what phase of the turn processing in which to fire effect, chance to fire on each object in scope, details of what game objects are in scope, a specific target game object, an "affiliation" restriction on scope that works with target, and various other effect-type-specific details.

Some details to include:

  • Turn Phase: Which phase of turn in which to fire effect. See Effects System. Meter Modifying effects ignore this parameter
  • Effect Chance: If an object meets all restrictions on the effect's scope, this is the chance that the effect will "fire" on that object
  • Effect Target: Works with Affiliation to determine which objects effect will "fire" on.
  • Effect Scope: Physical location restrictions on what objects will be "fired" on by effect
    • Galaxy -> All objects... no restriction
    • Empire -> All objects in a system with a planet owned by empire of target object
    • Distance -> All objects within Scope Range parameter distance of target object
    • StarLaneJumps -> All objects within Scope Range parameter starlane jumps of target object. Partial starlane jumps count as a full jump (eg. if target is a ship on a starlane, not at a plant)
    • System -> All objects in system of target object (later: or in fleet travelling with target ship)
    • Personal -> Target Object Only
  • Effect Scope Range: How many "lightyears" or starlane jumps for respective scope restrictions
  • Effect Affiliation: Restricts list of objects effect will fire on based on the empire that owns them.
    • TargetEmpireOnly -> objects owned by empire of target object only
    • TargetAllies -> objects owned by empire of target object, or owned by ally of empire that owns target object (meaningless in v0.3)
    • TargetEnemies -> objects owned by empires that are enemies of the empire that owns the target object
    • All -> object owned by any empire (no restriction)

Effects System

The processing of a game turn proceeds in this order:

  • Start of Turn Processing - all meters set to 0
  • Meter Accumulation Phase - All actors iterated through, any effect that modifies a meter is fired
  • Upkeep Phase - Production/resource creation, pop growth/starvation, creation of new ships, etc.
  • Pre-Movement Effect Phase - All Actors are iterated through. Any effect that is marked for this phase in its definition is fired. Any Actors summoned with duration 0 by an Actor effect fire their effects immediately. Any Actors summomed with duration other than 0 do not fire now (but can fire in post-movement phase)
  • Action Phase - Ship movement, battles, etc.
  • Post-Movement Effect Phase - All Actors are iterated through, any effect that is marked for this phase in its definition is fired. Actors created in the Pre-Movement Effect Phase are included in the iteration. 0 duration actors summoned fire effects immediately. non-0 duration Actors created in this phase do not function this turn, but will function starting in the Meter-Accumulation Phase or Pre-Movement Phase of next turn.
  • End of Turn Processing

Effects for v0.3

For v0.3, effects only function on:

  • Planets - meter modification, changing environment/size/population etc.
  • Empires - locking/unlocking reserach, buildings, ship types, stockpile modification
  • Actors - via the SpawnActor effect

Unless stated otherwise, an effect can be set to work in either the pre-movement or post-movement phase.

Specific Effects:

  • Modify Max Meter - Adds or subtracts from a planet's max meters this turn. Only functions during the meter accumulation phase. Does not affect current meter values.
  • Modify Current Meter - Adds or subtracts from a planet's current meter values. Can function at any time. Does not affect max meter values.
  • Modify Stockpile - Adds or subtracts from one of empire's stockpiles.
  • Modify Planet Build Slots - Adds or removes buildings to/from build slots of planets
  • Modify Planet Size/Environment - Sets the size and environment of a planet
  • Destroy Planet - Destoys Planet (may be lumped with modify planet size/environment by setting size to "none")
  • Modify Planet Population - Adds or subtracts from planet's population.
  • Set Research - Sets a tech a researched or not reserached.
  • Set Building Availability - Sets a building type as buildable or not buildable.
  • Set ShipeType Availability - Sets a ship class as buildable or not buildable.
  • SpawnActor - Creates a new actor, which begins to function as described in Effects System.