ID:36723
 

If you look at most RPGs out there (whether solitaire or multiplayer), you will almost always recognize one poor soul caught within the bits and bytes of the game. He is called Roger, or Bob, or Xiian, and he works 24 hours a day, 7 days a week, only to be able to sell you the best weapons and armours from a sheer endless supply. This brave man manages to withstand the temptations of such comforts such as food, sleep, and companionship in order to provide you with a way to spend those hard-earned gold coins looted from the bodies of the dead.

Practical? Yes. Realistic? No.

One of the easiest ways of giving a game more depth is by making its non-player characters more realistic. By adding more interaction between them and the rest of the world, the game not only becomes more realistic, but it actually adds new gameplay elements which add to the fun. This article will describe the fleshing out of a simple shopkeeper to a vital story element as an example of how to make one's NPCs three-dimensional.

 

Rygar the Shopkeeper

So let me begin by filling out the basics on my lowly PC named Rygar. The name is important - nothing ruins the suspension of disbelief more than marching through desperate moorland and savage dungeons to meet a Healer named Bob, or to search ancient unspeakable secrets scribed in ancient texts with the help of Conan the Librarian. So choose a name which fits the culture and theme of your game.

Next step: I am going to give him a nice description which will be revealed with someone "looks" at him... Rygar is a middle-aged man, with dark short hair, around 30 (which is old for medieval times), with kind features and slight wrinkles in his face. Is this important? It won't make any difference, gamewise, but it'll help players recognize and/or remember him.

Now that I have the basics, I am going to add him to the world.

 

Your NPC and his Shop

Obviously enough, the shopkeeper will need a shop in order to sell his wares. Instead of just having people talk to him directly in order to buy things, I am going to place the objects which are sold in the shop itself. Yes, this means that people can pick up items and examine them before talking to Rygar and buying them.

This immediately opens a wide range of opportunities. First, if there is only a limited amount of items in the store, it is possible for someone to buy everything up... just as in real life, there are times when what you are looking for is not available. If people sell items to Rygar, the items will then appear in the shelves/store (at a higher price, of course)... items do not disappear, they simply change hands.

You could even go the full economic route... rarer items are more expensive, common items are cheaper. However, in order to give Rygar a slight advantage over players who might set themselves up as shopkeeps, we are going to have NPC salesmen from out of town visit him twice a month and sell him items to replenish his stock. Just enough to keep him in business of course. Note that in a game with a real dynamic economy, this would not necessarily be a good decision, since it "cheats" and causes inflation.

Imagine what would happen if someone simply took an item... and walked outside of the shop with it? In Rygar's case, he'll probably yell at the top of his lungs, but he won't leave his shop behind where it could be looted in his absence. Other shopkeepers might chase after thieves, or shoot at them with guns, magic wands, or arrows. Some shopkeepers in high magical worlds might have traps which shock you for damage if you try to escape.

But what happens next? Well, first of all, Rygar is probably going to recognize the thief if he ever appears again, and definitely won't wait for him to steal something again. Next, he will reward anyone who returns the merchandise to him. Anyone who talks to him will probably learn what happened from him. At several places at the town "WANTED" posters will hang -- not with the name of the thief, since Rygar wouldn't necessarily know that, but with the thief's description (finally a good use for having players describe their characters!). We might even expand the idea with jails, and a town guard patrol, but that is for another time.

So now we have the possibility of players stealing wares or acting as "bounty hunters" and returning thieves for reward money, already adding new depth to the game.

 

Your NPC and the World

Unless he is an android or a golem of some type, it is highly unlikely that he will stay at work all the time. If you have some type of time system implemented, it is easy to have him close the shop in the evening, warning everyone to get out or be tossed out, locking the store, and walking home.

Yes, even NPCs have homes, which many people forget. Let's fill his home with a wife, and maybe children. By befriending them, you increase your reputation with Rygar... and good family friends always get a discount on his products. By visiting and helping the Rygar family, you help yourself.

We can take it even one step further - one day of the week, Rygar's oldest daughter Sense takes over the store for him while he goes to the old temple to meditate and pray. If you talk to Rygar at this time, he might talk religion with you - which might not be to everyone's taste, but might reveal tidbits of valuable information. Of course, if you are a member of the same religion as him and pray, he might be a tad friendlier to you as well... but the opposite goes if you a member of a rival temple.

By adding such variables to the relationship, you add a sense of connectivity to the world. Nothing exists alone. You can follow Rygar to work, to the temple, back home, maybe even to the inn on Thunderday and give him a beer. Everyone affects everything else.

 

Overview

As you can see, it is possible to give every single NPC so much detail that their code rivals that of other games. For the most part, you don't have to go that far, but with certain selected NPCs it can add so much more. Games feel more real if the NPCs don't stand still at one place all the time.

Next time you see a shopkeeper, don't walk up to him and use your BUY verb. Invite him to a glass of ale at the tavern, and listen to him tell tales of his adventures while still a lad in foreign lands...

I tend to do this sort of stuff with my NPCs, although the realism factor doesn't come into it for me.
I do it for the same reason I don't have all my monster areas as the same forest environment. It helps to stop the player from feeling as though they're just doing the same thing over and over again.

When you consider all the resources the modern developer has at their disposal it seems like a waste not to upgrade the smaller elements of the game world.
This is why I tend to let players create their own shops. All this happens, without me having to put in a lot of extra code.
Given a good enough programmer, you could write a scripting language or something like XML that stores the information about these NPCs. This data would be used to use the same code to make NPCs act differently, as well as have differeing schedules and other such things.
In addition to this, a nice touch would be permanent atmospheric changes. No one picks the weeds, the flowers die. It reboots? Weeds still there. Shopkeeper killed? Loot his store, upon reboot it'll be closed up. Break into the store? Next reboot the hole'll still be there.

This can easily be done with code and map saving, and adds a lot to the game.
My gosh, this is my first time reading this, and I must say, it is quite amazing! You really opened up new ideas and really changed my perspective of NPC's.