← Devblog

Mission Selection: Script-Driven Windows

Mission selection window

The mission selection and briefing flow has been migrated from C++ to JavaScript. The "select next mission" window is now fully script-driven, and the mission briefing window has been updated to use autoconfig initialization — continuing the pattern established with the Tax Collector and Sound Settings windows.

What Changed

Mission Choice Window

The new game_show_mission_choice(scenario_id) function reads a per-mission config object (e.g. mission6) to determine available choices. If there are no branching choices configured, it falls straight through to __game_load_mission(). If choices are present, it opens the mission_choice_window via the event system:

emit event_show_window{ id:"mission_choice_window" }

A debug console command update_mission_next was also added, making it easy to test the window for any scenario ID without playing through the campaign.

Briefing Window: Autoconfig Init

window_mission_briefing.cpp now uses the standard autoconfig window initialization path, consistent with other recently migrated windows. This removes manual layout setup from C++ and lets the JS config fully control the window structure.

Why This Matters

With mission choice logic in JavaScript, campaign flow between missions becomes moddable. Modders can define branching mission paths — choosing between different next missions based on performance or story choices — entirely in script files, without touching engine code.