Make pyCMO compatible with the Steam/non-premium version of Command
Closed this issue · 8 comments
Why
As a
user of pyCMO
I want
to be able to work with the Steam/commercial version of Command
So that
I save tens of thousands of dollars in license fees
Acceptance Criteria
Given
pyCMO
currently only supports the Premium edition of Command
When
we research alternative ways to send agent commands to the Steam/commercial version of Command and implement this functionality
Then
pyCMO
will be compatible with the Steam/commercial version of Command
Notes
Notes from past related issues
- You need the Lua function ScenEdit_ExportScenarioToXML() to output observations. The only alternative is to write your own Lua script and output data using the io module, but this might be cumbersome.
- I actually do not remember if you can use the io module in the non-Premium version. You should try it out in the console, but I believe the answer is no. Without io or some of the features from the Premium version, you cannot send commands (actions) into the game to take actions.
- Currently we send actions to the environment/game using a TCP/IP port, a feature only available in the Premium version.
- In order to output data (observations) to your local system, a Profession Edition of Command is required. I will do further experimentation with the commercial Steam version but it is my understanding that you cannot output files. I also do not think that you can send commands to the game because pycmo sends it through an open TCP/IP socket and you can only open that with a Professional version I think.
We could use the ScenEdit_RunScript
command to process an agent's action. Basically, we would turn the agent's action into a Lua script file and place it in the Lua directory. Command can then read from this file (perhaps every timestep). The challenge is to figure out a way to output observations.
We can use ScenEdit_ExportInst
to export information on a unit or set of units. Mini win?
Use this bash script to send key commands to Command to simulate pausing and playing the scenario, since we do not have access to the Premium lua functions that do the same (e.g. VP_PauseSimulation(), VP_RunForTimeAndHalt(), VP_RunSimulation(), VP_RunToTimeAndHalt())
NOTE
- We set up an event to fire the
ScenEdit_ExportInst
function every x seconds, where x can be one second. This event also pauses the scenario. - We should decide on a game speed that is already set when the scenario loads.
- Our agent continuously polls for the observation file generated by
ScenEdit_ExportInst
and decides on an action if the observation is "new". - We can use
ScenEdit_MsgBox
to simulate the effect of pausing the game. We can then use a bash script to send the "Enter" key to Command to exit out of the message box and resume the game. - We can also send the "Space" key to Command to pause or resume the game, but there is a lot of timing issues with this.
- Perhaps we should append to the end of the agent's action a lua script that sets up an event to pause the scenario after a certain amount of time, simulating a timestep. For example, we set up an event to run in delta timesteps after running the agent's action to spawn the message box, simulating the pausing of the scenario.
The ScenEdit_ExportInst
allows users to insert comments into the exported output. We could use this as a vector in which to inject game information that can be outputted.
Resolved in MR