Scholarly article on topic 'A UML Model for Mobile Game on the Android OS'

A UML Model for Mobile Game on the Android OS Academic research paper on "Electrical engineering, electronic engineering, information engineering"

Share paper
{"UML model" / "mobile game" / "Gallant Fighter with Double Blade" / "gravity sensing" / "Android OS"}

Abstract of research paper on Electrical engineering, electronic engineering, information engineering, author of scientific article — Zhu Quan-yin, Jin Yin, Xu Chengjie, Gen Rui

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

Academic research paper on topic "A UML Model for Mobile Game on the Android OS"

Available online at

SciVerse ScienceDirect

ProcediaEngineering 24 02011)313 - 318

Procedia Engineering

International Confaranca on Advancas in Engineering

A UML Modal for Mobila Gama on tha Android OS

Zhu Quan-yina, Jin Yina, Xu Changjiaa, Gan Ruia,a*

aFaculty of Computer Engineering, Huaiyin Institute of Technology, Huaian, 223003, China


In ordar to promota tha mobila gamas to kaap up with tha naw tachnologias davalopmant, tha mobila gama of Gallant Fightar with Doubla Blada basad on tha Android OS dasignad in this papar applias various tachniquas, aspacially for tha gravity sansing, such as objact pool, multi-thraadad, sockat connaction, maps and atc.. Tha gama managamant, tha sarvica class, tha sound managar class, tha gama viaw class, tha pass tips window class, and tha rank window class ara dasignad by UML modal raspactivaly. Exparimants damonstratad its parformanca and provad that this modal is maaningful and usaful to davalop othar onlina mobila gamas. Tha UML modal supports tha gama davalopmant and providas happinass for playars in tha laisura tima.

© 2311 Publishad by Elsaviar Ltd. Salaction and/or paar-raviaw undar rasponsibility of ICAEngll.

Keywords: UML modal; mobila gama; Gallant Fightar with Doubla Blada; gravity sansing; Android OS

1. Introduction

A mobila gama is a vidao gama playad on a mobila phona, call phona, PDA, handhald computar or portabla madia playar. This doas not includa gamas playad on handhald vidao gama systams such as Nintando DS or PlayStation Portabla. Mobila gamas ara playad using tha tachnologias prasant on tha davica itsalf. For natworkad gamas, thara ara various tachnologias in common usa. Examplas includa taxt massaga (SMS), multimadia massaga (MMS) or GPS location idantification.[1]

Young paopla ara oftan comprisad tha majority of aarly adoptars and most avid usars of mobila gadgats and applications, aspacially mobila gamas.[n] Mobila gaming is playing a mora and mora important rola in tha antartainmant industry, partially dua to tha rapid davalopmant of mobila communication.[3] Porting mobila wab application angina to tha Android platform can raduca tha workload.[4] Android is a widaly anticipatad opan sourca oparating systam for mobila davicas that providas a basic oparating systam, an application middlawara layar, a Java softwara davalopmant kit (SDK), and a collaction of systam applications. Sinca tha sourca coda of Android was ralaasad to paopla,

* Corresponding author. Tal.: +86-517-83591346; fax: +86-517-83591363 E-mail address:

1877-7058 © 2011 Published by Elsevier Ltd. doi:10.1016/j.proeng.2011.11.2648

ZhuQuan-yín etal. /Procedía Engineering 22 (2011( 313 - 318

a large community of developers has organized around Android.[5] Android has a large community of developers writing applications ("apps") that extend the functionality of the devices. Developers write primarily in a customized version of Java.[6] There are currently more than 530,000 apps available for Android[7][8].

We focused on the case study of mobile games. The UML model for the mobile game of Gallant Fighter with Double Blade which is widely well come on the Interest is studied in this paper.

2. Game management

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

Fig. 1. The game management UML 3. Gravity sensing

The Coordinate system of gravity sensing in the Android OS takes the upper-left of the mobile screen as the origin. The direct define is shown as Fig. 3.

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

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

3) Sensor sensor = sensorMgr.getDefaultSensor (Sensor. TYPE_ALL) can get the x, y and z values of offset.

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

4) Three parameters are listen, sensing device, and delicacy respectively. SENSOR_DELAY_ FASTEST, SENSOR_ DELAY_NORMAL and SENSOR_DELAY_UI represents the fast, normal and slowly respectively.

Zhu Quan-yin et al. / ProcediaEngmeermg 24(2011) 313- 318

x ^— \

Fig. 2 The Coordinate system

4. The main game UML models

4.1. Service UML model

Udpthread inherits the thread class and realization the method of run. Use while cycle control 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 IP and 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 the arraylist class. It can accommodate connection of the client. For the client class according to the server's IP and TCP, UDP interface to connect the server. See the Fig.3.

Fig. 3. The game service UML model

4.4. Sound management UML modrl

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

Single example mode to achieve their instantiation own static methods, if the object does not exist very empty then instantiation yourself, if there are calls for static object. The voice of the pool with system defined, the control method of sound belly is full, stop playing method for the stop. The voice getStreamMaxVolume methods obtain the voice of the system.

The MusicPlayer class is the public class of MediaPlayer awakened operation. This kind of doesn't limit the size of the file in the continuous play but there will be a delay in the background music. See the Fig.5.

ZhuQuan-yin etal. / Pmcedia Engineermg24 (2011( 313 - 318

Fig. 5. Tha music play UML modal

4.3. The game view UML model

With tha SurfaceHolder.Callback function calls back tha canvas, only whan tha canvas blockada to lock on tha top oparations such as updata and painting. Tha canvas is submitted to unlock tha procass of canvas. See the Fig.6.




Dr*Hi(dO - mi(]: mid



* gdWet^irefviETBgen( ]: NeKand&nagsr tGwdfetfariert •

- in'"|: it:d

^ arkiCtiEieditKilier: SufcsHdife): aid

* : SjrfaceHclder;: rid

* arfciiCtwgdlhddcr: Sufo[xH#i. mint: int. wdti: ithx^t: it): m j-doOnsrftlc: Csrwas): ™d

- iTciuciiEiertjim: Winifred): iMten

t : 'it rot: KtyEitrt) bociean





*■ iddFfetifjpfejsr OinPIra] :whJ + ge!HSayers[J: Ust<OwnHfei&> - NeKsmeHtogeiftttted: Ccrtd)

j jggmag

- nil)

t MG(t: Can«]: in d *4aO®ii(o: Ciibs): lid

* Jra^bprjc: Cams): md t4ai(Mji»ta(i::Camfs]

*■ henieTcijciiftsrtifflirt: HM:«tl]: raid

* hancteKjeyDmnflsiiCaje it, evaut: : v;id

- gsra!/£fi£: t


Fig. 6. Tha gama viaw UML modal

Zhu Quan-yt- et ai. /ProcediaEngineering 24(2011( 313- 318

4.4. Thr /enk endpess tips window UML model

Window bag is used in on the game popwindow collective management. The Rankwindow is a high marks popwindow and used to list achievement high grades of the display. LayoutInflater mLayoutlnflater = (Layoutlnflater)GameConfig. mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

The passtipswindow class is the passed tips class. It used to define the opening, closing, or the initial rest the game respectively. See the Fig.7.

5. The game implement

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



List View Butt (Hi


-USER№ME:Sfrng "usemame" ■ SCÜftÉ SOrmg = "score"

- rirkjrcnr. Slrimjf] s us* Sirirepjlf }|USERNME,SCCGE[

- renkjo: ¡nil = new int|]{i^em3ft№.scofe}

¡RsnflWndwjcortet: Corted) shwWinji/rttparent: View): void ck^VUndtM^] void

• ir<IWirdc<rt(] wad _ ade()ta


Li$t<Map< String. Siring»

Fig. 7 (a) rank window UML model; (b) pass tips window UML model

Fig. 8 (a) The First fighting window; (b) the Boss window; (c) the Second fighting widow

ZhuQuan-yin etal. /Procedia Engineering 22 (2011( 313 - 318

6. Conclusions

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

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


[1] ZHANG Xin-meng JIANG Sheng-yi JIANG Ling-min. Design and Implementation of mobile network games Based on j2ma/sockat. Microcomputer Information.2010.Vol.23(12-3),p.233-238

[2] Stan Kurkovsky.Can Mobile Game Development Foster Student Interest in Computer Science?.Games Innovations Conference, 2009. ICE-GIC 2009. International IEEE Consumer Electronics Society's. London, UK. 2009,p.92-95

[3] Weishan Zhang, Dong Han, Kunz, T. Hansen, K.M. Mobile Game Development: Object-Orientation or Not. 31st Annual International Computer Software and Applications Conference. Beijing, China. 2007 ,p.301 - 308

[4] Yonghong Wu, Jianchao Luo, Lei Luo. Porting mobile web application mcne to the Android platform.. 2010 IEEE 10th International Conference on Computer and Information Technology (CIT). Bradford, United Kingdom 2010,p.2157-2131

[5] Maoqiang Song, Wenkuo Xiong, Xiangling Fu. Research on Architecture of Multimedia and Its Design Based on Android. 2010 International Conference on Internet Technology and Applications. Wuhan, China. 2010, p.1 - 4

[3]Shankland, Stephen (12 November 2007). Google's Android parts ways with Java industry group. CNET News.

[7] Barra, Hugo (10 May 2011). Android: momentum, mobile and more at Google I/O. The Official Google Blog. Retrieved 10 May 2011.

[8] Android Stats. 25 Sep 2011. Retrieved 25 Sep 2011.