Talk:AI Programming Overview

From Valve Developer Community
Jump to: navigation, search

Hey guys i just wanted to say i'm sofar a huge hl2 fan and it's friggen awesome how realistic the AI in this game is...and now on to the main subject I like to spice things up a bit when i create an online or a lan game w/ my friends and maybe throw in an npc or two. But it really isn't that interesting because they just sit there and well really don't do jack shit **excuse the language por favor** so it's pretty cool for lets say half a second. If anone knows how to so called "piss off the NPC" in otherwords create an AI script or something. Please let me know. E-mail me at [email protected] I'm sure it'll make not only my online gaming a little more fun :P but yours as well. Thank you... Best Regards Jack Dan

Well it seems no one else will spill the beans on AI Programming with Source so I have started, I will evolve the documents the more I begin to understand them, at the moment I am shifting in content from my private documenting of the AI in Source, to help me understand it better, so I thought I would share, it's more from a programmatic viewpoint (my viewpoint) so feel free to weave in your wealth of AI knowledge you guru's.

--fluxtah 12:52, 3 Aug 2005 (PDT)

I would offer to help, but I'm so out of touch with programming I don't even know where I might be helpful! --TomEdwards 12:53, 3 Aug 2005 (PDT)
Thanks for sharing your information. I'm trying to figure out AI scripting(Response System), and I started reading AI related codes. I'll add my findings as my progress -N-neko

Nice one mate, there is still loads more that could go in, including an example of a working NPC with custom schedules, tasks and conditions to bring it all together.

Also some pathfinding would be good.

--fluxtah 01:21, 4 Aug 2005 (PDT)

Hint code

I feel silly asking this, but could anyone point me towards the code for each hint? I've only been able to find the instructions for the combine mine inhibitor (in the combine_mine source file). None of the other NPCs seem to have anything! --TomEdwards 14:47, 4 Aug 2005 (PDT)

Hints are defined in AI_hint.h. It seems to me FValidateHintType(CAI_Hint *pHint) method in NPC codes defines what kind of hints they are intesrested in. Then hint information is handled via hintCriteria. (I'm looking at npc_playercompanion.cpp FindNewAimTarget() for an example) N-neko


Is there any way to implement NPC code to players themselves, so that a player can function normally unless the NPC AI tells them to perform a command?

Valve tend to stay away from/don't like using Computer controlled player entities.
(Even things like cutscenes and dramatic ingame events are all from the players perspective and controlled by the player)
With the rare exceptions being the Breen/Citadel Finale in HL2 and the Advisor Barn in EP2
Check out their Dev commentaries on games like Ep2 etc, they make it very clear that the game may take control of the camera to show you something. They are basically saying that so you don't panic, and you can get back to killing things soon lol... Great question tho and i would like to know this myself. :)
Also remember to end your statements/questions on the wiki with two dashes and 4 tilde's like --~~~~
--Jenkins08 10:02, 7 April 2009 (UTC)

make bots do stuff

hi i created my own map, and evrytime i start with t's(not sure about ct's) the bots dont move from the spawn points until the ct bots appear on the stairs near there. can someone help me out and tell me how to make the bots plant the bomb and defuse it(maybe) and other stuff thanks, ewan

Hi there Ewan!
Even tho its been 2 and half years since you wrote that question, I will still reply without regard to time as people who may need this in the future can get the info.
You need to put info_node's in your map (Just place them with no properties) and then build the Navigation_Meshes ingame.
The above Navigation Meshes link might seem really long at first but for a newcomer you only need to worry about Manually starting the generation process
Below that is how to Edit the nav mesh, which i've explained below;
If your map is just a simple map with say 2 rooms this will be very fast process, if your map is a scale model of Tokyo then your going to run into lots of issues because bots need to know where to climb, jump and they WILL get stuck aswell. When those problems come up, then you have to edit the Nav mesh and delete the parts of the Nav mesh that the bots are getting stuck on etc. Also to make bots be able to climb, you will need place a set of Info_node_climb's.
Hope this helps!
--Jenkins08 10:28, 7 April 2009 (UTC)


my email adress is [email protected], ewan