Resync research after a new controller session

While the host has no controller session, events between the instance
and the controller are dropped in both directions, and research_sync
only synced technologies on instance start. A technology finished during
the outage stayed unresearched on the controller and on every other
instance until the instance restarted.

On a new session the instance now runs the same technology sync as on
start, before taking the cluster queue. Contributions made while the
controller is unreachable are summed per technology and sent on connect
or resume, since progress from several instances can't be rebuilt from a
state sync that keeps the highest progress. A finish made while the
connection was dropped triggers the sync on resume too.

sync_technologies now runs while the game is running, so it skips
writing progress to a technology that finished after the dump.

Fixes #1123

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-30 00:04:15 +00:00
1 parent fa2883d74e
commit 5589609b1b
4 files changed
+246 -44

No files matched your search

+2 -1
View File
@@ -332,7 +332,8 @@ function research_sync.sync_technologies(data)
end
tech.researched = true
progress = nil
elseif tech_data[progressIndex] then
-- may have finished here since the dump this sync is answering
elseif tech_data[progressIndex] and not tech.researched then
send_contribution(tech)
progress = tech_data[progressIndex]
set_technology_progress(tech, progress)