基于Unity的游戏逻辑引擎的设计与实现-软件工程专业论文.docx
文本预览下载声明
摘 要
近年来,随着市场上电子游戏的数量不断增长,种类不断增多,开发迭代 周期越来越快,对游戏逻辑的开发效率和可维护性的要求也变得越来越高。随 着众多游戏引擎的出现,游戏中渲染、物理、声音等部分的开发已经被极大地 简化了,然而目前较为常用的游戏引擎大多没有成熟的游戏逻辑解决方案,这 也使得游戏逻辑的开发难度大、复杂度高、可复用性差等问题进一步凸显出来。
为了解决游戏逻辑开发过程遇到的上述问题,本文全面地进行了分析与设 计,提出融合了状态机、时间轴与可视化编程语言三种工具的游戏逻辑引擎。 通过将这三种目前最常用的游戏逻辑工具进行无缝的集成,该系统能方便快速 地进行各种类型的游戏逻辑的开发,并能保证较高的可复用性及可维护性。
本系统以插件的形式工作在 Unity 游戏引擎之上,为了实现功能需求,系 统主要分为两部分:脚本执行组件和脚本编辑工具。脚本执行组件负责执行游 戏逻辑,相当于传统程序设计语言中的虚拟机,执行组件包含一个层次状态机, 当状态机发生状态转换、更新场景等事件时,可视化脚本语言,即事件图,会 被执行,从而执行相应的游戏逻辑,而时间轴工具作为事件图内的组件之一, 可以对动画进行所见即所得式的编辑。脚本编辑工具是在 Unity 引擎的开发环 境下运行的插件,实现为一个编辑器窗口,在窗口中实现对状态机、事件图等 可视化脚本语言组件的编辑功能,此外,本文还讨论了脚本编辑工具中调试功 能以及撤销回复功能等部分的设计与实现。
最后对系统进行了功能测试和非功能测试,测试结果符合预期,因此确定 系统已经满足了功能需求和非功能需求。整个游戏逻辑引擎已经投入实际使用 和运行。
关键词:游戏逻辑;状态机;时间轴;可视化编程语言;Unity
Abstract
In recent years, the number of video games are growing quickly. The variety of games is also becoming richer and richer. And game development cycle has become much shorter as well. All of which forms an increasingly urgent call for higher productivity and maintainability of game logic. With the emergence of many game engines, rendering, physics, sound, and other hard parts of game development has been greatly simplified. However, most of these popular game engines do not provide good game logic solutions, which further stresses the difficulty, complexity and low reusability issues in game logic development.
In order to solve those problems encountered during the development of game logic, after an in-depth analysis, this paper proposes a game logic engine integrated with three tools, i.e. state machine, timeline and visual programming language. Through seamlessly integration of those most commonly used tools in game logic development, this system can develop various types of game logic in a quick and easy way, while still guarantee high reusability and maintainability.
This system works as a plugin in Unity game engine, in order to achieve functional requirements, the system is divided into two parts: the script execution component and script e
显示全部