A UML Model for Mobile Game on the Android OS

本文介绍了基于Android平台的手机游戏《勇敢的双刀锋战士》的设计与实现过程,重点讨论了游戏开发中采用的UML模型及重力感应技术的应用。游戏利用对象池、多线程、套接字连接等多种技术,通过UML模型进行模块化设计,实现了良好的用户体验。

                                                                           

Abstract

In order topromote the mobile games to keep up with the new technologies development, themobile game of Gallant Fighter with Double Blade based on the Android OSdesigned in this paper applies various techniques, especially for the gravitysensing, such as object pool, multi-threaded, socket connection, maps and etc..The game management, the service class, the sound manager class, the game viewclass, the pass tips window class, and the rank window class are designed byUML model respectively. Experiments demonstrated its performance and provedthat this model is meaningful and useful to develop other online mobile games.The UML model supports the game development and provides happiness for playersin the leisure time.

© 2011 Published by Elsevier Ltd. Selectionand/or peer-review under responsibility of ICAE2011. Keywords: UML model;mobile game; Gallant Fighter with Double Blade; gravity sensing; Android OS

摘要

为了促进手机游戏跟上新技术的发展,在本文中设计的手机游戏--勇敢的双刀锋战士,它基于安卓操作系统,特别适用于各种技术,尤其是对于重力感应,如对象池、多线程、套接字连接、地图等。游戏管理,服务类、声音管理类、游戏视图类、传递技巧窗口类、和级窗口类是由UML模型分级设计。实验证明了它的性能,并证明了这一模型是有意义和有实用用的用于开发其他在线手机游戏。UML模型支持游戏发展,为玩家在闲暇时间提供快乐。

©2011由Elsevier出版公司的选择和/或同行评审的责任icae2011下。

关键词:UML模型;手机游戏;勇敢的双刀锋战士;重力感应;Android操作系统

 

1.Introduction

A mobile game isa video game played on a mobile phone, cell phone, PDA, handheld computer or portablemedia player. This does not include games played on handheld video game systemssuch as Nintendo DS or PlayStation Portable. Mobile games are played usingthe technologies present on the device itself. For networked games, there arevarious technologies in common use. Examples include text message (SMS),multimedia message (MMS) or GPS location identification.

Young people areoften comprised the majority of early adopters and most avid users of mobile gadgetsand applications, especially mobile games. Mobile gaming is playing a more andmore important role in the entertainment industry, partially due to the rapiddevelopment of mobile communication. Porting mobile web application engine tothe Android platform can reduce the workload. Android is a widely anticipatedopen source operating system for mobile devices that provides a basic operatingsystem, an application middleware layer, a Java software development kit (SDK),and a collection of system applications. Since the source code of Android wasreleased to people, a large community of developers has organized aroundAndroid.[5] Android has a large community of developers writing applications("apps") that extend the functionality of the devices. Developerswrite primarily in a customized version of Java.[6] There are currently morethan 520,000 apps available for Android.

We focused onthe case study of mobile games. The UML model for the mobile game of Gallant Fighterwith Double Blade which is widely well come on the Interest is studied in thispaper.

介绍

手机游戏是一个款影像游戏在移动手机,PDA,手机,掌上电脑或便携式媒体播放器上播放。这不包括在便携式影像游戏系统中播放的游戏,比如任天堂DS或PSP。手机游戏使用的现有技术是设备本身的技术。对于网络游戏,有各种各样的通用的技术。例子包括文本、信息(短信),多媒体信息(多媒体)或全球定位系统定位识别。

年轻人往往是小工具和应用的大多数的早期采用者和最狂热的移动用户,特别是手机游戏。手机游戏正在娱乐产业中扮演越来越重要的角色,部分原因是由于移动通讯的快速发展.

移植移动网络应用引擎到安卓平台可以减少负载。安卓是一个移动设备广泛使用的开源操作系统,它提供基本操作系统、应用中间件层、Java软件开发包(SDK),系统应用集。自从安卓的源代码发布给人们,一大批开发者围绕着安卓系统组织起来,[ 5 ]安卓有一大批开发者编写应用程序(“apps”),扩展了安卓设备的功能。开发者主要写一个定制版本的Java。目前有超过520000个应用程序可供安卓使用

我们专注于手机游戏的案例研究。手机游戏――勇敢的双刀锋战士的UML模型,正在本文中被很感兴趣的研究。

 

2.Game management

Game managerclass is the game management class that contains all the pictures methods, suchas the enemy's draw, boss, draw the effect of the explosion and the drawing ofthe machine etc. the painting thread, collision detection thread, collisiondetection methods of listening to events, such as a keyboard response of themonitor and touch screen phone surveillance are drawn. The game management UML.shows as Fig 1.


 Fig.1. The game management UML

2.游戏管理

游戏管理类是游戏管理类,包含所有的绘画方法,如敌人的画,老大,画出爆炸的效果和机器的绘画等。线程、冲突检测线程、监听事件的碰撞检测方法,如键盘监测和触摸屏电话监控的响应。游戏管理UML显示如图1。

 

3.Gravity sensing

The Coordinate system of gravity sensing in the Android OS takes theupper-left of the mobile screen as the origin. The direct define is shown asFig. 2.

Using the x, yand z values to get the trigonometric function value, and then the mobile phonemoving state can be accurate measurement.

1) SensorManagersensorMgr=(SensorManager) getSystem Service (SENSOR_SERVICE) can get a hardwarecontroller. For example, LocationManage can determine the location,AudioManager can use the audio player.

2) Sensor sensor= sensorMgr.getDefaultSensor (Sensor. TYPE_ALL) can get the x, y and z valuesof offset.

3)SensorEventListener lsn = new SensorEventListener() is used to get the valuechanging. When a SensorEvent has been declared to listen, the changing valuecan be gotten from TextView, and these values are float[] array. That is x, yand z value respectively.

4) Threeparameters are listen, sensing device, and delicacy respectively. SENSOR_DELAY_FASTEST, SENSOR_ DELAY_NORMAL and SENSOR_DELAY_UI represents the fast, normaland slowly respectively.

3.重力感应

安卓操作系统中的重力感应坐标系统取手机屏幕的左上角作为原点。

直接定义如图2。

通过x、y、z值,你可以得到三角函数值,然后手机移动状态可以被准确测量。

1)  SensorManager sensormgr =(SensorManager)getSystemService(sensor_service),

可以得到一个硬件控制器。例如,定位管理可以确定位置,媒体管理可以使用音频播放器。

2)Sensor sensor = sensorMgr.getDefaultSensor(Sensor. TYPE_ALL)

可以得到X,Y和Z值的偏移。

3)SensorEventListenerlsn = new SensorEventListener()用于得到值的变化。当一个sensorevent被定义去监听,变化值可以从TextView得到,这些值是浮点数组。分别是x、y、z值。

4)三个参数分别为监听、感测装置和精致。SENSOR_DELAY_FASTEST, SENSOR_ DELAY_NORMAL and SENSOR_DELAY_UI 分别代表快速、常速和低速

 

4.The main game UML models

4.1. Service UML model

Udpthreadinherits the thread class and realization the method of run. Use while cyclecontrol can keep on to test whether the client in connecting to the server.Thunderserver class connect to the client depend on the roles of provided IPand according to TCP, UDP interface. Running in the thread when the client connection,and put it in a container. The arraylist <client> class inherits from thearraylist class. It can accommodate connection of the client. For the clientclass according to the server's IP and TCP, UDP interface to connect theserver. See the Fig.3.


Fig. 3. The game service UML model

图3.游戏服务的UML模型

4.游戏主要的UML模型

4.1服务器端的UML模型

udpthread继承线程类和run实现方法。使用while循环控制可以保持测试,不论客户端是否连接到服务器上。thunderserver类连接到客户端依赖于提供的IP和TCP UDP接口。当客户端连接时在线程中运行,并将其放在容器中。ArrayList <client>类继承自ArrayList类。它可以适应客户的连接。让客户端类根据服务器的IP和TCP,UDP接口去连接服务器。见图3。

 

4.2.Sound management UML model

SoundManagerclass is a small clever class, it can be accurately controlled. However, theclass has loaded files can't be more than one million seconds, because when theexplosion of the time we need an exact file loading in the plane of theexplosion was so with this method of loading voice.

Single examplemode to achieve their instantiation own static methods, if the object does notexist very empty then instantiation yourself, if there are calls for staticobject. The voice of the pool with system defined, the control method of soundbelly is full, stop playing method for the stop. The voice getStreamMaxVolumemethods obtain the voice of the system.

The MusicPlayerclass is the public class of MediaPlayer awakened operation. This kind ofdoesn’t limit the size of the file in the continuous play but there will be adelay in the background music. See the Fig.5.

4.2完善的管理UML模型

soundmanager类是一个小的灵活的类,它可以被精确的控制。然而,这个类加载的文件不能超过一百万秒,因为当爆炸的时候,我们需要一个确切的文件装载在爆炸的平面,所以用这种方法加载声音。

单例模式实现初始化自己的静态方法,如果对象不存在为空 ,然后实例化自己,如果有静态对象则调用。系统定义的声音池,声音的控制方法是充分的,停止播放的方法为停止操作。声音getstreammaxvolume方法获得系统的声音。

音乐播放器类是媒体播放唤醒操作的公有类。该类不限制连续播放的文件的大小,但会有一个延迟的背景音乐。见图5。


Fig. 5. The music play UML model

图5。音乐播放的UML模型

 

4.3.The game view UML model

With the SurfaceHolder.Callback functioncalls back the canvas, only when the canvas blockade to lock on the topoperations such as update and painting. The canvas is submitted to unlock theprocess of canvas. See the Fig.6.

4.3 surfaceholder的游戏视图UML模型

用SurfaceHolder绘图,回调函数回调canvas,只有当canvas封锁顶层操作例如更新和绘制。canvas是提交去解锁canvas程序。见图6。

 

4.4.The rank and pass tips window UML model

Window bag isused in on the game popwindow collective management. The Rankwindow is a highmarks popwindow and used to list achievement high grades of the display.

LayoutInflater        mLayoutInflater =    (LayoutInflater)GameConfig.mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

 The passtipswindow class isthe passed tips class. It used to define the opening, closing, or the initialrest the game respectively. See the Fig.7. 5.

4.4等级和通行提示窗口的UML模型

Window包用于游戏PopWindow集体管理。rankwindow是一种高标志的PopWindow,用于列出实现高等级的播放。

LayoutInflatermLayoutInflater = (LayoutInflater)GameConfig.

mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

passtipswindow类是通行提示类。它用来分别定义打开、关闭或初始休息。见图7


5Thegame implement

Five staticconstants (Sign in, Start, Menu, Help, and Sign out) are defined in theMainMenu class which is used to identify the selected state. Six sub-staticconstants (Sky, Message, Music, Tool, Flight and Cloud) are defined in theConstantUtil class which is used to identify the selected sub-state. When theplayers enter the game from the start window of the main interface, the initialstate is Fighting window. The First fighting window, the Boss window, and theSecond fighting widow are shown as Fig. 8 (a), (b), (c) respectively.

5.游戏实现

五种在MainMenu类定义的静态常量(签到,开始,菜单,帮助,和签出),这是用于确定选定的状态。六种在constantutil类中定义的子静态常量(天空、消息、音乐、工具、飞行和云),它们是用来定义选定的子状态。当玩家从主界面开始窗口进入游戏,初始状态是战斗窗口。第一个战斗窗口,管理窗口,和第二个战斗窗口分别见图8(a),(b),(c)。

 

6.Conclusions

        There are many technologies involved inthe development of mobile games, such as game state machine, object pool,multi-threading, wizard, maps and so on. Through program optimization anddesign of compatibility, it develops the game engine and simple serverprocedure which are suitable for games that have single-screen maps. And it hasa good reference for those same kinds of games. As a language, Java is easy tolearn and master, and it follows a strong, secure, portable, and scalableplatform. All these elements make Java a perfect development tool in the fieldof small device.

3G willaccelerate the integration between mobile networks and traditional Internet.Meanwhile, network integration will enable the existing version of Internetgames to have the edition of mobile terminals. It can be foreseen that theentire game industry will eventually realize the integration of PC and mobilephones.

6.结论

手机游戏的发展涉及到许多技术,如游戏状态机器,对象池,多线程,向导,地图等。通过程序优化设计的兼容性,它开发的游戏引擎和简单的服务器程序,这是适用于有单一屏幕地图的游戏。对同类型的游戏有很好的借鉴影响。作为一种语言,Java很容易学习和掌握,它遵循一个强大的,安全的,可移植的,可扩展的平台。所有这些元素使Java成为在小设备领域的一个完美的开发工具。

3G将加快移动网络和传统互联网之间的融合。同时,网络整合将使现有的互联网游戏版本有移动版终端。可以预见,整个游戏产业最终将实现个人电脑和手机的一体化。

内容概要:本文介绍了ENVI Deep Learning V1.0的操作教程,重点讲解了如何利用ENVI软件进行深度学习模型的训练与应用,以实现遥感图像中特定目标(如集装箱)的自动提取。教程涵盖了从数据准备、标签图像创建、模型初始化与训练,到执行分类及结果优化的完整流程,并介绍了精度评价与通过ENVI Modeler实现一键化建模的方法。系统基于TensorFlow框架,采用ENVINet5(U-Net变体)架构,支持通过点、线、面ROI或分类图生成标签数据,适用于多/高光谱影像的单一类别特征提取。; 适合人群:具备遥感图像处理基础,熟悉ENVI软件操作,从事地理信息、测绘、环境监测等相关领域的技术人员或研究人员,尤其是希望将深度学习技术应用于遥感目标识别的初学者与实践者。; 使用场景及目标:①在遥感影像中自动识别和提取特定地物目标(如车辆、建筑、道路、集装箱等);②掌握ENVI环境下深度学习模型的训练流程与关键参数设置(如Patch Size、Epochs、Class Weight等);③通过模型调优与结果反馈提升分类精度,实现高效自动化信息提取。; 阅读建议:建议结合实际遥感项目边学边练,重点关注标签数据制作、模型参数配置与结果后处理环节,充分利用ENVI Modeler进行自动化建模与参数优化,同时注意软硬件环境(特别是NVIDIA GPU)的配置要求以保障训练效率。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值