How to Improve Scouting in StarCraft II with Python

10.1K views
•
July 22, 2018
by
sentdex
YouTube video player
How to Improve Scouting in StarCraft II with Python

TL;DR

To enhance scouting in StarCraft II using Python, implement a system that tracks unique unit IDs and their locations with dictionaries. Prioritize scouting by distance from the enemy's starting location and manage unit assignments efficiently to optimize scouting operations. This approach allows for better scout deployment and improved control over scouting resources.

Transcript

what's up everybody and welcome to part 14 of our AI in starcraft 2 with Python tutorials series in the previous video we talked about all the changes that we're gonna be working on and in this video we're gonna be working specifically on improving the scouting so the scouting that we had been doing was pretty stupid and we're gonna make it a littl... Read More

Key Insights

  • 🦾 The content provides a step-by-step guide on improving scouting mechanics in Starcraft 2 using Python programming.
  • 🙃 The code demonstrates how to use dictionaries to track unit IDs and their locations for efficient scouting.
  • âš¾ The tutorial explains how to prioritize scouting locations based on distance to optimize scouting efficiency.

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: How do you improve scouting in the Python AI in StarCraft II tutorial part 14?

Track every scout’s unique unit tag and assigned location in the Scouts and Spots dictionary. Then remove units that no longer exist, fill their vacant spots with new scouts, and visit enemy expansion locations in order of their distance from the enemy start.

Q: What is the purpose of the Scouts and Spots dictionary?

The dictionary maps each scouting unit’s unique tag to its assigned location. This makes it possible to track current scouts, remove those that die, and let replacement scouts take over their locations.

Q: How are enemy expansion locations prioritized for scouting?

The code calculates each expansion location’s distance to the first enemy start location. It uses those distances as dictionary keys, sorts the keys, and iterates through them to prioritize the closest expansions.

Q: How does the code calculate the distance from an expansion to the enemy start?

Each expansion location object calls its distance_to method with self.enemy_start_locations[0]. The resulting distance is stored as the key, while the expansion location object is stored as the value.

Q: Why does the tutorial sort expansion-distance keys separately?

The available StarCraft II Python setup cannot yet rely on Python 3.7 dictionary ordering because of a WebSockets issue mentioned in the tutorial. The code therefore creates a separately sorted list of the distance keys before iterating through the expansion locations.

Q: How does the code detect and remove scouts that no longer exist?

It builds a collection of existing unit tags from self.units and compares those tags with the scouts recorded in Scouts and Spots. Missing tags are added to a removal list and then deleted from the dictionary so another scout can fill the location.

Q: How does the AI choose between a probe and an observer for scouting?

If there are zero ready Robotics Facilities, the scouting unit type is set to probe. Otherwise, the unit type is set to observer.

Q: How many probes or observers can be assigned as scouts?

The probe limit is one because the tutorial does not want every probe sent scouting. For observers, the tutorial sets the limit to 15, while acknowledging uncertainty about that value.

Summary & Key Takeaways

  • The content focuses on improving the scouting functionality in Starcraft 2 using Python programming.

  • The tutorial explains how to track unit IDs and their locations using dictionaries in order to keep track of scouts.

  • The content then demonstrates how to prioritize scouting locations based on distance and send scouts accordingly.


Read in Other Languages (beta)

Share This Summary 📚

Explore More Summaries from sentdex 📚