google-deepmind / pysc2

StarCraft II Learning Environment
Apache License 2.0
8.02k stars 1.16k forks source link

Feature Request: List of individual unit details as features #18

Closed EndingCredits closed 6 years ago

EndingCredits commented 7 years ago

Hi,

I've noticed that all the features that are provided are provided as images (or spatially based). I can see why this is probably the best default set of features, however, I've had good results in the past using raw object features (i.e. a list of object feature vectors) and using a permutation invariant network (basically 1x1 convolutions and pooling) to convert the list into a single vector. I can also see this being useful for people who want to write other kinds of AI (e.g. GOFAI).

To clarify, the feature set would be a list of visible units, where each unit is represented by some feature vector e.g. one hot of class concatenated with health, position co-ordinates, etc. This could be broken down into separate lists for different classes, or all included in one big list.

EDIT: I realise this is possible using the client API, but it might be nice to make this information available under the same interface for comparing/combining the two different types.

tewalds commented 7 years ago

This isn't something we, deepmind, have much interest in, but you're welcome to implement this. If it's optional, sufficiently clean and the overhead for us is minimal, I'd be happy to merge it in. I'll need to add support for different sets of features to support rgb, so this could be one more optional channel.

andrewsilva9 commented 6 years ago

@tewalds Do you have suggestions for where to look to get this data (unit information like position, health, attacking/not_attacking flag, etc.) out of SC2 replay files?

MichaelStuartJr commented 6 years ago

@andrewsilva9 I'd try checking out the pysc2/dev. There is a flag called use_feature_units. It'll give a lot more detail on a unit.

pysc2/dev/pysc2/lib/features.py:

class FeatureUnit(enum.IntEnum):
  """Indices for the `feature_unit` observations."""
  unit_type = 0
  alliance = 1
  health = 2
  shield = 3
  energy = 4
  cargo_space_taken = 5
  build_progress = 6
  health_ratio = 7
  shield_ratio = 8
  energy_ratio = 9
  display_type = 10
  owner = 11
  x = 12
  y = 13
  facing = 14
  radius = 15
  cloak = 16
  is_selected = 17
  is_blip = 18
  is_powered = 19
  mineral_contents = 20
  vespene_contents = 21
  cargo_space_max = 22
  assigned_harvesters = 23
  ideal_harvesters = 24
  weapon_cooldown = 25

@tewalds is there an idea on when some, if not all, of these changes in dev will make it to pysc2/master?

tewalds commented 6 years ago

It's in master now, and hopefully on pypi soon.