This is a simple NPC generator for fantasy settings. It is designed based on Dungeons and Dragons 5th Edition, but can be used for any fantasy setting. It is designed to be used by a Dungeon Master to quickly generate NPCs for their campaign. It is a work in progress and will be updated as I have time to work on it.
The first step is lone the repo with the command git clone https://github.com/SimoneVizzuso/fantasy_npc_generator or download the zip file from the GitHub page.
For the generator to work, you also need to install a LLM (Large Language Model). The fastest and easiest way to do this is to use Ollama.
- You can download Ollama from here
Then you need to setting up a Python Environment: this guide will walk you through the process for setting up a new PC without Python.
- Open your web browser and navigate to the official Python website here.
- Click on the "Downloads" tab located on the top navigation bar and choose.
- Choose the python version 3.10 for your operating system (Windows, macOS, or Linux) and click on the download link.
- Once the download is complete, run the installer and follow the installation instructions provided.
- After the installation is complete, open your terminal, type
python --versionand press Enter. This command should display the installed Python version. - Check that the version is
3.10
- For Windows systems you can simply double-click on the
Fantasy_NPC_Generator.batfile. - For Unix-based systems you need first to execute
chmod +x run_webapp.shon terminal.- Then you can run the web app by executing
./Fantasy_NPC_Generator.shon terminal.
- Then you can run the web app by executing
- You need to create a virtual environment to install the dependencies.
- Open the terminal in fantasy_npc_generator folder, and type
python3 -m venv .venvto and press Enter. - Then type
.venv/Scripts/Activate.ps1and press Enter.
- Open the terminal in fantasy_npc_generator folder, and type
- To install all the dependencies type
pip install -r requirements.txtand press Enter.
- Once you have downloaded Ollama, you need to choose an LLM. This generator is optimized for Mistral 8x7b (or Mixtral).
- For Mistral 8x7b you need at least 48GB of RAM and a GPU with at least 24GB of VRAM.
- To use Mistral 7b, you need to open the terminal and type
ollama pull mixtraland press Enter.
- To use Mistral 7b, you need to open the terminal and type
- For Mistral 8x7b you need at least 48GB of RAM and a GPU with at least 24GB of VRAM.
- Once you have downloaded the LLM, you need to set the environment variable
OLLAMA_MODELin the file data/model.env- To use Mistral 8x7b, you need to set
OLLAMA_MODEL=mixtral.
- To use Mistral 8x7b, you need to set
- Navigate to fantasy_npc_generator using the command prompt or terminal.
- Type
streamlit run webapp.pyand press Enter. - A page will be opened in the default browser. If not, simply click on the Local URL link that will appear in the terminal.
- When the web app is opened, you can start to use it to generate your NPCs!
- Test the UNIX-based script
- Add more options for generating NPCs
- Generate also "standard NPCs" (like guards, merchants, etc.)
- Create a chatbot to interact with the generated NPC
- Add a feature to generate a full party of NPCs
- Generate also the NPC stats or a full character sheet
- Add PDF export functionality
- Add card-like view for the generated NPCs
- Add a field to add a custom description for the NPC
- Generate the NPC's image with an image generator
- Generate the NPC's voice with a voice generator
- Integrate it into a Character Creator for D&D 5e
- Added automatic installation for Windows systems
- Added a field to add a custom description for the NPC
- Added PDF export functionality
- Added hook to introduce the character
- Added a field to add a custom description for the NPC
- Added personality traits to the NPC
- Added the history of the last 5 NPCs generated
- Some fix of the prompt with age, hook and custom description
- Added possiblity to choose multiple alignments
- Added function to save all the generated NPCs in a json file
v2024.04.15
- Initial release
- Basic functionality to generate NPCs from classes, races, age
and alignment
- Webapp with basic UI to generate NPCs with StreamLit
- Added a script to open the webapp in windows or unix-based systems
- Added a README file with instructions on how to use the generator
- Added a requirements.txt file with the necessary dependencies
- Added a model.env file to set the LLM model
- Added a CHANGELOG file to keep track of the changes in the project