arXiv:2608.30056cs.AIAug 2026

Manuscript Offprint

arXiv:2608.30056

Game-Agnostic Value Functions through Automatic JSON Feature Extraction

Dien Nguyen, Diego Perez-Liebana

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Dien Nguyen, Diego Perez-Liebana

Queen Mary University of London - Game AI Group

d.l.nguyen, diego.perez@qmul.ac.uk

Abstract—JSON Bag-of-Tokens (JSON-Bag) is a recently proposed method to generically represent game trajectories by tokenizing their JSON descriptions. We introduce JSON-Bag VF, a game-agnostic approach to training value functions for game-playing agents using JSON-Bag prototypes. We show that this approach can be enhanced with Random Forest-based feature selection and a method to select game-stage-specific features. We evaluate JSON-Bag VF with One-step-look-ahead (JSON-Bag OSLA) on six tabletop games over different combinations of prototype-tokenization and feature selections. JSON-Bag OSLA outperforms baseline OSLA agents in most games. Our analysis also shows that feature selection significantly improves JSON-Bag VF and that feature selection is the most important factor in JSON-Bag VF performance, over prototype-tokenization.

Index Terms—JSON, game representation, game state, game trajectory, Jensen-Shannon distance, random forest, value function, OSLA, game-playing agent

I. INTRODUCTION

Defining features and representations for games and their corresponding distance/similarity metric is foundational for any task that requires game analysis. Designing strong game-playing agents is such a task, often requiring hand-crafted features using domain knowledge [1] or expensive deep-learning models [2].

JSON Bag-of-Tokens model (JSON-Bag) [3] is a framework to generically represent game trajectories by tokenizing their JSON descriptions. The JSON representation for a game trajectory is formed by concatenating the JSON of individual game states, serialized from the game objects' data, into a list. A JSON-Bag is a collection of token-occurrence count pairs from tokenizing the game trajectory in JSON. JSON-Bag has only been tested on toy problems to classify game trajectories.

This work aims to close the gap between toy problems and practical application by using a game-agnostic method to train a value function (JSON-Bag VF) with JSON-Bag prototypes formed by a classification task of predicting the winning player, utilizing Jensen-Shannon distance (JSD) [4] and prototype nearest-neighbor search (P-NNS) [3]. We demonstrate JSON-Bag's utility as an automatic feature extraction tool through Random Forest-based feature selection, improving JSON-Bag VF performance over no feature selection. Additionally, we introduce a method for selecting game-stage-specific features by segmenting game trajectories and applying feature selection to each segment independently.

We validate our approach on six tabletop games: 7 Wonders, Dominion, Sea Salt and Paper, Can't Stop, Connect4, and Dots and Boxes. For each game, we evaluate different prototype-tokenization strategies and feature selection methods. We use One-step-look-ahead (OSLA) with trained JSON-Bag VFs (JSON-Bag OSLA) as our proof-of-concept agent, with more sophisticated agents such as Monte Carlo Tree Search (MCTS) [5] left for future work. JSON-Bag OSLA significantly outperforms standard OSLA agents, which use the game scoring as value functions, across all games, except Sea Salt and Paper and Dots and Boxes. We analyze the effect sizes of prototype-tokenization and feature selection, showing that the latter is the most important factor for the agent's performance.

The main contributions of this paper are:

  • JSON-Bag VF: A game-agnostic approach for training a value function using JSON-Bag prototypes from a winner prediction task, leveraging JSD and P-NNS.

  • We show JSON-Bag compatibility with classical feature selection methods by greatly improving the performance of the value function with Random Forest-based feature selection. We also describe a method for selecting game-stage-specific features by segmenting game trajectories and applying feature selection separately to each segment.

  • Through effect size analysis, we show that feature selection is the most important factor for the agent's score.