.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
what happends when game ends?
Old
  (#1)
sten
Guest
 
Status:
Posts: n/a
Default what happends when game ends? - 08-11-2004

What hapends when game ends. I should write info about bots and game statistics to spesific file everytime when game ends. So I'm wondering where would be a good place to do this? I should also get my hands on game statistics(deaths,kills..).. so any ideas about that would also be nice.

- NiCo
  
Reply With Quote
Re: what happends when game ends?
Old
  (#2)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: what happends when game ends? - 08-11-2004

When game ends, you mean...
- when the SERVER shuts down (or when the map is changed) ?
- when the ROUND restarts (in round-based games such as Counter-Strike ?)

For the 1st one, hook the ServerDeactivate() function ; for the second one, it all depends on the way the mod authors implemented their round system. Usually a network message is sent to clients to synchronize the restart. Find this message and hook it.

Players frags are usually stored in pEdict->v.frags. It's the common place to store it but note that some mods may decide to store it elsewhere (as about any other variables in there, actually...)

Player deaths are usually stored in the entitie's private data (pEdict->pvPrivateData + offset), which you can't access without the mod's source code, or without a bit of reverse-engineering to find out the offset in memory where it is. A more convenient solution is to keep track of these events internally as they occur.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 08-11-2004 at 18:38..
  
Reply With Quote
Re: what happends when game ends?
Old
  (#3)
sten
Guest
 
Status:
Posts: n/a
Default Re: what happends when game ends? - 08-11-2004

I was talking about the situation when round restarts in counter-strike. Thanks for usefull info pierre.. Thats just what I needed to know.

- NiCo
  
Reply With Quote
Re: what happends when game ends?
Old
  (#4)
sten
Guest
 
Status:
Posts: n/a
Default Re: what happends when game ends? - 09-11-2004

I'm having problems outputting messages. I checked readme.txt from hpb bot wich explains how to do this, but I don't have _DEBUG flag in my sources anywhere.. So where can I put these lines to get message output? (or is it possible to put message output on from console?, that would also help)

Code:
fp=fopen("bot.txt","a");
fprintf(fp,"pfnRegUserMsg: pszName=%s msg=%d\n",pszName,msg);
fclose(fp);
I checked Joebot sources also and saw that there was message strings: #Terrorists_Win and #CTs_Win. I made BotClient_CS_TextMsg function and altered pfnMessageBegin for it, but it seems that these messages wont work with it, or I havent made right preparations to make that function work. So if anyone have any idea what could be wrong please reply. I have fighted almoust a day with this.

Here's what I add under else if (mod_id == CSTRIKE_DLL):
Code:
else if (msg_type == GET_USER_MSG_ID (PLID, "TextMsg", NULL))
{
      botMsgFunction = BotClient_CS_TextMsg;
      botMsgEndFunction = BotClient_CS_TextMsg;
}
  
Reply With Quote
Re: what happends when game ends?
Old
  (#5)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: what happends when game ends? - 09-11-2004

for setting such a preprocessor variable like _DEBUG, check your compiler's manual. for gcc it's -D, for MSVS, just go to the property page of your project and then compiler ...
outputting debug messages to the console is normally possible, but not during receiving messages, since you'd produce a new message and HL doesnt really like "recursive" messages

pfnMsgBegin is some nice function and there are different approaches to variable length message handling. I guess you just have to do some more experimenting. one day isnt much and this message you are talking about is one which has multible recipients, I think. Therefore the handling is a bit different. take a close look at it with debug_engine like pierre suggested and it should be fine


  
Reply With Quote
Re: what happends when game ends?
Old
  (#6)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: what happends when game ends? - 09-11-2004

or if you're lazy, look in botman's HPB template since the new CS round check is implemented already



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: what happends when game ends?
Old
  (#7)
sten
Guest
 
Status:
Posts: n/a
Default Re: what happends when game ends? - 12-11-2004

It works! Almoust two days gone by without trying to solve this problem. I started again to check what is in the MessageBegin funktion and found out that I had put some lines at wrong place.

- NiCo
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com