Blizzard / s2client-proto

StarCraft II Client - protocol definitions used to communicate with StarCraft II.
MIT License
3.76k stars 431 forks source link

Chat Interaction #54

Closed lschmelzeisen closed 6 years ago

lschmelzeisen commented 6 years ago

I'm currently building a mini game for which I need the ability for agents to both send chat messages as well as to receive them.

For sending chat message, I noticed the chat field in the Action message. However, I can't figure out how to correctly use it. If I send a request of

action {
  actions {
    chat {
      channel: Broadcast
      message: "Chat Test Message"
    }
  }
}

The response is always an error

action {
  result: Error
}
status: in_game

However, there seems to be no way to get more information about a request error from the API, so I don't know what I'm doing wrong here.

If I send the chat field together with a normal action (for example, to select a rectangle)

action {
  actions {
    action_feature_layer {
      unit_selection_rect {
        selection_screen_coord {
          p0 {
            x: 0
            y: 0
          }
          p1 {
            x: 63
            y: 63
          }
        }
        selection_add: false
      }
    }
    chat {
      channel: Broadcast
      message: "Chat Test Message"
    }
  }
}

the game responds with

action {
  result: Success
}
status: in_game

I can see in-game that the selection action is performed, however, no message is displayed in the chat.

Am I using the API in the wrong way or is chat sending functionality not yet implemented on the client? I'm testing this on Windows, by the way.

Furthermore, regarding the API for receiving chat messages, I have also never observed that the chat field in the ReponseObservations message was set.

As a side note, trying to use DebugChat with a request a la

debug {
  debug {
    chat {
      message: "Debug Chat Test Message"
    }
  }
}

seems to have no effect on the game.

KevinCalderone commented 6 years ago

This is the same as: https://github.com/Blizzard/s2client-proto/issues/29

You are using it correctly, but it just isn't implemented yet.

noorus commented 6 years ago

Is there any estimate of when this feature might possibly go in? It'd be tremendously useful in communicating with a bot that runs in realtime without having implement a separate GUI outside the game. Of course I also appreciate that no update to SC2 is going to go live just to implement some AI developer wishes, but I'm certainly looking forward to this.

KevinCalderone commented 6 years ago

Action::action_chat and ResponseObservation::chat will be working in the next patch.

DebugChat is redundant with ActionChat, so I just removed it: https://github.com/Blizzard/s2client-proto/pull/62/commits/cb1f6db35ff463f6bc4bb7443d748f8b79a3a25a