节点文献
基于LSTM的超级玛丽关卡自动生成与应用
Automatic Generation and Application for Super Mario Levels Based on LSTM
【作者】 刘海涛;
【作者基本信息】 北京化工大学 , 计算机技术(专业学位), 2022, 硕士
【摘要】 近年来,游戏行业的迅速发展带来了巨大的收益。但是,长周期和高成本使得游戏开发的风险不断提升,为解决此问题,游戏的程序化内容生成(PCG)技术应运而生。PCG技术利用算法快速生成游戏内容,从而减少人工成本,缩短研发周期,然而基于搜索、分形等传统PCG技术的实现较为复杂,且仍需较多的人工干预,为开发者提供的帮助有限。基于机器学习的PCG技术的出现在一定程度上缓解了这个问题,其通过模型训练代替算法设计,通过网络学习游戏设计规则,进一步减少人工干预。本文结合LSTM和PCG技术提出了一种超级玛丽游戏关卡的自动生成方案,并使用了四个适用于超级玛丽游戏的评价指标对生成模型进行评估。本文的主要研究工作包括:(1)在模型训练方面,本文基于VGLC游戏语料库建立了游戏物体与文本字符之间的对应关系,对语料库中超级玛丽的关卡进行预处理后构建了数据集,然后基于不同的参数搭建并训练了八个用于生成超级玛丽关卡的网络模型。(2)在模型评价方面,本文使用了四个适用于超级玛丽游戏的评价指标评价生成结果,并设计了相应的计算方法:使用离差平方和计算关卡的线性度,通过统计场景中不同游戏内容对难度的贡献值计算关卡的难度系数,通过归一化压缩距离计算关卡之间的相似度,以及将A~*算法改进后用于探究关卡的可玩性。然后,为简化对任意多个模型同时进行比较,本文基于评价指标搭建了评价平台,通过该平台,用户可输入任意数量的模型,并自动得到四个评价指标的结果,该平台还可用于查看生成的关卡文本与图像之间的转换。最后,本文基于评价平台比较了模型生成的关卡和原始关卡,结果证明,通过LSTM模型可生成难易度适中、线性度和相似度较低,可玩关卡占比较高的优秀关卡。(3)在模型应用方面,本文使用Pygame设计还原了超级玛丽游戏,然后将得到的较优的模型应用于超级玛丽的关卡生成部分。实验结果表明,基于LSTM的超级玛丽关卡的自动生成模型具有很强的适用性。
【Abstract】 In recent years,the rapid development of the game industry has brought huge benefits.However,the long cycle and high cost make the risk of game development continue to increase.To solve this problem,the Procedural Content Generation(PCG)in games has emerged as the times require.By using PCG,game content can be generated quickly,labor costs can be reduced,and development cycles can be shortened.However,the implementation of traditional PCG,such as search-based PCG and fractal-based PCG,is relatively complex,and still requires more manual intervention,which provides limited help for developers.The emergence of PCGML has alleviated this problem to a certain extent.It replaces algorithm design through model training,and learns game design rules through the network,further reducing manual intervention.In this paper,an automatic generation scheme of Super Mario levels is proposed by combining LSTM and PCG,and four evaluation indicators according to the characteristics of the game are used for evaluating the generation models.The main work of this paper includes:(1)In terms of model training,this paper establishes the correspondence between game objects and text characters based on the VGLC game corpus,preprocesses the Super Mario levels in the corpus to construct a dataset,and then builds and trains eight models based on different parameters for generating Super Mario levels.(2)In terms of model evaluation,this paper uses four evaluation indicators based on the characteristics of the Super Mario,and designs the corresponding calculation method.We use the sum of squared of deviations to calculate the linearity of the level,calculate the difficulty of the level by counting the contribution of different game contents in the scene,characterize the similarity between levels by normalized compression distance,and use the improved A~*algorithm to explore the playability of the levels.Then,in order to simplify the simultaneous comparison of any number of models,this paper builds an evaluation platform based on the evaluation indicators.Through this platform,users can input any number of models and automatically get the results of the four evaluation indicators.The platform can also be used to convert text levels to images.Finally,based on the evaluation platform,this paper compares the levels generated by models with the original levels.The results show that the LSTM model can generate excellent levels with moderate difficulty,low linearity and similarity,and a high proportion of playable levels.(3)In terms of model application,we use Pygame to develop Super Mario,and apply the better model to the game for level generation.The results show that the automatic generation model of Super Mario levels based on LSTM has strong applicability.
【Key words】 procedural content generation; LSTM; A~* algorithm; normalized compression distance; game development;
- 【网络出版投稿人】 北京化工大学 【网络出版年期】2023年 07期
- 【分类号】TP317;TP18