Jump to content

Recommended Posts

There seems to be no way to let bots communicate with each other like the way humans do by team chat. Actually in a 2v2 game, humans v. bots, humans can exchange info and tactics, bots can't - so chatting is cheating.

Imagine sending "attack in 20 sec" to your bot ally to launch a synced attack. Or "need 2000 metal" to force a tribute. Mixed teams would add a new level to the game.

Is it a big problem to put two way chat on the API? Sending is already there. Just listening is missing.

Link to post
Share on other sites

The API is only an experiment that grew by accident. So you can let it grow more.

Normally, the first AI programmer to want a feature is the one who adds it to the API.

But do watch out for localisation. An AI can chat to the player in his local language. So the AI should somehow be able to accept local messages back, without causing problems when multiple people in a game have a different language.

Link to post
Share on other sites

Yes, but in this case scripting can not add bot chat as feature. The most important part of the API is written in C++.

Is bot chat really more difficult than e.g. barterprices? An object with player id as key and message as value would be sufficient.

Link to post
Share on other sites

You should be able to reroute the chat from the GuiInterface to the AiInterface (in public/simulation/components), and pas the message on to the ai like that.

Well go through the cpp part, but that's very liberal. It just clones objects (which is needed for future parallelism), and passes them on.

Link to post
Share on other sites

Challenge accepted. I found all (human/bot) chat messages go through GuiInterface.prototype.PushNotification. What do you mean by "reroute" ?

A wild guess would be:

  1. collect messages in PushNotification
  2. add a new event type e.g. "chat" in AIInterface.prototype.EventNames
  3. use AIInterface.prototype.GetNonEntityRepresentation to ask GUI for collected messages

anything more?

Not clear is how to deal with network chat and recognize team chat.

Link to post
Share on other sites

You can send them from the GUIInterface to the AIInterface directly, like this:

GuiInterface.prototype.PushNotification = function(notification){    this.notifications.push(notification);    var cmpAIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_AIInterface);    if (cmpAIInterface)        cmpAIInterface.PushEvent("Notification", notification);};

Querying them from the AIInterface also works. But then you need to figure out when the messages are pushed and when they get flushed again (they disappear from that list when they get in the GUI I think).

I think the notification.type should be "chat" in case of a chat. But you'll also get all other sorts of notifications (like building failed notification).

I don't know much of the AI code, so I can't check if these events come through. But if you know it's working, I can commit your patch.

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...