Devlog #3 – Zombie AI Begins


Welcome back to another update on Last Loop! This devlog’s all about finally bringing the undead to life — I’ve started working on zombie AI. It’s still rough, but it’s already made the world feel way more alive (or… undead?).

Getting Zombies Moving

First goal: make zombies actually move toward the player. I used Unity’s NavMesh system to get basic pathfinding working. 

Zombies now:

  • Automatically find the player

  • Navigate around obstacles

  • Stop when they reach you (for now)

It’s basic, but seeing them shuffle through the map changes everything. There’s tension now — even if the “zombies” are just grey pills wandering around.

Attacking the Player

Next up was combat. When zombies get close, they now deal damage. Right now it’s just a flat hit every few seconds, but it does the job. I’ve also added basic player health, so you can actually die. No UI yet, but I’ll be adding a proper health bar soon.

Behind the Scenes: Performance & Pathfinding

I quickly found out that spawning a bunch of zombies all at once breaks things fast. If every zombie tries to recalculate its path at the same time, the NavMesh system struggles — especially in tighter spaces like corridors.

The fix? Staggered path updates. Each zombie updates its path slightly offset from the others. It makes things feel more natural and keeps performance solid. Even with dozens of zombies on screen, things run surprisingly smooth now.

if (Time.time >= nextPathUpdateTime) 
{     
    nextPathUpdateTime = Time.time + pathUpdateInterval; 
    Vector3 randomOffset = new Vector3
    (
        Random.Range(-randomOffsetRange, randomOffsetRange),
        0,         
        Random.Range(-randomOffsetRange, randomOffsetRange)
    );      
    
    Vector3 newTargetPosition = target.position + randomOffset;
      
    if (agent.isOnNavMesh)
    {
         agent.SetDestination(newTargetPosition); 
    } 
}

What’s Next?

  • Add speed variation — some zombies should shuffle, others should sprint.

  • Start building a wave system like classic Zombies — limited zombies per round, round ends when all are dead.

  • Introduce ragdolls on death instead of zombies just disappearing.

  • Possibly start work on random path offsets, so they don’t all walk in perfect lines.

Get Last Loop

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.