From Puppets to Souls: How ChatGPT Gives Game Characters a True Essence

21 May 2023

Do you play games? Have you ever wondered what it would be like if the NPCs in the game really "live" one day?

I love "Stardew Valley" and have played for more than a hundred hours. In this simulation business game, players can farm, raise animals, go down the mine, exchange feelings with villagers and even get married, and freely manage their own farm and life according to their own preferences.

However, while I can advance the game to my liking, the villagers in the game cannot. Their lives in the game are "fixed" and fully programmed in advance. If you follow the strategy, you can completely know that a certain villager will do a certain thing in a certain place at a certain time on a certain day.

The activities of each NPC are written strictly according to the timetable | Stardew valley Wiki

At the same time, the villagers have family, friendship, and love settings for each other, but in fact, except for special plots, it is difficult for you to see any communication between NPCs.

In other words, these villagers have no "soul" and are just puppets controlled by the program.

But GPT has changed everything: recently, some researchers used GPT-3.5-Turbo (yes, not even the latest GPT-4) to build a rich sandbox world. In that world, NPCs can carry out their own lives and have social interactions that are not pre-set [1].

An example is that when holding a party, there will be NPCs who will attend the appointment on time, and there will also be NPCs who will release pigeons. The choice a character will make is not pre-set by the program, but is decided by the character spontaneously, which is fundamentally different from NPCs in traditional games such as Stardew Valley.

Let NPC really "live"

The core of this article is to describe the programming of Generative Agents (Generative Agents, hereinafter replaced by GA). The researcher's goal is to enable GA to make decisions based on its past experience and environment, and to establish relationships with other GAs.

In the past games, if the game developers wanted to let the NPCs in the game hold a party, they needed to write dozens of character scripts in advance, from time, place to action, the workload was huge. But for GA, simply tell the target character that it wants to throw a party, then it will take the initiative to spread the news, prepare for the party, and then wait for its friends to come to complete the party together.

In the demo designed by the developer, there are a total of 25 GAs living in a small town called Smallville. This town has complete facilities, and each GA can move freely here.

The interaction between Smallville and GA[1]

Judging from the article, the interactions of GAs and the interventions that players can make to the world are completely different from previous games, for example:

GAs use natural language to interact with each other, such as expressing their views on election activities and their likes and dislikes to other GAs in natural language, and in a sense, GAs "understand" the information exchanged with each other, because these information will affect to their next activities.

(GA Interaction Example) Isabella: "I'm still weighing my options, but I've discussed the election with Sam. What do you think of him?" Tom: "Honestly, I don't like Sam. I think he Very alienated from the community and not concerned with our best interests."

People in real life can also use natural language to communicate with GA. For example, set yourself as a special identity such as a journalist, ask the other party's views on the election, and the other party will express their views.

People in real life can also use natural language to directly intervene in GA's actions, such as acting as Tom's "inner voice" , telling Tom "you will compete with Sam in the upcoming election", then Tom will decide Compete with Sam, whom he doesn't like, and share his plans with his wife and children.

GA can change the state of environmental objects , for example, the bed is occupied when GA sleeps, and the refrigerator is empty after GA finishes breakfast. People in real life can also use natural language to change environmental objects and affect GA actions. 

In addition, GA also has emerging (Emergent) social behavior . Emergence is a concept that has been widely discussed in the game design community in recent years. Simply put, it means that only the underlying rules are set in advance, and then there are extremely rich and unexpected events that are far more complex than the underlying rules.

Understanding the word "emergence"

For GA, emergent social activities include:

information diffusion. GAs will simply chat once they are in each other's attention range, and the information they are interested in will spread quickly from this. For example, only a few people knew about Sam's participation in the election, but through the gossip among GA, the whole town immediately knew about it and became a topic of conversation for the whole town.

relational memory. The dialogue between GAs will be accumulated and remembered by each other, and become the introduction of the next dialogue. For example, in the conversation on the first day, Latoya mentioned to Sam that she was taking photos for the newspaper. If they met again the next day, Sam would ask Latoya how the photos were going.

Coordinate activities. GA can understand the meaning behind the instructions and make relevant "realistic preparations". For example, the researchers only asked Isabella to hold a party on the afternoon of February 14th, and Isabella would spontaneously spread the news, asking friends to help decorate the venue and other social activities.

On the basis of the party, other GAs also spontaneously started socializing based on their own settings. For example, Maria had a crush on Klaus in her role setting, so after learning about the party, she invited Klaus to join her Party together, and Klaus gladly accepts.

The party is like a stone thrown into a pond, causing ripples in the town, and you can even see gossip[1]

How many steps does it take to turn a virtual character into a "person"?

To make GA interactions so real-like, the researchers faced considerable challenges. Interestingly, the solution to these problems is not simply a technical algorithm, but also a strong imitation of human cognition.

For example, GA has a huge amount of experience, how to let GA understand which ones are not important and which ones are important and need to be kept? If all the memories are kept, it will distract GA's "attention" and reduce the efficiency of decision-making, and from the perspective of system operation, it is impossible to keep all action records.

The technician's solution is very cognitive psychology, simulating the process of encoding, storing and retrieving human memory:

The memory flow records of GA experience events will be fully preserved. At the same time, the researchers constructed a retrieval function, including three variables of recency, importance and relevance , respectively , important, and relevant to the current situation are assigned higher scores.

GA will filter out the most important part of the memory flow to make an action [1]

In a sense, the same is true for our memory: recent events are easier to recall, important events are easier to recall, and related events are easier to recall (for example, I can’t think of what to say no matter how hard I think, suddenly I see Related things suddenly come to mind).

Human memory can be divided into long-term memory and working memory. Long-term memory is like a storage room filled with mementos from your past life; working memory is like a table in front of you with the things you need to use right now.

Similarly, you can understand the memory flow of GA including all actions as long-term memory, and the process of extracting related events and prioritizing them as working memory. This process is actually a simulation of cognitive activities such as human attention, memory and decision-making.

In addition, the researchers also used certain mechanisms to allow GA to develop the ability to reflect. GA can think about their own behaviors and choices, and make rankings according to their own values.

For example, GA will no longer decide who is more important simply because of superficial state variables, such as who spends more time with each other (because you may spend more time with your roommate, but in fact you are just a simple greeting relationship) .

GA will deeply reflect on his own settings, for example, Klaus will think "I am passionate about research", and "Maria also loves research", so "we may have a chat", and then think that Maria is the most important to him.

In addition, GA also has certain planning and planning capabilities, as well as the ability to carry out different dialogues according to different environments. For example, seeing a painter at an easel and seeing a painter in a coffee shop will have very different conversations in GA.

To some extent, human intelligence may also be the result of emergence. Through some simple underlying basic settings, such complex intelligence has finally been developed.

This kind of simulation even makes people start to have bolder conjectures: maybe we are not real at all, but digital simulations, that is, GA.

This is what the Oxford University philosopher Nick Bostrom calls the “simulation argument.” This argument is based on two assumptions:

1. "Consciousness" can be simulated in a computer.

2. With the development of technology to a certain extent, huge computing power can be used.

It is assumed that humans after thousands of years can run millions of "ancient human worlds" on supercomputers, and each virtual "ancient human world" has tens of billions of simulated consciousnesses. The amount of simulated human consciousness will greatly exceed the amount of non-simulated human consciousness.

Then, as a “consciousness”, the probability that we are a simulated consciousness is much higher than the probability that we are a real consciousness.

Looking back at this moment in time, we are almost certain that AI represented by GPT will be a meteor shower that will completely change the destiny of mankind. It may bring new life, or it may bring destruction. Regardless, it's truly spectacular.


Write & Read to Earn with BULB

Learn More

Enjoy this blog? Subscribe to CapitalThink


No comments yet.
Most relevant comments are displayed, so some may have been filtered out.