duyminh1998 / pycmo

Command Modern Operations Learning Environment
Other
49 stars 23 forks source link

Add feature to let pyCMO restart a scenario, end a scenario, and check when a scenario has ended #20

Closed duyminh1998 closed 10 months ago

duyminh1998 commented 10 months ago

Why

As a

user of pyCMO

I want

to be able to restart a scenario, end a scenario, and check when a scenario has ended in the Steam version of Command

So that

I can develop training procedures for RL agents (which depends on ending a scenario and restarting it)

Acceptance Criteria

Given

we currently do not have a way for pyCMO to check that a scenario has ended, end a scenario, and restart a scenario

When

we implement these features

Then

we can start to write training procedures for RL agents

Notes

duyminh1998 commented 10 months ago

The ScenLoaded and ScenEnd event triggers are unreliable. As a result, it is not advisable to record scenario ended information with those triggers. When a scenario loads but through the "Load recent" menu, the ScenLoaded event trigger does not seem to get triggered. In addition, when a scenario ends, we actually have to click 'OK' on a popup before the ScenEnd trigger will get triggered. It is probably better to write our own trigger (unit loss, target destroyed, etc.) that will end the scenario, and then write out that the scenario has ended, rather than relying on the game to end the scenario.

duyminh1998 commented 10 months ago

Clarification on note above: We can load a scenario through the "Load recent" menu, but after doing that, we have to press "Enter scenario" on the "Side selection and briefing" screen.

image

Currently, the restartScenario.bat script presses the ESC key which closes the dialogue box, but this generates a problem. If we do not press "Enter scenario," then the scenario does not actually reset and the ScenLoaded script never runs (which is not as important as the fact that the scenario is not even restarted). Currently, there does not seem to be any obvious keyboard shortcuts that would allow us to "press" on the "Enter scenario" button. We might have to look into solutions that involve mouse clicks.