Skip to content

Port Benchmark & Optimizer to Timberborn 1.1 with isolated CSV and intervals - #46

Closed
tharbad08 wants to merge 936 commits into
datvm:masterfrom
tharbad08:pr/benchmark-optimizer-v11-port
Closed

tharbad08 wants to merge 936 commits into
datvm:masterfrom
tharbad08:pr/benchmark-optimizer-v11-port

Conversation

@tharbad08

Copy link
Copy Markdown

Port Benchmark & Optimizer to Timberborn 1.1 — CSV Profiling & Safe Tick Controls

Overview

This PR introduces a Timberborn v1.1-compatible port of Benchmark & Optimizer, preserving the original mod's purpose: identifying performance bottlenecks and allowing players to adjust update frequencies for individual game systems.

The port is implemented in a separate BenchmarkAndOptimizerV11Port/ directory, leaving the original mod untouched for users running older game versions.

The implementation incorporates fixes and safety protections discovered through extensive profiling and testing with a heavily modded Timberborn 1.1 colony.

Features

1. Performance Benchmarking & CSV Export

  • On-demand 120-second benchmark initiated through Mod Settings.
  • Per-system performance measurements, including:
    • System name and originating mod.
    • Total execution time.
    • Invocation count.
    • Average, minimum, and maximum execution time.
  • Additional frame-performance CSV containing FPS, frame time, managed heap usage, and GC collection counts.
  • Optional, read-only timing breakdown for TimberPhysics (StepAll and Physics.Simulate).
  • Benchmarking temporarily suspends configured throttling to avoid distorting measurements, restoring the configured intervals afterward.

2. Per-System Update Frequency Controls

  • Individual update intervals for detected systems.
  • Default interval of 1 (vanilla behavior).
  • Live configuration through Mod Settings.
  • Support for inherited tick/update methods while maintaining independent configuration for concrete system types.
  • Persistent interval configuration in optimizer-v11.json.

Simulation safety: Critical systems are permanently protected from throttling, including global tick dispatchers, physics, navigation, planting, soil contamination, automation, and work scheduling.

These protections address issues encountered during development where throttling shared dispatchers or simulation-critical services caused unexpected gameplay behavior.

3. Improved Settings UI

  • Systems grouped into well-known and other detected systems.
  • Displays system names and originating mods.
  • Search/filter by system name or mod origin.
  • Protected systems clearly identified.
  • Improved handling of long system names and inherited-method ownership.

Crash fix: Filtering now changes the visibility of existing UI elements rather than rebuilding the UI tree during text input. This avoids a previously encountered crash when filtering the settings window.

4. System Discovery

The mod discovers eligible systems from loaded assemblies during initialization. Additional systems may be discovered when they execute during a benchmark.

Current limitation: Neither initial scanning nor benchmarking guarantees a complete list. Systems loaded later, or whose code is never exercised, may remain undiscovered.

The existing Refresh detected systems control refreshes the displayed list; it does not perform a separate discovery scan.

Scope & Compatibility

This is an independent v1.1 port, not a replacement for the original mod.

The PR intentionally excludes unrelated gameplay optimizations developed during performance investigations, including changes to EBR, BFR, Keystone, SuperCursor, preview processing, terrain colliders, and garbage collection behavior.

It also excludes experimental save/load modifications and startup assembly patches.

The intention is to keep benchmarking, profiling, and configurable update intervals together while maintaining a clean separation from unrelated performance fixes.

Validation

  • Source isolated from unrelated optimizations and experiments.
  • Dedicated Timberborn 1.1 project and manifest.
  • GitHub Actions build completed successfully.
  • Filter crash fix retained in the source.
  • Critical tick-system protections included.
  • Full in-game validation of the isolated build.
  • Verify CSV output and benchmark completion during gameplay.
  • Verify interval restoration and system discovery across save/load.

The PR is submitted as a draft pending in-game validation.

Possible Future Improvements

These are documented ideas, not implemented in this PR:

  1. Standalone system discovery: Add a Detect Systems button to find eligible systems without performing a full benchmark.
  2. Automatic discovery: Consider rescanning after a saved game finishes loading, or when the Mod Settings window opens.
  3. Editable system catalog: Export all detected systems, their origins, protected status, and intervals to JSON for manual editing and safe reloading.
  4. Incremental discovery: Allow the system list to grow when new mods or systems become active, without requiring repeated expensive scans.

Even with these improvements, complete discovery cannot be guaranteed for systems that have not been loaded or activated.


Upstream compatibility: The original BenchmarkAndOptimizer/ directory remains unchanged.

Source: BenchmarkAndOptimizerV11Port/

The goal is to make the original Benchmark & Optimizer useful again on Timberborn 1.1, while retaining its flexibility and incorporating the safety lessons learned from real-world modded gameplay.

datvm and others added 30 commits March 7, 2026 06:29
When using hotkeys, the UI should show which tool group is active,
including nested parent groups, for better visual feedback.

Added Button property to ButtonToolHotkeyDefinition. Modified
ToolHotkeyListener to find containing groups, walk parent chains using
ModdableToolGroupButtonService, and select all groups from root to leaf.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Select associated tool groups when using tool hotkey
translate to rus
Adds new lines with information about water and food consumption.
@tharbad08
tharbad08 force-pushed the pr/benchmark-optimizer-v11-port branch from 300630c to cbb4d58 Compare October 13, 2026 03:37
@datvm datvm closed this Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants