Skip to content

com.stratkit.auto-play-test

Provides automatic Play Mode tests.

Assemblies: - Stratkit.AutoPlayTest: the runner. Simulates input on registered action providers, learns a knowledge graph of outcomes and timings, and reports deviations. Scripted tests (e.g. the gameplay loop) keep to their intended steps with a NodeGuard: each step tells the node it is performed in and the one it leads to; when something else shows up (a popup, a tutorial, a list to pick from, a screen added recently), the guard goes back there with a reach run of the runner, through the action graph when it knows the way, else exploring and learning it. The tests hold no code for the unexpected. - Stratkit.AutoPlayTest.UI: registers the open views of the UiServices as providers, their actions found by reflection. - Stratkit.AutoPlayTest.Game: setup for a Stratkit game (GameAutoPlay): the match map as a provider, the game state queries of the runner (busy, map ready), and the gameplay loop (GameplayLoop) which plays a match through simulated input: constructs, produces, attacks, skips time. The intended game screens are told by an IGameplayUi of the game. GameAutoPlayCheats is what the cheat commands of a game call. - Stratkit.AutoPlayTest.Game.Editor: steps of the game auto-play tests (GameAutoPlayTestRunner): boot the game in play mode, wait for the lobby, run the test or the gameplay loop, learn the way to the map. - Stratkit.AutoPlayTest.Game.Tests: the auto-play tests shared by the games (AGameAutoPlayTests: breadth / depth first, reach map, explore, gameplay loop). Each game derives it with its AutoPlayTestGame: provider and action names, mostly constants.

Files, in the AutoPlayTest folder of the project (versioned): - knowledge-graph.csv: the learned outcomes and timings, one row per action and node. Can be deleted (or rows of it) to relearn. - providers.csv: the short names of the nodes. - blacked-list.csv: actions never performed, set by hand, kept when the knowledge graph is reset: real money purchases (their store dialog cannot be closed), links opening a browser. * as node for every node; * in provider and action ids for any text, e.g. *,ShopUI,*WebShop*,opens the web shop in a browser.

All assemblies of the package are compiled only with the ENABLE_AUTOPLAYTEST scripting define (define constraint), and the games guard their code using it with #if ENABLE_AUTOPLAYTEST: the feature is never part of a build without it. The game build workflows add ENABLE_AUTOPLAYTEST to builds having ENABLE_CHEATS, unless their enableAutoPlayTest option is false; live builds never get it.