sots-engine/src/game/sim/tuning.h

77 lines
3.3 KiB
C++

// Tuning constants the strategic formulas read at runtime.
//
// The game loads these as `KEY value` lines from its data files (StrategyVars.txt,
// globals.txt, ...). The data file is authoritative; the executable only carries fallback
// defaults, several of which differ from the shipped file. Nothing in this module
// hard-codes a shipped value: callers fill a TuningTable (from the parsed data files) and
// pass it in. Field names are the config keys verbatim so a loader can map by name.
//
// All values default to zero so a test can set only the keys a formula reads.
#pragma once
#include <cstdint>
namespace sots::sim {
struct TuningTable {
// ---- trade (StrategyVars) ----
double TRADE_ROUTE_REQ_CIVPOPULATION = 0; // civilians per supported route
double TRADE_ROUTE_REQ_IMPPOPULATION = 0; // imperials per supported route
int TRADE_ROUTE_STARTUP_TURNS = 0; // routes younger than this pay a flat amount
int TRADE_ROUTE_STARTUP_INCOME = 0;
int TRADE_ROUTE_MIN_INCOME = 0;
int TRADE_ROUTE_MAX_FREIGHTERS = 0; // freighter cap per route
int TRADE_ROUTE_INCOME_PERFREIGHTER_CRQ = 0;
int TRADE_ROUTE_INCOME_PERFREIGHTER_CR = 0;
int TRADE_ROUTE_INCOME_PERFREIGHTER_DE = 0;
double TRADE_ROUTE_OWNERS_SHARE = 0; // owner's share of a route's income (0..1)
double STATION_BONUS_TRADE_INCOME = 0; // per trade station at the system
double ADDICTION_TRADE_MOD = 0; // applied when the partner is addicted
// ---- bankruptcy ----
int BANKRUPTCY_ELIMINATION_TURNS = 0;
double BANKRUPTCY_PROTECTION_LIMIT_FACTOR = 0; // debt floor = -factor x max income
// ---- population ----
double POPULATION_GROWTH_MOD = 0;
double POPULATION_GROWTH_EXP = 0;
double INDSYS_IMPERIAL_POPULATION_MOD = 0;
// ---- slaves ----
double SLAVES_DEATH_RATE = 0;
double SLAVES_DEATH_RATE_BYHAZARD = 0;
double SLAVES_DEATH_RATE_BYOUTPUT = 0;
std::int64_t SLAVES_MIN_DEATHS = 0;
std::int64_t SLAVES_MAX_DEATHS = -1; // -1 = no upper clamp
// ---- system bonus (long-held stable colonies) ----
int SYSTEMBONUS_MINTURNS = 0;
double SYSTEMBONUS_POPBONUS = 0;
double SYSTEMBONUS_POPBONUS_HOME = 0;
double SYSTEMBONUS_POPBONUS_INC = 0;
double SYSTEMBONUS_INFRABONUS = 0;
double SYSTEMBONUS_INFRABONUS_HOME = 0;
double SYSTEMBONUS_INFRABONUS_INC = 0;
// ---- output modifiers ----
double STATION_BONUS_IMPERIAL_OUTPUT = 0;
double STATION_BONUS_SHIPCON = 0;
double MORALE_INCREASE_OUTPUT = 0;
double MORALE_INCREASE_OUTPUT_MOD = 0;
double MORALE_DECREASE_OUTPUT = 0;
double MORALE_DECREASE_OUTPUT_MOD = 0;
double ADDICTION_OUTPUT_MOD = 0;
// ---- movement (globals) ----
double STUTTER_SYSTEM_INFLUENCE_RADIUS = 0;
double STUTTER_MIN_SPEED = 0;
double STUTTER_MAX_SPEED = 0;
// ---- gates (read by the tech-effect layer) ----
// Both are integers in the executable: the tech callback does a signed integer max
// against the player's PrGtTrf word, not a float compare (B2, read from the branch).
int PERGATETRAFFIC_DRV_TpGate = 0; // per-gate traffic capacity granted by the gate tech
int PERGATETRAFFIC_DRV_GatAmp = 0; // ... and by the amplifier tech (the higher wins)
};
} // namespace sots::sim