Thanks, I recently tried something like this with a coder but we ran into some problems which he couldnt resolve. We got the NPC sleep radius working pretty fast, but I really wanted take the optimisation a small step further. The idea I had was to put the NPC into 'stasis' at a certain distance (done), but then to also cull it completely from the world and a slightly larger distance. So I asked if we could somehow destroy the NPC, leaving just a marker of somekind (for position and possibly rotation) and then spawn NPC back in again when the player gets within the culling distance. The problem he had was that when he spawned in the NPC, for some reason it was stuck in stasis, no animation or anything. It was like it wasn't initialising the AI upon spawning. If you were to approach this idea, what do you think the best way to approach it is? As I've mentioned I dont know much about code but I can quote from an email which he sent to me: "I changed the name of the Spawn() function to ActualSpawn(). I added Think() function which acts as a think function. The think function gets called by Spawn(), which is what I created. This is the only way I can think of to get the zombie to check continuously if it should spawn or not. It is the think function that is making things messed up and I can't figure out what to do just yet." Here is the code: void { { BaseClass::NPCInit(); ActualSpawn(); }CZombie::Think()if(BaseClass::GetAbsOrigin().DistTo(UTIL_PlayerByIndex(1)->GetAbsOrigin()) <=256)else{ SetNextThink(gpGlobals->curtime +1.0f); } }void { Think(); }CZombie::Spawn()
----- Original Message ---- From: Christopher Harris <[EMAIL PROTECTED]> To: Discussion of Half-Life Programming <hlcoders@list.valvesoftware.com> Sent: Sunday, 29 June, 2008 6:52:13 AM Subject: Re: [hlcoders] LOD-ing zombie AI, is it possible? Override NPCThink() In Psuedo Code If npc origin - player origin is greater than or equal to 2048 Return; BaseClass::NPCThink(); This actually makes them not animate or do any AI things. Though it is fine since player wont see them if he is 2048 units away. Chris -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Briscoe Sent: Wednesday, June 18, 2008 4:41 AM To: Discussion of Half-Life Programming Subject: Re: [hlcoders] LOD-ing zombie AI, is it possible? Apologies, a friend of mine from the steam forums suggested I might have more luck posting the problem on hlcoders. ----- Original Message ---- From: Tom Edwards <[EMAIL PROTECTED]> To: Discussion of Half-Life Programming <hlcoders@list.valvesoftware.com> Sent: Tuesday, 17 June, 2008 11:47:02 PM Subject: Re: [hlcoders] LOD-ing zombie AI, is it possible? It's best to keep discussions in one place. If you really must cross-post, link instead of pasting. http://forums.steampowered.com/forums/showthread.php?p=7749435 Robert Briscoe wrote: > Hi, > > So I have recently started planning out an idea of a small SP mod for the source engine which i plan to make over the summer and release around October. Without going into the intricate details of the mod it's self Im toying with using either hl2's npc zombies or ideally having slightly modified versions which act slightly differently than they currently do. > > Of course the latter needs code work which as an artist is way out of my league, but im wondering if anyone here would be willing to help me out, or at least give me an idea how hard it would be, from a coders point of view, to implement it into a mod. > > To give you an idea of exactly what im looking for here is a basic description: > > A way of LODing out the AI if the zombie is at a certain distance from the player. > For example: Once the player is 2048 units away from the NPC it will cease all AI and just play an idle animation remaining in a 'sleep state' until the player is within 2048 units radius of the NPC. > The reason for this is that im thinking of ways to have alot of zombie NPCs spread over a large area without clogging up the CPU on pointless walking and pathfinding stuff like they do now while they idle. > > Secondly, I recently played the latest version of SMOD and noticed they they added a pretty cool new type of zombie as shown in this video from SMOD: Tactical: > http://www.youtube.com/watch?v=4nIArug7ENk&feature=related > > It seems like a pretty simple AI modification to an NPC citizen or something, where they are idle until they see or hear the player then just run straight at them causing damage if they come into close contact with the player. They also seem to run to random path nodes whilst searching for the player also which also crude looks pretty convincing! > > If you're now thinking "why dont you just use SMOD?" its because they have no source code to implement the zombie LOD system which is more important atm and SMOD is not very mapper/modder friendly (it doesnt even have a FDG entity file for hammer). I also need to use some Orange box specific features for the mod to have some outstanding visuals. > > Anyway any advice or help anyone can offer would be greatly appreciated! > > Thanks! > Robert Briscoe > www.littlelostpoly.co.uk > > > __________________________________________________________ > Sent from Yahoo! Mail. > A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders __________________________________________________________ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders __________________________________________________________ Not happy with your email address?. Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders