On Thu, 27 Jan 2005 12:43:10 -0500, David Anderson <[EMAIL PROTECTED]> wrote:
Yes, I understand this - but it was relatively easy in HL1. Part of the
problem is that the interface name and version are concatenated as one
string, which makes it more difficult to request older versions
iteratively.
It's not really a problem requesting things from the engine, since that
is assumed to be okay... it's from the GameDLL where it's a problem.
And if mod developers and even Valve aren't updating the GameDLL
interfaces to their own SDK, it makes sense that an updated engine with
old GameDLL interfaces could also break. (Although that's not the case
here, since I don't think Engine uses IPlayerInfo).
All I'm saying is, it would be better to separate the version/name of
interfaces, and that it would be nice if when Valve did update API, they
recompiled their own mods (to at least set forth good policy for mod
developers). What's the point of releasing public API changes if you're
only going to half-support them?
Hello all, it's my first-time post on this list.
Allow me to drop my two cents on this issue:
A practical solution is to make use of as much engine interfaces as
possible, and as few game DLL interfaces as possible. Whenever a game DLL
interface is required, only the most important facilities should be used,
meaning here those that are not likely to change anytime a new version of
the interface is out.
A possible way of loading game DLL interfaces with some flexibility (to a
certain extent of course), would be to require from the game the interface
we want with a somewhat higher version number than the one we expect, then
gradually fall back until the interface version is found. This also allows
generic plugins to be used on various game DLLs, provided the order of the
function pointers in the interface doesn't change much.
For example:
// 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
(version #" version ") loaded at 0x%x as \"" #name "\"\n", name);
then
virtual bool CPlugin::Load (CreateInterfaceFn interfaceFactory,
CreateInterfaceFn gameServerFactory)
{
bool interface_verbose = true;
char interface_name[64];
int interface_version;
// get one interface from the engine
LOAD_SINGLE_INTERFACE (IVEngineServer, engine,
INTERFACEVERSION_VENGINESERVER, interfaceFactory, false);
// get some particular interface we want to use from the game DLL
for (interface_version = 9; interface_version > 0; interface_version--)
{
sprintf (interface_name, "ServerGameDLL00%d", interface_version);
LOAD_SINGLE_INTERFACE (IServerGameDLL, gamedll, interface_version,
gameServerFactory, false);
if (gamedll != NULL)
break; // stop trying as soon as a suitable interface is loaded
}
// rest of Load() function follows...
return (true); // return true so as to enable the engine to load this
plugin
}
So far, my main concern is to see Valve update the HL2MP server DLL to
support the IBotManager interface (which is unexistent by now).
Note: you can learn the different interfaces available from a game DLL along
with their particular version number by hex editing the server DLL.
--
Pierre-Marie Baty
Bots-United: http://www.bots-united.com
Bots-United forums: http://forums.bots-united.com
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders