Play the Modern kickoff live: minute steps, substitutions and tactics from the ticker

A rehearsal (session.advance with dryRun) settles questions of the run
before the kickoff; an extension answered there is agreed at the player's
demand of that moment. With an own match the kickoff runs live: one
live.step per beat of the speed control, substitutions and the tactics
board through live.substitute and live.tactics, and leaving the ticker
plays the match to its end. After the final whistle the engine's recording
replaces the frames composed on the way. The paused live read names clubs
in the world's spelling, and the review table shows wins, draws and losses.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-14 00:49:51 +01:00
1 parent 2d66609ca8
commit a5810b15ae
14 files changed
+456 -31

No files matched your search

+32 -5
View File
@@ -10,12 +10,32 @@ void App::engine_start(std::string label, std::function<EngineReply()> job, bool
// the engine's recording of it. Answers to questions of the run travel in the payload.
void App::engine_kickoff() {
if (engine_busy_ || !engine_link_) return;
const auto command = engine_advance_command(engine_data_, editor::new_id("request:ui-"), engine_advance_payload_);
// A rehearsal first: a question of the run (a contract running out) is asked before the
// kickoff, never after a match the manager has watched and steered.
Json rehearsal = engine_advance_payload_, live = engine_advance_payload_;
rehearsal["dryRun"] = true; live["live"] = true;
const auto probe = engine_advance_command(engine_data_, editor::new_id("request:ui-"), rehearsal);
const auto command = engine_advance_command(engine_data_, editor::new_id("request:ui-"), live);
auto link = engine_link_;
engine_start("Der Spieltag läuft …", [link, command] {
auto response = link->command(command);
if (response.value("messageType", "") == "command_result") response["liveRecording"] = link->read_live({{"kind", "fixture"}});
else response["advanceRefused"] = true;
const Json desk = engine_data_;
engine_start("Anstoß …", [link, probe, command, desk] {
auto response = link->command(probe);
if (response.value("messageType", "") != "command_result") {
response["advanceRefused"] = true;
return EngineReply{link, link->snapshot(), response, nullptr};
}
response = link->command(command);
if (response.value("messageType", "") != "command_result") {
response["advanceRefused"] = true;
return EngineReply{link, link->snapshot(), response, nullptr};
}
const auto state = link->read_live({{"kind", "fixture"}});
if (state.value("ok", false) && state.value("live", false)) {
// the kickoff stands after its first minute; the desk snapshot stays the one before it
response["liveState"] = state;
return EngineReply{link, desk, response, nullptr};
}
response["liveRecording"] = state;
return EngineReply{link, link->snapshot(), response, nullptr};
}, true);
}
@@ -67,6 +87,7 @@ void App::engine_accept(EngineReply result) {
engine_dirty_ = false; engine_notice_ = "Spielstand als neue OBS-Datei gespeichert.";
if(engine_exit_after_save_){engine_exit_after_save_=false;closed_=true;}
} else if(engine_response_.value("messageType","")=="created"){engine_dirty_=true;engine_notice_="Neue Partie · Noch nicht gespeichert.";}
else if(engine_response_.value("messageType","")=="live_finished"){engine_dirty_=true;engine_notice_="Abpfiff · Änderungen noch nicht gespeichert.";}
else engine_notice_ = "Spielstand geladen · Weitere Menüs werden schrittweise angebunden.";
if (engine_response_.value("messageType", "") == "command_result") { advertising_selected_ = -1; advertising_offer_ = 0; }
engine_credit_ = engine_data_.value("credit", Json()); engine_credit_edits_ = Json::array();
@@ -96,6 +117,12 @@ void App::engine_accept(EngineReply result) {
if (engine_response_.value("code", "") == "decision_pending" && args.is_object() && args.value("decision", "") == "contract_expiry")
engine_expiry_ask(args);
}
if (engine_response_.contains("liveState")) {
const Json state = engine_response_.at("liveState");
engine_response_.erase("liveState");
engine_advance_payload_ = Json::object();
engine_live_begin(state, engine_response_.value("newRevision", std::string()));
}
if (engine_response_.contains("liveRecording")) {
const Json recording = engine_response_.at("liveRecording");
engine_response_.erase("liveRecording");