{"id":18999103,"url":"https://github.com/crossr/meng_project","last_synced_at":"2026-02-15T12:37:41.937Z","repository":{"id":98398499,"uuid":"110462782","full_name":"CrossR/meng_project","owner":"CrossR","description":null,"archived":false,"fork":false,"pushed_at":"2019-06-24T21:26:56.000Z","size":22123,"stargazers_count":0,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T03:46:25.784Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CrossR.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-12T19:37:55.000Z","updated_at":"2019-06-24T21:26:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"aedcf685-7299-4e40-b81e-17d8add4560a","html_url":"https://github.com/CrossR/meng_project","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/CrossR/meng_project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrossR%2Fmeng_project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrossR%2Fmeng_project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrossR%2Fmeng_project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrossR%2Fmeng_project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CrossR","download_url":"https://codeload.github.com/CrossR/meng_project/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrossR%2Fmeng_project/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29478355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T11:35:25.641Z","status":"ssl_error","status_checked_at":"2026-02-15T11:34:57.128Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T17:49:19.483Z","updated_at":"2026-02-15T12:37:41.919Z","avatar_url":"https://github.com/CrossR.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reinforcement Learning For Games\n\n## Install Instructions\n\n### Singularity\n\nThe way used throughout the project was via Singularity.\n\n*   Install Singularity - https://singularity.lbl.gov/install-linux\n    *   This must be done on a personal machine! Singularity needs `root`\n        access for the initial build.\n*   Swap to the repo folder.\n*   Run `sudo singularity build starcraft.simg Singularity`.\n    *   This is going to install everything, so takes a while.\n*   Can be used either with:\n    *   `singularity shell -C starcraft.simg`\n    *   `singularity exec starcraft.simg python run.py ${SCRIPT_ARGS}`\n    *   If running on a machine that has a GPU + CUDA, ensure to pass `--nv`\n        after `shell` or `exec`.\n\n### Poetry\n\nOnly used initially, so may not be fully working.\n\n* Install SC2. If installed to a non-standard location set the `$SC2PATH`\n environment variable to point to the install location.\n    * An example of the install and setting this variable is in the\n     `Singularity` install file.\n    * Also install the maps, which are also listed in the `Singularity` file,\n      alongside their password. They should be installed into `$SC2PATH/Maps`,\n      where the maps folder may need making.\n* Install [poetry](https://github.com/sdispater/poetry) with `pip install poetry`.\n* Once installed, use `poetry install` inside this repo. This will create a\n  virtualenv and install all needed packages into it.\n* Then you can call the scripts like so:\n\n```sh\n# Basic example:\n# Map names can be gotten from the map file names that you just downloaded.\npoetry run python CNN/run.py --map_name MAP_NAME --model_name MODEL_NAME --training=False\n\n# For example:\npoetry run python CNN/run.py --map_name MoveToBeacon --model_name TestModel --training=True\n\n# To load that model back at a later date and continue training:\npoetry run python CNN/run.py --map_name MoveToBeacon --model_name TestModel --training=True --if_output_exists=continue\n\n# To load that model back at a later date with no more training:\npoetry run python CNN/run.py --map_name MoveToBeacon --model_name TestModel --training=False\n\n# To use that model in a secondary training phase:\n# This has not been tested, so its possible you'll need to instead run the initial model\n# with curriculum_num=0, since I don't remember how that code works.\npoetry run python CNN/run.py --map_name MoveToBeacon --model_name TestModel2 --training=True --curriculum_num=1 --previous_model=_files/models/TestModel\n```\n\nThis way is meant for PC dev work, so the TensorFlow version does not need a GPU.\nIf this is needed, then call `poetry remove tensorflow` and `poetry add tensorflow-gpu`.\n\nYou can also enter the poetry shell like so\n\n```sh\npoetry shell\n```\n\nAt that point, calling `python` will use the project venv.\n\n## Instructions to Run\n\nAn example script of running the CNN can be found in `CNN\\runPySC2.sh`, which\nuses Singularity. The paths in this script will need updating for a different\nuser.\n\nTo run a specific pretrained CNN model, the script should be called as follows,\nwhere `MAP_NAME` is the map or mini-game in question and `MODEL_NAME` is the\nexact name of the model, as stored in `CNN\\_files\\`.\n\n```sh\npython run.py --map_name MAP_NAME --model_name MODEL_NAME --training=False\n```\n\nThe folders for the models should look as follows:\n\n```\nCNN/_files/\n├── models\n│   └── test_model_20\n│       ├── checkpoint\n│       ├── model.ckpt-13000.data-00000-of-00001\n│       ├── model.ckpt-13000.index\n│       ├── model.ckpt-13000.meta\n│       ├── model.ckpt-13500.data-00000-of-00001\n│       ├── model.ckpt-13500.index\n│       └── model.ckpt-13500.meta\n└── summaries\n    └── test_model_20\n        └── events.out.tfevents.1521839337.db12gpu1.arc3.leeds.ac.uk\n```\n\nTo train a new model, instead drop the `--training=False`. It is necessary to\nadd `--if_output_exists=continue` to continue training an already existing model.\nThe full set of runtime flags can be found in [run.py](CNN/run.py)\n\nFlags of interest are as follows:\n\n - `training` - If the model should be trained or not.\n - `visualize` - If the PyGame GUI should be shown. Useful for local running during testing.\n\n - `n_envs` - Number of games to run in parallel. **Important** on a high powered machine to get the best performance.\n\n - `save_replays_every` - How often a game replay should be saved, such that the training progress can be seen.\n - `save_permanently_every` - Models are saved every few episodes, but are done in a rolling fashion. This flag is used to create models that will not be overwritten at any point\n - `curriculum_num` - What is the current curriculum number? Should be set for curriculum learning such that multiple models are loaded.\n - `previous_model` - Path to the previous model file, for curriculum learning.\n - `number_episodes` / `number_steps` - The maximum episodes or steps to take before stopping. If either of these are met, will stop.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrossr%2Fmeng_project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrossr%2Fmeng_project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrossr%2Fmeng_project/lists"}