sc2nachos 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sc2nachos-0.1.0/.gitignore +20 -0
- sc2nachos-0.1.0/LICENSE +21 -0
- sc2nachos-0.1.0/NOTICE +47 -0
- sc2nachos-0.1.0/PKG-INFO +188 -0
- sc2nachos-0.1.0/README.md +155 -0
- sc2nachos-0.1.0/data/footprints.json +3130 -0
- sc2nachos-0.1.0/data/repair.json +920 -0
- sc2nachos-0.1.0/data/stableid.json +35818 -0
- sc2nachos-0.1.0/data/tech_tree.json +13789 -0
- sc2nachos-0.1.0/data/turning.json +22459 -0
- sc2nachos-0.1.0/data/upgrades.json +3961 -0
- sc2nachos-0.1.0/docs/debugging.md +89 -0
- sc2nachos-0.1.0/docs/events.md +261 -0
- sc2nachos-0.1.0/docs/extensions.md +145 -0
- sc2nachos-0.1.0/docs/github-actions.md +207 -0
- sc2nachos-0.1.0/docs/ladder.md +133 -0
- sc2nachos-0.1.0/docs/maintaining/code-review.md +46 -0
- sc2nachos-0.1.0/docs/maintaining/code-style.md +80 -0
- sc2nachos-0.1.0/docs/maintaining/curating-ids.md +218 -0
- sc2nachos-0.1.0/docs/maintaining/releasing.md +48 -0
- sc2nachos-0.1.0/docs/migrating-from-python-sc2.md +131 -0
- sc2nachos-0.1.0/docs/orders.md +256 -0
- sc2nachos-0.1.0/docs/reference/game-behavior/README.md +29 -0
- sc2nachos-0.1.0/docs/reference/game-behavior/abilities-and-orders.md +431 -0
- sc2nachos-0.1.0/docs/reference/game-behavior/alerts-and-chat.md +52 -0
- sc2nachos-0.1.0/docs/reference/game-behavior/cheats.md +62 -0
- sc2nachos-0.1.0/docs/reference/game-behavior/damage-and-buffs.md +168 -0
- sc2nachos-0.1.0/docs/reference/game-behavior/map.md +137 -0
- sc2nachos-0.1.0/docs/reference/game-behavior/not-understood-yet.md +48 -0
- sc2nachos-0.1.0/docs/reference/game-behavior/protocol.md +153 -0
- sc2nachos-0.1.0/docs/reference/game-behavior/score-and-computer.md +26 -0
- sc2nachos-0.1.0/docs/reference/game-behavior/units.md +262 -0
- sc2nachos-0.1.0/docs/reference/game-behavior/upgrades-and-tables.md +108 -0
- sc2nachos-0.1.0/docs/reference/python-sc2.md +720 -0
- sc2nachos-0.1.0/docs/replays.md +124 -0
- sc2nachos-0.1.0/docs/testing.md +150 -0
- sc2nachos-0.1.0/examples/demo_bot.py +284 -0
- sc2nachos-0.1.0/examples/run_game.py +14 -0
- sc2nachos-0.1.0/pyproject.toml +110 -0
- sc2nachos-0.1.0/src/sc2nachos/__about__.py +2 -0
- sc2nachos-0.1.0/src/sc2nachos/__init__.py +57 -0
- sc2nachos-0.1.0/src/sc2nachos/_shared/__init__.py +4 -0
- sc2nachos-0.1.0/src/sc2nachos/_shared/checks.py +18 -0
- sc2nachos-0.1.0/src/sc2nachos/_shared/errors.py +10 -0
- sc2nachos-0.1.0/src/sc2nachos/_shared/readable_int_enum.py +53 -0
- sc2nachos-0.1.0/src/sc2nachos/_shared/rounding.py +11 -0
- sc2nachos-0.1.0/src/sc2nachos/api/__init__.py +10 -0
- sc2nachos-0.1.0/src/sc2nachos/api/_api.py +592 -0
- sc2nachos-0.1.0/src/sc2nachos/api/_fog_off_playback.py +168 -0
- sc2nachos-0.1.0/src/sc2nachos/api/_game.py +564 -0
- sc2nachos-0.1.0/src/sc2nachos/camera/__init__.py +5 -0
- sc2nachos-0.1.0/src/sc2nachos/camera/_camera.py +51 -0
- sc2nachos-0.1.0/src/sc2nachos/debug/__init__.py +31 -0
- sc2nachos-0.1.0/src/sc2nachos/debug/_cheat.py +27 -0
- sc2nachos-0.1.0/src/sc2nachos/debug/_color.py +50 -0
- sc2nachos-0.1.0/src/sc2nachos/debug/_debug_commands.py +355 -0
- sc2nachos-0.1.0/src/sc2nachos/debug/_drawing.py +82 -0
- sc2nachos-0.1.0/src/sc2nachos/debug/_marker.py +23 -0
- sc2nachos-0.1.0/src/sc2nachos/debug/_shapes.py +273 -0
- sc2nachos-0.1.0/src/sc2nachos/events/__init__.py +136 -0
- sc2nachos-0.1.0/src/sc2nachos/events/_done.py +14 -0
- sc2nachos-0.1.0/src/sc2nachos/events/_event.py +527 -0
- sc2nachos-0.1.0/src/sc2nachos/events/_event_bus.py +282 -0
- sc2nachos-0.1.0/src/sc2nachos/events/_event_filter.py +49 -0
- sc2nachos-0.1.0/src/sc2nachos/events/_event_meta.py +16 -0
- sc2nachos-0.1.0/src/sc2nachos/events/_event_priority.py +16 -0
- sc2nachos-0.1.0/src/sc2nachos/events/_event_subscriber.py +77 -0
- sc2nachos-0.1.0/src/sc2nachos/events/_event_subscriptions.py +166 -0
- sc2nachos-0.1.0/src/sc2nachos/events/_handler.py +77 -0
- sc2nachos-0.1.0/src/sc2nachos/events/_handler_timing.py +22 -0
- sc2nachos-0.1.0/src/sc2nachos/extensions/__init__.py +5 -0
- sc2nachos-0.1.0/src/sc2nachos/extensions/speed_mining.py +723 -0
- sc2nachos-0.1.0/src/sc2nachos/extensions/upgrade_inference.py +164 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/__init__.py +34 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_ability_data.py +359 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_cost.py +75 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_creep_requirement.py +15 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_effect_data.py +30 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_footprints.py +281 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_game_data.py +294 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_missing_attacks.py +152 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_repair_steps.py +27 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_resources.py +61 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_sent_as.py +17 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_tech.py +55 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_tech_requirements.py +25 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_techtree/__init__.py +40 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_techtree/_build_75689.py +5125 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_techtree/_overrides.py +354 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_techtree/_tech_tree.py +109 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_turning.py +125 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_unit_type_data.py +344 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_unit_type_upgrade.py +54 -0
- sc2nachos-0.1.0/src/sc2nachos/gamedata/_upgrade_data.py +69 -0
- sc2nachos-0.1.0/src/sc2nachos/gamemap/__init__.py +15 -0
- sc2nachos-0.1.0/src/sc2nachos/gamemap/_errors.py +11 -0
- sc2nachos-0.1.0/src/sc2nachos/gamemap/_expansion.py +358 -0
- sc2nachos-0.1.0/src/sc2nachos/gamemap/_expansion_locations.py +76 -0
- sc2nachos-0.1.0/src/sc2nachos/gamemap/_game_map.py +227 -0
- sc2nachos-0.1.0/src/sc2nachos/gamemap/_image_data.py +38 -0
- sc2nachos-0.1.0/src/sc2nachos/gamemap/_ramp.py +97 -0
- sc2nachos-0.1.0/src/sc2nachos/gametime/__init__.py +20 -0
- sc2nachos-0.1.0/src/sc2nachos/gametime/_game_speed.py +12 -0
- sc2nachos-0.1.0/src/sc2nachos/gametime/_game_time.py +239 -0
- sc2nachos-0.1.0/src/sc2nachos/gametime/_time_series.py +358 -0
- sc2nachos-0.1.0/src/sc2nachos/geometry/__init__.py +28 -0
- sc2nachos-0.1.0/src/sc2nachos/geometry/_area.py +71 -0
- sc2nachos-0.1.0/src/sc2nachos/geometry/_circle.py +153 -0
- sc2nachos-0.1.0/src/sc2nachos/geometry/_direction.py +41 -0
- sc2nachos-0.1.0/src/sc2nachos/geometry/_footprint.py +163 -0
- sc2nachos-0.1.0/src/sc2nachos/geometry/_grid.py +626 -0
- sc2nachos-0.1.0/src/sc2nachos/geometry/_point.py +310 -0
- sc2nachos-0.1.0/src/sc2nachos/geometry/_shapes.py +532 -0
- sc2nachos-0.1.0/src/sc2nachos/geometry/_tile_path.py +114 -0
- sc2nachos-0.1.0/src/sc2nachos/ids/__init__.py +21 -0
- sc2nachos-0.1.0/src/sc2nachos/ids/_id_enum.py +76 -0
- sc2nachos-0.1.0/src/sc2nachos/ids/ability.py +535 -0
- sc2nachos-0.1.0/src/sc2nachos/ids/buff.py +73 -0
- sc2nachos-0.1.0/src/sc2nachos/ids/effect.py +26 -0
- sc2nachos-0.1.0/src/sc2nachos/ids/raw/__init__.py +15 -0
- sc2nachos-0.1.0/src/sc2nachos/ids/raw/ability.py +4145 -0
- sc2nachos-0.1.0/src/sc2nachos/ids/raw/buff.py +314 -0
- sc2nachos-0.1.0/src/sc2nachos/ids/raw/effect.py +24 -0
- sc2nachos-0.1.0/src/sc2nachos/ids/raw/unit_type.py +2016 -0
- sc2nachos-0.1.0/src/sc2nachos/ids/raw/upgrade.py +317 -0
- sc2nachos-0.1.0/src/sc2nachos/ids/unit_type.py +299 -0
- sc2nachos-0.1.0/src/sc2nachos/ids/upgrade.py +101 -0
- sc2nachos-0.1.0/src/sc2nachos/match/__init__.py +20 -0
- sc2nachos-0.1.0/src/sc2nachos/match/_enemy.py +204 -0
- sc2nachos-0.1.0/src/sc2nachos/match/_errors.py +7 -0
- sc2nachos-0.1.0/src/sc2nachos/match/_match.py +111 -0
- sc2nachos-0.1.0/src/sc2nachos/match/_player.py +59 -0
- sc2nachos-0.1.0/src/sc2nachos/orders/__init__.py +9 -0
- sc2nachos-0.1.0/src/sc2nachos/orders/_commands.py +68 -0
- sc2nachos-0.1.0/src/sc2nachos/orders/_order.py +85 -0
- sc2nachos-0.1.0/src/sc2nachos/orders/_order_book.py +413 -0
- sc2nachos-0.1.0/src/sc2nachos/orders/_targets.py +67 -0
- sc2nachos-0.1.0/src/sc2nachos/pathing/__init__.py +5 -0
- sc2nachos-0.1.0/src/sc2nachos/pathing/_pathing.py +140 -0
- sc2nachos-0.1.0/src/sc2nachos/placement/__init__.py +7 -0
- sc2nachos-0.1.0/src/sc2nachos/placement/_build_sites.py +134 -0
- sc2nachos-0.1.0/src/sc2nachos/placement/_placement_grids.py +306 -0
- sc2nachos-0.1.0/src/sc2nachos/placement/_placement_reservation.py +75 -0
- sc2nachos-0.1.0/src/sc2nachos/placement/_townhall_zones.py +30 -0
- sc2nachos-0.1.0/src/sc2nachos/placement/_walls.py +119 -0
- sc2nachos-0.1.0/src/sc2nachos/protocol/__init__.py +35 -0
- sc2nachos-0.1.0/src/sc2nachos/protocol/_client.py +374 -0
- sc2nachos-0.1.0/src/sc2nachos/protocol/_errors.py +24 -0
- sc2nachos-0.1.0/src/sc2nachos/protocol/_permissive_playback_transport.py +163 -0
- sc2nachos-0.1.0/src/sc2nachos/protocol/_ports.py +32 -0
- sc2nachos-0.1.0/src/sc2nachos/protocol/_recording.py +201 -0
- sc2nachos-0.1.0/src/sc2nachos/protocol/_status.py +20 -0
- sc2nachos-0.1.0/src/sc2nachos/protocol/_transport.py +21 -0
- sc2nachos-0.1.0/src/sc2nachos/protocol/_websocket.py +96 -0
- sc2nachos-0.1.0/src/sc2nachos/run/__init__.py +31 -0
- sc2nachos-0.1.0/src/sc2nachos/run/_command_line_arguments.py +168 -0
- sc2nachos-0.1.0/src/sc2nachos/run/_game_process.py +169 -0
- sc2nachos-0.1.0/src/sc2nachos/run/_installation.py +161 -0
- sc2nachos-0.1.0/src/sc2nachos/run/_map_file.py +68 -0
- sc2nachos-0.1.0/src/sc2nachos/run/_runners.py +465 -0
- sc2nachos-0.1.0/src/sc2nachos/state/__init__.py +31 -0
- sc2nachos-0.1.0/src/sc2nachos/state/_action_result.py +247 -0
- sc2nachos-0.1.0/src/sc2nachos/state/_actions.py +168 -0
- sc2nachos-0.1.0/src/sc2nachos/state/_alert.py +76 -0
- sc2nachos-0.1.0/src/sc2nachos/state/_effect.py +43 -0
- sc2nachos-0.1.0/src/sc2nachos/state/_in_production.py +41 -0
- sc2nachos-0.1.0/src/sc2nachos/state/_production.py +129 -0
- sc2nachos-0.1.0/src/sc2nachos/state/_research.py +32 -0
- sc2nachos-0.1.0/src/sc2nachos/state/_score.py +160 -0
- sc2nachos-0.1.0/src/sc2nachos/state/_state.py +140 -0
- sc2nachos-0.1.0/src/sc2nachos/state/_supply.py +26 -0
- sc2nachos-0.1.0/src/sc2nachos/state/_ui_unit_counts.py +19 -0
- sc2nachos-0.1.0/src/sc2nachos/testing/__init__.py +8 -0
- sc2nachos-0.1.0/src/sc2nachos/testing/_made_up_units.py +70 -0
- sc2nachos-0.1.0/src/sc2nachos/testing/_shipped_game_data.py +31 -0
- sc2nachos-0.1.0/src/sc2nachos/testing/_unit_report.py +160 -0
- sc2nachos-0.1.0/src/sc2nachos/testing/game_data_75689.binpb.xz +0 -0
- sc2nachos-0.1.0/src/sc2nachos/units/__init__.py +38 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_errors.py +11 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_own_unit.py +230 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_snapshot.py +21 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_tracking/__init__.py +6 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_tracking/_builder_tracker.py +171 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_tracking/_tracker.py +108 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_tracking/_tracker_changes.py +104 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_tracking/_unit_comparer.py +119 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_tracking/_unit_tracker.py +379 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_tracking/_unit_watcher.py +80 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_tracking/_upgrade_level_reader.py +79 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_tracking/_upgrade_tracker.py +101 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_tracking/_watches.py +184 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_unit.py +990 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_unit_dict.py +149 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_unit_type.py +1098 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_units.py +521 -0
- sc2nachos-0.1.0/src/sc2nachos/units/_values.py +202 -0
- sc2nachos-0.1.0/tests/conftest.py +17 -0
- sc2nachos-0.1.0/tests/corpus/IncorporealAIE_v4-PvZ.sc2rec +0 -0
- sc2nachos-0.1.0/tests/corpus/LeyLinesAIE_v3-ZvP.sc2rec +0 -0
- sc2nachos-0.1.0/tests/corpus/MagannathaAIE_v2-TvT.sc2rec +0 -0
- sc2nachos-0.1.0/tests/corpus/PersephoneAIE_v4-PvT.sc2rec +0 -0
- sc2nachos-0.1.0/tests/corpus/PylonAIE_v4-TvZ.sc2rec +0 -0
- sc2nachos-0.1.0/tests/corpus/TorchesAIE_v4-TvP.sc2rec +0 -0
- sc2nachos-0.1.0/tests/corpus/UltraloveAIE_v2-ZvT.sc2rec +0 -0
- sc2nachos-0.1.0/tests/support.py +559 -0
- sc2nachos-0.1.0/tests/test_api.py +1074 -0
- sc2nachos-0.1.0/tests/test_camera.py +144 -0
- sc2nachos-0.1.0/tests/test_chat.py +118 -0
- sc2nachos-0.1.0/tests/test_combat.py +387 -0
- sc2nachos-0.1.0/tests/test_corpus.py +305 -0
- sc2nachos-0.1.0/tests/test_debug.py +776 -0
- sc2nachos-0.1.0/tests/test_demo_bot.py +44 -0
- sc2nachos-0.1.0/tests/test_errors.py +52 -0
- sc2nachos-0.1.0/tests/test_events.py +1081 -0
- sc2nachos-0.1.0/tests/test_expansions.py +732 -0
- sc2nachos-0.1.0/tests/test_extensions.py +222 -0
- sc2nachos-0.1.0/tests/test_fog_off_playback.py +174 -0
- sc2nachos-0.1.0/tests/test_footprints.py +16 -0
- sc2nachos-0.1.0/tests/test_game_time.py +307 -0
- sc2nachos-0.1.0/tests/test_gamedata.py +1112 -0
- sc2nachos-0.1.0/tests/test_gamemap.py +396 -0
- sc2nachos-0.1.0/tests/test_geometry.py +1012 -0
- sc2nachos-0.1.0/tests/test_geometry_footprint.py +160 -0
- sc2nachos-0.1.0/tests/test_geometry_grid.py +879 -0
- sc2nachos-0.1.0/tests/test_geometry_path.py +145 -0
- sc2nachos-0.1.0/tests/test_ids.py +185 -0
- sc2nachos-0.1.0/tests/test_launch.py +394 -0
- sc2nachos-0.1.0/tests/test_made_up_units.py +261 -0
- sc2nachos-0.1.0/tests/test_match.py +57 -0
- sc2nachos-0.1.0/tests/test_orders.py +1866 -0
- sc2nachos-0.1.0/tests/test_package.py +112 -0
- sc2nachos-0.1.0/tests/test_pathing.py +287 -0
- sc2nachos-0.1.0/tests/test_placement.py +1037 -0
- sc2nachos-0.1.0/tests/test_players.py +213 -0
- sc2nachos-0.1.0/tests/test_protocol.py +1018 -0
- sc2nachos-0.1.0/tests/test_repair_steps.py +104 -0
- sc2nachos-0.1.0/tests/test_reporter.py +1696 -0
- sc2nachos-0.1.0/tests/test_run.py +1171 -0
- sc2nachos-0.1.0/tests/test_speed_mining.py +1193 -0
- sc2nachos-0.1.0/tests/test_state.py +679 -0
- sc2nachos-0.1.0/tests/test_tech_tree.py +786 -0
- sc2nachos-0.1.0/tests/test_turning.py +207 -0
- sc2nachos-0.1.0/tests/test_unit_dict.py +105 -0
- sc2nachos-0.1.0/tests/test_unit_types.py +373 -0
- sc2nachos-0.1.0/tests/test_units.py +1795 -0
- sc2nachos-0.1.0/tests/test_units_collection.py +573 -0
- sc2nachos-0.1.0/tests/test_upgrade_inference.py +421 -0
- sc2nachos-0.1.0/tests/test_upgrades.py +713 -0
- sc2nachos-0.1.0/tests/test_util_timeseries.py +527 -0
- sc2nachos-0.1.0/tools/README.md +36 -0
- sc2nachos-0.1.0/tools/_sandbox.py +317 -0
- sc2nachos-0.1.0/tools/api_reference_templates/module.html.jinja2 +11 -0
- sc2nachos-0.1.0/tools/build_api_reference.py +56 -0
- sc2nachos-0.1.0/tools/generate_action_results.py +71 -0
- sc2nachos-0.1.0/tools/generate_footprints.py +190 -0
- sc2nachos-0.1.0/tools/generate_ids.py +125 -0
- sc2nachos-0.1.0/tools/generate_repair_steps.py +96 -0
- sc2nachos-0.1.0/tools/generate_tech_tree.py +722 -0
- sc2nachos-0.1.0/tools/generate_turning.py +273 -0
- sc2nachos-0.1.0/tools/generate_unit_types.py +399 -0
- sc2nachos-0.1.0/tools/list_multiline_docstrings.py +40 -0
- sc2nachos-0.1.0/tools/record_corpus.py +95 -0
- sc2nachos-0.1.0/tools/show_ramps.py +134 -0
- sc2nachos-0.1.0/tools/sweep_alerts.py +1057 -0
- sc2nachos-0.1.0/tools/sweep_buffs.py +423 -0
- sc2nachos-0.1.0/tools/sweep_combat.py +1216 -0
- sc2nachos-0.1.0/tools/sweep_fog.py +220 -0
- sc2nachos-0.1.0/tools/sweep_movement.py +725 -0
- sc2nachos-0.1.0/tools/sweep_orders.py +5377 -0
- sc2nachos-0.1.0/tools/sweep_pathing.py +724 -0
- sc2nachos-0.1.0/tools/sweep_placement.py +704 -0
- sc2nachos-0.1.0/tools/sweep_repair.py +480 -0
- sc2nachos-0.1.0/tools/sweep_replays.py +949 -0
- sc2nachos-0.1.0/tools/sweep_requests.py +919 -0
- sc2nachos-0.1.0/tools/sweep_tech_tree.py +1378 -0
- sc2nachos-0.1.0/tools/sweep_timed_life.py +327 -0
- sc2nachos-0.1.0/tools/sweep_townhall_placement.py +302 -0
- sc2nachos-0.1.0/tools/sweep_turning.py +523 -0
- sc2nachos-0.1.0/tools/sweep_upgrades.py +311 -0
- sc2nachos-0.1.0/tools/sweep_walls.py +329 -0
- sc2nachos-0.1.0/tools/write_shipped_game_data.py +41 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.idea
|
|
2
|
+
.vscode
|
|
3
|
+
.claude/*
|
|
4
|
+
!.claude/CLAUDE.md
|
|
5
|
+
!.claude/plans/
|
|
6
|
+
.env
|
|
7
|
+
|
|
8
|
+
__pycache__/
|
|
9
|
+
*.py[cod]
|
|
10
|
+
*.egg-info/
|
|
11
|
+
build/
|
|
12
|
+
dist/
|
|
13
|
+
# Written by hatch-vcs from the git tag.
|
|
14
|
+
src/sc2nachos/__about__.py
|
|
15
|
+
|
|
16
|
+
.venv/
|
|
17
|
+
.pytest_cache/
|
|
18
|
+
.ruff_cache/
|
|
19
|
+
.coverage
|
|
20
|
+
htmlcov/
|
sc2nachos-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Max Nusspickel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
sc2nachos-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
NachOS (sc2nachos)
|
|
2
|
+
Copyright (c) 2026 Max Nusspickel
|
|
3
|
+
|
|
4
|
+
This product is an independent reimplementation of a StarCraft II client API.
|
|
5
|
+
It is not a clean-room implementation: python-sc2 was read and used as a
|
|
6
|
+
reference during development, and portions of this library are derived from or
|
|
7
|
+
directly informed by it.
|
|
8
|
+
|
|
9
|
+
-------------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
python-sc2
|
|
12
|
+
https://github.com/BurnySc2/python-sc2
|
|
13
|
+
|
|
14
|
+
MIT License
|
|
15
|
+
|
|
16
|
+
Copyright (c) 2017 Hannes Karppila
|
|
17
|
+
|
|
18
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
19
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
20
|
+
in the Software without restriction, including without limitation the rights
|
|
21
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
22
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
23
|
+
furnished to do so, subject to the following conditions:
|
|
24
|
+
|
|
25
|
+
The above copyright notice and this permission notice shall be included in all
|
|
26
|
+
copies or substantial portions of the Software.
|
|
27
|
+
|
|
28
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
29
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
31
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
32
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
33
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
34
|
+
SOFTWARE.
|
|
35
|
+
|
|
36
|
+
-------------------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
StarCraft II Client Protocol
|
|
39
|
+
https://github.com/Blizzard/s2client-proto
|
|
40
|
+
|
|
41
|
+
Protocol definitions are consumed via the pys2clientprotocol package. StarCraft
|
|
42
|
+
II and its API are the property of Blizzard Entertainment, Inc. Use of the
|
|
43
|
+
StarCraft II client is subject to the AI and Machine Learning License at
|
|
44
|
+
https://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html
|
|
45
|
+
|
|
46
|
+
Identifier data generated from the game's stableid.json is derived from
|
|
47
|
+
StarCraft II game data and remains the property of Blizzard Entertainment, Inc.
|
sc2nachos-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sc2nachos
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: NachOS — an event-driven StarCraft II bot API for Python
|
|
5
|
+
Project-URL: Homepage, https://github.com/maxnus/NachOS
|
|
6
|
+
Project-URL: Repository, https://github.com/maxnus/NachOS
|
|
7
|
+
Project-URL: Documentation, https://maxnus.github.io/NachOS/
|
|
8
|
+
Author-email: Max Nusspickel <max.nusspickel@gmail.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: NOTICE
|
|
12
|
+
Keywords: AI,Bot,StarCraft,StarCraft 2,StarCraft II
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Games/Entertainment :: Real Time Strategy
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Requires-Dist: loguru>=0.7
|
|
22
|
+
Requires-Dist: numpy>=2.0
|
|
23
|
+
Requires-Dist: pys2clientprotocol>=1.0.2
|
|
24
|
+
Requires-Dist: scipy>=1.14
|
|
25
|
+
Requires-Dist: semita>=0.2.1
|
|
26
|
+
Requires-Dist: websocket-client>=1.9
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pdoc>=15; extra == 'dev'
|
|
29
|
+
Requires-Dist: pyright>=1.1.390; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff>=0.8; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# NachOS
|
|
35
|
+
|
|
36
|
+
An event-driven StarCraft II bot API for Python, built directly on the
|
|
37
|
+
[StarCraft II client protocol](https://github.com/Blizzard/s2client-proto).
|
|
38
|
+
|
|
39
|
+
> **Status: alpha.** The Terran bot [AvocaDOS](https://github.com/maxnus/AvocaDOS) has played on the
|
|
40
|
+
> [AI Arena](https://aiarena.net/) ladder on NachOS since its version 1.4.0. Until NachOS 1.0, a release may still
|
|
41
|
+
> change the API.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install sc2nachos
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
import sc2nachos
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
NachOS needs Python 3.12 or later. The distribution and the import name are both `sc2nachos`. The project is called
|
|
52
|
+
NachOS; the bare `nachos` name on PyPI belongs to an unrelated project.
|
|
53
|
+
|
|
54
|
+
## Getting started
|
|
55
|
+
|
|
56
|
+
1. **Install StarCraft II.** On Linux, download Blizzard's headless client from
|
|
57
|
+
[s2client-proto](https://github.com/Blizzard/s2client-proto#downloads): NachOS is tested against its 4.10 build,
|
|
58
|
+
75689, the one the AI Arena ladder plays, and `run_local` logs a warning for any other. On Windows and macOS,
|
|
59
|
+
Battle.net installs the current build, free to play, which NachOS is not tested on. NachOS finds the game through
|
|
60
|
+
`SC2PATH`, then where the launcher recorded it, then where the platform installs it by default:
|
|
61
|
+
`C:\Program Files (x86)\StarCraft II`, `/Applications/StarCraft II` or `~/StarCraftII`.
|
|
62
|
+
2. **Add the maps.** NachOS finds a map by its name anywhere under the game's `Maps` folder, so a folder of maps can
|
|
63
|
+
go in as it is. [`sc2maps/AIE`](https://github.com/maxnus/NachOS/tree/main/sc2maps/AIE) holds the AI Arena
|
|
64
|
+
ladder's maps that NachOS is tested on.
|
|
65
|
+
3. **Play a game.** [`examples/demo_bot.py`](https://github.com/maxnus/NachOS/blob/main/examples/demo_bot.py) is a
|
|
66
|
+
whole bot in one file: a Terran that trains SCVs, expands and attacks with marines, and beats the built-in computer
|
|
67
|
+
at medium difficulty. Save it and run:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
python demo_bot.py --Map PylonAIE_v4 --ComputerRace ZERG --ComputerDifficulty MEDIUM
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## What NachOS has
|
|
74
|
+
|
|
75
|
+
- **Units**: `api.units`, this player's, the enemy's and the map's, remembered structures included, selected by
|
|
76
|
+
[type group](https://maxnus.github.io/NachOS/sc2nachos/units.html#UnitType), alliance and distance; and a bot's own
|
|
77
|
+
data for each unit in a [`UnitDict`](https://maxnus.github.io/NachOS/sc2nachos/units.html#UnitDict), which forgets a
|
|
78
|
+
unit once it dies.
|
|
79
|
+
- **Events** for what happens in a game, from a unit's death to an upgrade finishing, each subscribed to with
|
|
80
|
+
`api.on` ([guide](https://github.com/maxnus/NachOS/blob/main/docs/events.md)).
|
|
81
|
+
- **Orders** through `api.orders.issue`, with what the game refused listed in `api.action_failures` on the next turn
|
|
82
|
+
([guide](https://github.com/maxnus/NachOS/blob/main/docs/orders.md)).
|
|
83
|
+
- **The game's data**: `api.data`, every unit type, ability, upgrade and weapon from the game's tables, with the tech
|
|
84
|
+
tree, the structures' footprints and what the tables leave out, measured in the game
|
|
85
|
+
([reference](https://maxnus.github.io/NachOS/sc2nachos/gamedata.html)).
|
|
86
|
+
- **The map**: `api.map`'s heights, ramps and start locations, `api.expansions`, and each player's `start_location`
|
|
87
|
+
with its main's ramp, its ground, its natural and its thirds
|
|
88
|
+
([reference](https://maxnus.github.io/NachOS/sc2nachos/gamemap.html)).
|
|
89
|
+
- **Placement**: `api.placement`, where a structure may stand now, sites kept for builds to come, and the walls at a
|
|
90
|
+
main's ramp ([reference](https://maxnus.github.io/NachOS/sc2nachos/placement.html)).
|
|
91
|
+
- **Pathing**: `api.pathing`, the cheapest paths on the game's current pathing grid, and the game's own distances
|
|
92
|
+
([reference](https://maxnus.github.io/NachOS/sc2nachos/pathing.html)).
|
|
93
|
+
- **Combat reads** on a unit: the weapon that can hit a target, whether it is in range, one attack's damage and the
|
|
94
|
+
damage per second.
|
|
95
|
+
- **Debugging**: drawing on the game's screen, cheats and creating units
|
|
96
|
+
([guide](https://github.com/maxnus/NachOS/blob/main/docs/debugging.md)).
|
|
97
|
+
- **Running** a game against the built-in computer, on the ladder, and on GitHub Actions
|
|
98
|
+
([ladder](https://github.com/maxnus/NachOS/blob/main/docs/ladder.md),
|
|
99
|
+
[GitHub Actions](https://github.com/maxnus/NachOS/blob/main/docs/github-actions.md)).
|
|
100
|
+
- **Recordings and replays**: a game recorded and played back through a bot with no game client, and a replay played
|
|
101
|
+
back as one of its players saw it ([replays](https://github.com/maxnus/NachOS/blob/main/docs/replays.md)).
|
|
102
|
+
- **Testing**: `sc2nachos.testing` makes units for a bot's unit tests
|
|
103
|
+
([guide](https://github.com/maxnus/NachOS/blob/main/docs/testing.md)).
|
|
104
|
+
- **Extensions**: features a bot opts into, NachOS's or anyone's, which the api builds once the game starts and holds
|
|
105
|
+
as `api.extensions`. NachOS's own are speed mining and upgrade inference
|
|
106
|
+
([guide](https://github.com/maxnus/NachOS/blob/main/docs/extensions.md)).
|
|
107
|
+
|
|
108
|
+
## Design
|
|
109
|
+
|
|
110
|
+
**You instantiate the API. You do not subclass it, and your bot does not live inside it.** NachOS exposes an
|
|
111
|
+
`Api` that owns the client, game state, game data, units, orders and event handlers. Construct one and reach it
|
|
112
|
+
however suits your bot — most bots will want a module-level singleton:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
# my_bot/api.py
|
|
116
|
+
from sc2nachos import Api
|
|
117
|
+
|
|
118
|
+
api = Api()
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
# my_bot/economy.py — anywhere else in your bot
|
|
123
|
+
from sc2nachos import GameTime
|
|
124
|
+
from sc2nachos.events import TurnEvent
|
|
125
|
+
|
|
126
|
+
from my_bot.api import api
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@api.on(TurnEvent, min_interval=GameTime(steps=4))
|
|
130
|
+
def manage_workers(event):
|
|
131
|
+
for worker in api.units.own.workers.idle:
|
|
132
|
+
...
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
NachOS itself never creates or exposes a singleton and holds no module-level mutable state. The singleton is your
|
|
136
|
+
choice, confined to one line of your own code. An api plays one game, so a bot plays a game per process, as on a
|
|
137
|
+
ladder, and two bots playing each other run in a process each. A program that plays several games in one process,
|
|
138
|
+
such as a script reading replays, makes an api for each.
|
|
139
|
+
|
|
140
|
+
Your own helpers live in your own modules, as ordinary functions and objects, and there is no mixin to inherit. A
|
|
141
|
+
feature a bot opts into, NachOS's or anyone's, is an extension: `Api(extensions=Extensions)` builds the bot's own
|
|
142
|
+
object holding its extensions once the game starts, and `api.extensions` holds it
|
|
143
|
+
([extensions](https://github.com/maxnus/NachOS/blob/main/docs/extensions.md)). If you want to subclass so you can
|
|
144
|
+
hang a helper off `api`, that is a gap in NachOS, not a pattern to follow — please open an issue.
|
|
145
|
+
|
|
146
|
+
`Api()` is cheap and needs no live connection, so you can construct it at import time and register handlers as
|
|
147
|
+
your modules load. Connecting happens later, in the runner:
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from sc2nachos import Computer, Difficulty, Race, run_local
|
|
151
|
+
|
|
152
|
+
run_local("PylonAIE_v4", api, Computer(Race.ZERG, Difficulty.VERY_HARD), race=Race.TERRAN)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Documentation
|
|
156
|
+
|
|
157
|
+
- [API reference](https://maxnus.github.io/NachOS/): every public module, class and function, from its docstrings,
|
|
158
|
+
for the latest release.
|
|
159
|
+
- [Events](https://github.com/maxnus/NachOS/blob/main/docs/events.md): every event a game hands out, and how to
|
|
160
|
+
subscribe to only some of them.
|
|
161
|
+
- [Orders](https://github.com/maxnus/NachOS/blob/main/docs/orders.md): how a bot orders its units, and what it learns
|
|
162
|
+
about each order.
|
|
163
|
+
- [Debugging](https://github.com/maxnus/NachOS/blob/main/docs/debugging.md): drawing on the game's screen, cheats, and
|
|
164
|
+
creating units.
|
|
165
|
+
- [Extensions](https://github.com/maxnus/NachOS/blob/main/docs/extensions.md): features a bot opts into, how to use
|
|
166
|
+
one and how to write one.
|
|
167
|
+
- [Running StarCraft II on GitHub Actions](https://github.com/maxnus/NachOS/blob/main/docs/github-actions.md): playing
|
|
168
|
+
matches in a bot repository's workflows.
|
|
169
|
+
- [Playing on the ladder](https://github.com/maxnus/NachOS/blob/main/docs/ladder.md): one script for the ladder and
|
|
170
|
+
for local games, and what the ladder passes.
|
|
171
|
+
- [Testing a bot](https://github.com/maxnus/NachOS/blob/main/docs/testing.md): making units for a unit test, and
|
|
172
|
+
playing a bot through a recorded game, with no game client.
|
|
173
|
+
- [Playing back a replay](https://github.com/maxnus/NachOS/blob/main/docs/replays.md): a replay played through an api
|
|
174
|
+
as one of its players saw the game, with every unit besides if the fog is off, and recorded to play again with no
|
|
175
|
+
game client.
|
|
176
|
+
- [Migrating from python-sc2](https://github.com/maxnus/NachOS/blob/main/docs/migrating-from-python-sc2.md): the same
|
|
177
|
+
bot in both, and where a translation goes wrong;
|
|
178
|
+
[python-sc2 and NachOS](https://github.com/maxnus/NachOS/blob/main/docs/reference/python-sc2.md) has every name and
|
|
179
|
+
every difference.
|
|
180
|
+
- [How the game behaves](https://github.com/maxnus/NachOS/blob/main/docs/reference/game-behavior/README.md): what
|
|
181
|
+
StarCraft II was seen to do through the API, by topic, each finding with how it was seen.
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT. See [LICENSE](https://github.com/maxnus/NachOS/blob/main/LICENSE), and
|
|
186
|
+
[NOTICE](https://github.com/maxnus/NachOS/blob/main/NOTICE) for attribution — NachOS is an independent
|
|
187
|
+
reimplementation that used [python-sc2](https://github.com/BurnySc2/python-sc2) (MIT, © 2017 Hannes Karppila) as a
|
|
188
|
+
reference.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# NachOS
|
|
2
|
+
|
|
3
|
+
An event-driven StarCraft II bot API for Python, built directly on the
|
|
4
|
+
[StarCraft II client protocol](https://github.com/Blizzard/s2client-proto).
|
|
5
|
+
|
|
6
|
+
> **Status: alpha.** The Terran bot [AvocaDOS](https://github.com/maxnus/AvocaDOS) has played on the
|
|
7
|
+
> [AI Arena](https://aiarena.net/) ladder on NachOS since its version 1.4.0. Until NachOS 1.0, a release may still
|
|
8
|
+
> change the API.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install sc2nachos
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
import sc2nachos
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
NachOS needs Python 3.12 or later. The distribution and the import name are both `sc2nachos`. The project is called
|
|
19
|
+
NachOS; the bare `nachos` name on PyPI belongs to an unrelated project.
|
|
20
|
+
|
|
21
|
+
## Getting started
|
|
22
|
+
|
|
23
|
+
1. **Install StarCraft II.** On Linux, download Blizzard's headless client from
|
|
24
|
+
[s2client-proto](https://github.com/Blizzard/s2client-proto#downloads): NachOS is tested against its 4.10 build,
|
|
25
|
+
75689, the one the AI Arena ladder plays, and `run_local` logs a warning for any other. On Windows and macOS,
|
|
26
|
+
Battle.net installs the current build, free to play, which NachOS is not tested on. NachOS finds the game through
|
|
27
|
+
`SC2PATH`, then where the launcher recorded it, then where the platform installs it by default:
|
|
28
|
+
`C:\Program Files (x86)\StarCraft II`, `/Applications/StarCraft II` or `~/StarCraftII`.
|
|
29
|
+
2. **Add the maps.** NachOS finds a map by its name anywhere under the game's `Maps` folder, so a folder of maps can
|
|
30
|
+
go in as it is. [`sc2maps/AIE`](https://github.com/maxnus/NachOS/tree/main/sc2maps/AIE) holds the AI Arena
|
|
31
|
+
ladder's maps that NachOS is tested on.
|
|
32
|
+
3. **Play a game.** [`examples/demo_bot.py`](https://github.com/maxnus/NachOS/blob/main/examples/demo_bot.py) is a
|
|
33
|
+
whole bot in one file: a Terran that trains SCVs, expands and attacks with marines, and beats the built-in computer
|
|
34
|
+
at medium difficulty. Save it and run:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
python demo_bot.py --Map PylonAIE_v4 --ComputerRace ZERG --ComputerDifficulty MEDIUM
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## What NachOS has
|
|
41
|
+
|
|
42
|
+
- **Units**: `api.units`, this player's, the enemy's and the map's, remembered structures included, selected by
|
|
43
|
+
[type group](https://maxnus.github.io/NachOS/sc2nachos/units.html#UnitType), alliance and distance; and a bot's own
|
|
44
|
+
data for each unit in a [`UnitDict`](https://maxnus.github.io/NachOS/sc2nachos/units.html#UnitDict), which forgets a
|
|
45
|
+
unit once it dies.
|
|
46
|
+
- **Events** for what happens in a game, from a unit's death to an upgrade finishing, each subscribed to with
|
|
47
|
+
`api.on` ([guide](https://github.com/maxnus/NachOS/blob/main/docs/events.md)).
|
|
48
|
+
- **Orders** through `api.orders.issue`, with what the game refused listed in `api.action_failures` on the next turn
|
|
49
|
+
([guide](https://github.com/maxnus/NachOS/blob/main/docs/orders.md)).
|
|
50
|
+
- **The game's data**: `api.data`, every unit type, ability, upgrade and weapon from the game's tables, with the tech
|
|
51
|
+
tree, the structures' footprints and what the tables leave out, measured in the game
|
|
52
|
+
([reference](https://maxnus.github.io/NachOS/sc2nachos/gamedata.html)).
|
|
53
|
+
- **The map**: `api.map`'s heights, ramps and start locations, `api.expansions`, and each player's `start_location`
|
|
54
|
+
with its main's ramp, its ground, its natural and its thirds
|
|
55
|
+
([reference](https://maxnus.github.io/NachOS/sc2nachos/gamemap.html)).
|
|
56
|
+
- **Placement**: `api.placement`, where a structure may stand now, sites kept for builds to come, and the walls at a
|
|
57
|
+
main's ramp ([reference](https://maxnus.github.io/NachOS/sc2nachos/placement.html)).
|
|
58
|
+
- **Pathing**: `api.pathing`, the cheapest paths on the game's current pathing grid, and the game's own distances
|
|
59
|
+
([reference](https://maxnus.github.io/NachOS/sc2nachos/pathing.html)).
|
|
60
|
+
- **Combat reads** on a unit: the weapon that can hit a target, whether it is in range, one attack's damage and the
|
|
61
|
+
damage per second.
|
|
62
|
+
- **Debugging**: drawing on the game's screen, cheats and creating units
|
|
63
|
+
([guide](https://github.com/maxnus/NachOS/blob/main/docs/debugging.md)).
|
|
64
|
+
- **Running** a game against the built-in computer, on the ladder, and on GitHub Actions
|
|
65
|
+
([ladder](https://github.com/maxnus/NachOS/blob/main/docs/ladder.md),
|
|
66
|
+
[GitHub Actions](https://github.com/maxnus/NachOS/blob/main/docs/github-actions.md)).
|
|
67
|
+
- **Recordings and replays**: a game recorded and played back through a bot with no game client, and a replay played
|
|
68
|
+
back as one of its players saw it ([replays](https://github.com/maxnus/NachOS/blob/main/docs/replays.md)).
|
|
69
|
+
- **Testing**: `sc2nachos.testing` makes units for a bot's unit tests
|
|
70
|
+
([guide](https://github.com/maxnus/NachOS/blob/main/docs/testing.md)).
|
|
71
|
+
- **Extensions**: features a bot opts into, NachOS's or anyone's, which the api builds once the game starts and holds
|
|
72
|
+
as `api.extensions`. NachOS's own are speed mining and upgrade inference
|
|
73
|
+
([guide](https://github.com/maxnus/NachOS/blob/main/docs/extensions.md)).
|
|
74
|
+
|
|
75
|
+
## Design
|
|
76
|
+
|
|
77
|
+
**You instantiate the API. You do not subclass it, and your bot does not live inside it.** NachOS exposes an
|
|
78
|
+
`Api` that owns the client, game state, game data, units, orders and event handlers. Construct one and reach it
|
|
79
|
+
however suits your bot — most bots will want a module-level singleton:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
# my_bot/api.py
|
|
83
|
+
from sc2nachos import Api
|
|
84
|
+
|
|
85
|
+
api = Api()
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
# my_bot/economy.py — anywhere else in your bot
|
|
90
|
+
from sc2nachos import GameTime
|
|
91
|
+
from sc2nachos.events import TurnEvent
|
|
92
|
+
|
|
93
|
+
from my_bot.api import api
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@api.on(TurnEvent, min_interval=GameTime(steps=4))
|
|
97
|
+
def manage_workers(event):
|
|
98
|
+
for worker in api.units.own.workers.idle:
|
|
99
|
+
...
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
NachOS itself never creates or exposes a singleton and holds no module-level mutable state. The singleton is your
|
|
103
|
+
choice, confined to one line of your own code. An api plays one game, so a bot plays a game per process, as on a
|
|
104
|
+
ladder, and two bots playing each other run in a process each. A program that plays several games in one process,
|
|
105
|
+
such as a script reading replays, makes an api for each.
|
|
106
|
+
|
|
107
|
+
Your own helpers live in your own modules, as ordinary functions and objects, and there is no mixin to inherit. A
|
|
108
|
+
feature a bot opts into, NachOS's or anyone's, is an extension: `Api(extensions=Extensions)` builds the bot's own
|
|
109
|
+
object holding its extensions once the game starts, and `api.extensions` holds it
|
|
110
|
+
([extensions](https://github.com/maxnus/NachOS/blob/main/docs/extensions.md)). If you want to subclass so you can
|
|
111
|
+
hang a helper off `api`, that is a gap in NachOS, not a pattern to follow — please open an issue.
|
|
112
|
+
|
|
113
|
+
`Api()` is cheap and needs no live connection, so you can construct it at import time and register handlers as
|
|
114
|
+
your modules load. Connecting happens later, in the runner:
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from sc2nachos import Computer, Difficulty, Race, run_local
|
|
118
|
+
|
|
119
|
+
run_local("PylonAIE_v4", api, Computer(Race.ZERG, Difficulty.VERY_HARD), race=Race.TERRAN)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Documentation
|
|
123
|
+
|
|
124
|
+
- [API reference](https://maxnus.github.io/NachOS/): every public module, class and function, from its docstrings,
|
|
125
|
+
for the latest release.
|
|
126
|
+
- [Events](https://github.com/maxnus/NachOS/blob/main/docs/events.md): every event a game hands out, and how to
|
|
127
|
+
subscribe to only some of them.
|
|
128
|
+
- [Orders](https://github.com/maxnus/NachOS/blob/main/docs/orders.md): how a bot orders its units, and what it learns
|
|
129
|
+
about each order.
|
|
130
|
+
- [Debugging](https://github.com/maxnus/NachOS/blob/main/docs/debugging.md): drawing on the game's screen, cheats, and
|
|
131
|
+
creating units.
|
|
132
|
+
- [Extensions](https://github.com/maxnus/NachOS/blob/main/docs/extensions.md): features a bot opts into, how to use
|
|
133
|
+
one and how to write one.
|
|
134
|
+
- [Running StarCraft II on GitHub Actions](https://github.com/maxnus/NachOS/blob/main/docs/github-actions.md): playing
|
|
135
|
+
matches in a bot repository's workflows.
|
|
136
|
+
- [Playing on the ladder](https://github.com/maxnus/NachOS/blob/main/docs/ladder.md): one script for the ladder and
|
|
137
|
+
for local games, and what the ladder passes.
|
|
138
|
+
- [Testing a bot](https://github.com/maxnus/NachOS/blob/main/docs/testing.md): making units for a unit test, and
|
|
139
|
+
playing a bot through a recorded game, with no game client.
|
|
140
|
+
- [Playing back a replay](https://github.com/maxnus/NachOS/blob/main/docs/replays.md): a replay played through an api
|
|
141
|
+
as one of its players saw the game, with every unit besides if the fog is off, and recorded to play again with no
|
|
142
|
+
game client.
|
|
143
|
+
- [Migrating from python-sc2](https://github.com/maxnus/NachOS/blob/main/docs/migrating-from-python-sc2.md): the same
|
|
144
|
+
bot in both, and where a translation goes wrong;
|
|
145
|
+
[python-sc2 and NachOS](https://github.com/maxnus/NachOS/blob/main/docs/reference/python-sc2.md) has every name and
|
|
146
|
+
every difference.
|
|
147
|
+
- [How the game behaves](https://github.com/maxnus/NachOS/blob/main/docs/reference/game-behavior/README.md): what
|
|
148
|
+
StarCraft II was seen to do through the API, by topic, each finding with how it was seen.
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
MIT. See [LICENSE](https://github.com/maxnus/NachOS/blob/main/LICENSE), and
|
|
153
|
+
[NOTICE](https://github.com/maxnus/NachOS/blob/main/NOTICE) for attribution — NachOS is an independent
|
|
154
|
+
reimplementation that used [python-sc2](https://github.com/BurnySc2/python-sc2) (MIT, © 2017 Hannes Karppila) as a
|
|
155
|
+
reference.
|