Lets first look at the purpose of an Actor in a film.
They play an important role in any movie as they are one of the most significant ways through which viewers experience what is going on. Not all actors are equal however, and while some may constantly be on the screen, others are just there as "filler". Some actors such as those who have the leading roles must have depth, and their lives must make sense in order for the person interacting with them to treat them as believable. This is less so with supporting actors who are revisited frequently, but whose lives we do not follow closely enough to warrant being as well fleshed out. Lastly is the lowly "extra", the actor who is seen in the background, who appears to have a purpose but in reality is just "pretending" to go about their lives and whose role stops the second the camera turns away from them.
How does this apply to any CRPG?
Types of NPCs
In essence, NPC's fill the role of actors in any adventure. They are one of the most significant ways through which the players interact with the game world in direct correction to actors they should have 3 distinct varieties.
The Leading NPCs
These are the equivalent of the Leading actors. They are constantly visited by the characters and they have a critical role in the adventure. They are the significant beings in the game world that are generally focused on in great depth. Sadly however, most CRPGs fail to understand the need for them to be more "life-like", and instead of fleshing them out and making them a living part of the world, they leave them as placeholders who spend all day and night in a single location and treat the characters in exactly the same way all the time. To me this is a serious oversight on the part of the module designer, as these leading NPCs are the focal point of any adventure and time spent on them never goes to waste as all characters will experience them multiple times throughout the adventure.
These people have moods, they have a mind and they remember. The intention here should be to build a relationship with these people, to cultivate either a mutual respect or a healthy friendship due to the pivotal roles they play. Whether it is the king of your country, or your mentor, or the owner of the tavern where you work, the way in which you interact with them should matter.
Imagine them becoming nervous because time is marching on and what you have been asked to do looks like it wont get done in time? Or imagine them becoming angry with you because you failed an important milestone? Imagine them being extremely happy because you managed to complete an important part of the quest just in the nick of time? The purpose here is that your actions have an effect, and that affect will be lasting and remembered.
Remember also that these people have lives. It isn't their sole reason for living to be sitting at the desk or standing in their living room waiting for you. They eat, they live, they sleep. They may go to work or seek refuge in a pint of ale down the local tavern. Fleshing them out doesn't mean just giving them a longer dialogue, it means giving them key mechanisms that are not given to other entities in the game world. Reputation, persistent memory, daily lives, multiple paths of actions to choose from.
Supporting Roles
Just like a supporting actor, the purpose of NPCs that fill this niche is to provide the characters with something more than just a faceless body, but obviously not require the same amount of time and attention as the leading NPCs. They are not seen as often and their lives have less importance due to the specific part they play. These NPCs could be the merchants and inn keepers, the captain of the guard or teachers at a wizard's school. They too have a memory and they also can have moods, however the reduced interaction required with them means that you do not have to go all out in providing them with full and complete lives. In this respect, their lives begin and end at designated times. During these times they are living and breathing entities, but once that time has passed they fade into obscurity until they are required again.
Some of the same mechanisms used for the leading roles can be used here as well, but not all are required. Their daily lives are simple, the paths of actions are less. Their role is not as directly related to the adventure itself and thus their path is more specific to their own purposes rather than being bent to the purpose of the adventure.
Extras
If the world were only populated with leading and supporting roles then it would be a fairly bland place. Cities and villages which based on the number of houses around, should be teaming with life, appear to be empty accept for remote pockets of people, all of whom have a purpose. This is where the extra comes in. They are the faceless masses, and their purpose is give the appearance of civilization, or of a number of people that don't truly exist. They are faceless and numerous, and their only purpose is to give the "appearance" of having lives to characters who happen to pass them by. Their lives begin only when the characters encounter them and end once they have passed out of view.
Now instead of having individual daily lives, we have "group" daily lives. Each location has a definition for the types and numbers of citizens that will be milling around at various times of the day or night. When characters are in the area, extras will be going about their business as if they truly had lives.
Implementing in NWN
Obviously it would place far too much strain on the NWN server to even attempt to programmatically control all NPCs. The fact that processing time is restricted to those areas which are occupied by characters means that events wont fire often enough to effectively have them exist in the game world at all times. So how do you minimize server usage while still being able to keep things realistic? The answer involves using the NWN Server for what it was strictly built for, while utilizing the NWNX script interface to interact with an external assembly which is designed to truly control the NPCs and their lives.
NPC Simulator
As an external assembly written in the C#.Net language, it has none of the restrictions that the NWScript language has, nor is it tied into sharing resources with the NWN Server. This decoupling not only frees the NWN Server up from having to closely control the movements and actions of the NPCs, but the place where this control is processed doesn't even have to be on the same physical machine as the server, thus utilizing additional CPU resources to make things run smoother.
The purpose then for the NPC simulator is to approximate the lives of NPCs based on their type, and to record information about what has happened in their lives for future processing and incorporation into who they are as beings in the world. This of course can be as simple or as complex as is required, and it can be expanded and improved upon without the need to change or recompile the module itself. Not only that, but I have the luxury of using 3rd party components or a choice of conceptual AI models to simulate their lives. Whether this is using mimetics, heuristics or an extremely complex deterministic system is still on the drawing board.
What the NWN Server does
The NWN Server now becomes a form of input for the NPC simulator. When characters are in the area the individual NPCs themselves relay information to the NPC Simulator as things occur. The simulator then processes these pieces of information and returns a new set of goals and tasks for the NPC to complete. The NWN Server then controls the current action of the NPC based on those goals. This could mean moving from one location to another or performing a task at their current location. When each goal is reached, that information is relayed back to the simulator for further instructions. In this way the server does not need to provide complete control over the NPC, it simply feeds information back to the simulator and then takes action based on what the simulator said to do. Updates are infrequent and short, and are only occurring for those NPCs which are in areas occupied by characters. All other NPCs are being completely controlled by the simulator and have no presence in the game world.
In this way, whenever certain events fire, the Server can pass information back to the server and get instructions on what the NPC should do as a result. This could be anything from the NPC perceiving someone they know and being instructed to say "Hello" to them being damaged by someone and recording a memory of who it was that attacked them and remembering to stay away in future.
Managing the switch between Simulator and Server
This of course necessitates the need to know when characters are about to enter an area (so that the area can be loaded prior to their arrival), when they are in an area, and when an area is now devoid of characters and control can be returned to the server. This will be done through a mechanism which utilizes both the OnAreaEnter and OnAreaLeave events, as well as a few special area placeables around every area transition which will be used to confirm when a character is either entering or leaving those areas. The Server then feeds this information to the simulator which instructs the server on which NPCs to load, where they will be and what they will be doing before the player is there. If an NPC is instructed to move to a destination and leaves via an area transition, then that NPC returns control to the simulator until such time as a character enters the new area.
The system from a character perspective
But what does all of this mean from the point of view of the characters... after all, the only reason any of this is being done is to improve the experience of the player and to immerse them in the game world.
Now instead of NPCs being static and unchanging, with clearly visible patterns that repeat for no apparent reason, we have NPCs that not only react to what goes on around them, but remember events and go about their lives as if they were real people. They will recognize the characters they meet and react to them based on the relationship that has been established, they will progress through their day based on the lives they have and the tasks that are important to them at the time, and the characters will feel immersed in a world that gives the appearance of being alive even though it is only being simulated. The general "buzz" of civilization will be different for large built up cities than it is for small villages and it will have a different feel during different times of the day and night. No longer will it feel like the entire world is on hold waiting for the characters to talk to them, now everybody will feel as if they have their own life and that you are part of a bigger world that is going about its business whether you choose to interact with it or not.
0 comments:
Post a Comment