{"id":16948151,"url":"https://github.com/dentosal/python-sc2","last_synced_at":"2025-04-08T11:07:31.122Z","repository":{"id":24068688,"uuid":"100306850","full_name":"Dentosal/python-sc2","owner":"Dentosal","description":"A StarCraft II bot api client library for Python 3","archived":false,"fork":false,"pushed_at":"2022-11-22T02:49:13.000Z","size":2712,"stargazers_count":589,"open_issues_count":64,"forks_count":182,"subscribers_count":40,"default_branch":"master","last_synced_at":"2025-04-01T10:08:07.513Z","etag":null,"topics":["python3","starcraft","starcraft-ii","starcraft-ii-bot","starcraft2"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dentosal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-14T20:29:20.000Z","updated_at":"2025-03-18T01:38:01.000Z","dependencies_parsed_at":"2023-01-14T00:21:22.644Z","dependency_job_id":null,"html_url":"https://github.com/Dentosal/python-sc2","commit_stats":null,"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dentosal%2Fpython-sc2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dentosal%2Fpython-sc2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dentosal%2Fpython-sc2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dentosal%2Fpython-sc2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dentosal","download_url":"https://codeload.github.com/Dentosal/python-sc2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247829491,"owners_count":21002995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["python3","starcraft","starcraft-ii","starcraft-ii-bot","starcraft2"],"created_at":"2024-10-13T21:49:46.649Z","updated_at":"2025-04-08T11:07:31.099Z","avatar_url":"https://github.com/Dentosal.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## This repository is no longer maintained and may not work with the latest version of the StarCraft 2 client. You can use [this fork](https://github.com/BurnySc2/python-sc2) instead which aims to stay updated for both the latest windows StarCraft 2 client and latest linux client, while also being available on [pypi.org](https://pypi.org/project/burnysc2/#history).\n\n# A StarCraft II API Client for Python 3\n\nAn easy-to-use library for writing AI Bots for StarCraft II in Python 3. The ultimate goal is simplicity and ease of use, while still preserving all functionality. A really simple worker rush bot should be no more than twenty lines of code, not two hundred. However, this library intends to provide both high and low level abstractions.\n\n**This library (currently) covers only the raw scripted interface.** At this time I don't intend to add support for graphics-based interfaces.\n\nDocumentation is in [the Wiki](https://github.com/Dentosal/python-sc2/wiki).\n\nFor automatically running multiple matches, check out [Dentosal/sc2-bot-match-runner](https://github.com/Dentosal/sc2-bot-match-runner).\n\n## Installation\n\nBy installing this library you agree to be bound by the terms of the [AI and Machine Learning License](http://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html).\n\nYou'll need Python 3.6 or newer.\n\n```\npip3 install --user --upgrade sc2\n```\n\nPlease note that not all commits are released to PyPI. Releases are tagged with version number. You can see latest released versions from [tags page](https://github.com/Dentosal/python-sc2/tags).\n\nYou'll also need an StarCraft II executable. If you are running Windows or macOS, just install the normal SC2 from blizzard app. [The free starter edition works too.](https://us.battle.net/account/sc2/starter-edition/). Linux users get the best experience by installing the Windows version of StarCraft II with [Wine](https://www.winehq.org). Linux user can also use the [Linux binary](https://github.com/Blizzard/s2client-proto#downloads), but it's headless so you cannot actually see the game.\n\nYou probably want some maps too. Official map downloads are available from [Blizzard/s2client-proto](https://github.com/Blizzard/s2client-proto#downloads). Notice: the map files are to be extracted into *subdirectories* of the `install-dir/Maps` directory.\n\n### Running\n\nAfter installing the library, a StarCraft II executable, and some maps, you're ready to get started. Simply run a bot file to fire up an instance of StarCraft II with the bot running. For example:\n\n```\npython3 examples/protoss/cannon_rush.py\n```\n\nIf you installed StarCraft II on Linux with Wine, set the `SC2PF` environment variable to `WineLinux`:\n\n```\nSC2PF=WineLinux python3 examples/protoss/cannon_rush.py\n```\n\n## Example\n\nAs promised, worker rush in less than twenty lines:\n\n```python\nimport sc2\nfrom sc2 import run_game, maps, Race, Difficulty\nfrom sc2.player import Bot, Computer\n\nclass WorkerRushBot(sc2.BotAI):\n    async def on_step(self, iteration):\n        if iteration == 0:\n            for worker in self.workers:\n                await self.do(worker.attack(self.enemy_start_locations[0]))\n\nrun_game(maps.get(\"Abyssal Reef LE\"), [\n    Bot(Race.Zerg, WorkerRushBot()),\n    Computer(Race.Protoss, Difficulty.Medium)\n], realtime=True)\n```\n\nThis is probably the simplest bot that has any realistic chances of winning the game. I have ran it against the medium AI a few times, and once in a while it wins.\n\nYou can find more examples in the [`examples/`](/examples) folder.\n\n## Help and support\n\nYou have questions but don't want to create an issue? Join the [Starcraft 2 AI Discord](https://discordapp.com/invite/zXHU4wM). Questions about this repository can be asked in channel #python-sc2.\n\n## Bug reports, feature requests and ideas\n\nIf you have any issues, ideas or feedback, please create [a new issue](https://github.com/Dentosal/python-sc2/issues/new). Pull requests are also welcome!\n\n\n## Contributing \u0026 style guidelines\n\nGit commit messages use [imperative-style messages](https://stackoverflow.com/a/3580764/2867076), start with capital letter and do not have trailing commas.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdentosal%2Fpython-sc2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdentosal%2Fpython-sc2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdentosal%2Fpython-sc2/lists"}