AI & NPC

PostNukeRP Gamemode Suggestions

AI & NPC

Postby Lord Rahl » Wed Mar 21, 2012 9:36 am

Well I was playing pnrp the other day, and I was basically doing little more then alot of NPC hunting.
I was running around near the ruins by the train station, And I see an antlion guard. I crouch down behind the walls in the ruins, and i prepare to take down what will be quite an easy kill thanks to my UMP.
Then I realize something.

This isn't supposed to be this easy. I'm fighting an alien beast at least 3 times my size, and I can kill it in about 10 seconds if I'm having a good day. All this monster does is charge at me. Over. And over. And over.

Same goes for zombies. They just sorta... try to smack you.
or tackle you.
Or throw a crab at you.

I know Lost was/is working on a new npc, but honestly I think we need more than one- I know it'd be hard and that it might be asking alot, but if things like that could get a bit more spiced up itd be pretty cool.

For example.

Not that many Zombies spawn at once. And I love the idea of fighting for my life as Zombie hordes close in on me- but that never happens. (unless in tunnels in pn_bunker)

I realize that AI is alot of work, but I never feel like I'm in any danger- I would love to see huge packs of antlions trying to fly over my walls- and having to try to fight them off.
Or falling asleep in my house- only to wake up to find a dozen starved zombies pounding on my door in an attempt to come and devour my living flesh. :twisted:

So what if....
1) AI could be improved?
2) A couple more NPC's (zombines, antlion spitters, or guardians*)
*Guardians are reskinned antlion guards equipped with with poison glands, one appears in Episode 2.
3) NPC spawn rate could be increased?
4) Zombies could walk up to props, attack them, and slowly break them apart?
5) Zombies could walk up to, and break doors down?
6) I would love to see either the tank or the charger from left 4 dead in pnrp, attacking a guard. Even though its likely impossible.
7) Turrets are either removed, made breakable, or have to be powered by armor batteries. I am starting to view them as somewhat of a game breaker.
8) What if every now and then, an event happened, where all npcs currently on the map just dropped dead, and a ridiculous amount of antlion mounds spawned at once, right next to each other?
9) An event happens where all NPCs became faster and deadlier?
10) An event where all zombies spawning on the map get replaced with fast zombies?
11) Or an event where a ridiculous amount of Antlion Guards Spawn at once?
PermaFrost, formerly known as Lord Rahl
Lord Rahl
 
Posts: 128
Joined: Wed Oct 13, 2010 12:55 pm

Re: AI & NPC

Postby DevilsNipple » Wed Mar 21, 2012 10:49 am

i like the idea of zombies breaking down doors. and i like the event where a ton of guards spawn, and im all for a little more zombies every now and then. From what i know, lost said resources and npc's will spawn a little more commonly.

turrets are good but i agree they are kinda game breaking, they shouldnt be take out but rather refillable, the turrets will need 357 ammo put into them and wont fire if they dont have any. the 357 ammo should act as like 10 because turrets shoot fast. so for every 1 357 bullet into it is 10 turret butllets. means 1 lots of 357 will fill the turret for 250 shots.
DevilsNipple Do it the Awesome way!

Image
DevilsNipple
 
Posts: 452
Joined: Sun Feb 26, 2012 4:41 pm

Re: AI & NPC

Postby eldarstorm » Wed Mar 21, 2012 1:38 pm

Few things, and will probably let Lost go into more detail since he has the better memory on our plans.

One thing, we are somewhat limited on teh ability with affecting NPC AI. We have tried making NPC's hate entities. Our original plan was to have zombies attack antlion mounds for example. Well, you see how affective that was.

Lost's new zombie still needs alot fo work, but he will be a chalance. They will work in packs and do have the ability break down doors (And they will).

The next system getting a rework is Contruction, after that we should be working on the Mob Spawner. One of the changes will be that we are making it modular (will be easier to add stuff to it). We will look into the antlion spitters as well.

As far as the L4D mobs, that would be cool, bad part of doing that if we could, players would have to have L4D. Does not sound too hard, but we still have issues with people not having EP2.

Turrets will need to be worked on. On thing that we have thought about was making it so they could not be frozen. The ammo or battery thing may work as well. We are planning to build a interface on the turret, more on that later.

As far as hords or waves of zombies, we have a few ideas on how the spawingin system will change.

As far as how many of what spawns on the map, that can allready be changed by a admin thorough the spawn menu. Have to be carfull though, the more npc's the more it can lag a server.
Image
User avatar
eldarstorm
Developer
 
Posts: 1172
Joined: Tue Nov 17, 2009 1:56 pm

Re: AI & NPC

Postby DevilsNipple » Wed Mar 21, 2012 1:54 pm

all sounds good. allthough with the turrets. if you add something in terms of ammo or batery then we should be able to freeze them, if you make them s thaey cant be frozen then we shouldt need batery or ammo. the 2 together wont be too great
DevilsNipple Do it the Awesome way!

Image
DevilsNipple
 
Posts: 452
Joined: Sun Feb 26, 2012 4:41 pm

Re: AI & NPC

Postby Lord Rahl » Wed Mar 21, 2012 3:07 pm

reasonable enough i suppose.
PermaFrost, formerly known as Lord Rahl
Lord Rahl
 
Posts: 128
Joined: Wed Oct 13, 2010 12:55 pm

Re: AI & NPC

Postby LostInTheWired » Wed Mar 21, 2012 3:39 pm

Alright, doing some NPC and AI responses, eh? Well, let's see...

How 'bout this.
Code: Select all
local schdZombNewWander = ai_schedule.New( "AIZombieNewWanderNode" )
   schdZombNewWander:AddTask( "PlaySequence",                   { Name = "ACT_IDLE", Speed = 1 } )
   schdZombNewWander:EngTask( "TASK_GET_PATH_TO_RANDOM_NODE",       512 )
   schdZombNewWander:EngTask( "TASK_WALK_PATH_TIMED",             0.5 )
   schdZombNewWander:EngTask( "TASK_WAIT",                   0.5 )
   
local schdZomb = ai_schedule.New( "AIZombieWander" )
   schdZomb:EngTask( "TASK_WALK_PATH_TIMED",          0.5 )
   schdZomb:EngTask( "TASK_WAIT",                   0.5 )
   
local schdZombChill = ai_schedule.New( "AIZombieChill" )
   schdZombChill:AddTask( "PlaySequence",             { Name = "ACT_IDLE", Speed = 1 } )
   schdZombChill:EngTask( "TASK_WAIT",             math.random( 1, 5 ))
   
local schdZombChse = ai_schedule.New( "AIZombieChase" )
   schdZombChse:EngTask( "TASK_GET_PATH_TO_ENEMY",       0 )
   schdZombChse:EngTask( "TASK_RUN_PATH_TIMED",          0.1 )
    schdZombChse:EngTask( "TASK_WAIT",                   0.1 )
   
local schdZombAttack = ai_schedule.New( "AIZombieAttack" )
   schdZombAttack:EngTask( "TASK_STOP_MOVING",       0 )
   schdZombAttack:EngTask( "TASK_FACE_ENEMY",          0 )
   schdZombAttack:AddTask( "PlaySequence",          { Name = "swing", Speed = 1 } )
   
local schdZombChrgDoor = ai_schedule.New( "AIZombieChargeDoor" )
   schdZombChrgDoor:EngTask( "TASK_GET_PATH_TO_TARGET ",          0 )
   schdZombChrgDoor:EngTask( "TASK_RUN_PATH_TIMED",          0.5 )
    schdZombChrgDoor:EngTask( "TASK_WAIT",                   0.5 )

local schdZombBreakDoor = ai_schedule.New( "AIZombieBreakDoor" )
   schdZombBreakDoor:EngTask( "TASK_STOP_MOVING",       0 )
   schdZombBreakDoor:EngTask( "TASK_FACE_TARGET",       0 )
   schdZombBreakDoor:AddTask( "PlaySequence",          { Name = "swing", Speed = 1 } )

These are the current schedules. They're badly done, and MUST be redone, but they give us the gist. These are the basic actions using engine commands. Honestly, it's not very good. I wish it was better, but I keep feeling like I need to redo practically the whole thing. Eh...

Here's where the meat happens though:
Code: Select all
function ENT:SelectSchedule()
   local enemy = self:GetEnemy()
   local sched = ChooseRandom({schdZomb, schdZomb, schdZomb, schdZombChill})
   local distToGoal = self:GetPathDistanceToGoal() or 0
   local isCustom = true
   
   if not self:OnGround() then
      
   end
   
   if distToGoal < 50 then
      isCustom = true
      sched = schdZombNewWander
   end
   
   if ValidEntity( enemy ) then
      if self:GetPos():Distance( enemy:GetPos() ) < 50 then
         isCustom = true
         sched = schdZombAttack
      else
         local myDistance = self:GetShootPos():Distance(enemy:GetShootPos())
         local tracedata = {}
         tracedata.start = self:GetShootPos()
         tracedata.endpos = enemy:GetShootPos()
         tracedata.filter = self
         local trace = util.TraceLine(tracedata)
         local targetEnt = trace.Entity or NullEntity()
         if (not trace.HitWorld) and ((not trace.HitNonWorld) or targetEnt:IsPlayer()) and myDistance < 2048 then
            ErrorNoHalt("Memory Update Hit.")
            self:UpdateEnemyMemory( enemy, enemy:GetPos() )
            self.LastSeen = CurTime()
         end
         local timeDiff = CurTime() - self.LastSeen
         if timeDiff < 30 then
            local trace = {}
            trace.start = (self:GetPos() + Vector(0,0,60)) + (self:GetAngles():Forward() * -10)
            trace.endpos = trace.start + self:GetAngles():Forward() * 110
            trace.filter = self
            local tr = util.TraceLine(trace)
            
            local traceEnt = tr.Entity or NullEntity()
            if traceEnt:IsValid() then
               if traceEnt:GetClass() == "prop_door_rotating" and traceEnt:GetLocalAngles().y == 0 then
                  self:SetTarget(traceEnt)
                  self.BlockingDoor = traceEnt
               end
            else
               isCustom = true
               sched = schdZombChse
            end
         else
            self.LastSeen = CurTime()
            self:ClearEnemyMemory()
            self:EnemySearch( "player", 512 )
         end
         
         
      end
      
      -- local blockingEnt = self:GetBlockingEntity()
      
      -- if blockingEnt and blockingEnt:IsValid() then
         -- ErrorNoHalt("Blocking Class:  "..blockingEnt:GetClass())
         -- if blockingEnt:GetClass() == "prop_door_rotating" then
            -- self:SetTarget(blockingEnt)
            -- self.BlockingDoor = blockingEnt
         -- end
      -- end
      
      if self.BlockingDoor:IsValid() then
         if self:GetPos():Distance( self.BlockingDoor:GetPos() ) < 90 then
            isCustom = true
            sched = schdZombBreakDoor
         else
            isCustom = true
            sched = schdZombChrgDoor
         end
      end
   else
      if math.random(1,100) < 25 then self:VoiceSound(ChooseRandom(Vo.Zombie_T), 100) end
      self:EnemySearch( "player", 512 )
   end
   
   if isCustom then
      self:StartSchedule( sched )
   else
      self:SetSchedule( sched )
   end
end


Here is the real problems. The schedule selection is wonky, works funky, and honestly needs better target detection. It's just...not very good. Like I said, I probably need to do some rewriting. But, because of a fairly recent discovery:
Code: Select all
function ENT:OnCondition( iCondition )
   print( self, " Condition: ", iCondition, " - ", self:ConditionName(iCondition), "\n" )
end

I've been able to get conditions, which may make the AI more streamlined, if it works correctly of course. We'll see, and that's about as in depth as I can get. That's where I'm at, and I hope that explains our current issues with the AI, at least a bit.
LostInTheWired
Developer
 
Posts: 306
Joined: Tue Nov 17, 2009 7:54 pm

Re: AI & NPC

Postby DevilsNipple » Thu Mar 22, 2012 7:52 am

nice, the zombie will charge a door at distance or just break it when close. im not great at code but im fairly sure im good enoguh to see that xD
DevilsNipple Do it the Awesome way!

Image
DevilsNipple
 
Posts: 452
Joined: Sun Feb 26, 2012 4:41 pm

Re: AI & NPC

Postby Lord Rahl » Thu Mar 22, 2012 8:11 am

Sounds cool to me!
PermaFrost, formerly known as Lord Rahl
Lord Rahl
 
Posts: 128
Joined: Wed Oct 13, 2010 12:55 pm


Return to PNRP Suggestions

Who is online

Users browsing this forum: No registered users and 5 guests

cron