Microcomputer Applications Vol. 26, No.8, 2010文章编号:1007-757X(2010)8-0009-02研究与设计微型电脑应用2010 年第 26 卷第 8 期手机游戏地图设计的高级技术研究程和侠,孙宜南,黄国兴摘 要:游戏地图的设计,对于整个游戏开发来说起着最为重要的作用,游戏的其他元素都是依托于地图而进行设计的。
整 个地图系统要考虑的问题是地图的格式标准,以及利用该标准设计和形成地图,最后是如何解析地图并显示到屏幕上。
以急 速飚车(Outrun)为例描述游戏地图设计过程中的一些高级技巧技术,包括地图的存储,地图动画效果的实现技巧,以及地 图的优化处理技术。
关键词:游戏;手机游戏;游戏地图;地图存储;地图优化 中图分类号: TP39 文献标志码: A0引言近年来,我国手机和网络游戏市场发展迅速, 尤其是手 机游戏的发展。
众多 SP(无线增值服务提供商)相继成立 手机游戏开发部门, 增加对这一市场的资金和人力投入。
但 是,游戏开发制作人才匮乏, 目前的手机游戏大多来自于国 外,日、韩、欧美等地开发的游戏几乎占据了中国手机游戏 市场 80%的游戏内容[1]。
所以,国内手机游戏服务商也已经 开始进行自主研发, 目前国内手机游戏已走过了从最初的文 字类游戏、嵌入式游戏、 可下载的单机版游戏到大型手机网 络游戏的发展历程,手机游戏的业务形态日益成熟。
手机游戏开发也逐渐成体系、 系统化, 基本上可以从下 面几个方向学习研究[2]: 1) 手机游戏的开发流程 2) 游戏开发框架 3) 关键技术:GUI、游戏地图的生成、音效、动画 与特效、无线网络通信、常用算法、3D 技术 4) 手机网游 本文着重研究手机游戏的地图设计中的一些高级处理 技术。
直观地说,地图系统仅仅是一个二维数组,然后用最 快的方式将数组影射到屏幕上[3][4]。
由于手机游戏平台的特 殊性,手机游戏地图是由程序员用代码编写, 一般采用元素 分层的方式,根据程序需要分离出地图中的不变层和变化 层,然后对游戏进行逻辑处理。
本文以急速飚车(Outrun) 为例描述游戏地图设计过程中的一些高级技巧技术, 包括地 图的存储,地图动画效果的实现技巧, 以及地图的优化处理 技术。
及当前处于活动区域的元素状态, 最后根据主角不同的状态 (被撞、刹车、转弯,等等)来描绘就可以了。
逻辑处理的作用都是为了下一帧内容的描绘服务的。
游 戏流程中的一个循环称为一帧。
一帧只能包含一个静态图 像。
这里主要讲解一帧内的内容。
假如有如下图 1 中的一关 赛道。
对于像 Outrun 这类卷动的游戏,实际在描绘的时候, 总是以主角(赛车)为参照物,因此赛车的位置是不变的,而 场景则是以相对的速度向后退。
图 1 赛道先对赛道作如下图 2 的塞道划分所示。
图 2 赛道划分图1地图的存储及实现赛车每帧行驶的距离对应前进一个矩形, 如下图 3 所示: (赛车一帧前进距离等于一个矩形) 。
在游戏开发框架部分介绍了游戏主要是由两部分组成, 逻辑处理和单帧描绘,而地图要解决的主要是两个问题,每 帧逻辑是如何, 每帧又是如何描绘的。
Outrun 的逻辑处理就 是碰撞处理,主角(赛车)与非玩家控制元素之间的碰撞处 理。
碰撞只考虑按照当前运动状态之后, 下一步会碰到什么 元素,以及哪些元素又会被激活,哪些元素会消亡,以及被 激活的元素下一帧之后会做有什么行为。
描绘只要按层来描 绘就可以,只要取得当前所在的区域在大地图上的位置, 以图 3 赛车运动的存储图——————————— 作者简介: 程和侠 (1982-) 男, , 安徽怀宁人, 安庆师范学院计算机与信息学院讲师, 硕士, 研究方向: 信息系统、 嵌入式系统; 安庆 246011; 孙宜南(1978-) ,女,安徽潜山人,安庆师范学院计算机与信息学院讲师,硕士,研究方向:信息管理与信息化,安庆 246011; 黄国兴,华东师范大学软件学院 教授,安庆 246011·9·Microcomputer Applications Vol. 26, No.8, 2010研究与设计微型电脑应用2010 年第 26 卷第 8 期其中 Road_p 指示游戏中要描绘的矩形的最大编号。
如 ( 左一幅图就表示要画的矩形分别为 n, n-1, …, n-9),每个小 矩形用 CRoadData 结构来存储。
我们定义一个 10 元的 CRoadData 数组,这十个矩形就 对应了赛车在当前位置所能看到的路面, 也就是我们一帧内 要描绘的赛道路面。
赛车前移一格,CRoadData 数组内容就 前移一个(CRoadData[9]内容赋给 CRoadData[8], 。
。
CRoadData[1],内容就赋给 CRoadData[0])并读取一个新的 小矩形内容到 CRoadData[9], 因此游戏就是不断地描绘这个 数组的内容就形成了不断移动的路面动画。
至于景物层和活动层只是以这个矩形为基准单位进行 摆放(如图 4)。
的移动是指去掉其他几层碰撞之后可以活动的范围) ,在这 个基础上铺上第二层, 这样就可以形成了一个赛道, 至于边 界可以由很多一半画其他地表一半画赛道这样的矩形来衔 接。
在上两层的基础上再铺上环境层就形成了不规则的赛 道。
44.1优化图 4 赛车运动的景物图其他的层是与这个地表层的是一一对应的。
景物的存储 也是以小矩形为单位进行存储的。
碰撞检测 在 Outrun 逻辑处理中的碰撞检测比较简单,只要根据 X,Y 的坐标判定就可以了,但是这样就会对元素分层中的 各层都做碰撞检测,可以加入优化,以减少检测次数。
游戏 中常用的一些碰撞检测算法有:边界检测,中心点检测,等 等。
这部分内容属于手机游戏常用算法内容, 这里就不详细 介绍。
4.2 双缓冲技术 成熟的游戏地图框架中,为了美观,适用性强,可能需 要采用外部文件引入的图片贴图, 有关贴图, 并提供了用于 增强游戏功能的 Game 包, 使得解决静态或动态、 画面背景、 屏幕刷新的双缓冲等都有较好的解决方案。
所谓的双缓冲技术 [5] 就是在内存中开辟一片区域作为 后台画面,程序对它更新,修改,完成后再显示它。
这样被 显示的图像永远是已经完全画好的图像, 程序修改的将不是 正在被显示的图像,这样就能有效避免屏幕闪烁。
5结束语2动画的效果实现游戏中一些效果的实现也是通过对上述 10 个矩形来实 现的。
根据当前的主角(赛车)的运动状态,相应地改变描绘 这些矩形。
上下坡: 至于上坡还是下坡只要通过调整每段的高度可 以实现,上坡的时候,每段差距较大,上坡的十个矩形的高 度和要比下坡的时候小。
转弯:每按一下左右键(左右转弯) 景物也就相应右左 偏移一段距离。
加减速:比如说在游戏中,赛车启动时,赛车所在的矩 形的高度是 37,其他九个是都是 1 ,速度越大,这几个矩 形高度差距也就越小。
减速同加速处理。
至于其他的动画技巧属于动画与特效内容。
整个游戏地图设计系统要考虑的问题是地图的格式标 准, 以及利用该标准设计和形成地图, 最后是如何解析地图 并显示到屏幕上。
游戏中的地图除了可以是由程序员用代码 实现, 还可以是先由程序员做一个地图编辑器, 在这个地图 编辑器中生成地图,再保存成地图文件[6]。
后者具有更广泛 的通用性,这里由于手机平台的限制,所以选择了前者。
参考文献[1] 饶威.浅谈中国手机游戏的发展[J].科教文汇.2006 年 02 期, P159-160. [2] 程和侠.手机游戏的 GUI 技术研究[J] .2007 年第 9 期.P210-216. [3] 惠志.一个基于 3D 游戏引擎的虚拟展示方案[J].微机发 展. 2005 年 04 期, P95-97+99. [4] 涂超.基于 Morfit 3D 引擎的三维游戏开发研究[J].微机 发展. 2005 年 10 期, P70-73. [5] 王森. JAVA 手机和 PDA 程序设计入门[M].第 3 版.电子 工业大学出版社, 2005. [6] Littman M L. (1994), Markov games as a framework for multi-agent reinforcement learning, in W. W. Cohen & H. Hirsh, eds, `Proceedings of the Eleventh International Conference on Machine Learning (ML-94)', Morgan Kauffman Publishers, Inc , New Brunswick, NJ, pp. 157--163. 1994. (收稿日期:2010-01-07)3不规则元素的实现地图中我们经常看见的不规则的物体,是如何实现的 呢?游戏地图的类型很多,这里我们主要是指 2.5D 游戏的 地图,所谓的 2.5D 就是介于二维和三维之间。
地图中不规 则的元素主要是指地表等元素,对于 2.5D 游戏来说不规则 的地表主要是拼接而形成的, 主要有两种方法: 一种是矩形 的,一种是菱形的。
后一种多用在斜视游戏中。
对于景物元 素,其实他们在游戏逻辑判断中是作为规则物体来判定的。
在 Outrun 中。
游戏中主要不规则元素是赛道,首先按照元 素分层的时候第一层可以定义一个可移动区域 (注意这里面·10·Microcomputer Applications Vol. 26, No. 8, 2010 ABSTRACTS & KEY WORDS微型电脑应用2010 年第 26 卷第 8 期ISSN1007-757XZhu Zhongying Editor-in-Chief Vol.26, No.8 (General No.208) August 2010Microcomputer ApplicationsMonthly (Since 1985)CONTENTSEXPERT FORUM Technique Development Trends of Foundational Software…………………………………………………………………………(1) Yu Huiqun1, Qian Zhiling1, Zhu Zhongying2 (1. School of Computer Science and Engineering ,East China of University of Science and Technology,Shanghai 200237,China;2.School of Electronic, Information and Electrical Engineering,Shanghai Jiaotong University, Shanghai 200030, China)Abstract: This paper surveys various aspects of foundational software, including basic concepts, characteristics, contents, requirements, techniques and products. Main streams of foundational software, as well as future development trends are addressed. Based on analysis of typical application domains, we explore the current situation and limitation of foundational software development in China. This survey aims to assisting decision making for domestic foundational software industry policy. Key words: Foundational Software; Software Engineering; Software Service; Software IndustryRESEARCH AND DESIGN Design and Implement of the Peformance Optimization in Network Storage System……………………………………………… (3) Li Lina( School of Information Security Engineering, Shanghai Jiaotong University, Shanghai 200240,China)Abstract: Vast amounts of data appear with the digital wave, the world is entering an era of network storage. NFS (Network File System) is one of the most common protocols used nowadays. But the default setting of NFS is based on SYN UDP, which cannot achieve traffic control during communication and easily results in performance barriers in a heavy-loading network storage system. According to the demand of airborne storage, this paper analyzes the NFS protocol on a stable and reliable real time operating system- VxWorks, and design optimization for the NFS protocol based on queuing theory. Key words: Network Storage; VxWorks; NFS; Traffic ControlStrengthening the Research of Information Security Risk Evaluation……………………………………………………………… (6) Fu Sha(Software School, Hunan University, Changsha 410082, China)Abstract: This paper reviews the history of information security risk evaluation job at home and abroad, points out the importance of each application field while carries through with information security risk evaluation. The information security risk evaluation question is elaborated, the major methods in information security risk evaluation fields are introduced, and the methods are analyzed and studied. Discusses the processes and forecasts the future prospect. Key words:Information Security;Risk Evaluation;Asset Threat;Weak PointDesign of the Mobile Game's Map……………………………………………………………………………………………………(9) Cheng Hexia1, Sun Yinan1, Huang Guoxing2(1.Departement of Computers, Anqing Teachers College, Anqing 246011,China;2. College of Software, East China Normal University, Shanghai 200237,China )Abstract: The design of the game's map is the most important part of the game design. The other elements of the game are dependent on this design of game's map. Map system must consider these issues: the standard format of the map, Using of this standard format and forming a map and analysis to the map and display on the screen. This Paper describes the map design of advanced technology through the game of outrun, including the map storage, map animation, map optimization. Key words: Game; Mobile Phone Game; Game's Map; Map Storage; Map Optimize Feedback Control for Fractional-Order LinearStatic Output Feedback Control for Fractional-Order Linear Systems: An LMI Approach……………………………………(11) Lou Zhengqing (Department of Automation, Shanghai Jiaotong University, Shanghai 200240, China)Abstract: This paper investigates the static output feedback robust stabilization problem of fractional-order linear systems. A static output feedback controller is designed such that the closed-loop uncertain fractional-order linear system is asymptotically stable. The gain of this static output feedback controller can be obtained by solving linear matrix inequalities (LMIs). Finally, a numerical example is given to demonstrate the effectiveness of the proposed results. Key words: Fractional-order System; Robust Stability; Linear Matrix Inequality; Static Output Feedback ControlMDA-based Development and Design for Community E-services Platform………………………………………………………(15) Jia Leilei 1, Li Shuyu 2(Computer Science College, Shanxi Normal University, Xi’an 710062, China)Abstract: Through analysis of the current status of community e-service system, there is the performance bottleneck of existing systems, network latency, slow integration of new business issues, and design an open community-based e-service platform across operating systems and network platform, cross-programming environment, which will help with existing systems integrated, flexible and scalable, support system for rapid remodeling and new services quickly access. At the same time in view of all the disadvantages of traditional software development, in the organization of the OMG's MDA (Model Driven Architecture) framework for thinking a detailed analysis and research, build PIM and PSM of community e-service development platform, ultimately achieved quickly a new community e-services development platform. Key words: MDA; Community E-service Platform; PIM; PSMII。