// 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_RESEARCH, EFFECT_CULTURE, EFFECT_INFANTRY_ATTACK, EFFECT_INFANTRY_DEFENSE, EFFECT_ARTILLERY_ATTACK, EFFECT_CONSTRUCTION_SPEED, EFFECT_RAIL_SPEED, EFFECT_ENERGY_EFFICIENCY, EFFECT_STEEL_EFFICIENCY, EFFECT_FOOD_EFFICIENCY, EFFECT_LUXURY_EFFICIENCY, EFFECT_HIGHTECH_EFFICIENCY, 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 lifts national production.", theme: "economy", cost: 80, prerequisites: ["scientific_method"], effects: [effect(EFFECT_PRODUCTION, 0.03, 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)], }, // Efficiency research: one repeatable technology per commodity that raises the // output the nation gets from each unit of energy. Each level adds 5% to that // commodity's output per input, so the power drawn to make it falls. { id: "efficient_generation", name: "Efficient Generation", description: "Better turbines and heat recovery wring more electricity from every tonne of fuel.", theme: "economy", cost: 50, repeatable: true, repeatCostGrowth: 0.03, prerequisites: ["renewable_energy"], effects: [effect(EFFECT_ENERGY_EFFICIENCY, 0.05, 1.0)], }, { id: "advanced_metallurgy", name: "Advanced Metallurgy", description: "Continuous casting and heat recycling smelt more steel for less power.", theme: "economy", cost: 50, repeatable: true, repeatCostGrowth: 0.03, prerequisites: ["industrial_automation"], effects: [effect(EFFECT_STEEL_EFFICIENCY, 0.05, 1.0)], }, { id: "precision_agriculture", name: "Precision Agriculture", description: "Climate-controlled growing and tailored feed raise the food won from each unit of power, on the land and in synthesis.", theme: "economy", cost: 50, repeatable: true, repeatCostGrowth: 0.03, prerequisites: ["scientific_method"], effects: [effect(EFFECT_FOOD_EFFICIENCY, 0.05, 1.0)], }, { id: "automated_extraction", name: "Automated Extraction", description: "Automated mines and sorting win more gold and diamonds for the same power.", theme: "economy", cost: 50, repeatable: true, repeatCostGrowth: 0.03, prerequisites: ["industrial_automation"], effects: [effect(EFFECT_LUXURY_EFFICIENCY, 0.05, 1.0)], }, { id: "advanced_lithography", name: "Advanced Lithography", description: "Finer process nodes pack more chips onto every wafer, cutting the power each component costs.", theme: "science", cost: 80, repeatable: true, repeatCostGrowth: 0.03, prerequisites: ["quantum_computing"], effects: [effect(EFFECT_HIGHTECH_EFFICIENCY, 0.05, 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)); }