Towards Game Level Generation Through LLM and GAN
Filip Martinović, Danijel Mlinarić, Juraj Dončević, Agneza Krajna, Ivica Botički
DOI: http://dx.doi.org/10.15439/2025F1909
Citation: Proceedings of the 20th Conference on Computer Science and Intelligence Systems (FedCSIS), M. Bolanowski, M. Ganzha, L. Maciaszek, M. Paprzycki, D. Ślęzak (eds). ACSIS, Vol. 43, pages 739–745 (2025)
Abstract. This paper tackles the challenge of adaptive level generation in video games, focusing on generating content that aligns with player skill. A key limitation of procedural content generation (PCG) is achieving semantic control. Specifically, generating levels of varying difficulty with limited training data. To address this problem, we propose a hybrid approach combining Large Language Models (LLMs) and Generative Adversarial Networks (GANs). An LLM is used to generate a diverse, difficulty-labeled dataset of Snake game levels, which are validated with A* pathfinding to ensure playability. These levels serve as training data for GANs that are able to efficiently generate new levels. The system is evaluated through user study and playability metrics. Results show that the LLM-assigned difficulty labels correlate strongly with human perception. The achieved playability is 87\% for easy levels and 36\% for hard levels. Our findings demonstrate that the hybrid LLM-GAN approach enables scalable and semantically controlled content generation, balancing quality, adaptability, and computational efficiency.
References
- G. N. Yannakakis and J. Togelius, ‘Experience-Driven Procedural Content Generation’, IEEE Trans. Affect. Comput., vol. 2, no. 3, pp. 147–161, Jul. 2011, https://dx.doi.org/10.1109/T-AFFC.2011.6.
- D. Mlinarić, ‘Extension of dynamic software update model for class hierarchy changes and run-time phenomena detection’, info:eu-repo/semantics/doctoralThesis, University of Zagreb. Faculty of Electrical Engineering and Computing. Department of Applied Computing, 2020. Accessed: May 26, 2025. [Online]. Available: https://urn.nsk.hr/urn:nbn:hr:168:087042
- D. Mlinarić, J. Dončević, M. Brčić, and I. Botički, ‘Revolutionizing Software Development: Autonomous Software Evolution’, in 2024 47th MIPRO ICT and Electronics Convention (MIPRO), May 2024, pp. 224–228. https://dx.doi.org/10.1109/MIPRO60963.2024.10569871.
- N. Shaker, J. Togelius, and M. J. Nelson, Procedural Content Generation in Games. in Computational Synthesis and Creative Systems. Cham: Springer International Publishing, 2016. https://dx.doi.org/10.1007/978-3-319-42716-4.
- J. Togelius, E. Kastbjerg, D. Schedl, and G. N. Yannakakis, ‘What is procedural content generation? Mario on the borderline’, in Proceedings of the 2nd International Workshop on Procedural Content Generation in Games, in PCGames ’11. New York, NY, USA: Association for Computing Machinery, Jun. 2011, pp. 1–6. https://dx.doi.org/10.1145/2000919.2000922.
- I. J. Goodfellow et al., ‘Generative Adversarial Networks’, Jun. 10, 2014, https://arxiv.org/abs/ arXiv:1406.2661. https://dx.doi.org/10.48550/arXiv.1406.2661.
- A. Vaswani et al., ‘Attention Is All You Need’, Jun. 12, 2017, https://arxiv.org/abs/ arXiv:1706.03762. https://dx.doi.org/10.48550/arXiv.1706.03762.
- A. Dosovitskiy et al., ‘An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale’, Oct. 22, 2020, https://arxiv.org/abs/ arXiv:2010.11929. https://dx.doi.org/10.48550/arXiv.2010.11929.
- A. Summerville et al., ‘Procedural Content Generation via Machine Learning (PCGML)’, IEEE Trans. Games, vol. 10, no. 3, pp. 257–270, Sep. 2018, https://dx.doi.org/10.1109/TG.2018.2846639.
- V. Volz, J. Schrum, J. Liu, S. M. Lucas, A. Smith, and S. Risi, ‘Evolving Mario Levels in the Latent Space of a Deep Convolutional Generative Adversarial Network’, May 02, 2018, https://arxiv.org/abs/ arXiv:1805.00728. https://dx.doi.org/10.48550/arXiv.1805.00728.
- N. Hansen, S. D. Müller, and P. Koumoutsakos, ‘Reducing the Time Complexity of the Derandomized Evolution Strategy with Covariance Matrix Adaptation (CMA-ES)’, Evol. Comput., vol. 11, no. 1, pp. 1–18, Mar. 2003, https://dx.doi.org/10.1162/106365603321828970.
- R. Rodriguez Torrado, A. Khalifa, M. Cerny Green, N. Justesen, S. Risi, and J. Togelius, ‘Bootstrapping Conditional GANs for Video Game Level Generation’, in 2020 IEEE Conference on Games (CoG), Aug. 2020, pp. 41–48. https://dx.doi.org/10.1109/CoG47356.2020.9231576.
- M. Bazzaz and S. Cooper, ‘Guided Game Level Repair via Explainable AI’, Nov. 04, 2024, https://arxiv.org/abs/ arXiv:2410.23101. https://dx.doi.org/10.48550/arXiv.2410.23101.
- S. M. Lundberg and S.-I. Lee, ‘A Unified Approach to Interpreting Model Predictions’, in Advances in Neural Information Processing Systems, Curran Associates, Inc., 2017. Accessed: Apr. 02, 2025. [Online]. Available: https://proceedings.neurips.cc/paper_files/paper/2017/hash/8a20a8621978632d76c43dfd28b67767-Abstract.html
- N. Kokhlikyan et al., ‘Captum: A unified and generic model interpretability library for PyTorch’, Sep. 16, 2020, https://arxiv.org/abs/ arXiv:2009.07896. https://dx.doi.org/10.48550/arXiv.2009.07896.
- H. Zhang, M. C. Fontaine, A. K. Hoover, J. Togelius, B. Dilkina, and S. Nikolaidis, ‘Video Game Level Repair via Mixed Integer Linear Programming’, Oct. 13, 2020, https://arxiv.org/abs/ arXiv:2010.06627. https://dx.doi.org/10.48550/arXiv.2010.06627.
- S. Cooper and A. Sarkar, ‘Pathfinding Agents for Platformer Level Repair’.
- R. Jain, A. Isaksen, and C. Holmg, ‘Autoencoders for Level Generation, Repair, and Recognition’.
- G. E. Hinton and R. R. Salakhutdinov, ‘Reducing the Dimensionality of Data with Neural Networks’, Science, vol. 313, no. 5786, pp. 504–507, Jul. 2006, https://dx.doi.org/10.1126/science.1127647.
- ‘Google Snake Mods’. Accessed: Apr. 04, 2025. [Online]. Available: https://googlesnakemods.com/v/4/
- ‘DarkSnakeGang/GoogleSnakeLevelEditor: Level Editor Mod for Google Snake’. Accessed: Apr. 08, 2025. [Online]. Available: https://github.com/DarkSnakeGang/GoogleSnakeLevelEditor
- A. J. Summerville, S. Snodgrass, M. Mateas, and S. Ontañón, ‘The VGLC: The Video Game Level Corpus’, Jul. 03, 2016, https://arxiv.org/abs/ arXiv:1606.07487. https://dx.doi.org/10.48550/arXiv.1606.07487.
- M. Arjovsky, S. Chintala, and L. Bottou, ‘Wasserstein GAN’, Dec. 06, 2017, https://arxiv.org/abs/ arXiv:1701.07875. https://dx.doi.org/10.48550/arXiv.1701.07875.
- C. Little, M. Elliot, R. Allmendinger, and S. S. Samani, ‘Generative Adversarial Networks for Synthetic Data Generation: A Comparative Study’, Dec. 03, 2021, https://arxiv.org/abs/ arXiv:2112.01925. https://dx.doi.org/10.48550/arXiv.2112.01925.
- ‘Structured Outputs - OpenAI API’. Accessed: May 24, 2025. [Online]. Available: https://platform.openai.com
- ‘LangChain’. Accessed: May 22, 2025. [Online]. Available: https://www.langchain.com/langchain
- P. E. Hart, N. J. Nilsson, and B. Raphael, ‘A Formal Basis for the Heuristic Determination of Minimum Cost Paths’, IEEE Trans. Syst. Sci. Cybern., vol. 4, no. 2, pp. 100–107, Jul. 1968, https://dx.doi.org/10.1109/TSSC.1968.300136.
- ‘Optuna - A hyperparameter optimization framework’, Optuna. Accessed: May 23, 2025. [Online]. Available: https://optuna.org/