Published
Dec 15, 2024
Updated
Dec 15, 2024

Haggling NPCs? LLMs Could Make It Happen

Leveraging Large Language Models for Active Merchant Non-player Characters
By
Byungjun Kim|Minju Kim|Dayeon Seo|Bugeun Kim

Summary

Imagine stepping into a bustling fantasy marketplace where the merchants aren't just automatons with fixed prices. Instead, they haggle, they barter, they try to get the best deal – just like in the real world. This engaging scenario could soon become a reality thanks to the power of large language models (LLMs). Researchers are exploring how LLMs can transform the typically static merchant NPCs in games into dynamic, interactive characters capable of appraising items and negotiating prices. This new framework, known as MART, uses two key modules: an appraiser and a negotiator. The appraiser analyzes item descriptions to estimate a fair price, moving beyond pre-defined values. The negotiator then engages in a back-and-forth with the player, employing various persuasion tactics to strike a deal. Experiments with different LLM sizes and training methods show promising results. Fine-tuning smaller models through techniques like knowledge distillation can create surprisingly effective negotiators, balancing performance and efficiency. However, there are some quirks to iron out. LLMs sometimes offer 'giveaways' not typically found in games, or even 'hallucinate' non-existent items. Smaller models can also struggle with basic arithmetic, occasionally miscalculating prices. Despite these challenges, LLMs offer a compelling path toward more immersive and engaging in-game economies. Future research could explore how different LLMs perform in this context and how human players adapt their tactics when faced with a haggling AI.
🍰 Interesting in building your own agents?
PromptLayer provides the tools to manage and monitor prompts with your whole team. Get started for free.

Question & Answers

How does the MART framework use LLMs to enable NPC haggling in games?
The MART framework employs a two-module system using LLMs for dynamic price negotiation. The first module (appraiser) analyzes item descriptions to determine fair market value, while the second module (negotiator) handles the actual bargaining process with players. This works by: 1) Having the appraiser evaluate item characteristics to establish a baseline price, 2) Enabling the negotiator to engage in back-and-forth dialogue using persuasion tactics, and 3) Processing player responses to adjust offers accordingly. For example, when a player tries to sell a rare sword, the appraiser would first evaluate its properties, then the negotiator might start high and gradually lower the price based on the player's counter-offers.
What are the benefits of AI-powered NPCs in modern gaming?
AI-powered NPCs bring significant improvements to gaming experiences by creating more realistic and engaging interactions. The main benefits include: 1) More dynamic and unpredictable conversations, making each interaction unique, 2) Adaptive behavior that responds to player actions and choices, and 3) More immersive gameplay through natural dialogue and realistic reactions. For instance, instead of static responses, AI NPCs can remember past interactions, adjust their behavior based on player reputation, and create more meaningful relationships within the game world. This technology helps bridge the gap between scripted gameplay and truly interactive experiences.
How is AI transforming the future of video game economies?
AI is revolutionizing in-game economies by introducing dynamic pricing and realistic market behaviors. This transformation creates more authentic virtual marketplaces where prices fluctuate based on supply and demand, player actions, and market conditions. The benefits include: 1) More realistic economic systems that mirror real-world trading, 2) Enhanced player engagement through meaningful economic decisions, and 3) Reduced exploitation of fixed-price systems. For example, rare items might become more expensive during periods of high demand, while common items' prices might drop when the market becomes saturated, creating a more authentic and challenging gaming experience.

PromptLayer Features

  1. A/B Testing
  2. Testing different LLM sizes and training methods for negotiation effectiveness
Implementation Details
Configure parallel test groups comparing different model sizes and fine-tuning approaches for merchant negotiations
Key Benefits
• Quantitative comparison of negotiation success rates • Performance tracking across model sizes • Early detection of hallucination issues
Potential Improvements
• Add price accuracy metrics • Include conversation naturality scoring • Implement fairness evaluation criteria
Business Value
Efficiency Gains
Faster optimization of model selection and training approaches
Cost Savings
Identify smallest effective model size for deployment
Quality Improvement
Better balance between negotiation performance and computational efficiency
  1. Multi-step Orchestration
  2. Managing the two-module MART framework with appraiser and negotiator components
Implementation Details
Create workflow templates connecting item appraisal to negotiation logic with controlled handoffs
Key Benefits
• Coordinated module interaction • Consistent price estimation flow • Reusable negotiation patterns
Potential Improvements
• Add dynamic context handling • Implement failure recovery • Create adaptive negotiation strategies
Business Value
Efficiency Gains
Streamlined development of complex NPC interactions
Cost Savings
Reduced integration overhead through template reuse
Quality Improvement
More reliable and consistent merchant behaviors

The first platform built for prompt engineering