No description
  • Python 98.8%
  • Shell 1.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-24 08:42:24 +02:00
.vscode Added rsync on save 2026-01-26 08:45:50 +01:00
ai-worker Reconsolidated docs + cleanup 2026-05-25 18:09:55 +02:00
docs Update 2026-06-29 16:39:51 +02:00
Mods Prep for 1.0 2026-07-24 08:11:18 +02:00
scripts Proper gating for many weapons 2026-07-16 13:55:40 +02:00
.gitignore Update 2026-06-29 16:39:51 +02:00
AGENTS.md Proper gating for many weapons 2026-07-16 13:55:40 +02:00
config.py Update 2026-06-29 16:39:51 +02:00
dashboard_state.json Loc checks 2026-07-07 08:21:45 +02:00
extraction.py Rename file 2026-07-24 08:42:07 +02:00
longwar.png Rename file 2026-07-24 08:42:07 +02:00
MOD_SUMMARY.md Doc fix 2026-07-24 08:38:34 +02:00
project_effects.txt Major cleanup 2026-06-25 10:20:23 +02:00
README.md Proper gating for many weapons 2026-07-16 13:55:40 +02:00
requirements.txt Minor tech fixes 2026-07-15 08:09:43 +02:00
runme.sh Bumped 2026-05-24 21:52:22 +02:00
show-data.py Loc checks 2026-07-07 08:21:45 +02:00
sync_mods.sh Prep for 1.0 2026-07-24 08:11:18 +02:00
terra-invicta.code-workspace Prep for 1.0 2026-07-24 08:11:18 +02:00
update_effects.txt Update 2026-05-27 21:18:12 +02:00

Terra Invicta Tools

Extract, visualize, and mod Terra Invicta savegame data.

Important

Uses an rsync action inside The Workspace File to sync files to the game's Mods directory.

Core Scripts

  • extraction.py - Parse savegames into structured CSV/JSON datasets
  • show-data.py - Streamlit app with interactive charts and filters
  • config.py - Centralized workspace paths and data file constants
  • scripts/cleanup_saves.py - Archive/tidy save games (keeps newest N per type)

Script Organization

File Summary
Root
extraction.py Parse savegames into structured CSV/JSON datasets
show-data.py Streamlit app with interactive charts and filters
config.py Centralized workspace paths and data file constants
scripts/cleanup_saves.py
scripts/cleanup_saves.py Archive and tidy save games (keeps newest N per type)
scripts/ai/ — AI project generation
scripts/ai/worker.py Call local Ollama model to generate staged project candidates
scripts/ai/swarm.py Swarm orchestrator for multiple Ollama models
scripts/ai/runner.py Core run_cycle orchestration logic
scripts/ai/helpers.py JSON extraction, model calls, staging, validation utilities
scripts/ai/prompts.py Prompt building helpers
scripts/ai/selection.py Template/effect selection logic
scripts/ai/mining_leveler.py Mining bonus level suffix mapping
scripts/mods/ — Mod validation and utilities
scripts/mods/validate.py Read-only validator for all mod JSON files (includes loc orphan check)
scripts/mods/loc_audit.py Find orphan/missing/partial localization entries + placeholder validation. Supports --delete.
scripts/mods/check_localization.py Validate mod entries against localization file
scripts/mods/check_weapons.py Score weapons by capability, flag prereq-cost outliers
scripts/mods/check_armor.py Score armor by capability, flag prereq-cost outliers
scripts/mods/check_drives.py Score drives by capability, flag prereq-cost outliers
scripts/mods/generate_weapon.py Generate weapon templates from damage/DPS parameters
scripts/mods/scan_effects.py Count effect occurrences in project templates
scripts/mods/update_descriptions.py Update project summaries via local Ollama model
scripts/mods/fix_unlock_chance.py Fix max unlock chance values
scripts/mods/prereq_cost.py Calculate total prereq cost for projects and suggest chains
scripts/tools/
scripts/tools/mining_bonus.sh Get full mining bonus data
scripts/tools/project_list.sh Generate project list for AI worker
scripts/tools/generate_outline.py Generate project outline documentation
scripts/one_off/ — Analysis
scripts/one_off/analyze_all_effects.py All effects across every project, grouped by context, with value conversion
scripts/one_off/analyze_effects.py Tracked priority effects only (from project_effects.txt)
scripts/one_off/analyze_weapon_balance.py Correlate weapon DPS with research cost, mount slots, PD vulnerability
scripts/one_off/analyze_heatsink_balance.py Compare heatsink capacity/mass ratio against base game
scripts/one_off/analyze_radiator_balance.py Compare radiator power, temp, vulnerability against base game
scripts/one_off/analyze_powerplant_balance.py Compare power plant output, efficiency, density against base game
scripts/one_off/ — Balancing (modify mod files)
scripts/one_off/balance_effects.py Bump effect tiers below 400% into target range, adjust cost
scripts/one_off/balance_prereqs.py Redistribute prerequisites for even game-progression spread
scripts/one_off/update_research_costs.py Reduce cost for effect-matched projects, clamp outliers
scripts/one_off/ — Content generation
scripts/one_off/generate_content.py AI-driven mod content: easy/middle/full tiers, --dry-run then --apply
scripts/one_off/consolidate_mc_hl.py Consolidate MC mining and human lifespan projects
scripts/one_off/consolidate_military.py Consolidate MilitaryPriority projects
scripts/one_off/generate_funding_effects.py Generate SpaceDevPriority effects and ~40 projects
scripts/one_off/reduce_effects.py Reduce overabundant effects (Pherocyte, HabResearch, MarketSales)
scripts/one_off/validate_exotic_prereqs.py Verify exotic-material items have Exotics in prereq chain

Getting Started

Install dependencies

python3 -m pip install -r requirements.txt

Run all scripts

./runme.sh start|stop|restart|status

Run individually

python3 extraction.py
streamlit run show-data.py

AI Project Generation

Run the AI worker with your preferred model:

python3 scripts/ai/worker.py --once --print-output --generate-localization --model gemma3:12b --temperature 0.15 --loc-attempts 6 --auto-apply --count 1

Temperature Guide

Temperature Outcome
0.0 Deterministic, low creativity
0.1 - 0.3 Conservative, safe variation
0.4 - 0.7 Moderate creativity
~1.0+ High randomness, unpredictable

Generally 12B+ parameter models produce usable results. Find local models with ollama list.

See ai-worker/prompts.md for prompt instructions and ai-worker/llm-config.yml for LLM settings.

Adding Nations for Data Capture

Automatic

Set in extraction.py:

AUTO_PERSIST_MY_NATIONS = True
ALWAYS_OVERWRITE_MY_NATIONS = True

Manual

Set above to False, then add nation names in config.yml:

my_nations:
  - United Kingdom
  - Germany
  - Mauritius

Helpful Commands

cat /home/martin/Games/TerraInvicta/templates/TITechTemplate.json | yq -r '.[] | .techCategory + "|" + .dataName + " - " + (.researchCost|tostring)' | grep -i "spaceScience" | sort -n -k 3