Files
Battle-for-Tismo/shared/data/technologies.js
T
adrien e7ee5dbf0e Added the resource economy, its works and their icons
- Five resources (energy, steel, food, luxury, high-tech) with per-city stores, a world market, delivery and material upkeep.
- Resource-producing tile works built outside cities; every nation opens with the works its economy needs.
- Real game-icons.net art replacing the dummy icons for the new resources and works, with the credits updated.
2026-09-22 05:27:11 +02:00

165 lines
5.5 KiB
JavaScript

// Research tree. A technology costs research points and may require earlier
// technologies before it can be started.
//
// Research is focused: a nation picks one technology, and every research point
// it creates is applied to it, month on month, until it is discovered. A
// `repeatable` technology may be researched again and again, each level costing
// `repeatCostGrowth` more than the last, and unlike a discovery it raises no
// news event (it only notifies the player).
import {
EFFECT_PRODUCTION,
EFFECT_BUDGET_INCOME,
EFFECT_RESEARCH,
EFFECT_CULTURE,
EFFECT_INFANTRY_ATTACK,
EFFECT_INFANTRY_DEFENSE,
EFFECT_ARTILLERY_ATTACK,
EFFECT_CONSTRUCTION_SPEED,
EFFECT_RAIL_SPEED,
effect,
} from "./effects.js";
// The tabs the technology panel groups research under.
export const TECH_THEMES = [
{ id: "science", name: "Science" },
{ id: "economy", name: "Economy" },
{ id: "society", name: "Society" },
{ id: "military", name: "Military" },
];
export const TECHNOLOGIES = [
{
id: "scientific_method",
name: "Scientific Method",
description: "A disciplined approach to experiment and evidence. Lays the groundwork for every later technology.",
theme: "science",
cost: 20,
prerequisites: [],
effects: [effect(EFFECT_RESEARCH, 1.0, 1.0), effect(EFFECT_PRODUCTION, 0.02, 1.0)],
},
{
id: "industrial_automation",
name: "Industrial Automation",
description: "Robotics and control systems take over the factory floor, lifting national production.",
theme: "economy",
repeatable: true,
cost: 60,
prerequisites: ["scientific_method"],
effects: [effect(EFFECT_PRODUCTION, 0.08, 1.0)],
},
{
id: "renewable_energy",
name: "Renewable Energy",
description: "Clean generation cuts waste and strengthens the public finances.",
theme: "economy",
cost: 80,
prerequisites: ["scientific_method"],
effects: [effect(EFFECT_PRODUCTION, 0.03, 1.0), effect(EFFECT_BUDGET_INCOME, 0.05, 1.0)],
},
{
id: "quantum_computing",
name: "Quantum Computing",
description: "Machines that reason in superposition. A step change in the pace of discovery.",
theme: "science",
cost: 120,
prerequisites: ["scientific_method"],
effects: [effect(EFFECT_RESEARCH, 4.0, 1.0)],
},
{
id: "space_program",
name: "Space Program",
description: "Reaching orbit inspires the nation and spins off technology across the economy.",
theme: "science",
cost: 300,
prerequisites: ["industrial_automation", "quantum_computing"],
effects: [effect(EFFECT_CULTURE, 3.0, 1.0), effect(EFFECT_PRODUCTION, 0.05, 1.0)],
},
{
id: "fusion_power",
name: "Fusion Power",
description: "Controlled fusion. The key to the fusion power plant, and the most expensive research a nation can undertake.",
theme: "science",
// 500,000 research points, a lifetime's work for a mature nation.
cost: 5_000,
prerequisites: ["space_program", "quantum_computing"],
effects: [effect(EFFECT_RESEARCH, 8.0, 1.0)],
},
// Repeatable levels. Each raises a single stat by 1% of its base value.
{
id: "infantry_weapons",
name: "Infantry Weapons",
description: "Better small arms and training raise the damage infantry deal.",
theme: "military",
cost: 40,
repeatable: true,
repeatCostGrowth: 0.02,
prerequisites: ["scientific_method"],
effects: [effect(EFFECT_INFANTRY_ATTACK, 0.01, 1.0)],
},
{
id: "body_armour",
name: "Body Armour",
description: "Personal protection raises infantry base defense.",
theme: "military",
cost: 40,
repeatable: true,
repeatCostGrowth: 0.02,
prerequisites: ["scientific_method"],
effects: [effect(EFFECT_INFANTRY_DEFENSE, 0.01, 1.0)],
},
{
id: "artillery_shells",
name: "Artillery Shells",
description: "Improved propellant and shells raise the damage artillery deal.",
theme: "military",
cost: 50,
repeatable: true,
repeatCostGrowth: 0.02,
prerequisites: ["scientific_method"],
effects: [effect(EFFECT_ARTILLERY_ATTACK, 0.01, 1.0)],
},
{
id: "construction_technology",
name: "Construction Technology",
description: "Better methods and machines speed every building and unit the nation produces.",
theme: "economy",
cost: 50,
repeatable: true,
repeatCostGrowth: 0.02,
prerequisites: ["scientific_method"],
effects: [effect(EFFECT_CONSTRUCTION_SPEED, 0.01, 1.0)],
},
{
id: "trains_technology",
name: "Trains Technology",
description: "Faster locomotives raise movement speed along railways.",
theme: "economy",
cost: 50,
repeatable: true,
repeatCostGrowth: 0.02,
prerequisites: ["scientific_method"],
effects: [effect(EFFECT_RAIL_SPEED, 0.01, 1.0)],
},
];
export function technologyById(id) {
return TECHNOLOGIES.find((t) => t.id === id) || null;
}
// Research is deliberately expensive: the catalogue lists the thematic base
// price, and every effective cost is scaled by this factor. Keeping the scale
// in one place lets the whole tree be retuned without touching each entry.
export const RESEARCH_COST_MULTIPLIER = 100;
// The cost of the next level of a technology given how many times it has been
// researched already. Non-repeatable technologies cost the same either way.
export function technologyCost(proto, repeatCount = 0) {
if (!proto) return 0;
const base = proto.cost * RESEARCH_COST_MULTIPLIER;
if (!proto.repeatable) return base;
const growth = proto.repeatCostGrowth || 0;
return base * Math.pow(1 + growth, Math.max(0, repeatCount));
}