Extracting information

neozero

Newbie
Joined
Oct 26, 2003
Messages
160
Reaction score
0
This is a repost of a request I made on hl2coding.com
anyway the topic's here.

I really am wondering how to do the last thing I mentioned.

It seems that teamwork is normally handled with a different entity ( the one for managing City17 Citizen squads) , but do you think this is necessesary? If there is anyway for spawned NPC's to be aware of each other's existance I'd like to know.
 
I'm sure that the majority of NPCs have squad code built in, although you need to set a squad-name for them, or something. HL1 would dynamically assign Grunts to squads when they were in a certain range.

The Teamwork entity for City17 Citizens, as far as I know, handles the player controlled element. Notice that the Metrocops work as a team, but don't need this entity.

-Angry Lawyer
 
Okay well it would seem as if the class AI_Manager is just what I need.

In fact it seems to have a global variant called g_AI_Manager.

Can I assumet that g_AI_Manager holds every A.I. currently spawned?
 
*Sigh this seems like a conversation with myself*

Anyway, if I have everything correct, it seems as if the spawn function just describes key properties of the NPC.

Any Idea how it actually spawns?

I'm still a little puzzled how this is all handled.

I'm assuming that when an NPC is spawned, that an instance of it's class is created. But what is this instance named? Is it stored in g_AI_Manager. Sigh, so lost, but I must understand.

Anyway I hope you realize what I'm asking.
 
No idea where it comes into things, but I'd assume it's automatically created somewhere down the line.

NPCs are aware of each other - but they just don't show it. What exactly are you trying to achieve?

-Angry Lawyer
 
I can't seem to get to your original thread, in any case g_AI_manager is an external class of the type CAI_Manager. Basically it's an array of up to 256 AI's there is no communication done by the manager that is instead handled by the AI's, they can iterate through the array and communicate to whichever AI's they like, however they like.

Check out AI_BaseNPC it has the definition of CAI_Manager and also has the definition of basic AI communication. Remember that any of these communications may be overridden somewhere in the inheritance line. If you want to get into making the AI coordinate better you could try doing things at this relative top level, but you probably should be looking into the other CAI classes:

CAI_Senses
CAI_MoveProbe
CAI_Motor
CAI_LocalNavigator
CAI_Navigator
CAI_TacticalServices

Unfortunately since these are all discrete services it looks like you might have to write some sort of coordinating system to really make the AI work together.
 
Back
Top