• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# NPCs (La la la)

## Recommended Posts

I felt like sharing this. No other reason :
Most cities in RPGs seem to be sparsely populated by NPCs. To create the illusion of a population, we create a few select Major NPCs (which have individual AI) and a specified number (determinant on city size) of Minor NPCs, which are controlled by a ''Group Mind'' and moved about with flocking technology. If we try to disturb these NPCs, they will either ignore and walk around us (flocking in action), or give us a short, sharp message like ''Sorry, I''m in a hurry. Please excuse me.'' Identification of Major NPCs can be an issue, however, they will often remain in certain locations for extended periods of time, be dressed in a unique fashion, or be in areas where the number of Minor NPCs is low, or nil. Using this method has one especially interesting side-effect : you have to actively work to FOLLOW a Major NPC if it enters a group of Minor NPCs. Also, Minor NPCs make excellent soldiers, especially if you want to send an army of soldiers, whether it be 100 or 1000, against your Player.
Yes, it works, and works very well. It also works very fast. At its simplest level, the Flocking System I refer to is a Particle System with Object Avoidance in the movement code. I hope this benefits someone ... Merrick

##### Share on other sites
Nice, Merrick.

I have an intresting idea for an extention to this: the ability to turn one of these minor into a major NPC, if the current state of the game requires it. (note: this is dynamic rpgs only)

ANDREW RUSSELL STUDIOS
Visit Tiberia: it''s bigger, it''s badder, it''s pouyer...

##### Share on other sites
''NPC (La la la)'' could be a hit song..

but anyway...
Im interested to see how your AI is... you seem to be getting awfully advanced at this stuff...

:: Jamie Interactive ::

##### Share on other sites
morfe,
Yes that is the way it usually is. I suppose it works, but it can make things feel quite generic. It brings up questions to the player such as why is this NPC highly detailed, and this one is just a generic cookie-cutter type of NPC . I suppose due to speed and memory constraints it may be the only way to do it. I guess it's a necessary evil unless/until we find a better way. Although, Andrew's idea sounds interesting too.

I have heard ES3: Morrowind is going to have every NPC as detailed as the player. I wonder how they're doing it.

Need help? Well, go FAQ yourself.
What a plight we who try to make a story-based game have...writers of conventional media have words, we have but binary numbers

Edited by - Nazrix on March 21, 2001 9:35:30 AM

##### Share on other sites
quote:
Original post by Nazrix
It brings up questions to the player such as why is this NPC highly detailed, and this one is just a generic cookie-cutter type of NPC

I imagine it would still work quite well in RPGs.

For instance, trolls aren''t exactly famed for their intelligence, so it''d be perfectly natural for them to have minor AI. Then, if your setting calls for lots of trolls around the place - you''d have it sorted.

E

##### Share on other sites
quote:
Original post by Eight

I imagine it would still work quite well in RPGs.

For instance, trolls aren''t exactly famed for their intelligence, so it''d be perfectly natural for them to have minor AI. Then, if your setting calls for lots of trolls around the place - you''d have it sorted.

E

Yes, I''m fine with that approach for NPCs that are known to have a lesser intelligence like animals or unintelligent beasts, but many RPGs do this for what are supposed to be as intelligent as others like them. It is obvious to the player in many RPGs that one NPC is only more detailed because the developers just had to make some detailed and some not. When seeing through the developers'' plans, it looses some suspension of belief.

Need help? Well, go FAQ yourself.
What a plight we who try to make a story-based game have...writers of conventional media have words, we have but binary numbers

##### Share on other sites
quote:
Original post by Nazrix

Yes, I''m fine with that approach for NPCs that are known to have a lesser intelligence like animals or unintelligent beasts, but many RPGs do this for what are supposed to be as intelligent as others like them. It is obvious to the player in many RPGs that one NPC is only more detailed because the developers just had to make some detailed and some not.

I''m with you 100% on that one.

The difference has to make sense to the player. Categorization of the being is a cheap way of doing it, but doesn''t work in situations where you have large numbers of the same intelligent being. E.g. a human city setting.

What about a 2 1/2 tiered AI.

For example.

Beast A
is a fully articulate living animal which has the top AI to give it a real life in the world.

Beast B(1)
has minor level AI - i.e. group mindset

BUT

Beast B(2)
has minor level AI except when the player''s attention is on the creature.
For example, you pick a creature/group of creatures and start following them. The AI could then be upgraded to a midpoint level where the creatures'' goals/destinations are picked at random. The group would then divide up to head towards these new destinations, enabling the engine to begin to pinpoint which individual beast is the focus of the player.

Maybe something like that would work?

##### Share on other sites
I really think the way to go is to look how a storyteller would improvise on the fly. A mob of people is just genericly controlled until the player begins to focus on a particular character. At this point, the NPC is dynamically built, fleshing out characteristics and a history for the NPC which is consistent with the NPC''s location, heading, etc.

By the time the player confronts the NPC, the NPC has been fleshed out. If the confrontation only lasts a short time and then the NPC goes on his way, the NPC''s dataset can be discarded UNLESS: The player learned of some key facts which will enable the player to meet up with this NPC again, such as his residence address, his place of work, etc. In this case, the NPC''s dataset is kept around until resources dry up. The case of resources drying up may never happen given the size of future hard drives and the finite time a player has to explore the world. For example, let''s say a very rich and highly linked database is used which requires 20k of storage for the fully fleshed out NPC. Now, let''s say our player causes NPCs to be procedurally generated at the rate of one every five minutes. This means 4166 hours of gameplay will produce 50,000 NPCs, which results in one GB of storage.

##### Share on other sites
bishop,
that sounds interesting, but are you suggesting that when the player finds enough info. about an NPC to make him/her worth keeping track of the game will dynamically store this info on the HDD for future reference. Then it would load it into RAM when the info is needed.

I just wanted to make sure I understand what you're saying.

Need help? Well, go FAQ yourself.
What a plight we who try to make a story-based game have...writers of conventional media have words, we have but binary numbers

Edited by - Nazrix on March 21, 2001 2:11:00 PM

##### Share on other sites
quote:
Original post by Nazrix

bishop,
that sounds interesting, but are you suggesting that when the player finds enough info. about an NPC to make him/her worth keeping track of the game will dynamically store this info on the HDD for future reference. Then it would load it into RAM when the info is needed.

I just wanted to make sure I understand what you''re saying.

Yes.

But I would go a step furhter, and say an NPC could be dynamically generated as a Soar program (there''s that word again) and called into the Soar system when the NPC needs to be reloaded. This way, not only could one build the traits of the character, but the beliefs and knowledge of the character as well, including the newly learned knowledge about the player and the prior interactions with the player. Additionally. a set of default knowledge (a separate Soar module) could be merged into the NPC program each time the NPC is reloaded.

We would probably be talking about more than 20k of uniqued data per NPC as a Soar program, but still, we''re talking about advanced next generation technology here, and I think it would still be in the realm of taday''s storage capacities, especially since I don''t think a player is going to encounter 50,000 NPC''s by playing for 4000 hours, as I mentioned in my above post.

The default knowledgebase which could be merged with the explicit knowledge of the NPC (Soar is designed to handle the seamless merging of knowledgebases) would include various knowledge sets about topics such as ownership, survival, need for shelter, empathy, combat, financial goals, etc.

##### Share on other sites
I''m looking forward to seeing how this works, but I have some truly "old school" input:

Anyone ever play Paragon software''s MegaTraveller? Old old game based on Mark Miller RPG. It had relatively large cities filled with NPCs. You could identify normal NPCs from special ones because the special ones were green (hey, it was an EGA game).

The generic NPCs would respond with "I''m too busy" messages (essentially, "I have nothing to say") and it actually got irritating after awhile. Why? Because you ended up searching through a sea of non-interactivity for a few interesting nodes of gameplay. Boring.

Understand, btw, that I''ve been DYING to see New York sized environs filled with NPCs, so I support any step that gets closer.

I really like the idea that any NPC could be a major NPC. What''s wrong with combining both approaches: Distinctive, location based NPCs, like the CEO of a huge multinational, who''s always in his office; and the spontaneous generation of a major NPC some of the time when you talk with minor NPCs, and your generic non-interactive NPC other times.

With this approach, you''d get both story / environment relevent NPCs the player could count on, plus great surprises from time to time.

(Oh, btw, I think rather than the "I''m too busy" approach, maybe Fallout''s more environment / story dependent quotes would be better.)

--------------------
Just waiting for the mothership...

##### Share on other sites
And as a player I just LOVE when loading and saving a game takes 10 minutes.

I''ve gone down this road myself, and man does the disk get hit hard with it.

Yes, the space is available, but in a game? Not sure it''s a good idea.

Not to mention this situation:
Enter a new city
Save game
Walk up to NPC 123
Find out fact ABC
Piss off the city guards and get killed.
Walk up to NPC 123
Find out fact DEF
HUH? What just happened?

So to protect against this, players can only have one saved game? The instant they made contact the data is saved, then when they...

Walk up to NPC 123
You get one of two responses:
1) "Hey! It''s good to see you again!"
2) a complete repeat of the conversation

Just some thoughts...

Dustin

##### Share on other sites
quote:
Original post by Dustin_00

And as a player I just LOVE when loading and saving a game takes 10 minutes.

I''ve gone down this road myself, and man does the disk get hit hard with it.

Yes, the space is available, but in a game? Not sure it''s a good idea.

Not to mention this situation:
Enter a new city
Save game
Walk up to NPC 123
Find out fact ABC
Piss off the city guards and get killed.
Walk up to NPC 123
Find out fact DEF
HUH? What just happened?

So to protect against this, players can only have one saved game? The instant they made contact the data is saved, then when they...

Walk up to NPC 123
You get one of two responses:
1) "Hey! It''s good to see you again!"
2) a complete repeat of the conversation

No, not like that at all.

##### Share on other sites
Ahem.

class Major : public Minor {
...
};

The insinuation is not that Minor NPCs are "intellectually inferior" to Major NPCs, but rather that the intelligence is of a Hive nature, rather than Individual. They are capable of complex thought, however, they act like the Borg, for example.

Just have a class constructor specifically for inheriting from a Minor NPC.

##### Share on other sites
well, actualy, I don''t think that you would want to inheret the stuff for a minor NPC, because you may be storing stuff like where it is in the flock, and minor actions, which the major NPC wouldn''t be using.

ANDREW RUSSELL STUDIOS
Visit Tiberia: it''s bigger, it''s badder, it''s pouyer...

##### Share on other sites
Sorry for the coder speak... but you could use some sort of Proxy object for an NPC that presents an ''intelligent'' interface to the rest of the game, but hides the fact that the NPC might actually have no knowledge yet. Initially, an NPC could just exhibit dumb hive flocking mentality or whatever, but when queried for more detailed information, it would allow the NPC to be dynamically fleshed out as appropriate. And when an NPC has been ignored for long enough, it could ''lose'' the detailed part of its intelligence so that the game data doesn''t just grow and grow. This would allow you to give NPCs a memory for significant things that have happened to them, without necessarily having to distinguish between ''major'' and ''minor'' ones. More interestingly perhaps, an NPC with no set role in the plot would have the capability to feature prominently in certain cases.

Another idea is to take a procedural approach to NPC attributes, generating them as necessary. So, instead of this:
class NPC{int unique_id;int hair_colour;int eye_colour;int home_town;int race;int class;int number_of_beers_can_safely_consume;// etc....} all_npcs[32000];

you could do this:
class NPC{int unique_id;int GetHairColour();int GetEyeColour();//etc...} all_npcs[32000];

All you have to do is base the results of GetHairColour() and the other functions deterministically on the unique id, and you potentially have totally unique NPCs, that will always ''remember'' their details, and yet never need more than a single integer to store them.

I admit that this system only addresses constants such as description, background, attributes and personality, rather than events that have occurred to that character in the game, but a combination of the 2 approaches could work well to add the appearance of a really detailed and consistent world that doesn''t require a lot of wasted CPU resources.

##### Share on other sites
Dunno if this fits into the current discussion,
but I''d like to see a game (futuristic RPG?) that uses the NPC-technique described by morfe and made with the engine of Syndicate Wars...
I loved this dark cities, but they could be tuned up with more peasants and traffic...whew, this would rock !

##### Share on other sites
quote:
you could do this:

class NPC
{
int unique_id;
int GetHairColour();
int GetEyeColour();
//etc...
} all_npcs[32000];

  class Minor_NPC { unsigned long unique_id; // 2 billion NPCs (max) unsigned short Appearance; // hair, eye and race/skin color (bitflags) vector Position; // where they are in the world ai_func *Sub_AI; // Function pointer to their AI subroutine } all_npcs[MAX_NPCS];

Of course you would want to add a couple of values for occupation, and perhaps parentage, which would determine social status etc. for you. These values would allow you to calculate almost every other variable you''d need, rather than having to store them in precious memory.

And I''d rather use a list than an array. Much easier to update when NPCs die, or you want to add new ones,

##### Share on other sites
quote:
Original post by kabale

Dunno if this fits into the current discussion,
but I''d like to see a game (futuristic RPG?) that uses the NPC-technique described by morfe and made with the engine of Syndicate Wars...
I loved this dark cities, but they could be tuned up with more peasants and traffic...whew, this would rock !

Yeah, I want to see this, too, for a futuristic RPG. But I''d also like a dash of "Grand Theft Auto" thrown so you could operate vehicles, too.

--------------------
Just waiting for the mothership...

##### Share on other sites
What do you mean? You could control all the vehicles in both Syndicate & Syndicate Wars.

I loved the Battletanks, and the APCs got me through so many tough situations.

##### Share on other sites
quote:
Original post by Anonymous Poster

What do you mean? You could control all the vehicles in both Syndicate & Syndicate Wars.

I loved the Battletanks, and the APCs got me through so many tough situations.

? Whaaa!?! That''s what I get for not playing enough! I never finished, and I was ALWAYS on foot! :\

--------------------
Just waiting for the mothership...

##### Share on other sites
Well, duh.
Everyone knows that you get smarter, stronger, and more important by changing the color of your hat (shoes, etc).

I expect there''s an shop for NPCs somewhere that handles this.
The downside to the change is that you keep getting pestered by all these adventurers....

##### Share on other sites
I''m kinda new to coding still, but couldn''t you use friend functions in a class, to make certain things dependant on anything special... maybe an NPC''s name could be dependant on the location on a map, as names are different around the world. Or age/appearance could depend on life expectancy in that area. Is that possible? I dunno how to do that...

##### Share on other sites
quote:
Original post by Anonymous Poster

Well, duh.
Everyone knows that you get smarter, stronger, and more important by changing the color of your hat (shoes, etc).

Oh, ha ha.

1. The class was for Minor NPCs, and Int, Str & Chr are almost irrelevant.

2. It was eye, hair & skin color, which determine race.

3. I forgot gender. Oops.

4. Int, Str, Dex, etc. CAN be calculated from that, when you include the occupation. This is a case where stereotyping is a good thing, since you can have a base set of stats for each gender in each occupation. Eg, you''re not going to find a weak Blacksmith, or a stupid Librarian.

5. Where the NPC lives (if you have that much complexity) can be determined like so : their appearance and their occupation determine which sector of the city they live in. Their unique ID references the house. By only have to record coords in a sector rather than the whole city/area, you save a lot of space, and can have more NPCs.

quote:

I''m kinda new to coding still, but couldn''t you use friend functions in a class, to make certain things dependant on anything special...

Friend is evil, avoid using it. You''ll learn this down the line (since you''re new), but learn it quick

quote:
? Whaaa!?! That''s what I get for not playing enough! I never finished, and I was ALWAYS on foot! :\

That''s probably why you never finished. IIRC, a couple of missions required you to steal a flying car to get to a part of the map, or steal a normal vehicle to get through some of the gates. At any rate, some vehicles had weapons on them too (Battletank = missiles, flying car = laser).

I still play that game, but I too would like someone to create a fan version with better AI. Leave everything else alone, and just make way better AI - especially for the enemy agents.

Before I go, I remember one story about how when Syndicate was first play-tested by outsiders, they had women with babies and dogs as civilians in the game. People objected to the dogs getting killed much more than the babies. In the end, they decided they had better take out both ...

• ### Forum Statistics

• Total Topics
627738
• Total Posts
2978881

• 10
• 10
• 21
• 14
• 13