.:: 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
HL2 plugin Weapon support
Old
  (#1)
DrEvil
Member
 
DrEvil's Avatar
 
Status: Offline
Posts: 142
Join Date: Jan 2004
Location: Los Angeles, CA
Default HL2 plugin Weapon support - 27-05-2005

So I got my Omni-bots running around in HL2DM with the independant movement and aim and such. From what I've read server plugins are still waiting on some functionality for weapons to work. I started looking at weapon stuff a bit yesterday and wrote some code to print out the players weaponselect field of his command

Code:
IPlayerInfo *pLocalCharacter = g_pPlayerInfoManager->GetPlayerInfo(INDEXENT(1));
	if(pLocalCharacter)
	{
		CBotCmd cmd = pLocalCharacter->GetLastUserCommand();
		if(cmd.weaponselect != 0)
		{
			char buffer[64];
			sprintf(buffer,"weaponselect : %d\n", cmd.weaponselect);
			Msg(buffer);
		}
	}
I was hoping the value would be some enumerated number defined somewhere in the mod, but the resulting output was some arbitrary numbers that jumped all over the place. Also odd was that sometimes changing weapons no new value was printed.

Anyways, by the looks of things we don't have a way of seeing what equipment a bot currently has, and a bit of investigating into IBotController.SetActiveWeapon seems to show that it will give the bot the weapon if they don't have it, which is clearly cheating and a less than ideal solution. At least if it returned a bool it could be used to check the presence of weapons.

So, can we compile a list of things we are missing from a server plugin standpoint to get fully functional bots, and I will re-submit it to valve in hopes of getting it taken care of. No doubt some of you have done this already. I want to hopefully be allowed access to methods of doing these things the right way, as opposed to hacking around and trying to get a plugin compiled pulling in all the extra stuff that wasn't intended to come in.

Here's a list I have so far in my < 1 week of messing with the plugin bot integration. If theres a way to do these things please let me know.

1) Check if a bot has a certain weapon or item. A bool IBotController.HasWeapon(const char *) would be nice, as well as a HasItem(const char *) that mods can implement for custom non-weapon equipment(kevlar vests, helmets...)
2) Access to an entities velocity? This is critical for some weapons to calculate proper leading. I'd rather not hack around this by getting the position each frame and calculating this myself, though I will if I have to I suppose.
3) Access to any entities position/orientation/velocity. Seems right now we're limited to players, but any decent bot is probably going to want to have perceptions of projectiles/grenades/dynamic map props.
4) Access to any entity in general. I suppose we can blindly loop through the edict list, but an interface to CGlobalEntityList would be so much better.
5) IPlayerInfo.ChangeClass would be nice. Empty by default, but at least provides an interface for future mods to implement. More mods than not will likely be class based.
6) Can we have access to trace_t.GetEdict() ? It's wrapped in #if defined( ENGINE_DLL ). Is it safe to define these in a plugin?
7) Minor issue, is there a reason IBotController and IPlayerInfo returns angles/vectors by value as opposed to const & ?
8 ) We need access to ammo values without switching to the weapon. Perhaps IBotController.GetWeaponAmmo(const char *weaponname, int &_curClip1, int &_curClip2, int &_maxclip1, int &_maxclip2). The reason there are 2 is to support weapons that use different ammo types for their alt-fire. Other stuff like max ammo, max clip size, ammo per shot I suppose are normally constants so I don't suppose we need access to them. Also what would be useful is IBotController.GetAmmo(const char *ammoname, int &_current, int &_max), to get the total amount of ammo the bot has, not counting what's in the weapon clips(or counting I guess it doesnt matter).
9) How to choose the model for a bot? How about spraypaint?

Simply giving us access to CGlobalEntityList and CBaseEntity in plugins would solve most of these problems. There are velocity accessors in there and it is not specific to players only like IPlayerInfo or IBotController. Adding accessors in the IPlayerInfo once again limits their use to players only, and we need to have access to any entity if we ever hope to create bots that are not retarded to their surroundings and capable of some level of avoidance of the props that could be anywhere, as well as projectile awareness and stuff.(The wall mounted armor dispensers in hl2dm.)

Please post any additional things you think we will need, or correct me if there is a way to do something that I have posted. Hopefully we can petition some time out of valve to finish up what we need in one final go and we can leave them alone

Thanks
Jeremy


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

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



Last edited by DrEvil; 27-05-2005 at 15:37..
  
Reply With Quote
Re: HL2 plugin Weapon support
Old
  (#2)
DrEvil
Member
 
DrEvil's Avatar
 
Status: Offline
Posts: 142
Join Date: Jan 2004
Location: Los Angeles, CA
Default Re: HL2 plugin Weapon support - 27-05-2005

ok, after a little more messing around with CBotCmd.weaponselect I noticed that the values appear to be different on the same weapon in different maps(wtf?), so this doesn't appear to be a constant that we can rely on unless we know what that number actually means.

Anyone know where to find a master list of the weapon names that are to be used in IBotController.SetActiveWeapon ?


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

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


  
Reply With Quote
Re: HL2 plugin Weapon support
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: HL2 plugin Weapon support - 28-05-2005

for point 4, I loop though the edict list. What would be the advantages of your method ? Most MODs would make changes to their CBaseEntity anyway...

for point 6, you already can get the edict after a trace: use
Code:
gameents->BaseEntityToEdict (tr.m_pEnt)
it's a method from the IServerGameEnts interface, the provider of it is gameServerFactory()



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; 28-05-2005 at 22:02..
  
Reply With Quote
Re: HL2 plugin Weapon support
Old
  (#4)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: HL2 plugin Weapon support - 29-05-2005

ooh nice function!
  
Reply With Quote
Re: HL2 plugin Weapon support
Old
  (#5)
DrEvil
Member
 
DrEvil's Avatar
 
Status: Offline
Posts: 142
Join Date: Jan 2004
Location: Los Angeles, CA
Default Re: HL2 plugin Weapon support - 29-05-2005

I suppose mods COULD make changes to baseentity, though IMO it is stupid to do so. Fortress Forever is far along with their coding and hasn't touched it. A good programmer should implement new functionality in their own mod specific sub classes.

Anyways, the reason I brought up access to CBaseEntity, and therefore CGlobalEntityList, is that there is functionality built into there that would be nice to have access to, like being able to get the position/velocity/orientation of any arbitrary entity, kinda like #3. Do you know of a way to get this info about non-player entities?

One of the major problems other than lack of access to weapon/ammo data is being limited to getting info about anything other than players. In a prop filled environment it is necessary to get this info about other entities too in order to make a smarter bot.

Thanks for the info for point 6.


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

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



Last edited by DrEvil; 29-05-2005 at 17:20..
  
Reply With Quote
Re: HL2 plugin Weapon support
Old
  (#6)
DrEvil
Member
 
DrEvil's Avatar
 
Status: Offline
Posts: 142
Join Date: Jan 2004
Location: Los Angeles, CA
Default Re: HL2 plugin Weapon support - 29-05-2005

sigh, Anyone get much weapon stuff working? It's become clear that IPlayerInfo.SetActiveWeapon isn't very useful. Every time you call it, another weapon is created. After a while of weapon switching the game shuts down after running out of edicts.

Anyone made sense out of CBotCmd.weaponselect ? The values for a particular weapon seem to change per map. Wonder if it's the index for a weapon edict in the master list or something. hmm.

edit: ahh looks like it is.


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

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



Last edited by DrEvil; 29-05-2005 at 23:07..
  
Reply With Quote
Re: HL2 plugin Weapon support
Old
  (#7)
DrEvil
Member
 
DrEvil's Avatar
 
Status: Offline
Posts: 142
Join Date: Jan 2004
Location: Los Angeles, CA
Default Re: HL2 plugin Weapon support - 30-05-2005

Ok, so CBotCmd.weaponselect is the index of the weapon in the edict list apparently. Unfortunately that doesn't help us much since I don't know of a way to get which weapons a particular player has so I could then use their index. Grr, seems this is kinda stuck until valve can give us more access, or fix the behavior of SetActiveWeapon so it doesn't create a new weapon each time or something.


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

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


  
Reply With Quote
Re: HL2 plugin Weapon support
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: HL2 plugin Weapon support - 30-05-2005

How about bumping on HLCoders again ?



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: HL2 plugin Weapon support
Old
  (#9)
DrEvil
Member
 
DrEvil's Avatar
 
Status: Offline
Posts: 142
Join Date: Jan 2004
Location: Los Angeles, CA
Default Re: HL2 plugin Weapon support - 01-06-2005

Theres a discussion going in there now, please everyone interested in bot coding lend your support to the mailing list. If they see there is a higher demand than 1 person they might take the requests more seriously.


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

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


  
Reply With Quote
Re: HL2 plugin Weapon support
Old
  (#10)
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: HL2 plugin Weapon support - 01-06-2005

I jumped in to back you up bro.

I do hope someone at Valve will grace us with a response this time...



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)
 
Thread Tools

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