Coder Social home page Coder Social logo

pycmo's Introduction

img

PyCMO - Command Modern Operations Reinforcement Learning Environment

PyCMO is a reinforcement learning environment for Command Modern Operations written in Python. It exposes the game as slices of observation, reward, and available actions that get returned at each timestep.

This project was submitted to the NSIN AI for Command Challenge 2021.

Prerequisites

  1. Python 3.9.2
  2. pip

Quick Start Guide

Get PyCMO

  1. Make sure the following settings are enabled in your Command Modern Operations' configurations (in CPE.ini):
[Lua]
EnableSocket = 1
SocketPort = 7777
AllowIO = 1
EncodingMode = 8
  1. Click on "Clone or download", and then "Download Zip".
  2. Unzip the repo anywhere.
  3. Configure the project's pycmo/configs/config.py file to fit your system's paths. Do not change the amount of backslashes that are present in each entry as that could mess up its usage! If the steps directory is not present in raw then create it.
{
    "command_path": "C:\\Program Files (x86)\\Command Professional Edition 2\\",
    "observation_path": "C:\\\\Users\\\\AFSOC A8XW ORSA\\\\Documents\\\\Python Proj\\\\AI\\\\pycmo\\\\raw\\\\steps\\\\",
    "scen_ended": "C:\\\\Users\\\\AFSOC A8XW ORSA\\\\Documents\\\\Python Proj\\\\AI\\\\pycmo\\\\pycmo\\\\configs\\\\scen_has_ended.txt",
    "command_cli_output_path": "C:\\ProgramData\\Command Professional Edition 2\\Analysis_Int"
}
  1. Navigate to the folder than contains setup.py and install the repository using pip install . Anytime you make changes to the files in the project folder, you need to reinstall the package using pip install ..

Run an agent

1a. Open a terminal within the game's directory and load a scenario in Interactive mode. For example,

./CommandCLI.exe -mode I -scenfile "C:\ProgramData\Command Professional Edition 2\Scenarios\Standalone Scenarios\Wooden Leg, 1985.scen" -outputfolder "C:\ProgramData\Command Professional Edition 2\Analysis_Int"

1b. Alternatively, open a terminal anywhere and call pycmo/lib/start_server.py to start a scenario in Interactive mode. The path to the scenario must be supplied, e.g.

python pycmo/lib/start_server.py "C:\ProgramData\Command Professional Edition 2\Scenarios\Standalone Scenarios\Wooden Leg, 1985.scen"
  1. Call python pycmo/bin/agent.py to run the main loop with the following arguments.
-agent AGENT        Select an agent. 0 for RandomAgent, 1 for ScriptedAgent, 2 for RuleBasedAgent.
-size SIZE          Size of a timestep, must be in "hh:mm:ss" format.
-scenario SCENARIO  The name of the scenario, used for ScriptedAgent and RuleBasedAgent. Usually the literal name of the .scen file.
-player PLAYER      The name of player's side.

The default is to run a RandomAgent on Wooden Leg with a timestep of 1 minute. Accepted scenario file names for the -scenario parameter above are

scenario_id = {
    'Operation Brass Drum, 2017',
    '2 - English Jets over Uganda, 1973',
    'Fighter Weapons School - GAT 5 and 6, 1977',
    'Iron Hand, 2014',
    'Khark Island Raid, 1985',
    'North Pacific Shootout, 1989',
    'Pyrpolitis 1-14, 2014',
    'Sea of Fire, 1982',
    'Shamal, 1991',
    'Task Force Normandy, 1991',
    'Wooden Leg, 1985',
    'None'
}

Environment Details

For a full description of the specifics of how the environment is configured, the observations and action spaces work read the environment documentation.

pycmo's People

Contributors

duyminh1998 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.