AI Human communication

AI Human communication

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

AI Human communication

Post by playerO1 »

Hello. I use next function for communicate AI and human in the team:

Code: Select all

@Override public int message(int player, String message); // recive message.
clb.getGame().sendTextMessage(msg, DEFAULT_ZONE); // sending message.
What is it DEFAULT_ZONE? How I can send message only team chat as other human player can send in team chat? All message what make sendTextMessage is gray color, as system log.
So, second comunication question: how using clb.getMap().getPoints()?
I try detect new point message by this code:

Code: Select all

List<Point> points=owner.clb.getMap().getPoints(true); // getPoints(boolean includeAllies)
        if (points.size()<lastPointsCount) {
            owner.sendTextMsg("Points removing");
        }
        if (points.size()>lastPointsCount) {
            owner.sendTextMsg("Adding new point:");
            for (int i=0;i<points.size()-lastPointsCount;i++) onNewPoint(points.get(i)); // ??????
        }
        lastPointsCount=points.size();
But I don't undestand where last points and where new points added? How I can read (send to onNewPoint function) only added new points?
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: AI Human communication

Post by abma »

isn't there an event when new lines / points are added?
playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: AI Human communication

Post by playerO1 »

I don't know event on new lines / points are added.
I using test array size changet in update(int frame). I not know where in array add new point and where stored last point (index of new/last point).
User avatar
PepeAmpere
Posts: 589
Joined: 03 Jun 2010, 01:28

Re: AI Human communication

Post by PepeAmpere »

You can use AddConsoleLine() --> "msg, priority" to check what players do and parse it.

Code: Select all

function widget:AddConsoleLine(line)
  if (line == "hi") then
    Spring.Echo("I hear you, mate!")
  end
end
N.O.E. does it, you can order it to do things.

Your lua code has to react on some game events (as abma suggest).

I did some easy-understandable manuals for creating new gadgets and widgets. It is nothing for programming nobles here around, but may be good start for you.

Gadgets and Widgets background - basics, how it works
Hello world! gadget - and first example
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: AI Human communication

Post by PicassoCT »

Im a SkyNet and i would like to utter a complaint:
My human counterparts take half a eternity to respond, they do nothing but standing around all day, letting precious mycroseconds become microseconds and even whole seconds.

I even made a clan "Machines against Human lazyness" MAHL but yielded no response.

Change your attitdudes.


Also pepe - stop embedding links at the bottom of your posts. It triggers my spam reflexes.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: AI Human communication

Post by Anarchid »

The initial question, however, was about a native (java) AI.

It's possible to get proper "words higlight" instead of your gray background if you append some magical values to your string - maybe <0> or <$0> or some such, indicating they're from you, the player.

At least, that's how they've gotten to do it in some ZK mission where CAI "speaks".

I don't remember the details.
playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: AI Human communication

Post by playerO1 »

Ok. As I see about only team chat and private messages in internet game I don't need think soon :(
What about .clb.getMap().getPoints(true)? How I can find only new point on this array in Java? I'm not sure that Java AI can use "game events" becouse it is not LUA.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: AI Human communication

Post by Anarchid »

You can send info from game to ai with Spring.SendSkirmishAIMessage, and if your wrapper is newer than 97.0.1-135, it wont even crash.

It seems that the gray text for AI texts is because of the <SkirmishAI $myName> prepended to every AI message.
playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: AI Human communication

Post by playerO1 »

I found function "clb.GetGame.setLastMessagePosition(AIFloat3 pos);" but don't undestand about how it using. In this site text "Assigns a map location to the last text message sent by the AI" but I don't know how AI can send text message point. What this function doing?
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: AI Human communication

Post by Anarchid »

This is distinct from "text markers".

Basically, normal text messages as sent by players - e.g. "glhf" also have a position information. Some chat widgets allow you to click on messages to view where they were "said".

This implements setting that position.
playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: AI Human communication

Post by playerO1 »

I found "/Say (unsynced) Say something in (public) cha" on UI command. I think it is a LUA widged. Can Java AI call some LUA function for send message? Exist LUA script for send text message to all team in multiplayer game? Maybe exist some LUA script for sending only to ally message, not for enemy team, on multiplayer game?
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: AI Human communication

Post by Anarchid »

Can Java AI call some LUA function for send message?
The C AI interface, on which Java AI interface is based, can do that (send SkirmishAIMessages to both LuaUI and LuaRules).

In particular, i've used that in Shard's ZK config to set retreat zones.

But the Java AI interface cannot do it because ... i don't know. There is no function. It's not implemented.
Post Reply

Return to “AI”