Jump to content
Sign in to follow this  
agentx

Bots Can't Chat

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.

Share this post


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.

Share this post


Link to post
Share on other sites

I have often wished this could happen. It is more likely to get implemented with Petra than Aegis (the rumors are that Aegis is getting replaced by Petra). I wonder what Wraitii thinks about it?

Share this post


Link to post
Share on other sites

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

Are you proposing different binaries for different AIs?

Share this post


Link to post
Share on other sites

The API is scripted too (for the biggest part). And if you add something, just give us a patch. If it doesn't break other code (which is unlikely when only adding a feature), it will get committed.

Share this post


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.

Share this post


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.

Share this post


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.

Share this post


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

Share this post


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.

Sign in to follow this  

×
×
  • Create New...