Page 1 of 1

Sending messages to another bot

Posted: Wed Sep 19, 2007 12:02 pm
by SunTzu
Is it possible for one bot to send a message to another bot via the message(String message, Object data) method in the LuxAgent interface?

Obviously we wouldn't want bots to be able to send offical Lux messages like attackNotice, youLose or chat, but could bots send other generic messages? It would then be up to the other bot on how to act on those messages.

Posted: Wed Sep 19, 2007 1:59 pm
by dustin
I would advise you to use the chat methods to send messages between bots.

Posted: Wed Sep 19, 2007 2:15 pm
by SunTzu
But then you couldn't send data, such as a list of countries they should target...

Posted: Wed Sep 19, 2007 2:55 pm
by dustin
Couldn't you?

CleverAI: target-codes 3,14,20,33

Posted: Wed Sep 19, 2007 3:00 pm
by SunTzu
Are bots able to read the chat if the game isn't checked "Allow other players to join?"

Also, the chat might get very busy & annoying...

Posted: Wed Sep 19, 2007 11:37 pm
by dustin
SunTzu wrote:Are bots able to read the chat if the game isn't checked "Allow other players to join?"
No, they don't (I am pretty sure).

You could use the message() method if you can get a reference to the bot you want to send a message to, but Lux gives you no way of getting that.

Posted: Thu Sep 20, 2007 12:14 am
by Scad
dustin wrote:(I am pretty sure).
With absolutely no offense intended, I love it when programmers say things like this about their programs. It suggests a level of complexity at which the program is no longer reacting to our desires, but rather we to it...

Posted: Thu Sep 20, 2007 12:52 am
by Sylocat
It's creepy, isn't it? :shock:

Remember that Dilbert cartoon where Dogbert said "every living thing is made up of simpler, less complex life forms, therefore a supreme being must be our future rather than our origin. What if 'God' is the consciousness that will be created when enough of us are connected by the internet?"

Posted: Thu Sep 20, 2007 4:40 am
by Kef
Then 90% of God would be a retard, just look at myspace and youtube to see what I mean

Posted: Thu Sep 20, 2007 8:56 am
by SunTzu
dustin wrote:
SunTzu wrote:Are bots able to read the chat if the game isn't checked "Allow other players to join?"
No, they don't (I am pretty sure).
I just checked, and bots can't read chat messages if the "Allow other players to join" isn't selected.

dustin wrote:You could use the message() method if you can get a reference to the bot you want to send a message to, but Lux gives you no way of getting that.
Would it be too much of a security issue if you provided a way for bots to get the references to other bots?

Posted: Thu Sep 20, 2007 10:52 am
by GregM
If all the bots in question are of the same class, you can just use static variables.

You could declare a global variable like:

class MyBot {
static Vector<Country> teamTargets;
...
}


and then each instance of MyBot has access to the same teamTargets variable.

Posted: Thu Sep 20, 2007 12:57 pm
by SunTzu
Thanks for the tip Greg, but the variables I want to pass will be for different bots.

I'm working on creating a bot that can read advanced starting scenarios and then pass specific data (alliances, target countries, etc.) to another bot.

Posted: Thu Sep 20, 2007 1:43 pm
by Bertrand
You could create a new class that only contains static variables. This new class would have to be instantiated by the different AI. Each AI would then have access to the same static variables.

The only potential problem with this is what will happen if many games are running simultaneously? Will all the AI from the different games share the same static variables?

Hmmmm, thinking about this, maybe Reaper has this problem: he does use static variables to handle teaming. When Dustin runs many games at the same time on his server, if all the Reapers share the same variables then that could lead to chaos...

Posted: Thu Sep 20, 2007 7:45 pm
by dustin
I run multiple instances of Lux, so I think they all have their own static variables in this case.

Posted: Tue Oct 02, 2007 11:33 am
by Enokrad
Sylocat wrote:It's creepy, isn't it? :shock:

Remember that Dilbert cartoon where Dogbert said "every living thing is made up of simpler, less complex life forms, therefore a supreme being must be our future rather than our origin. What if 'God' is the consciousness that will be created when enough of us are connected by the internet?"
Kef wrote:Then 90% of God would be a retard, just look at myspace and youtube to see what I mean

:arrow: LOL :D

Posted: Thu Nov 01, 2007 10:24 pm
by Sir Holo
SunTzu wrote:Also, the chat might get very busy & annoying...
That doesn't happen already with humans?

Posted: Fri Nov 21, 2008 8:42 pm
by dustin
You could send messages between bots by writing/reading from a file on the filesystem (code example here).