arXiv:2606.21171cs.SEcs.AI2026-06

用GPT-4o做游戏代码重构和功能生成,发现改局部代码比造新玩法更靠谱。

An Exploratory Case Study of LLM-Assisted Refactoring and Gameplay Feature Generation in an Endless Runner Game

论文配图:An Exploratory Case Study of LLM-Assisted Refactoring and Gameplay Feature Generation in an Endless Runner Game
图 1 · 摘自论文原文
  • 让GPT-4o对现有游戏代码进行局部重构和新功能生成
  • 3个重构任务全成功,仅1个新功能正确集成
  • 适合想尝试LLM辅助开发的游戏开发者参考

大型语言模型(LLMs)在软件开发中应用日益广泛,但在实际游戏开发场景中的实用性仍缺乏探索,尤其是生成代码需融入已有系统时。本文通过一个探索性实证案例研究,考察GPT-4o在自定义Python/Pygame无尽跑酷游戏中的表现。研究涵盖六项任务:三项局部重构与三项游戏机制生成。通过软件度量、单元测试和人工游戏评估对结果进行分析。所有三项重构任务在功能上均成功完成,但仅一项新机制生成任务实现正确集成。结果表明,在该场景下,GPT-4o在处理局部代码变换时优于跨多系统的新交互设计。由于是单案例探索性研究,结论仅为趋势性观察,非普适性能证明。论文提供了透明的案例分析,揭示了LLM在现有游戏系统中辅助重构与功能生成的机遇与局限。

原文摘要 · Abstract (English)

Large language models (LLMs) are increasingly used to support software development, but their practical usefulness in applied game-development settings remains underexplored, especially when generated code must be integrated into an existing game software system. This paper presents an exploratory empirical case study of GPT-4o in a custom Python/Pygame endless runner. The study examines six selected development tasks: three localized refactoring tasks and three tasks involving gameplay feature generation. The resulting implementations were evaluated using software metrics, unit tests, and manual gameplay assessments. In this case study, all three selected refactoring tasks were completed successfully in functional terms, whereas only one of the three selected gameplay feature generation tasks resulted in a correctly integrated feature. The findings suggest that, in this setting, GPT-4o handled localized transformations more reliably than tasks requiring new gameplay interactions across multiple existing systems. Given the exploratory single-case design, these results are best interpreted as indicative observations rather than as generalizable evidence of category-level model performance. Overall, the paper contributes a transparent case-based account of the opportunities and limitations of LLM-assisted refactoring and gameplay feature generation in an existing game software system.

游戏开发LLM辅助代码生成

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。