Performance Optimizer

If you liked this item, please rate it up on Steam Workshop page.

Author: 化风为刃

Last revision: 8 Jul at 17:35 UTC

File size: 841.91 KB

On Steam Workshop

Description:

This is my personal-use mod.
The changes are as follows:

# Performance Optimizer

A Victoria 3 performance mod that improves late-game (1870s+) framerate and responsiveness by tweaking engine defines and optimizing GUI rendering.

## 1. Defines Tuning

### NCountry — Journal Entries

| Key | Value | Vanilla (approx.) | Description |
|—|—|—|—|
| `JOURNAL_ENTRY_UPDATE_ACTIVE` | **14** | ≈7 | Update interval (days) for active journal entries; reduces check frequency |
| `JOURNAL_ENTRY_UPDATE_INACTIVE` | **30** | ≈15 | Update interval (days) for inactive journal entries |

### NEconomy — Economy

| Key | Value | Vanilla (approx.) | Description |
|—|—|—|—|
| `NON_TRADE_CENTER_STATE_TRADE_POTENTIAL_UPDATE_FREQUENCY` | **90** | ≈30 | Trade potential update frequency (days) for non-trade-center states |
| `AUTO_DOWNSIZE_BUILDING_MIN_EMPTY_FRACTION` | **0.05** | ≈0.0 | Minimum empty fraction before auto-downsizing triggers |
| `AUTO_DOWNSIZE_BUILDING_MONTHS_TO_WAIT` | **3** | ≈1 | Months to wait before downsizing, adds buffer |

### NMilitary — Military

| Key | Value | Vanilla (approx.) | Description |
|—|—|—|—|
| `CONVOY_RAIDING_COOLDOWN_DAYS_MIN` | **20** | ≈10 | Minimum cooldown (days) for convoy raiding |
| `CONVOY_RAIDING_COOLDOWN_DAYS_MAX` | **60** | ≈30 | Maximum cooldown (days) for convoy raiding |
| `DAYS_BETWEEN_WAR_EXHAUSTION` | **14** | ≈7 | War exhaustion calculation interval; halves compute frequency |

### NDiplomacy — Diplomacy

| Key | Value | Vanilla (approx.) | Description |
|—|—|—|—|
| `DIPLOMATIC_PLAY_ESCALATION_DAILY` | **2** | ≈0.5~1 | Daily escalation points for diplomatic plays; speeds up the process |

### NPops — Population (Core Optimization)

| Key | Value | Vanilla (approx.) | Description |
|—|—|—|—|
| `POP_MERGE_MAX_WORKFORCE_MODERATE_CONSOLIDATION` | **100** | ≈50 | Max workforce for moderate consolidation; reduces merge triggers |
| `POP_MERGE_MIN_NUM_POPS_SAME_PROFESSION_MODERATE_CONSOLIDATION` | **3** | ≈2 | Min pop count of same profession to trigger moderate merge |
| `POP_MERGE_MAX_WORKFORCE_AGGRESSIVE_CONSOLIDATION` | **200** | ≈100 | Max workforce for aggressive consolidation |
| `POP_MERGE_MAX_WORKFORCE_MAX_CONSOLIDATION` | **500** | ≈200 | Max workforce for final consolidation |
| `POP_MERGE_START_POPS` | **20000** | ≈10000 | Population threshold to start merging pops |
| `POP_MERGE_MAX_TARGET_POPS` | **30000** | ≈15000 | Target max population after merge |
| `QUALIFICATIONS_UPDATE_FACTOR` | **0.0001** | ≈0.001 | Qualification update factor; reduced to 1/10 of vanilla |
| `MAX_DEMAND_ADJUSTMENT_BASE_AMOUNT` | **0.02** | ≈0.05 | Base max demand adjustment; reduces fluctuation |
| `MAX_DEMAND_ADJUSTMENT_SCALED_AMOUNT` | **0.15** | ≈0.25 | Scaled max demand adjustment |
| `CULTURAL_COMMUNITY_MAX_PER_MONTH_CHANCE` | **0.01** | ≈0.05 | Max monthly chance for cultural community to form; reduced to 1/5 |
| `MIGRATION_MAX_PER_STATE_BASE` | **300** | ≈500 | Max base migration per state per month |
| `MARKET_MIGRATION_PER_WEEK_FACTOR` | **10** | ≈5 | Weekly market migration factor; speeds up migration completion |
| `BUCKET_MIGRATION_THRESHOLD` | **2000** | ≈1000 | Bucket migration threshold; reduces calculation frequency |
| `MASS_MIGRATION_MIN_EMIGRANTS` | **200000** | ≈100000 | Min emigrants to trigger mass migration; reduces large migration events |

### NAI — AI Behavior (Construction Logic Optimization)

#### Randomness Control
| Key | Value | Description |
|—|—|—|
| `PRODUCTION_BUILDING_RANDOM_FACTOR` | **2.0** | Random factor for AI building selection |
| `PRODUCTION_BUILDING_STATE_RANDOM_FACTOR` | **0.15** | Random factor for AI state selection |

#### Infrastructure Constraints
| Key | Value | Description |
|—|—|—|
| `PRODUCTION_BUILDING_INCORPORATED_INFRASTRUCTURE_USAGE_FACTOR` | **0.25** | Infrastructure usage factor in incorporated states |
| `PRODUCTION_BUILDING_UNINCORPORATED_INFRASTRUCTURE_USAGE_FACTOR` | **2.0** | Infrastructure usage factor in unincorporated states |
| `PRODUCTION_BUILDING_DESIRED_INFRASTRUCTURE_SURPLUS` | **5** | Desired infrastructure surplus for AI |
| `PRODUCTION_BUILDING_FREE_INFRASTRUCTURE_TARGET_WHEN_LACKING_WORKFORCE` | **10** | Free infrastructure target when lacking workforce |
| `PRODUCTION_BUILDING_EXCESSIVE_INFRASTRUCTURE_SURPLUS` | **20** | Excessive infrastructure surplus threshold |

#### Profit Orientation
| Key | Value | Description |
|—|—|—|
| `PRODUCTION_BUILDING_GOODS_PROFIT_FACTOR` | **8000** | Goods profit weight; AI prioritizes profit more |
| `PRODUCTION_BUILDING_GOODS_DEFICIT_FACTOR` | **15000** | Goods deficit weight; AI more aggressively fills shortages |
| `PRODUCTION_BUILDING_REDUCE_SHORTAGE_MULT` | **8** | Shortage reduction multiplier |
| `PRODUCTION_BUILDING_LOW_EMPLOYMENT_THRESHOLD` | **0.9** | Low employment threshold (below 90%) |

#### Autonomous Investment Optimization
| Key | Value | Description |
|—|—|—|
| `PRODUCTION_BUILDING_AUTONOMOUS_INVESTMENT_RANDOM_FACTOR_MULT` | **0.5** | Autonomous investment random factor multiplier |
| `PRODUCTION_BUILDING_AUTONOMOUS_INVESTMENT_STATE_RANDOM_FACTOR_MULT` | **0.5** | Autonomous investment state random factor multiplier |
| `PRODUCTION_BUILDING_AUTONOMOUS_INVESTMENT_BELOW_DESIRED_INFRASTRUCTURE_FACTOR_MULT` | **1.0** | Investment factor when infrastructure is insufficient |
| `PRODUCTION_BUILDING_AUTONOMOUS_INVESTMENT_PROFIT_FACTOR_MULT` | **3.0** | Autonomous investment profit factor multiplier |
| `PRODUCTION_BUILDING_AUTONOMOUS_INVESTMENT_PROFIT_PRIVATIZE_FACTOR_MULT` | **2.0** | Privatization profit factor multiplier |
| `OWNER_BUILDING_LOCATION_NO_AVAILABLE_INFRASTRUCTURE_MULT` | **0.01** | Building location multiplier when no infrastructure available (very low) |
| `PRODUCTION_BUILDING_AUTONOMOUS_INVESTMENT_INDUSTRIAL_GOODS_FACTOR_MULT` | **3.0** | Industrial goods investment factor multiplier |

#### Subsidy Strategy
| Key | Value | Description |
|—|—|—|
| `SUBSIDIZE_SHARE_OF_INFRA_FACTOR` | **6000** | Infrastructure subsidy share factor |
| `SUBSIDIZE_SHARE_OF_SUPPLY_FACTOR` | **3000** | Supply subsidy share factor |

#### Infrastructure Construction Priority
| Key | Value | Description |
|—|—|—|
| `MONEY_SPENDING_INFRASTRUCTURE_CRITICAL_THRESHOLD` | **0.90** | Critical infrastructure threshold (AI builds infra at 90% usage) |
| `MONEY_SPENDING_INFRASTRUCTURE_DESIRED_THRESHOLD` | **1.15** | Desired infrastructure threshold (prioritize infra at 115% usage) |

## 2. On_Action Optimization

### Exile Pool Culling (`exile_pool_culling_on_action`)

– **Vanilla**: runs every month on the entire exile pool
– **Optimized**: runs once every 3 months (January/April/July/October), with an additional trigger — only executes when the exile pool exceeds its max size + 10
– **Effect**: reduces exile pool culling calculations by ~**75%**

## 3. GUI Optimizations

The following GUI files have been tweaked to reduce layout re-computation and improve UI responsiveness:

| File | Description |
|—|—|
| `building_browser_panel.gui` | Building browser panel |
| `country_politics_panel.gui` | Country politics panel |
| `information_panel_bar.gui` | Information bar |
| `journal_entry.gui` | Journal entry UI |
| `map_list_panel.gui` | Map list panel |
| `map_markers.gui` | Map markers |
| `outliner_framework.gui` | Outliner framework |
| `politics_panel_types.gui` | Politics panel types |
| `pop_browser_panel.gui` | Pop browser panel |
| `pops_overview.gui` | Pops overview |
| `timemanip.gui` | Time manipulation UI |
| `topbar.gui` | Top bar |