Code Monkey home page Code Monkey logo

npcgpt's Introduction

npcgpt

Writeup: https://medium.com/@sean_skimmer/npc-gpt-3f4cb5272773

Leveraging large language models for video games and NPCs. This proof of concept is built out for the game Stardew Valley. The project is made up of 3 parts, described below.

Part 1: Character Generation

To generate dynamic and unique NPC's, the first model generates a short character bio. The model is based on OpenAI's open source GPT2LMHeadModel. The model was fine tuned using sample character bios that were generated using similar formatting and description styles as the Stardew Valley villager wiki pages. The sample bios used for training data can be found at data/character_bios.csv. The generated character bio is then cleaned and processed to be used as input for the dialogue model.

Part 2: Dialogue Model

The cleaned personalities generated by the model above are fed into the dialogue model to create conversations that are both relevant to the game and personality. For this step, the knowledge base of objects in the game was created to ensure the dialogue surrounded relevant items, mobs, and locations. Training data was created with the ChatGPT API created by OpenAI, using prompts that returned item definitions, quests, and general dialogue. This replaced the original method which used the original game dialogue, scraped with VideoGameDialogueCorpusPublic, as the original dialogue was not comprehensive enough to achieve substantial results. Multiple models were trained with guidance from this Medium article, using DialoGPT and GPT2 as base models. The outputs of this model are run through part 3 to determine if there is intent related to a conversation.

Part 3: Rule-Based Named-Entity Recognition for Intent Recognition

To capture the transactional intention of dialogue with the NPC, two Spacy Matchers are used to identify and pull the relevant information from the dialogue. For example, if the user asks the NPC for a quest, the NPC might give the user an item quest or a mob related quest. The Matcher rules can identify that a quest has been given to the user and extract the target items (or mobs), the quantity requested, and the potential reward offered to the user upon completion of the request. This information is used to dynamically implement the transactions in the game, allowing for a more robust and complete user experience.

npcgpt's People

Contributors

seankim658 avatar kylearbide avatar

Stargazers

Autuan.Yu avatar  avatar  avatar  avatar Yucheng Huang avatar Pouria Taj avatar jialiang avatar Bupathi Sangeeth avatar  avatar Graham Winchester avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.