.:: 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
Moving my mod from TFC to DOD...
Old
  (#1)
bots4fun
Guest
 
Status:
Posts: n/a
Default Moving my mod from TFC to DOD... - 29-08-2004

Hi,

I've got a mod that I've been tinkering with tha works great on TFC but causes the DOD client to just quit. I've stripped down all the engine call back subroutines to nothing to make sure it wasn't my code, and the thing still caues the client to quit.
When putting the liblist.gam to dod.dll only it works fine (this is win32 btw). But when having my dll load first via liblist.gam the dod client precaches all info, then says "Parsing game info... " then quits, no error, nothing.
How can I make the steam client log errors or show the error in the console? When the client is connecting to the server I just get that status bar window telling me what it's currently doing but I can't bring up the console so I might catch a glimpse of an error...
Thinking that I may have missed something in the sdk updates, I downloaded botman's HPB_Bot Template 4 (thanks botman for a great template) and stripped it out of all code except for the engine callbacks too and added the code to load the dod.dll, but I get the same result, the client just quits.

Anyone have an idea what to try? Thanks
B4F
  
Reply With Quote
Re: Moving my mod from TFC to DOD...
Old
  (#2)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: Moving my mod from TFC to DOD... - 29-08-2004

Counter Strike and DoD are currently maintaining their own internal list of entities inside the MOD DLL code. This was done as an engine performace measure to keep the game code from use the engine's function to search for game entities (since the game code knows better what entities it wants to search for and can optimize this search by storing things internally in the game DLL code instead of relying on the engine).

What this means is that if you are createing or destroying entities within your plugin, you will probably have problems with the game DLL crashing (because you created or destroyed something that the game DLL wasn't aware of and now it is out of sync).

You don't indicate what you are "tinkering" with, but if you are tinkering with creating or destroying entities, don't do that and see if that prevents the crashing problem.

You should still be able to change variables on entities that already exist (such as changing health or location), so if that's all your doing, then you have some bug in your code.

botman
  
Reply With Quote
Re: Moving my mod from TFC to DOD...
Old
  (#3)
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: Moving my mod from TFC to DOD... - 29-08-2004

Why wouldn't you make this mod a metamod plugin instead? that's IMO the safest way.



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: Moving my mod from TFC to DOD...
Old
  (#4)
bots4fun
Guest
 
Status:
Posts: n/a
Default Re: Moving my mod from TFC to DOD... - 29-08-2004

I had written some custom bots for my TFC and DM servers and along the way started getting into much more "admin mod" like features, like special effects, shaking, fades, glows, client command filtering, voting, sound effects, using custom sprites/sounds, stats tracking, and was having a lot of fun doing it. I got into DOD recently and found it would be kind of neat to use this on DOD as well. Everything worked great on the TFC / DM side, but the server crashed with my mod using DOD.. so I started doing some investigating trying to find out the cause of the crash... I removed all custom code except some log code (using your template) because I figured this would be a safe way to start. So the subroutines generally look like this:

void StartFrame( void )
{
fp=fopen("log.txt","a"); fprintf(fp, "StartFrame\n"); fclose(fp);
(*other_gFunctionTable.pfnStartFrame)();
}
void ClientCommand( edict_t *pEntity )
{
fp=fopen("log.txt","a"); fprintf(fp, "ClientCommand\n"); fclose(fp);
(*other_gFunctionTable.pfnClientCommand)(pEntity);
}
etc etc

so you can see there's nothing there except logging to make sure the engine passed through there...
I did this for every subroutine, hoping I could catch where something might cause a crash, but now the server doesn't crash at all...

added this to h_export:
else if (strcmpi(mod_name, "dod") == 0)
{
mod_id = DOD_DLL;
#ifndef __linux__
strcpy(game_dll_filename, "dod\\dlls\\dod.dll");
#else
strcpy(game_dll_filename, "dod/dlls/dod_i386.so");
#endif
}

added this to linkfunc:
// DAY OF DEFEAT
LINK_ENTITY_TO_FUNC(info_gameplaylogic);

basically my dll became nothing but a passthrough...

after doing these things the server stopped crashing, and I could change maps, do all console commands etc with no problems. but now the client gets past precaching, and then when it gets to "Parsing game info..." the client (not the server) just quits. Doesn't crash or report an error (that I can see) it just quits. The server keeps going happily along (this is using hlds win32) and just reports Dropped Player from server Reason: Timed out. So what I suspect is that the client is not getting something it is asking for from the server, and just quitting, but the server doesn't show any problems, and the client, well that leads me back to my original post, why's the client just quitting?
PMB: As to meta-mod, I don't use it because I learned using the template, and I really don't want to re-learn another method of doing the mods.. besides this way I just worry about sdk updates, not sdk and meta-mod.. I dunno who metamod is written by but if they decide to stop someday, but the engine gets updated, don't all metamod plugins then break?
I like just talking to the engine directly, kind of old fashioned i guess
Anyway, any ideas what I might be overlooking? Something simple probably...
Thanks!
B4F

P.S. My Steam HLDS dod is completely up to date using the update tool.
  
Reply With Quote
Re: Moving my mod from TFC to DOD...
Old
  (#5)
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: Moving my mod from TFC to DOD... - 30-08-2004

Quote:
Originally Posted by bots4fun
PMB: As to meta-mod, I don't use it because I learned using the template, and I really don't want to re-learn another method of doing the mods.. besides this way I just worry about sdk updates, not sdk and meta-mod.. I dunno who metamod is written by but if they decide to stop someday, but the engine gets updated, don't all metamod plugins then break?
I like just talking to the engine directly, kind of old fashioned i guess
Well I had exactly the same speech ... before.

Now I couldn't live without it, nor even consider writing ANYTHING that would look like a regular hook DLL.

If you want to see a simple example on how a metamod plugin works, check out one of my plugins source code. The metamod stuff is clearly delimited and well commented. All the rest is regular HL coding. Learning is simplissime.

Metamod is currently a collective project developed over SourceForge. It is almost immortal because this tool has become almost mandatory for any server admin (AMX, AdminMod are metamod plugins). You don't have to worry about API changes. You don't have to worry about entity lists. You don't have to worry about network message IDs. You only declare in a struct the functions you want to use, like here for the HPB_bot,

Code:
C_DLLEXPORT int GetEntityAPI2 (DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
{
   gFunctionTable.pfnGameInit = GameDLLInit;
   gFunctionTable.pfnSpawn = Spawn;
   gFunctionTable.pfnKeyValue = KeyValue;
   gFunctionTable.pfnClientConnect = ClientConnect;
   gFunctionTable.pfnClientDisconnect = ClientDisconnect;
   gFunctionTable.pfnClientPutInServer = ClientPutInServer;
   gFunctionTable.pfnClientCommand = ClientCommand;
   gFunctionTable.pfnStartFrame = StartFrame;
 
   memcpy (pFunctionTable, &gFunctionTable, sizeof (DLL_FUNCTIONS));
   return (TRUE);
}
Code:
C_DLLEXPORT int GetEngineFunctions (enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion)
{
   meta_engfuncs.pfnChangeLevel = pfnChangeLevel;
   meta_engfuncs.pfnEmitSound = pfnEmitSound;
   meta_engfuncs.pfnClientCommand = pfnClientCommand;
   meta_engfuncs.pfnMessageBegin = pfnMessageBegin;
   meta_engfuncs.pfnMessageEnd = pfnMessageEnd;
   meta_engfuncs.pfnWriteByte = pfnWriteByte;
   meta_engfuncs.pfnWriteChar = pfnWriteChar;
   meta_engfuncs.pfnWriteShort = pfnWriteShort;
   meta_engfuncs.pfnWriteLong = pfnWriteLong;
   meta_engfuncs.pfnWriteAngle = pfnWriteAngle;
   meta_engfuncs.pfnWriteCoord = pfnWriteCoord;
   meta_engfuncs.pfnWriteString = pfnWriteString;
   meta_engfuncs.pfnWriteEntity = pfnWriteEntity;
   meta_engfuncs.pfnClientPrintf = pfnClientPrintf;
   meta_engfuncs.pfnCmd_Args = pfnCmd_Args;
   meta_engfuncs.pfnCmd_Argv = pfnCmd_Argv;
   meta_engfuncs.pfnCmd_Argc = pfnCmd_Argc;
   meta_engfuncs.pfnSetClientMaxspeed = pfnSetClientMaxspeed;
   meta_engfuncs.pfnGetPlayerUserId = pfnGetPlayerUserId;
   meta_engfuncs.pfnGetPlayerAuthId = pfnGetPlayerAuthId;
 
   memcpy (pengfuncsFromEngine, &meta_engfuncs, sizeof (enginefuncs_t));
   return TRUE;
}
and there ya go.



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: Moving my mod from TFC to DOD...
Old
  (#6)
bots4fun
Guest
 
Status:
Posts: n/a
Default Re: Moving my mod from TFC to DOD... - 30-08-2004

Ok I suppose I'll take a crash course (no pun intended ) in metamod. TX for the hard sell, PMB. You guys do great work!

B4F
  
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