View Single Post
Re: Custom Interfaces
Old
  (#2)
DrEvil
Member
 
DrEvil's Avatar
 
Status: Offline
Posts: 142
Join Date: Jan 2004
Location: Los Angeles, CA
Default Re: Custom Interfaces - 07-06-2005

Ok, so after trying the custom interface in a newly exported mod it loads fine. So it seems like steam is overwriting my server.dll each run if I try loading the interface in HL2DM. They probably overwrite it if it doesn't match what's in the cache file or something. Kinda sucks for testing but it makes sense why they would do it I suppose.

Anyways, I'd like to get any and everyones feedback on everything that you'd like exposed via this custom interface that will be useful to bot coders.

Here's the current list of prototypes for functions that I have so far. Pretty much everything is done retrieved using a CBaseEntity* as the input. This should allow it to be useful for much more than players, like we are currently limited to.

You will also notice some duplicate functionality to what IBotController and/or IPlayerInfo provide. Other than trying to keep it simple and providing most things through a common interface, I believe the implementations of the CPlayerInfoManager and the accessors for some of the properties are less than ideal in terms of efficiency and safety.

For example CPlayerInfoManager::GetPlayerInfo blindly casts the CBaseEntity to a CBasePlayer. Not that it's hard to not call this on non player slots, it seems to demonstrate that these interfaces were likely hastily put together. Why didn't they use CBaseEntity::GetPredictionPlayer or CBaseEntity::GetSimulatingPlayer ?

So what other functionality do you think would be useful through a general IEntityInfoManager interface

Code:
class IEntityInfoManager
{
public:
	virtual const QAngle& GetAbsAngles(const CBaseEntity *_ent) const = 0;
	virtual const QAngle& GetLocalAngles(const CBaseEntity *_ent) const = 0;
	virtual const Vector& GetAbsOrigin(const CBaseEntity *_ent) const = 0;
	virtual const Vector& GetLocalOrigin(const CBaseEntity *_ent) const = 0;
	virtual const Vector& GetAbsVelocity(const CBaseEntity *_ent) const = 0;
	virtual const Vector& GetLocalVelocity(const CBaseEntity *_ent) const = 0;
	virtual const QAngle& GetLocalAngularVelocity(const CBaseEntity *_ent) const = 0;
	virtual const Vector GetEyePosition(const CBaseEntity *_ent) const = 0;
	virtual const Vector GetEarPosition(const CBaseEntity *_ent) const = 0;
};
Regarding the weapon/ammo/player access functionality we're missing, I'm thinking of putting player related functionality in the entityinfo class as well, because I think it's favorable to keep the entity access out of the classes themselves. For example, the current way IPlayerInfo is handled is that there is litterally a CPlayerInfo member in CBasePlayer, and an accessor to it, which is what CPlayerInfoManager::GetPlayerInfo returns the pointer to. This is both intrusive to CBasePlayer class, and adds an extra dependency.

The way CEntityInfoManager is currently set up, a mod can drop 3 files into their project, compile and thats it, no adding stuff to any other classes like CBasePlayer does. No extra dependencies, the CBaseEntity and CBasePlayer know nothing about an interface providing access to some of their members to a server plugin. Plus the drop in & compile should be easier to get mods(and valve) to do than a list of code lines to add to other files.

Anyways, here's the current train of thought for getting player info.

add:
Code:
  virtual const CBasePlayer *GetBasePlayer(const CBaseEntity *_ent) const = 0;
to the EntityInfoManager, and then provide a set of functionality such as:
Code:
 virtual void ChangeTeam( const CBasePlayer *pPlayer, int iTeamNum ) = 0;
virtual void ChangeClass( const CBasePlayer *pPlayer, int iClassNum ) = 0;
...

GetBasePlayer could use CBaseEntity::GetPredictionPlayer or CBaseEntity::GetSimulatingPlayer, assuming one of these functions is available server plugin side(and gives back what we need), or we can figure out another method of getting the CBasePlayer from a CBaseEntity safely.

Pretty much all the necessary things we need as bot authors are provided in CBaseEntity or CBasePlayer. By having the EntityInfoManager act as a wrapper around those function calls I think the result will be a safe and flexible way to expose everything we need for bots.

Anyways, please list any functionality from arbitrary entities or players that you can think of that needs exposed.

Thanks.


Omni-bot AI framework
http://www.omni-bot.com

Foxbot - for Team Fortress Classic
http://www.foxbot.net



Last edited by DrEvil; 07-06-2005 at 15:05..
  
Reply With Quote