.:: 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 > SDK Programming discussions > Half-Life 2 SDK
Half-Life 2 SDK For developments focused around the Half-Life 2 engine Half-Life 2

Reply
 
Thread Tools
Several problems with HL2DM
Old
  (#1)
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 Several problems with HL2DM - 26-01-2005

I have several problems when trying to make my plugins work in HL2DM.

1. Returning "false" in the plugin's Load() virtual method, which would normally tell Source to skip this plugin and not attempt to load it, makes the server crash.

2. I am unable to load the IPlayerInfoManager and IBotManager interfaces through gameServerFactory (which noteworthy, are not interfaces from the engine but from the game DLL, hence the need to load them from gameServerFactory() and not interfaceFactory()). The same code works fine in CS:Source, where I can load all the interfaces I want.

Here's my Load() function:
Code:
virtual bool Load (CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory)
{
	 // get the interfaces we want to use
	 if (!(playerinfomanager = (IPlayerInfoManager *) gameServerFactory (INTERFACEVERSION_PLAYERINFOMANAGER,NULL))
		 || !(gameclients = (IServerGameClients *) gameServerFactory (INTERFACEVERSION_SERVERGAMECLIENTS, NULL))
		 || !(debugoverlay = (IVDebugOverlay *) interfaceFactory (VDEBUG_OVERLAY_INTERFACE_VERSION, NULL))
		 || !(engine = (IVEngineServer *) interfaceFactory (INTERFACEVERSION_VENGINESERVER, NULL))
		 || !(gameeventmanager = (IGameEventManager *) interfaceFactory (INTERFACEVERSION_GAMEEVENTSMANAGER,NULL))
		 || !(filesystem = (IFileSystem *) interfaceFactory (FILESYSTEM_INTERFACE_VERSION, NULL))
		 || !(helpers = (IServerPluginHelpers *) interfaceFactory (INTERFACEVERSION_ISERVERPLUGINHELPERS, NULL))
		 || !(enginetrace = (IEngineTrace *) interfaceFactory (INTERFACEVERSION_ENGINETRACE_SERVER,NULL))
		 || !(serverconsole = (ICvar *) interfaceFactory (VENGINE_CVAR_INTERFACE_VERSION, NULL)))
		 return (false); // we require all these interface to function
 
	 gpGlobals = playerinfomanager->GetGlobalVars (); // get a pointer to the engine's globalvars
	 ConCommandBaseMgr::OneTimeInit (&g_ConVarAccessor); // register any cvars and server commands
	 return (true); // return true so as to enable the engine to load this plugin
}
I precise that I don't try to get gpGlobals when I don't load playerinfomanager, so the crash does not come from here.

Is it me or is it that HL2DM is buggy ?



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; 27-01-2005 at 00:07..
  
Reply With Quote
Re: Several problems with HL2DM
Old
  (#2)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Several problems with HL2DM - 26-01-2005

lol, well thats odd. The only thing that first did not work was createfakeclient, and now somehow the interfaces do not work. I think you should contact Alfred about this..


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Several problems with HL2DM
Old
  (#3)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Several problems with HL2DM - 26-01-2005

from the hlcoders list this mail gives you an answer:

Quote:
From what I've seen, it seems IPlayerInfoManager on HL2DM is still at version 001 while IPlayerInfoManager on CS:S is at version 002.

While all Valve needs to do is recompile, the fact that the version number and interface name are in one string make it very difficult for good backward compatibility. Assuming they were separated, and Valve simply added new functions to the end of the vtable, it wouldn't be a problem. But that's not going to happen.

What's the solution to this? Are we going to have to do ugly hacks to check the name's last three digits from X to 001 until we get a valid interface pointer? Other than that, I see nasty compatibility problems in the future.

Thanks for any help,

-----David "BAILOPAN" Anderson

http://www.sourcemod.net/


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Several problems with HL2DM
Old
  (#4)
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: Several problems with HL2DM - 26-01-2005

Haha! I suspected something like that. Gotta toy with the version numbers a bit.

I should sign up for this mailing list someday.



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: Several problems with HL2DM
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: Several problems with HL2DM - 26-01-2005

! IPlayerInfoManager interface loaded in HL2DM. Now on the IBotManager one...

Stefan, it's totally normal that creating a fake client wouldn't work, since this function is a member of IBotManager, and the interface has not been attached! The problem is not that calling botmanager->CreateBot crashes, but that botmanager is NULL

*edit* found the interface version strings all in hl2mp/bin/server.dll if you hexedit it. Bailopan was right, there's a version mismatch between HL2MP and CS:Source for the IPlayerInfoManager interface. On the IBotManager one though, it's more complicated as its version is already 001 in the SDK and I find no occurence of it in the server DLL. It looks like the IBotManager interface is unknown in HL2DM!!! o_O it means HL2DM doesn't support bots, simply.

*edit 2* OK, IPlayerInfoManager interface correctly loaded as version "PlayerInfoManager001" but still unusable. Calling playerinfomanager->GetGlobalVars () leads to a memory access crash. I suspect they added GetGlobalVars to the interface just for this version 002, which means it's inexistent so far in the current server DLL. Dat sux0rz teh big 0n3.



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; 26-01-2005 at 23:49..
  
Reply With Quote
Re: Several problems with HL2DM
Old
  (#6)
Iced_Eagle
Member
 
Status: Offline
Posts: 30
Join Date: Jan 2005
Default Re: Several problems with HL2DM - 27-01-2005

Well there is an update tonight on the SDK... let's hope they fix that!!
  
Reply With Quote
Re: Several problems with HL2DM
Old
  (#7)
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: Several problems with HL2DM - 27-01-2005

where did you see that ? the steam news don't mention it...



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: Several problems with HL2DM
Old
  (#8)
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: Several problems with HL2DM - 27-01-2005

In the meantime, here's a helpful macro for you guys
Code:
// plugin interface loader
#define LOAD_SINGLE_INTERFACE(type,name,version,provider,halt_on_error) \
   name = (type *) provider (version, NULL); \
   if (name == NULL) \
   { \
	  Warning (PLUGIN_NAME " - unable to load version #" version " of the " #type " interface as \"" #name "\"!\n"); \
	  if (halt_on_error) return (false); \
   } \
   else if (interface_verbose) Msg (PLUGIN_NAME " - " #type " interface loaded at 0x%x as \"" #name "\"\n", name);
use it like that:
Code:
   virtual bool Load (CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory)
   {
	  bool interface_verbose = true;
 
	  // get the interfaces we want from the engine
	  LOAD_SINGLE_INTERFACE (IVEngineServer, engine, INTERFACEVERSION_VENGINESERVER, interfaceFactory, false);
	  LOAD_SINGLE_INTERFACE (ISpatialPartition, spatialpartition, INTERFACEVERSION_SPATIALPARTITION, interfaceFactory, false);
	  LOAD_SINGLE_INTERFACE (IVDebugOverlay, debugoverlay, VDEBUG_OVERLAY_INTERFACE_VERSION, interfaceFactory, false);
	  LOAD_SINGLE_INTERFACE (IGameEventManager, gameeventmanager, INTERFACEVERSION_GAMEEVENTSMANAGER, interfaceFactory, false);
	  LOAD_SINGLE_INTERFACE (IBaseFileSystem, basefilesystem, BASEFILESYSTEM_INTERFACE_VERSION, interfaceFactory, false);
	  LOAD_SINGLE_INTERFACE (IFileSystem, filesystem, FILESYSTEM_INTERFACE_VERSION, interfaceFactory, false);
	  LOAD_SINGLE_INTERFACE (IServerPluginHelpers, helpers, INTERFACEVERSION_ISERVERPLUGINHELPERS, interfaceFactory, false);
	  LOAD_SINGLE_INTERFACE (IEngineTrace, enginetrace, INTERFACEVERSION_ENGINETRACE_SERVER, interfaceFactory, false);
	  LOAD_SINGLE_INTERFACE (IVModelInfo, modelinfo, VMODELINFO_SERVER_INTERFACE_VERSION, interfaceFactory, false);
	  LOAD_SINGLE_INTERFACE (ICvar, serverconsole, VENGINE_CVAR_INTERFACE_VERSION, interfaceFactory, false);
	  LOAD_SINGLE_INTERFACE (IUniformRandomStream, randomstream, VENGINE_SERVER_RANDOM_INTERFACE_VERSION, interfaceFactory, false);
 
	  // get the interfaces we want from the game DLL
	  LOAD_SINGLE_INTERFACE (IServerGameDLL, gamedll, INTERFACEVERSION_SERVERGAMEDLL, gameServerFactory, false);
	  LOAD_SINGLE_INTERFACE (IServerGameEnts, gameents, INTERFACEVERSION_SERVERGAMEENTS, gameServerFactory, false);
	  LOAD_SINGLE_INTERFACE (IServerGameClients, gameclients, INTERFACEVERSION_SERVERGAMECLIENTS, gameServerFactory, false);
	  LOAD_SINGLE_INTERFACE (IPluginHelpersCheck, helperscheck, INTERFACEVERSION_PLUGINHELPERSCHECK, gameServerFactory, false);
	  LOAD_SINGLE_INTERFACE (IEffects, effects, IEFFECTS_INTERFACE_VERSION, gameServerFactory, false);
	  LOAD_SINGLE_INTERFACE (IPlayerInfoManager, playerinfomanager, INTERFACEVERSION_PLAYERINFOMANAGER, gameServerFactory, false);
	  LOAD_SINGLE_INTERFACE (IBotManager, botmanager, INTERFACEVERSION_PLAYERBOTMANAGER, gameServerFactory, false);
 
	  gpGlobals = playerinfomanager->GetGlobalVars (); // get a pointer to the engine's globalvars
	  ConCommandBaseMgr::OneTimeInit (&g_ConVarAccessor); // register any cvars and server commands
 
	  return (true); // return true so as to enable the engine to load this plugin
   }



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
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