NPCs have terrible AI.

Samrux

Santa Claus

I built my NPC mansion partially with the new NPC mechanics in mind. Stairs allow any NPC from anywhere in the house to reach anywhere else; I figured this would make the building much more lively and interesting, if not frustrating to find someone I needed during the day.

It turns out, though, that the NPCs just like to move around a single sector, and once they're away from their house, they are so dumb that they can't find their room again.

It was ridiculous to watch the Guide walk in circles, not deciding to go down the stairs which would take him to his home below. He was able to get up there through the same stairs, but wasn't able to return. He apparently was convinced that he could reach his house just by dropping down, but there were no platforms below his feet. The guide couldn't reach his house from the same level that my character is at:

GuideHouse.png



Here, our friend DeAndre the Arms Dealer appears to be trapped, somehow not recognizing that he can drop down from this wood platform to return to his house. He was walking from side to side:

DeAndre.png



This is kind of worrying me. I wanted to see all NPCs interacting together, but since they don't want to move away from a single area, and don't know the difference between a stair and a solid block, or a sloped block from a normal one, I can't but feel awkward. This is taking me out of the experience, now that I have over 15 NPCs, and I have to watch them move in circles through the same places over and over again, blind to other paths that are obvious and in sight. I was dissapointed, because the update promised an NPC overhaul. I also feel a little sad that my town not only doesn't feel alive, but feels dead and robotic.



Right now, an NPC's Artificial Intelligence has proven to be defined simply by:
-Choose a random direction. Walk that way.
-There's a wall in an open space. Jump while facing it.
-There's a door in the way. Open it then close it.
-An enemy is nearby. I should attack it.
-A chair is here. Maybe I should sit.
-Another NPC is in front of me. Say hi, talk a bit.
-I should go home. If my home is left/right, move left/right. If my home is up/down, try to jump/descend.
-If I can't reach my home, walk in wider circles until I get somewhere else to try again.



The developers of Terraria can do so, oh so much more than this. Yet, even when the simplest of pathfinding AI's would be needed to make the NPCs not seem stupid, we got like, what? 8 different commands to execute? Can that even be considered an AI, for an entity that is supposed to make the player's experience and environment seem more lively and interactive? When Terraria was released, NPCs didn't talk and sit and attack, but they did all the same nobrained things they do up to this day. Nothing has really changed since Terraria 1.0.

Actually, since NPCs can now drown, but they don't have anything telling them to avoid water, they will often wander off into a deep lake and die, without the player being able to do anything to stop it apart from blocking the way.

As I said, a pathfinding AI is relatively easy to build, even more so for a 2D game. Make NPCs differentiate between stairs, platforms and solid blocks. Make them recognize what a sloped block is. Make them not jump into a pond and die. Make them know how to reach their home, if they can. Make them know where it is possible to travel, and maybe make them know if they won't be able to go back if they go that way. Heck, make them jump up platforms in the ceiling, because they can't even do that.



The current NPC AI was designed, 4 years ago, for towns like this:

37VNZ.jpg




But Terraria has grown a whole lot. Not only are town designs similar to the shown above almost never used (every player I've met makes towers to pack all their NPCs together, unless they are making a world specifically for building), but players like me actually try to make interesting houses, towns and mansions, that both players and NPCs can live in. I want for my tiny attempt of civilization to look alive, and for its inhabitants to not seem stupid, because they shouldn't be stupid anymore. 4 years ago it was okay for them to be stupid; Terraria was then just born, and Redigit didn't even know how far the game would go. Now, times have changed, and much more can be accomplished with the tools available, both in terms of in-game building, and out-game development.

With the humblest and most honest of words; I am hoping for the current developers to do something about this for 1.3.1.


Thanks for reading.

 
Last edited:
I would play on a server, and noticed the cyborg was on the bottom layer and his house was a couple layers up, and instead of jumping up there he walked in circles and went into a different house and used it as his house for nighttime, ignoring all existence of his house. He would not even teleport to it after he was offscreen. I tried to move him to a different house but he did the same thing. If the NPC's could not do this I would be happy, so support is here.
 
While I only build square houses and apartments, this would allow me to try attempting to build a more elaborate build without seeing weird...npc...ai.
 
And then when events like Solar Eclipses happen they will walk OUTSIDE of your house so that MORE ENEMIES will enter and make things even more annoying. Not to mention they now proactively try to seek out things to kill in such events when they should be standing still in the house.

Talk about snitches.
 
Couldn't agree more. I'm not good at building enough to have a problem where they can't get home, but I always feel bad when all the Steampunker has to talk to is the Pirate because they're both too dumb to drop down between floors of the apartment, or jump back up.

When my NPCs are in disarray at night, though, I just walk far away and come back and they teleport back into their rooms. I also have a mechanism to seal their doors at night.
 
I don't think the developers can really do much to make the npcs smarter. But they could implement an item that one hit kills any unruly npcs. I just locked a stupid merchant outside. The doors are closed at sundown whether or not npcs are all inside.

Maybe make npcs sleep in beds at night.
 
I don't think the developers can really do much to make the npcs smarter. But they could implement an item that one hit kills any unruly npcs. I just locked a stupid merchant outside. The doors are closed at sundown whether or not npcs are all inside.

Maybe make npcs sleep in beds at night.
solar eruption used to do that... then they removed that mechanic as it was apparently a bug :(
 
I don't think the developers can really do much to make the npcs smarter. But they could implement an item that one hit kills any unruly npcs. I just locked a stupid merchant outside. The doors are closed at sundown whether or not npcs are all inside.

Maybe make npcs sleep in beds at night.
Of course they can do much. Zombies in Minecraft were as stupid as Terraria NPCs for years. Then they were given pathfinding AI, and they now can, literally, solve huge complex corn mazes to get to you.
 
I play Terraria on console, but I still understand. Can we have an update that just focuses on NPSs and their AIs? A 'follow me' button would be helpful, so you can show them where to go unti!l the next dawn, when they can wonder off.
 
Back
Top Bottom