aboutsummaryrefslogtreecommitdiff
path: root/docs/appendices/script-vm.md
Commit message (Collapse)AuthorAgeFilesLines
* fix(combat): charge the drive before refilling weaponsValentin Popov5 days1-1/+9
| | | | Read the resource multiplier from CTL when all authored states agree and price the latest local motion in the existing Control budget. A licensed AutoDemo flyer charges its weapons more slowly when the drive is drawing from the same supply. Control.dll oracle vectors, the AutoDemo window, and all 29 mission startup sweeps pass.
* fix(behavior): finish attacks against depleted targetsValentin Popov10 days1-0/+22
| | | | | | | | | | | | | | | | | | | | | | | Static buildings remain in the world after Control marks their depletion. Attack used to wait for removal and kept selecting the exhausted building. Share the native missing/depleted/zero-position completion condition between the order queue and firing selection. Remove a finished final Attack even when no successor was queued, while keeping handle generations distinct. Validation: unchanged x86 Behavior/Control DLL functions for target state and the early Attack tick; queue tests; licensed stock raid regression, which first exposed reacquisition after depletion and now reaches ShutDown without further shots. Workspace fmt/check/tests, release build, and all 29 stock 900-second reports pass. Windowed mission 19 completed Attack, two retreat Go orders and ShutDown with the hero at the stock start. Four incidental interior shots during window activation returned no damage result; the bunker still had its full root amount before the raid. Native oracle lookup, state proxy and position resolver are host fixtures; this does not establish full original mission chronology or movement parity. Windowed retreat is slower than the report run: the temporary motion controller and waypoint time loss remain G8 work. Aiming and destruction FX are unchanged and still approximate.
* fix(control): apply static root and critical-node depletionValentin Popov10 days1-3/+22
| | | | | | | | | | | | | | | | | | | | Native Control+0x10f30 marks root/critical depletion with +0x550=0xfffe. Class 3 then returns without death notifications, deletion timers or a root cascade. Preserve that predicate through repair, and permit the native already-marked path while retaining explicit errors for unsupported deaths. Move the shared amount update out of the large runtime module. Validation: native x86 DLL oracle at x87 CW 0x007f for root/critical depletion, repair and an already-marked mobile owner; Rust rule tests; licensed stock mission-19 raid; workspace fmt/check/tests and release build. All 29 stock 900-second reports pass with unchanged world/outcome summaries and no combat damage_error entries. The windowed stock raid depleted bunker node 0 at 329083 ms, with the hero left at the stock start throughout. Scope is Control amount/marker publication. Static structures stay in the world. Stage propagation, ruins, effects and finishing an attack against an exhausted static target remain open; projectile damage is still approximate. The affected mission-19 target is a bunker, not a factory.
* feat(combat): feed weapon charge from Control energy budgetsValentin Popov10 days1-2/+36
| | | | | | | | | | | | | | | | | | | | | | | | | Keep factory-2/30 charge in the owner's Control table. AI and player banks read it before firing, debit completed shots and wait for regeneration. Preserve one charge across bank changes and accumulate energy waits by object, including an idle bank publishing after an active bank. Mobile owners now run the resource budget. Restore the shared factory-1 callbacks, factory-2/30 charging and factory-10 passive upkeep. Factory 30 uses the weapon constructor's native disabled default. Motion demand is still an explicit zero-rate stub; unsupported budgets disable charge limiting for that owner and record the reason. Execute unmodified GOG Control.dll callbacks at RVA 0x29a40/0x29a90, 0x264b0/0x26510 and 0x21860/0x21890; check the common constructor at 0x294c0. Rust golden vectors cover disabled refill, zero capacity, negative charge and x87 rounding at control word 0x007f. SHA-256: bcb86318089028548a178b03a21accdce15df0cc85ddd91674cf3c2f55012c6e. Validated fmt, workspace check/tests, release, licensed shared-bank charge exhaustion/recovery, stock combat and damaged-profile regressions. All 29 stock missions reached 900 seconds; the only mobile-budget stub was the known motion input. Observed stock window combat and replenishment. Full live native mission comparison and motion energy remain open.
* fix(research): advance laboratory Control energy budgetsValentin Popov10 days1-3/+3
| | | | | | | | | | | | | | | | | | | | Paid laboratory work read a work-device coefficient that never received a Control budget update. Run the recovered resource clock and budget for laboratories as well as factories, so energy work follows the actual device allocation. Generalize the state and report counters to control_resource_*. A licensed outage regression drains the lab reserve and removes external power: energy work stays fixed while task time advances, then resumes when the original generation is restored. Stock research for both AI clans, player free research and paid factory production still pass. The original laboratory task reaches its class-3 Control owner, whose native budget runs on the same quarter-second resource path as the factory. Verified this in the running stock mission through Behavior 0x2f76e and Control 0x2d340. Workspace fmt/check/tests and release build pass. All 29 stock missions run 900 seconds without script or resource-budget stops. A stock mission-28 window completes paid technologies and starts subsequent projects. Control initial phase, RNG seed, other owners and global ordering remain approximate.
* fix(production): use Control energy budgets for factory workValentin Popov10 days1-0/+8
| | | | | | | | | | | | | | | | | | | | Factories now run the recovered Control resource-budget pass on its own randomized clock before Behavior task updates. Paid production reads its current work-device E00 value, including the local power reserve and allocation, instead of gating full speed on any clan generation. The clock redraws jitter on every accepted frame and uses a separate Control RNG. Initial phase, seed and ordering with other owners remain explicit approximations. Budget failures preserve the table and are counted per owner. Original DLL calls verify the budget callbacks, strict deadline, per-call RNG, forced update and inactive baseline. A live class-3 factory executes the same budget with the default 250 ms setting. Licensed regressions cover an empty factory power reserve, subsequent generator capture, four completed paid orders, the Behavior task deadline and scripted warbot/transport/builder births. Workspace fmt/check/tests and release build pass. All 29 stock missions run 900 seconds without script or new budget stops. Stock mission 28 accepts and completes a free and then a paid player order in the Vulkan-validation window.
* fix(ai): expose the native research catalog scan statusValentin Popov10 days1-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Handler(56) returned a constant zero and was described as an automatic research permission flag. It actually normalizes the cached candidate scan byte. Read ResearchCandidateSet.status without refreshing the catalog and report queries by clan and result instead of counting them as stubs. GOG ai.dll SHA-256 c19cd6cd31cd2896f8c4ba0f0e700dd3408aec8182daaf4863d98a7d233a2abc: Handler(56), RVA 0xe430, reads AI+0x431. Native calls to this getter and the chooser at 0x10f90 confirm that finishing the last candidate preserves the old scan flag until the next refresh. Empty/processed sets, missing pending candidates, stale flags, and noncanonical nonzero bytes were exercised. A live stock Single.01 query also returned zero from the same cached byte. The shipped scream.scr condition suppresses the laboratory request for a nonzero result. An ignored resource test executes that original condition and request for cached bytes 0, 1 and 255; an ordinary Rust test covers the cached-state semantics and missing catalog. This isolated branch check does not establish that an entire mission has exhausted all research naturally. Validated fmt, workspace check/tests, the licensed scenario-branch test and the release build. All 29 stock missions pass --sim-report 900 without new script stops; stock mission 28 also runs in the window with ongoing research and the native zero result. None of these stock runs reached a nonzero scan flag. Handler(58) upgrades and Handler(65) candidate power remain explicit stubs, and full timed AI/mission parity remains open.
* fix(ai): age script deadlines while the world is pausedValentin Popov10 days1-0/+6
| | | | | | | | | | | | | | | | Record paused wall time separately from simulation time. After resuming, Mission and clan AI check their expired deadlines once, then schedule the next interval without replaying missed cycles. Move application pause handling into its own module and retain frozen world, animation and audio. Live ai.dll timer calls confirm that Mission runs before the paused world clock refreshes and the next AI callback uses an already expired deadline. Record the unresolved AutoDemo sphere and first-projectile boundaries. Validation: workspace fmt/check/tests, release build, licensed stock-clock pause test, all 29 missions at --sim-report 900 without script stops, and a stock mission-28 window with a 33-second pause and unchanged world time. Full AI chronology and minimized-window timing remain open.
* fix(ai): start player and clan cycles on the first updateValentin Popov10 days1-1/+2
| | | | | | | | | | | | | | | | Fresh AI contexts enter their first cycle immediately, including the player context with an empty Problems0. Share their logical clock with Mission timeouts and registration notifications. The stock original confirms the first Mission callback sees zero before the first AI cycle. Run the player Problems0 path and support TAKE_ALL_BATTLE_UNITS: preserve reserved and same-kind assignments, take warbots from other combat tasks. Native ai.dll calls verify recruitment and the initial shared RNG draws. Validation: workspace fmt/check/tests, release build, licensed stock-clock test, all 29 stock missions at --sim-report 900 without script stops, and stock mission windows 28 and 20. Full AI chronology, native occupancy and remaining RNG consumers are still approximate.
* fix(ai): schedule clan cycles with native jitter and logical timeValentin Popov10 days1-1/+2
| | | | | | | | | | | | | Use a separate AI CRT stream for the 7000 + rand() % 1000 ms cycle. Require a strictly later deadline, reschedule late callbacks from actual arrival time, and advance script time by seven seconds per cycle. Count executed cycles by clan; retain explicit initial-phase and RNG-order gaps. Validated the native RNG through ai.dll and the timer in the running original. Workspace fmt/check/tests and all 29 stock 900-second reports pass. A stock-start mission-28 window ran through warbot and transport production and successive laboratory projects. This is not full G7 chronology acceptance; candidate properties for 65/69 remain stubbed.
* fix(ai): recognize newly built labs in research queriesValentin Popov10 days1-0/+3
| | | | | | | | | | | | | | | | | | | Handler(41) searched only the initial mission objects. A constructed lab has an issued logical ID, so the stub returned missing-object ERROR and sent the script into an unsupported ST_SOLVING transition. Resolve the lab through the live logical roster: an unloaded catalog returns false and the original script finishes the request without inventing a research job. Validation: fmt, workspace check/tests and an ignored stock-start regression build a lab, exercise 41 and confirm no script stop or granted technology. GOG ai.dll calls verify static/dynamic IDs, missing labs, cold catalogs and backend acceptance. A stock window replay reaches the lab and 41 without the old stop; the lab itself is outside the player's view. All 29 stock missions complete 900-second reports with successful exits and no Init, Mission or clan-script hard stops. Explicit research and gameplay stubs remain counted. Research catalog 43 and actual research dispatch remain explicit stubs. This coverage-blocker fix follows the visible scripted-mine construction change.
* fix(ai): account for pending construction in class limitsValentin Popov10 days1-0/+15
| | | | | | | | | | | | | | | | | | | Implement Handler(11) limits for the original class set, including hangar and laboratory counters. Keep owned-object caps separate from pending thresholds; medium and large towers allow three and one active builds. Record the ordered class on construction tasks and count queries by clan, class and result. Execute ai.dll RVA 0xc5e7 with the GOG hash guard and compare owned counts, maxima, pending counts and unknown classes. Preserve these native vectors in a Rust test. Extend the licensed construction test to require pending count before registration, owner isolation and reset after completion. Validate fmt, workspace check/tests, licensed construction, release build and stock mission 29 in simulation and its window. This removes the Handler(11) coverage blocker for the following construction work; generic building orders and Handler(40) are still open. Pending counter sources and lifecycle beyond active FParkan Construction tasks remain approximate.
* feat(ai): queue scripted movement and raid ordersValentin Popov10 days1-2/+17
| | | | | | | | | | | | | | | | | | | | | Execute Go, Attack and ShutDown through one ordered queue from Init, Mission and clan AI events. Append preserves the active task; replacement clears its tail. Support the appended point patrol ending mission 19's second raid, and count accepted commands by object and order type. Execute the original ai.dll Handler(15) at RVA 0x8054 with its hash guard: move, attack, shutdown and appended patrol reach the unit without a current problem context, with native insertion modes and missing-unit flag 5. Behavior.dll RVA 0x4280 identifies append and replace paths. Native task completion and profile-dependent behavior remain approximate. Test mixed queues, replacement and deferred patrol; run the licensed mission-19 scenario from its stock start through its first movement. Validate fmt, workspace check/tests, release build and all 29 missions for 900 seconds. Mission 19 has both raid messages and no script stops; mission 29's existing counter/construction stops remain. Check the live stock-start window with normal clocks and Vulkan validation. This does not establish mission completion or native movement/combat parity.
* feat(ai): deliver clan script notifications to the playerValentin Popov11 days1-5/+10
| | | | | | | | | | | | | | | | | Handle clan Handler(30) through the same host command and first-message state as the Mission event. Carry clan notices in FrameResult and pass them to the existing text and voice queues without changing the Mission tick counter. Extract shared host dispatch and app presentation modules. Execute ai.dll RVA 0xc266 with the original hash guard: clan contexts 0 and 2 call the global host as (0, MESSAGE_INFO, index), reading live varset cells. Extend the licensed stock Convoy test to require message 0 after the delayed attack, and test shared first-message and AutoDemo behavior. Repeated native message UI branches remain explicit debt. Validate fmt, workspace check/tests, licensed stock-start test, release simulation and the mission window. Clock replay checks message delivery, not full mission completion.
* feat(ai): carry ore from clan mines to storageValentin Popov2026-11-141-1/+2
| | | | Resolve the stock transport order against the newly produced unit. Move between owned endpoints and limit transfers by rate, source stock and destination space. The window logged the first departure and the stock simulation completed an unloading cycle. Native roster selection was called directly. Port approaches and rates remain approximations.
* fix(ai): preserve raw script problem argumentsValentin Popov2026-11-141-4/+7
| | | | Keep the target logical ID across Handler(2) and Handler(29). Verified slots 0, 1 and 2 with GOG ai.dll at RVA 0xc182. Single.01 now distinguishes nearby building IDs and leaves robot selection as the next blocker.
* feat(ai): evaluate clan combat strength in scriptsValentin Popov2026-11-141-0/+6
| | | | Use the live roster and Control weapon and capacity data in Handler(38). The original ai.dll rating formula was exercised with three capacity vectors. Single.01 reaches Handler(35) and retains factory production. Remaining ammunition and the exact selector 0x36 capacity are reported as an approximation.
* fix(ai): propagate problem priority to dependent ordersValentin Popov2026-11-141-0/+3
| | | | Read Handler(12) from the active problem, as verified by calling ai.dll. The Two Fortresses transport section now submits its dependent production request. Transport assignment and design selection are still uncovered.
* fix(ai): wait for the factory before restarting robot jobsValentin Popov2026-11-141-0/+2
| | | | Track the factory assigned by ST_SOLVING and the ACTION_NOTHING_DOING expression. Stock Single.01 completes the first robot at 27 seconds without duplicate busy-factory rejections. Keep other expression variants explicitly uncovered.
* feat(ai): honor clan construction class limitsValentin Popov2026-11-141-0/+3
| | | | Use the live per-class varset limits and roster count in Handler(11). Both enemy clans in stock Single.02 now request mines and enter their Start sections. Pending buildings and the hangar/lab counters are still uncovered.
* feat(ai): let clan scripts resume mining at existing shaftsValentin Popov2026-11-141-0/+3
| | | | Handle the free-mine lookup and the mine order in Problems0. Preserve a live shaft's deposit binding, claim nearby free reserves, and leave neighboring live shafts alone. Stock Single.02 now reaches the mine limit check instead of stopping on the lookup.
* fix(script): copy live DWORD values between script cellsValentin Popov2026-11-141-0/+3
| | | | The native record-copy branch covers 73 DWORD-to-DWORD instructions in the shipped shared varset. Stock mission 11 now copies the protection request value and reaches group assignment at Handler(25).
* fix(production): let separate factories build concurrentlyValentin Popov2026-11-141-0/+2
| | | | Reserve each slot at order time and advance one order per live factory. Hostile completion no longer changes the player's status. A stock Two Fortresses regression starts the player's factory during an enemy job and observes completions from both.
* feat(ai): build battle robots from clan factory scriptsValentin Popov2026-11-141-0/+6
| | | | Route the construct order from PBM_ROBOT_NEEDED into shared factory ownership, free quota, and paid production. Stock Single.01 builds an enemy robot at 27 seconds in the fixed-step report and about 27.4 seconds in the Vulkan window. Count accepted and rejected orders by clan and factory; configured prebuild selection and the global order slot remain approximations.
* feat(ai): advance clan jobs past unloaded laboratory researchValentin Popov2026-11-141-3/+8
| | | | Bind placed units for the duration of a Start section and report the native unloaded-catalog result with a stub counter. Consider the other pending priorities so the stock factory and transport Start sections are reached.
* feat(ai): start the highest-priority clan script problemValentin Popov2026-11-141-2/+5
| | | | Open the matching Start section after Problems0, expose its arguments, and support completion and unreserved placed-unit selection. Two Fortresses enters its laboratory job and reaches Handler(6). Timing, ties and continuation remain explicit approximations.
* feat(ai): queue clan script problems by native identityValentin Popov2026-11-141-6/+4
| | | | Pass Handler(2) operands through the existing scheduler and require matching script sections. The stock Two Fortresses clan queues research, transport, and robot problems before its combat-strength query. Pending dispatch is counted by clan and problem kind.
* feat(script): query clan storage and follow forward jumpsValentin Popov2026-11-141-0/+7
| | | | Use live storage capacity for Handler(16), expose the unbound research policy as a counted Handler(56) stub, and honor forward control-3 jumps. Checked storage arithmetic, flag truthiness and raw jump behavior by calling ai.dll. Stock Single.01 now reaches problem submission.
* fix(mining): feed placed mines from nearby depositsValentin Popov2026-11-141-0/+6
| | | | Bind stock mines to TMA reserves within the Behavior collection radius and report the live clan reserve to Problems0. Verified extraction from stock Single.01 and preserved the Field Camp mine order. Single.01 reaches Handler(56) in the 120-second report and renders with clean Vulkan validation.
* feat(ai): read free clan power in problem scriptsValentin Popov2026-11-141-0/+5
| | | | The typed event host stores the finite or negative float result in the script cell. A direct call to ai.dll verifies available minus requested power. Single.01 evaluates the energy branch and reaches its mine resource query.
* feat(ai): expose clan roster counts to problem scriptsValentin Popov2026-11-141-0/+6
| | | | Handler(49) counts free native-format startup slots and Handler(34) reads the live clan roster. The Two Fortresses reaches the research-dependent Handler(65) from every scheduled Problems0 invocation.
* feat(ai): dispatch periodic clan problem scriptsValentin Popov2026-11-141-0/+7
| | | | Runs the supported Problems0 prefix for AI clans and counts every stop by clan, event and instruction. Single.01 now reaches the native scenario body and identifies Handler(49) as the next unsupported command. Existing defensive behavior remains active.
* feat(ai): dispatch scripted attacks against logical targetsValentin Popov2026-11-141-0/+4
| | | | Resolve the stock logical target and feed it to unit combat. Mission 20 assigns the attack at startup and continues through the remaining Init commands. All 29 original missions completed 15 minutes without a hard Init or periodic Mission stop.
* feat(ai): queue scenario move orders for mobile unitsValentin Popov2026-11-141-0/+6
| | | | Runs the stock order sequence in mission 16. Both mobile headquarters receive five destinations in script order. Movement uses existing terrain routing until the native Go task is wired.
* feat(ai): patrol around script-selected objectsValentin Popov2026-11-141-0/+4
| | | | Uses the TMA logical ID to route a warbot around the current position of a building or unit. The original Behavior.dll confirms target class selection and radius. Mission 13 now assigns building patrols at stock startup.
* feat(ai): honor scenario warbot shutdown ordersValentin Popov2026-11-141-0/+4
| | | | Behavior.dll task dispatch selects ShutDown for order 0x13. Stop autonomous motion and fire until a new supported order is assigned. The field-camp clan now completes Init and all three placed warbots receive the shutdown order.
* fix(script): honor numeric condition scopes during InitValentin Popov2026-11-141-0/+10
| | | | Shares condition execution with Mission and compares a float left operand as f32. Native ai.dll confirms all six operators on the observed difficulty comparison. The complete 900 s corpus has no crashes or periodic Mission stops; remaining Init stops are Handlers 15 and 68.
* fix(script): evaluate products before adding formula termsValentin Popov2026-11-141-3/+5
| | | | Reuses the original operand formats and rounds each product before adding or subtracting. The original ai.dll agreed on three campaign difficulty expressions. Mission 19 now reaches comparison branches in Init.
* feat(ai): reserve placed units for scenario ordersValentin Popov2026-11-141-0/+9
| | | | Handler(51) changes availability in the owning clan, matching a direct ai.dll call. Reserved units stay out of the free capturer query. Campaign mission 7 now finishes Init and mission 13 reserves the addressed unit.
* feat(script): evaluate scenario deadlines and timeout testsValentin Popov2026-11-141-0/+16
| | | | Handler(59) stores a DWORD deadline in Init or Mission. Handler(60) compares it strictly against the current scenario clock. The original ai.dll confirms overflow and the equality boundary. Mission 16 now reaches its scheduled message.
* feat(ai): issue scripted place patrols from clan InitValentin Popov2026-11-141-2/+5
| | | | Handler(15) читает живые клетки и направляет размещённого варбота в указанную точку. Кампания 01, миссия 02 при штатном старте ставит четыре патруля и продолжает Init до Handler(51).
* feat(runtime): execute scripted place patrol ordersValentin Popov2026-11-141-5/+12
|
* fix(runtime): set tutorial production thresholds from live clansValentin Popov2026-11-141-1/+8
|
* feat(runtime): count exact clan classes in mission scriptsValentin Popov2026-11-141-0/+7
|
* feat(runtime): resolve mission objectives and outcomeValentin Popov2026-11-141-6/+24
|
* feat(runtime): count live clan objects in mission scriptsValentin Popov2026-11-141-0/+14
|
* feat(runtime): trigger tutorial voices from tactical areasValentin Popov2026-11-141-0/+21
|
* feat(runtime): dispatch the periodic Mission script eventValentin Popov2026-11-141-2/+30
|
* feat(runtime): start missions with explicit Init stubsValentin Popov2026-11-141-1/+4
|
* fix(script): apply immediate Init assignmentsValentin Popov2026-11-141-0/+9
|