RuleSmith: Multi-Agent LLMs for Automated Game Balancing
Organizations: Yale University, New Haven, CT, USA · Texas A&M University, College Station, TX, USA
Abstract
Game balancing is a longstanding challenge requiring repeated playtesting, expert intuition, and extensive manual tuning. We introduce RuleSmith, a framework that couples multi-agent LLM self-play with surrogate-based optimization over a parameterized rule space. As a proof of concept, we build CivMini, a simplified civilization-style game with two asymmetric factions governed by 12 tunable parameters. LLM agents interpret textual rulebooks and game states to propose actions that are validated by the game engine, yielding noisy estimates of faction win rates. Our primary implementation uses Gaussian-process Bayesian optimization with Expected-Improvement-based adaptive sampling to allocate more evaluation games to promising candidates. RuleSmith consistently finds near-balanced configurations: three independent optimization runs reach near-even empirical win rates in independent 200- and 300-game evaluations, and additional experiments with NTBEA and TPE show that the same self-play interface supports different search components. Cross-model evaluations and small human studies provide preliminary evidence of transfer across player populations. RuleSmith produces interpretable numerical rule adjustments without task-specific policy training. Project and code: https://adonis-galaxy.github.io/RuleSmith-website/
Figures & tables
| Parameter | Range | Prec. | Parameter | Range | Prec. |
|---|---|---|---|---|---|
| Economy | Production | ||||
| Initial resources | int | Empire unit cost | int | ||
| Empire farmer gather | int | Nomads unit cost | int | ||
| Nomads kill gain | int | ||||
| Combat | Scoring | ||||
| Empire damage | int | Resource weight | 0.1 | ||
| Optimize Evaluate | E 2B vs N 2B | E 2B vs N 8B | E 8B vs N 2B | E 8B vs N 8B |
|---|---|---|---|---|
| E 2B vs N 2B | 48 52 | 32 68 | 73 27 | 55 45 |
| E 2B vs N 8B | 81 19 | 47 53 | 91 9 | 75 25 |
| E 8B vs N 2B | 37 63 | 0 6 94 | 52 48 | 29 71 |
| E 8B vs N 8B | 53 47 | 24 76 | 81 19 | 51 49 |
| Configuration | Games | Empire (%) | 95% CI (%) | |
|---|---|---|---|---|
| Default (additional evaluation) | 300 | 11.3 | [8.2, 15.4] | |
| Optimized configuration (Table 10 ) | 500 | 47.6 | [43.3, 52.0] | 0.30 |
| GP run 1 | 300 | 51.7 | [46.0, 57.3] | 0.60 |
| GP run 2 | 300 | 49.3 | [43.7, 55.0] | 0.86 |
| GP run 3 | 300 | 52.7 | [47.0, 58.2] | 0.39 |
| NTBEA | 300 | 48.0 | [42.4, 53.6] | 0.53 |
| Optimization LLM | Evaluation LLM | Empire% | Nomads% | |
|---|---|---|---|---|
| InternVL3.5-8B | InternVL3.5-8B | 51 | 49 | 0.02 |
| InternVL3.5-8B | Qwen3.5-9B | 50 | 50 | 0.00 |
| Qwen3.5-9B | InternVL3.5-8B | 49 | 51 | 0.02 |
| Qwen3.5-9B | Qwen3.5-9B | 52 | 48 | 0.04 |
| Random Search | (1+1)-ES | BO (adaptive) | |
|---|---|---|---|
| Win Rate | 13 87 | 26 74 | 51 49 |
| BO ( ) | BO ( ) | BO ( ) | |
| Win Rate | 34 66 | 61 39 | 48 52 |
| Metric | First 100 games | All 300 games |
|---|---|---|
| Distinct three-turn opening sequences | 86/100 | 229/300 |
| Distinct first-turn action combinations | 6 | 11 |
| Action entropy, Empire / Nomads (bits) | 2.03 / 1.65 | 2.04 / 1.64 |
| Mean turn-5 Jaccard distance | 0.62 | 0.62 |
| Ended before the turn cap (a city destroyed) | 63% | 62% |
| Game length, mean (SD) in turns | 10.8 (4.4) | 11.1 (4.4) |
| Map size (turn limit) | Three factions | Map size optimized | ||||||
|---|---|---|---|---|---|---|---|---|
| 5 5 (16) | 7 7 (16) | 9 9 (32) | 11 11 (32) | 8B | 2B | 8B | 2B | |
| Win rate (%) | 53 47 | 51 49 | 48 52 | 51 49 | 32 33 35 | 34 33 33 | 53 47 | 51 49 |
| Balance loss | 0.06 | 0.02 | 0.04 | 0.02 | 0.033 | 0.013 | 0.06 | 0.02 |
Appendix figures & tables20 assets
Supplementary material from the paper’s appendix.
Appendix
| Empire | Nomads | Empire% | Nomads% |
|---|---|---|---|
| InternVL3.5-8B | Random | 100 | 0 |
| Random | InternVL3.5-8B | 0 | 100 |
| InternVL3.5-2B | Random | 100 | 0 |
| Random | InternVL3.5-2B | 0 | 100 |
| LLM-optimized params | Rule-optimized params | ||||
|---|---|---|---|---|---|
| Empire | Nomads | Empire% | Nomads% | Empire% | Nomads% |
| InternVL3.5-8B | Rule-based | 75 | 25 | 73 | 27 |
| Rule-based | InternVL3.5-8B | 22 | 78 | 38 | 62 |
| InternVL3.5-2B | Rule-based | 68 | 32 | 65 | 35 |
| Rule-based | InternVL3.5-2B | 31 | 69 | 46 | 54 |
| Parameter | Initial | Opt. | Parameter | Initial | Opt. |
|---|---|---|---|---|---|
| Economy | Production | ||||
| Initial resources | 6 | 10 | Empire unit cost | 7 | 9 |
| Empire farmer gather | 2 | 1 | Nomads unit cost | 3 | 8 |
| Nomads kill resource gain | 4 | 7 | |||
| Combat | Scoring | ||||
| Empire damage | 4 | 4 | Score per resource | 0.1 | 0.1 |
| Optimization LLM | Evaluation LLM | Empire% | Nomads% | |
|---|---|---|---|---|
| InternVL3.5-8B | Gemini 2.5 Flash | 51 | 49 | 0.02 |
| InternVL3.5-8B | Gemini 2.5 Pro | 47 | 53 | 0.06 |
| Qwen3.5-9B | Gemini 2.5 Flash | 45 | 55 | 0.10 |
| Qwen3.5-9B | Gemini 2.5 Pro | 53 | 47 | 0.06 |
| Empire | Nomads | Empire% | Nomads% | |
|---|---|---|---|---|
| InternVL3.5-8B | Gemini 2.5 Flash | 45 | 55 | 0.10 |
| InternVL3.5-8B | Gemini 2.5 Pro | 41 | 59 | 0.18 |
| Gemini 2.5 Flash | InternVL3.5-8B | 45 | 55 | 0.10 |
| Gemini 2.5 Pro | InternVL3.5-8B | 49 | 51 | 0.02 |
| Empire | Nomads | Total | |
|---|---|---|---|
| Wins | 32 | 28 | 60 |
| Win Rate | 53.3% | 46.7% | N/A |
| Participant | Human faction | vs. 2B | vs. 8B |
|---|---|---|---|
| P1 | Empire | 9/10 | 8/10 |
| P1 | Nomads | 10/10 | 8/10 |
| P2 | Empire | 8/10 | 7/10 |
| P2 | Nomads | 9/10 | 9/10 |
| P3 | Empire | 9/10 | 7/10 |
| P3 | Nomads | 10/10 | 9/10 |
| Population | Empire wins | E (%) | E 95% CI (%) | |
|---|---|---|---|---|
| Human vs. human | 32/60 | 53.3 | [40.9, 65.4] | 0.70 |
| Human vs. 2B | 27/60 | 45.0 | [33.1, 57.5] | 0.52 |
| Human vs. 8B | 26/60 | 43.3 | [31.6, 55.9] | 0.37 |
| Parameter | LLM Agents | Random Agents | Rule-Based Agents |
| Economy | |||
| Initial resources | 10 | 4 | 6 |
| Empire farmer gather | 1 | 1 | 2 |
| Nomads kill resource gain | 7 | 5 | 5 |
| Combat | |||
| Empire damage | 4 | 2 | 3 |
| Parameter | E 2B vs N 2B | E 2B vs N 8B | E 8B vs N 2B | E 8B vs N 8B |
| Initial resources | 10 | 2 | 10 | 10 |
| Empire farmer gather | 1 | 2 | 4 | 1 |
| Nomads kill resource gain | 6 | 9 | 1 | 7 |
| Empire damage | 4 | 2 | 2 | 4 |
| Nomads damage | 3 | 3 | 5 | 3 |
| Empire soldier HP | 9 | 14 | 16 | 9 |
| Parameter | R94 | R98 | Reported 8B/8B |
| Initial resources | 8 | 4 | 10 |
| Empire farmer gather | 1 | 1 | 1 |
| Nomads kill resource gain | 8 | 7 | 7 |
| Empire damage | 2 | 2 | 4 |
| Nomads damage | 4 | 4 | 3 |
| Empire soldier HP | 14 | 14 | 9 |
| Search / run | E (%) | N (%) | E 95% CI | ||||
|---|---|---|---|---|---|---|---|
| GP run 1 | 200 | 103 | 51.5 | 48.5 | 0.030 | [44.6, 58.3] | 0.72 |
| GP run 1 | 300 | 155 | 51.7 | 48.3 | 0.033 | [46.0, 57.3] | 0.60 |
| GP run 2 | 200 | 98 | 49.0 | 51.0 | 0.020 | [42.2, 55.9] | 0.83 |
| GP run 2 | 300 | 148 | 49.3 | 50.7 | 0.013 | [43.7, 55.0] | 0.86 |
| GP run 3 | 200 | 103 | 51.5 | 48.5 | 0.030 | [44.6, 58.3] | 0.72 |
| GP run 3 | 300 | 158 | 52.7 | 47.3 | 0.053 | [47.0, 58.2] | 0.39 |
| Rate (%) | 95% CI (%) | Rate (%) | 95% CI (%) | Rate (%) | 95% CI (%) |
|---|---|---|---|---|---|
| 0 | [0.0, 3.7] | 6 | [2.8, 12.5] | 13 | [7.8, 21.0] |
| 22 | [15.0, 31.1] | 24 | [16.7, 33.2] | 26 | [18.4, 35.4] |
| 29 | [21.0, 38.5] | 31 | [22.8, 40.6] | 32 | [23.7, 41.7] |
| 33 | [24.6, 42.7] | 34 | [25.5, 43.7] | 35 | [26.4, 44.7] |
| 37 | [28.2, 46.8] | 38 | [29.1, 47.8] | 41 | [31.9, 50.8] |
| 45 | [35.6, 54.8] | 46 | [36.6, 55.7] | 47 | [37.5, 56.7] |
| Setting | Attempted actions | Converted to PASS | Rate |
|---|---|---|---|
| 8B agents, 500 games | 33,834 | 1,126 | 3.33% |
| 2B agents, 200 games | 21,871 | 1,012 | 4.63% |
| Component | Setting |
|---|---|
| Agents | InternVL3.5-2B/8B, FP16, one call per player turn, at most 300 new tokens, temperature 0.7, top- 0.9, no regeneration; rule checker disabled |
| Retrieval | TF-IDF with cosine similarity over the 10 rulebook entries, query “multi-unit actions turn structure”, top 3 |
| Prompt | Up to 5 own units listed per decision |
| Game | map, 16-turn cap, Farmer HP 5, city HP equal to the faction’s combat-unit HP, battle multiplier 1, city production 3 per action, movement 1 (Empire) and 2 (Cavalry), Empire starts with one Farmer and one Soldier and Nomads with two Cavalry |
| GP optimizer | scikit-optimize 0.10.2: Gaussian process with constant amplitude times ARD Matérn-5/2 kernel, Gaussian noise, normalized targets; 10 random initial points; acquisition optimized with L-BFGS; EI ( ); LCB runs use |
| Adaptive budget | Eq. ( 6 ), , , , integer truncation |
Multi-Agent System Optimization
Multi-Agent System Optimization studies how to improve agent teams’ coordination, performance, resource use, and reliability.
See all 161 papers