feat: add research grant investment engine (#8)
Some checks failed
Accessibility Checks / a11y-audit (pull_request) Successful in 16s
Smoke Test / smoke (pull_request) Failing after 23s

This commit is contained in:
Timmy
2026-04-14 22:17:51 -04:00
parent 729343e503
commit 3dc8fc742b
5 changed files with 796 additions and 3 deletions

View File

@@ -28,7 +28,11 @@ const CONFIG = {
CREATIVITY_RATE_USER_MULT: 0.001,
OPS_OVERFLOW_THRESHOLD: 0.8,
OPS_OVERFLOW_DRAIN_RATE: 2,
OPS_OVERFLOW_CODE_MULT: 10
OPS_OVERFLOW_CODE_MULT: 10,
GRANT_MARKET_REFRESH: 4,
GRANT_AUTOMATION_COST: 18,
GRANT_OFFICE_TRUST_BASE: 12,
GRANT_YOMI_BASE: 3
};
const G = {
@@ -43,6 +47,7 @@ const G = {
trust: 5,
creativity: 0,
harmony: 50,
yomi: 0,
// Totals
totalCode: 0,
@@ -106,6 +111,12 @@ const G = {
pactFlag: 0,
swarmFlag: 0,
swarmRate: 0,
grantFlag: 0,
grantAutoCollect: 0,
grantOfficeLevel: 0,
grantYomiLevel: 0,
grantMarketTimer: 0,
grants: {},
// Game state
running: true,
@@ -119,6 +130,7 @@ const G = {
// Systems
projects: [],
activeProjects: [],
completedProjects: [],
milestones: [],
// Stats
@@ -363,6 +375,57 @@ const BDEF = [
}
];
const GRANT_DEFS = [
{
id: 'grant_nlnet',
name: 'NLNet Commons Fund',
risk: 'low',
basePrice: 5, minPrice: 3, maxPrice: 8, swing: 1, cycle: 14,
reward: { compute: 40, knowledge: 18, trust: 1 },
edu: 'Public-interest microgrants keep digital commons, accessibility work, and maintenance alive.'
},
{
id: 'grant_gitcoin',
name: 'Gitcoin Matching Round',
risk: 'low',
basePrice: 6, minPrice: 4, maxPrice: 10, swing: 1, cycle: 16,
reward: { knowledge: 26, ops: 18, trust: 2 },
edu: 'Quadratic funding rewards many small supporters, not just one whale.'
},
{
id: 'grant_prototype',
name: 'Prototype Fund Residency',
risk: 'med',
basePrice: 8, minPrice: 5, maxPrice: 13, swing: 2, cycle: 18,
reward: { compute: 52, knowledge: 28, ops: 10 },
edu: 'Residencies fund ambitious prototypes that are too early for normal venture math.'
},
{
id: 'grant_fellowship',
name: 'Research Fellowship',
risk: 'med',
basePrice: 9, minPrice: 6, maxPrice: 14, swing: 2, cycle: 20,
reward: { knowledge: 34, trust: 4, ops: 12 },
edu: 'Fellowships buy focused thinking time so research can compound before it monetizes.'
},
{
id: 'grant_compute_pool',
name: 'Sovereign Compute Pool',
risk: 'high',
basePrice: 11, minPrice: 7, maxPrice: 17, swing: 3, cycle: 22,
reward: { compute: 84, knowledge: 30, ops: 14 },
edu: 'Shared compute pools behave like co-ops: more volatile, but they can underwrite serious local inference.'
},
{
id: 'grant_crisis_dao',
name: 'Crisis Response DAO',
risk: 'high',
basePrice: 12, minPrice: 8, maxPrice: 18, swing: 3, cycle: 24,
reward: { trust: 6, knowledge: 24, ops: 18 },
edu: 'Mission-aligned DAOs can move faster than institutions, but their budgets and governance swing harder.'
}
];
// === PROJECT DEFINITIONS (following Paperclips' pattern exactly) ===
// Each project: id, name, desc, trigger(), resource cost, effect(), phase, edu
const PDEFS = [
@@ -421,6 +484,20 @@ const PDEFS = [
log('Creativity unlocked. Generates while operations are at max capacity.');
}
},
{
id: 'p_research_grants',
name: 'Investment Engine — Research Grants',
desc: 'Build a sovereign grant desk with live pricing, risk tiers, and passive funding cycles.',
cost: { knowledge: 1500, trust: 8 },
trigger: () => G.deployFlag === 1 && G.totalKnowledge >= 1500 && G.trust >= 8 && G.grantFlag !== 1,
effect: () => {
G.grantFlag = 1;
G.grantMarketTimer = 0;
ensureGrantState();
log('Research grants unlocked. Funding now moves even when the build queue is quiet.', true);
},
milestone: true
},
// === CREATIVE ENGINEERING PROJECTS (creativity as currency) ===
{