mobilewar:一款移动端GPGPU游戏外文翻译资料

 2022-03-22 09:03

MobileWars: A Mobile GPGPU Game

Abstract. Nowadays mobile phones, especially smartphones, are equipped with advanced computing capabilities. Most of these devices have multicore processors such as dual-core CPUs and many-core GPUs. These processors are designed for both low power consumption and high performance computation. Moreover, most devices still lack libraries for generic multicore computing usage, such as CUDA or OpenCL. However, computing certain kind of tasks in these mobile GPUs, and other available multicores processors, may be faster and much more efficient than their single threaded CPU counterparts. This advantage can be used in game development to optimize some aspects of a game loop and also include new features. This work presents an architecture designed to process most of the game loop inside a mobile GPU using the Android Renderscript API. As an illustrated test case for the proposed architecture, this work presents a game prototype called “MobileWars”, completely developed using the proposed architecture.

Keywords: Mobile, Mobile Multicore Computing, Game Architecture, GPGPU, Game Physics, Game AI, RenderScript API, Android.

1 Introduction

Digital games are defined as real-time multimedia applications that have a time constraints to run their tasks [1]. If the game is not able to execute its processing under some time threshold, it will fail [2], as its immersion will be lost. Mobile games are also real-time multimedia application that run on mobile phones, having the same time constraints. However, many others characteristics are different [3], when compared to PC or console games: hardware (processing power and screen size); user input, (buttons, voice, touch screen and accelerometers); and a big diversity of operating systems, such as Android, iOS, Symbian and Windows Mobile[4].

The market of mobile devices is growing [5]. Devices powered with Android have 60% of the sale market share in the first quarter of this year in the USA, according to [6]. Also the usage of the internet on such devices are gaining

importance, since its has been doubling every year [7]. These are important motivations for game developers and designer to create blockbusters and high end mobile games.

Google introduced in the Honeycomb version of Android the Renderscript API (application programming interface) [8]. Renderscript is an API for achieving better performance on Android phones and tablets. Using this API, developers can use the same code to process on different hardware architectures such as different CPUs (Central Processing Unity), ARM (Advanced RISC Machine) v5, ARM v7, and X86, GPUs (Graphic Processing Unit) and DSPs (Digital Signal Processors). The API decides which processor will run the code on the device at runtime, choosing the best processor for the available code. This work presents a novel game architecture suitable for this new architecture, which extends previous work that were applied in a desktop hardware [2]. As far as the authors knows, this is the first mobile game that uses this kind of architecture.

Summarizing, this work has following contributions: Modeling of a game architecture for mobile device; Adaptation of the architecture and data structures for Renderscript API; and Implementation of a state machine on the mobile GPU.

The paper is organized as follows: Section 2 presents related works on mobile multicore processing and the Renderscript API. Section 3 presents the related work on GPGPU on mobile devices while Section 4 the game design of MobileWars is presented. Section 5 presents the game architecture used in this work and Section 6 presents the results. Finally Section 7 presents the conclusion of this paper.

  1. Mobile Multicore Processing

Multicore architecture are, nowadays, found in home PCs and mobile phone, available as multicore CPUs and GPUs. GPUs are powerful processors originally dedicated to graphics computation [9]. GPUs for PCs are composed by hundreds of parallel processors, achieving much better performance then modern CPUs for several specific applications scenarios. The GPU can be used on the PC as a generic processor to process data and deal with computationally intensive tasks, through development of elaborate architectures such as CUDA (Compute Unified Device Architecture ) and OpenCL.

On mobile devices, the GPU is much less capable and powerful [10], and is typically integrated into the mobile processor system-on-a-chip (SoC), which also consists of one or several CPUs, DSP (digital system processor), and other available mobile-specific accelerators. This embedded GPU does not have a dedicated memory, having to share the system bus with others processors for accessing the memory. Consequently the memory bandwidth is also much lower when compared to desktops GPUs [11]. Currently, mobile GPUs emphasis more on lower power consumption [12] than performance. Some of these currently available GPUs devices are the Qualcommrsquo;s Adreno 200, the TIrsquo;s PowerVR SGX 530/535 and the nVidia Tegra3.

Normally, most works that uses mobile for parallel processing deals with the use of GPU for generic processing with the OpenGL ES programable shaders, the vertex and fragment shader, as the programming interface [13]. The disadvantage found in some approaches is the traditional shader languages limitations (such as scatter memory operations, i.e. out-of-order indexed write array operations), and features that are not even implemented on those languages (such as integer data operands like bit-wise logical operations AND, OR, XOR, NOT and bitshifts). Some of these disadvantages are also presented in the Rendersript API, as the limitation of scatter memory operations.

2.1 The Renderscript API

Renderscript is a new software development kit and API for Andro

全文共22824字,剩余内容已隐藏,支付完成后下载完整资料


mobilewar:一款移动端GPGPU游戏

摘要现在的手机,尤其是智能手机,都具备了先进的计算能力。其中大多数设备都有多核处理器,如双核cpu和多核处理器。这些处理器是为低功耗和高性能计算而设计的。此外,大多数设备仍然缺少用于通用多核计算使用的库,如CUDA或OpenCL。但是,在这些移动gpu和其他可用的多核处理器中计算某些任务可能比它们的单线程CPU处理器更快、更高效。这种优势可以用于游戏开发,以优化游戏循环的某些方面,还包括新特性。这个工作展示了一个架构,设计用来在移动GPU中使用Android Renderscript API处理大部分的游戏循环。作为所提议的架构的演示测试用例,该工作展示了一个名为“MobileWars”的游戏原型,它完全是使用所提议的架构开发的。

关键词:移动,移动多核计算,游戏架构,GPGPU,游戏物理,游戏AI, RenderScript API, Android。

1介绍

数字游戏被定义为具有时间约束[1]的实时多媒体应用程序。如果游戏不能在某个时间阈值下执行它的处理,它将会失败[2],因为它的沉浸将会丢失。手机游戏也是在手机上运行的实时多媒体应用,具有相同的时间限制。然而,与PC或主机游戏相比,其他许多特性都不同[3]:硬件(处理能力和屏幕尺寸);用户输入,(按钮,声音,触摸屏和加速计);而安卓、iOS、Symbian和Windows Mobile等操作系统也有很大的多样性[4]。

移动设备市场正在增长[5]。根据[6],在今年第一季度,搭载安卓系统的设备在美国市场占有60%的市场份额。此外,互联网在这类设备上的使用也在增加。

重要性,因为它每年都翻倍[7]。这些都是游戏开发者和设计师制作大片和高端手机游戏的重要动机。

谷歌在Android的Honeycomb版本中引入了Renderscript API[8]。Renderscript是在Android手机和平板电脑上实现更好性能的API。使用这个API,开发人员可以使用相同的代码来处理不同的硬件架构,例如不同的cpu(中央处理Unity)、ARM(高级RISC机器)v5、ARM v7和X86、gpu(图形处理单元)和dsp(数字信号处理器)。API决定哪个处理器在运行时在设备上运行代码,为可用的代码选择最好的处理器。这项工作展示了一种适合这种新架构的新颖的游戏架构,它扩展了以前在桌面硬件中应用的工作[2]。就作者所知,这是第一个使用这种架构的手机游戏。

总结,这项工作有以下贡献:为移动设备建模一个游戏架构;对Renderscript API的架构和数据结构的适应;并在移动GPU上实现状态机。

本文组织如下:第2节介绍了移动多核处理和Renderscript API的相关工作。第3节介绍了移动设备上GPGPU的相关工作,并介绍了mobilewar的游戏设计。第5节介绍了该工作中使用的游戏架构,第6节给出了结果。最后给出了本文的结论。

2移动多核处理

多核结构现在在家用电脑和移动电话中都有,可用作多核cpu和gpu。gpu是强大的处理器,最初致力于图形计算[9]pc的gpu由数百个并行处理器组成,在几个特定的应用场景中实现了更好的性能。GPU可以在PC上作为一个通用处理器来处理数据和处理计算密集型任务,通过开发诸如CUDA(计算统一设备体系结构)和OpenCL等复杂的体系结构。

在移动设备上,GPU的能力和功能都要小得多[10],通常集成到移动处理器系统芯片(SoC)中,它也包括一个或多个cpu、DSP(数字系统处理器)和其他可用的移动专用加速器。这个嵌入式GPU没有专门的内存,必须与其他处理器共享系统总线以访问内存。因此,与桌面gpu相比,内存带宽也要低得多[11]。目前,移动gpu比性能更强调低功耗[12]。其中一些目前可用的gpu设备是高通的肾上腺200,TI的PowerVR SGX 530/535和nVidia Tegra3。

通常情况下,大多数使用移动设备进行并行处理的工作都是使用GPU进行通用处理,OpenGL ES可编程着色器、顶点和片段着色器[13]。在某些方法中发现的缺点是传统的着色语言限制(比如分散内存操作,即无序的索引写数组操作),以及那些在那些语言上甚至没有实现的特性(例如像位逻辑操作和,或者,XOR, not和bitshift)这样的整数数据操作数。其中一些缺点也在Rendersript API中提出,作为分散内存操作的限制。

2.1的渲染脚本API

Renderscript是一个新的软件开发工具包和API,首先由谷歌在Honeycomb版Android中引入。Renderscript是Android手机和平板电脑上高性能图形处理的API。它被用于快速3D渲染和计算处理,与GPU计算库和框架有相似的模式[14]。Renderscript API的主要目标是为Android开发人员带来更低层次、更高性能的API,以便更好地实现可视化动画和模拟[15]。

Renderscript代码是在运行时在设备上编译的,避免了针对不同处理器类型的应用程序重新编译的必要性。这个事实使开发人员更容易使用它。它的语言是C99语言的扩展,它被翻译成编译时的中间字节码,然后在运行时转换成机器码。该API将生成的代码扩展到设备上可用的处理核心数量,即cpu、gpu或dsp。选择哪个处理器将运行代码的决定是在运行时在设备上做出的,对于开发人员来说是完全透明的。通常,简单的脚本可以在可用的gpu上运行,而更复杂的脚本将在CPU上运行。CPU也是一个后备,运行代码以防没有可用的设备。

在Renderscript中实现的所有任务都可以自动移植到设备可用处理器上的并行处理,比如CPU、GPU甚至DSP。Renderscript特别适用于处理图像处理、数学建模或其他需要大量数学计算的应用程序,类似于GPU计算范例。Renderscript的主要用途是在关键代码中获得性能,而传统的Android框架和OpenGL ES api还不够快。

3相关工作

关于在多核处理器上使用移动设备的方法,很少有相关的文献,特别是关于游戏的。大部分的工作处理图像处理,使用GPU进行通用处理。在[16]中,利用OpenGL ES 2.0在手持设备上设计和实现了一些图像处理算法。在[17]中提出了本地二进制模式特征提取的移动GPU实现,在CPU与GPU一起使用时显示了更好的性能和功耗。

同时使用OpenGL 2.0进行图像处理[11]显示人脸识别算法,总能耗为4.25x,减少3.88x。[18]介绍了基于gpu的窗口系统在EGL和OpenVG上的实现。openCV[19]是一个用于计算机视觉的库,它包括一些用于移动设备的新特性和实验特性。这些工作尤其重要,因为它们表明移动GPU的使用速度更快,耗电量低。

Nah等[20]利用kd -树显示基于OpenGL的CPU-GPU混合射线追踪器。在[21]中,提出了一种利用GPU来加速其处理的移动电话中选定视频帧的文档拼接图像的系统。在[22]中提出了一种基于ARM-Linux和OpenGL ES的移动设备的图像变形实现。

也有一些作品[23,24,25,26]利用云计算在云上进行处理,在实时模拟和游戏中进行移动。这些方法往往依赖于网络来实现这些分布,这可能非常不可靠,并且使用移动电话运营商的速度很慢。

遗憾的是,在这篇文章中所提出的移动GPGPU上处理游戏任务的文献中并没有任何内容。唯一类似的工作是前一项工作[27],在移动GPU中使用Renderscript实现了植植boid。这项工作也从[2]中得到了一些概念,在GPU中,PC游戏是通过CUDA完全实现的。

4游戏设计

MobileWars的游戏原型是一个巨大的2D原型射手,有一个自上而下的视角。游戏类似于几何战争和E4游戏。mobilewar的主要增强是它使用移动GPU来处理它的计算,允许处理和渲染数千个敌人,而类似的游戏只处理数百个。

游戏非常简单:玩家在“计算机宇宙”中扮演一个移动电话(被称为“mShip”),主要任务是通过游戏来处理(通过射击他们)多边形、阴影和数据(敌人)。每当“mShip”与一个敌人进行物理接触时,它就会释放时间,因此它会释放FPS。目标是在较小的时间内处理最大数量的数据,同时保持游戏的互动性,每秒钟至少12帧。mobilewar使用多点触控屏幕作为游戏的输入设备,控制“mShip”的移动和击球的方向。

5建议的体系结构

计算机游戏是一种多媒体应用,它运用了许多不同学科的知识,如计算机图形学、人工智能、物理、网络和其他[28]。此外,计算机游戏也是交互式应用程序,它展示了三大类任务:数据采集、数据处理和数据显示。游戏中的数据采集与从触摸、鼠标和加速计等输入设备收集数据有关。数据处理包括应用游戏规则来响应用户指令,模拟物理和人工智能行为。数据展示是关于向玩家提供关于当前游戏状态的反馈,通常是通过图像、音频和力量反馈。在建议的体系结构中,所有的游戏逻辑都在GPU中处理,即。,所有数据处理任务。CPU只用于不能以并行方式归档的任务,例如数据获取。

为了在移动设备上进行充分的工作,模拟架构被划分为四个不同的环境:Android框架,其中应用程序是与renderscript上下文一起创建的。此外,该环境负责收集输入并将其发送给计算renderscript;计算renderscript是创建模拟变量的地方,对renderscript计算引擎的调用和对NGrid的维护,NGrid是社区聚集的数据结构,将在下一小节中解释。renderscript计算引擎处理场景的行为,在可用的处理器之间分配进程。OpenGL负责渲染所有的对象,应用阴影和视觉效果。这个体系结构如图1所示。

mobilewar的执行工作如下。首先,该活动创建所有上下文,以使用RenderScript API。然后计算Renderscript初始化所有必要的变量并创建玩家和敌人。在此初始化之后,游戏循环将开始收集用户在整个活动中的输入,并将其发送到Compute Renderscript以进行进一步的处理。Compute Renderscript向Renderscript计算引擎发出调用,用于处理游戏中的所有实体的游戏物理和游戏AI。Compute Renderscript根据NGrid数据结构的规则执行一个进程。所有这些更新都存储在VBO(顶点缓存对象)中,并发送给着色器以供其呈现。GPU还与CPU共享变量,以判断它是否应该终止应用程序或播放声音效果。

Renderscript程序在线程中被划分。为了处理需要连续执行的主要游戏逻辑,所提议的体系结构有一个专门的线程负责它。该线程还负责处理“mShip”数据和输入。在此过程中,包括以下任务:根据输入更新“mShip”的位置;由其他线程制作的照片;计算分数;检查游戏结束;并检查新敌人的产生。其他线程负责更新敌人(作为物理行为实体)、照片(物理实体)和一些粒子动画,如爆炸(作为行为实体)。将位置和类型放入VBO中,并发送到顶点着色器,以便在不使用活动的情况下呈现个体。

图1 体系结构概述

因为所有的实体都在使用GPU进行更新和执行,而GPU有一些限制。重要的是要有一个高效且能够适应这种硬件的数据结构。为了满足这一需求,这项工作使用了NGrid,它在下一小节中介绍。

5.1NGrid

为了处理物理和人工智能,需要一些社区聚集。大多数游戏都试图通过将某种空间细分应用到环境中,并根据它们的位置对单元间的实体进行分类,从而避免接近性查询的高复杂性。为了加速数据获取,实体列表必须以这样一种方式进行排序,即同一单元上的所有实体都被分组在一起。这种方法有助于降低近距离查询的数量,但是对于能够适合单个单元的最大实体数量来说是非常合理的。所提议的架构实现了一种新的模拟数据结构,该结构将实体保持为另一种基于邻近的结构,称为NGrid。在这个数据结构中,每个单元现在只适合一个实体,不能直接表示一个离散的空间细分。NGrid是将n维环境映射到带有Ndimensions的离散映射(格)的环境中的邻域系统的近似表示。这样,相邻的实体在地图上就会彼此靠近。因此,也可以看作是环境的多维压缩,它仍然保留所有实体的原始位置信息。图2显示了NGrid的收缩。

为了使相邻的实体在NGrid中彼此接近,使用了排序机制。由于实体在每个框架中移动,所以相邻的网格会变得不一致。为了保持邻域网格,使得几何空间中的邻居彼此之间存储单元格,每一步都需要进行排序。对于这种工作,使用了奇偶排序的数据结构。在[29,30]上可以看到更多关于这个数据结构的信息。

图2 在自顶向下的摄像机中构建NGrid。

5.2物理处理

物理处理是负责物理行为的更新,实体如何处理和解决所有的碰撞和力的反应。该体系结构的物理基础是粒子系统[31]和混合物理引擎[28]。

碰撞检测是一项复杂的操作。对于系统中的n个实体,必须在O(n2)对实体之间进行碰撞检查。通常,为了降低计算成本,这个过程分为两步:第一阶段,第二阶段,第二阶段。在广泛的阶段中,冲突库检测哪些主体有可能在它们自己之间发生冲突,而NGrid正在被使用。在狭窄的阶段,一个更精细的算法来做碰撞测试是在已经经过了广泛阶段的两对身体之间进行。

物理步骤是造成碰撞检测的广义阶段;它也执行了窄阶段的碰撞检测,我。e,在每个物体上应用碰撞;通过对运动方程的积分,通过计算新的位置和速度,将每个物体的仿真步骤进行计算。

lt;

全文共7233字,剩余内容已隐藏,支付完成后下载完整资料


资料编号:[15831],资料为PDF文档或Word文档,PDF文档可免费转换为Word

原文和译文剩余内容已隐藏,您需要先支付 30元 才能查看原文和译文全部内容!立即支付

以上是毕业论文外文翻译,课题毕业论文、任务书、文献综述、开题报告、程序设计、图纸设计等资料可联系客服协助查找。