Hooked Bot, "<botname> timed out" bot kick


(Alan) #1

Hi, i am working on a hooked bot Library for ET.

The bots are kicked by the server after 4 minutes, and i haven’t found why !
Can you help me please.

Some images:

The “/addubot” command


Here is the bot.


After 4 minutes the bot is kicked !

The func that adds Bots:

void AddBot ( ... ) {
[...]

	clientNum = trap_BotAllocateClient( 0 );	// Arnout: 0 means no prefered clientslot
	bot = gEnts + clientNum;
	bot->r.svFlags |= SVF_BOT;
	bot->inuse = qtrue;

	ubotuserinfo = "\\cg_etVersion\\Enemy Territory, ET 2.56\\cg_uinfo\\13 0 30\\g_password\
one\\cl_guid\\2CF49DB75739144100DC3B8D6E0BC160\\cl_punkbuster\\1\\cl_anonymous\\0\\snaps\\20\\rate\\25000\
ame\\ubotname\\cl_wwwDownload\\1\\protocol\\83\\qport\\262\\challenge\\0\\ip\\localhost\0";

	trap_SetUserinfo( clientNum, ubotuserinfo );

	if( s = ClientConnect( clientNum, qtrue, qfalse ) ) {
		G_Printf( S_COLOR_RED "Unable to add bot: %s
", s );
		return;
	}
	
	ClientBegin (clientNum);

	BotSendConsoleCommand( from_clientNum, clientNum, EXEC_APPEND, "obj", "obj -1" );
	BotSendConsoleCommand( from_clientNum, clientNum, EXEC_APPEND, "team", "team r 0 3 2" );
	return; 
}

BotSendConsoleCommand( ) is used to send “obj” and “team” commands with the Bot clientNum.

And the Console messages :
Blue: /addubot command
Red: the bot is kicked

Sys_LoadDll(/usr/local/games/enemy-territory/etmain/qagame.mp.i386.so)… ok
Sys_LoadDll(qagame) found vmMain at 0x4be1a27e
Sys_LoadDll(qagame) succeeded!
^3Ubot v0.3: ubot.cfg config file says mod=etmain
^3Ubot v0.3: Opening Library ./etmain/qagame.mp.i386.so.original … ^3Ok.
^3Ubot v0.3: vmMain (GAME_INIT, time=16050, random=36531, restart=1)
------- Game Initialization -------
gamename: etmain
gamedate: Sep 10 2003
Not logging to disk.
Enable spawning!
Disable spawning!
0 teams with 0 entities

Setting MOTD…
Setting Allied autospawn to West Bunker
Setting Axis autospawn to West Bunker
^3Ubot v0.3: vmMain (GAME_CLIENT_CONNECT, client=0, firsttime=0, isbot=0)
^3Ubot v0.3: syscall (G_GET_USERINFO num=0, \cg_etVersion\Enemy Territory, ET 2.56\cg_uinfo\13 0 30\g_password
one\cl_guid\2CF49DB75739144100DC3B8D6E0BC160\cl_wwwDownload\1
ame(fr)Popof le Russkof\rate\25000\snaps\20\cl_anonymous\0\cl_punkbuster\1\ip\localhost)
^3Ubot v0.3: syscall (G_GET_USERINFO num=0, \cg_etVersion\Enemy … idem
^3Ubot v0.3: syscall (G_GET_USERINFO num=0, \cg_etVersion\Enemy … idem
^3Ubot v0.3: syscall (G_CVAR_SET n=Players_Axis, v=1 )
^3Ubot v0.3: syscall (G_CVAR_SET n=Players_Allies, v=(None))
^3Ubot v0.3: vmMain (GAME_CLIENT_BEGIN, client=0)
^3Ubot v0.3: syscall (G_GET_USERINFO num=0, \cg_etVersion\Enemy … idem
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND client=-1, print "lofPopof le Russkof^7 [lon]entered the game
")
^3Ubot v0.3: syscall (G_CVAR_SET n=Players_Axis, v=1 )
^3Ubot v0.3: syscall (G_CVAR_SET n=Players_Allies, v=(None))
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND client=0, tinfo 1 0 684 -2530 100 2)
skipnotifyPopof le Russkof^7 entered the game
[skipnotify]^1FIGHT!
^3Ubot v0.3: vmMain (GAME_CLIENT_COMMAND, client=0)
^3Ubot v0.3: syscall (G_ARGV 0, b=obj, bl=1024)
^3Ubot v0.3: syscall (G_ARGC 2)
^3Ubot v0.3: syscall (G_ARGV 1, b=-1, bl=16)
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND client=0, portalcampos -1 3978 -1004 848 -10 236 0 -1)
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND client=0, tinfo 1 0 684 -2530 100 0)
]/addubot
^3Ubot v0.3: vmMain (GAME_CONSOLE_COMMAND)
^3Ubot v0.3: syscall (G_ARGV 0, b=addubot, bl=1024)
^3Ubot v0.3: CMD addubot
^3Ubot v0.3: vmMain (GAME_CLIENT_CONNECT, BOT=1, firsttime=1, isbot=0)
^3Ubot v0.3: syscall (G_GET_USERINFO num=1, \cg_etVersion\Enemy Territory, ET 2.56\cg_uinfo\13 0 30\g_password
one\cl_guid\2CF49DB75739144100DC3B8D6E0BC160\cl_punkbuster\1\cl_anonymous\0\snaps\20\rate\25000
ame\ubotname\cl_wwwDownload\1\protocol\83\qport\262\challenge\0\ip\localhost)
^3Ubot v0.3: syscall (G_CVAR_SET n=Players_Axis, v=1 )
^3Ubot v0.3: syscall (G_CVAR_SET n=Players_Allies, v=(None))
^3Ubot v0.3: syscall (G_CVAR_SET n=wstats1, v=1)
^3Ubot v0.3: syscall (G_CVAR_SET n=session1, v=3 22850 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
^3Ubot v0.3: syscall (G_CVAR_SET n=sessionstats1, v=0.00 0.00 0.00 0.00 0.00 0.00 0.00 0 0 0 0 0 0 0)
^3Ubot v0.3: syscall (G_CVAR_SET n=wstats1, v=1 0 0 0 0 0 0)
^3Ubot v0.3: syscall (G_GET_USERINFO num=0, \cg_etVersion\Enemy … idem
^3Ubot v0.3: syscall (G_GET_USERINFO num=1, \cg_etVersion\Enemy … idem
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND client=-1, cpm "ubotname^7 connected
")
^3Ubot v0.3: syscall (G_CVAR_SET n=Players_Axis, v=1 )
^3Ubot v0.3: syscall (G_CVAR_SET n=Players_Allies, v=(None))
^3Ubot v0.3: vmMain (GAME_CLIENT_BEGIN, client=1)
^3Ubot v0.3: syscall (G_GET_USERINFO num=1, \cg_etVersion\Enemy … idem
^3Ubot v0.3: syscall (G_GET_USERINFO num=1, \cg_etVersion\Enemy … idem
^3Ubot v0.3: syscall (G_CVAR_SET n=Players_Axis, v=1 )
^3Ubot v0.3: syscall (G_CVAR_SET n=Players_Allies, v=(None))
^3Ubot v0.3: vmMain (GAME_CONSOLE_COMMAND)
^3Ubot v0.3: syscall (G_ARGV 0, b=obj, bl=1024)
^3Ubot v0.3: vmMain (GAME_CLIENT_COMMAND, BOT=1)
^3Ubot v0.3: syscall (G_ARGV 0, b=obj, bl=1024)
^3Ubot v0.3: syscall (G_ARGC 2)
^3Ubot v0.3: syscall (G_ARGV 1, b=-1, bl=16)
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND BOT=1, portalcampos -1 3978 -1004 848 -10 236 0 -1)
^3Ubot v0.3: vmMain (GAME_CONSOLE_COMMAND)
^3Ubot v0.3: syscall (G_ARGV 0, b=team, bl=1024)
ubotname^7 connected
^3Ubot v0.3: vmMain (GAME_CLIENT_COMMAND, BOT=1)
^3Ubot v0.3: syscall (G_ARGV 0, b=team, bl=1024)
^3Ubot v0.3: syscall (G_ARGV 1, b=r, bl=1024)
^3Ubot v0.3: syscall (G_ARGC 5)
^3Ubot v0.3: syscall (G_ARGV 1, b=r, bl=1024)
^3Ubot v0.3: syscall (G_ARGV 2, b=0, bl=4)
^3Ubot v0.3: syscall (G_ARGV 3, b=3, bl=4)
^3Ubot v0.3: syscall (G_ARGV 4, b=2, bl=4)
^3Ubot v0.3: syscall (G_GET_USERINFO num=1, \cg_etVersion\Enemy … idem
^3Ubot v0.3: syscall (G_GET_USERINFO num=1, \cg_etVersion\Enemy … idem
^3Ubot v0.3: syscall (G_GET_USERINFO num=1, \cg_etVersion\Enemy … idem
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND client=-1, print "[lof]ubotname^7 [lon]entered the game
")
^3Ubot v0.3: syscall (G_CVAR_SET n=Players_Axis, v=1 2 )
^3Ubot v0.3: syscall (G_CVAR_SET n=Players_Allies, v=(None))
^3Ubot v0.3: syscall (G_CVAR_SET n=wstats1, v=1)
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND BOT=1, aftc -1)
[skipnotify]ubotname^7 entered the game
ubotname^7 has joined the Axis team^7!
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND client=0, tinfo 2 0 684 -2530 100 0 1 680 -2716 -1 2)
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND BOT=1, tinfo 2 0 684 -2530 100 0 1 680 -2716 -1 2)
^3Ubot v0.3: syscall (G_GET_USERINFO num=1, \cg_etVersion\Enemy … idem
^3Ubot v0.3: syscall (G_GET_USERINFO num=1, \cg_etVersion\Enemy … idem
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND client=0, tinfo 2 0 684 -2530 100 0 1 680 -2716 100 2)
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND BOT=1, tinfo 2 0 684 -2530 100 0 1 680 -2716 100 2)
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND client=0, tinfo 2 0 684 -2530 100 0 1 680 -2716 100 0)
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND BOT=1, tinfo 2 0 684 -2530 100 0 1 680 -2716 100 0)
^5PunkBuster Client: Master Query Sent to (ID2.EVENBALANCE.COM) 192.246.40.80
^5PunkBuster Client: Received Master Security Information
^3Ubot v0.3: vmMain (GAME_CLIENT_DISCONNECT, BOT=1)
^3Ubot v0.3: syscall (G_CVAR_SET n=Players_Axis, v=1 )
^3Ubot v0.3: syscall (G_CVAR_SET n=Players_Allies, v=(None))
ubotname^7 timed out
^3Ubot v0.3: syscall (G_SEND_SERVER_COMMAND client=0, tinfo 1 0 684 -2530 100 0)
----- Server Shutdown -----
^3Ubot v0.3: vmMain (GAME_SHUTDOWN, restart=0)
==== ShutdownGame ====
^3Ubot v0.3: syscall (G_CVAR_SET n=session, v=2 0 battery)
^3Ubot v0.3: syscall (G_CVAR_SET n=session0, v=1 800 1 0 0 3 2 0 3 2 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16550 0)
^3Ubot v0.3: syscall (G_CVAR_SET n=sessionstats0, v=0.00 0.00 0.00 0.00 0.00 0.00 0.00 0 0 0 0 0 0 0)
^3Ubot v0.3: syscall (G_CVAR_SET n=wstats0, v=0 1 0 0 0 0 0)
^3Ubot v0.3: syscall (G_CVAR_SET n=fireteam0, v=\id-1)
^3Ubot v0.3: syscall (G_CVAR_SET n=fireteam1, v=\id-1)
^3Ubot v0.3: syscall (G_CVAR_SET n=fireteam2, v=\id-1)
[… etc …]

Thanks,
Alan


(Jaquboss) #2

Is this because they dont sent any commands so they are kicked for unactivity?


(Alan) #3

No, unfortunately it isn’t.
I catch my commands and send it to all the bots (it is easier to debug), so the bots can fire, jump, etc …

The inactivity code is :

qboolean ClientInactivityTimer( gclient_t *client ) {
[...]
		trap_DropClient(client - level.clients, "Dropped due to inactivity", 0 );

And the problem comes from the 3D engine, not from the qagame dll

^3Ubot v0.3: vmMain (GAME_CLIENT_DISCONNECT, BOT=1)


(Alan) #4

It seems to be an “inactivity timer” driven by the server (3D engine), not by the game.

The flag bot->r.svFlags |= SVF_BOT; is important. If i don’t put it, the ping of the bot is 999.

I try to say to the server that bots are bots, and to the game that bots are human players.
Perhaps the server is waiting something from a cgame that doesn’t exist because he thinks that the bot is an human player.

Do you have some questions or ideas ?
Thanks


(Alan) #5


Have you ever seen 20 bots jumping at the same time ? :slight_smile:


The “timed out” virus begin


Now they are all kicked.


(zl1corvette) #6

Now they are all kicked.

:frowning:


(Alan) #7

I still don’t know what is wrong, but i have found a solution. :smiley:
The GAME_CLIENT_DISCONNECT signal isn’t sent to the game, and that works.


Let’s go


Timed out …


They are still in the game.

Radical but efficient.


(Jaquboss) #8

Yeah , it is radical , but good job , hovewer how this will work with disconecting players ?


(Alan) #9

GAME_CLIENT_DISCONNECT has the clientNum in argument. I compare it with the clientNum of my bots and send the signal if it isn’t a bot.