Java ME Vs. Flash Lite: a Comparison of Mobile Phone Game Development
Total Page:16
File Type:pdf, Size:1020Kb
Java ME vs. Flash Lite: A Comparison of Mobile Phone Game Development Submitted in partial fulfilment of the requirements of the degree of Bachelor of Science (Honours) of Rhodes University Alex Koller Grahamstown, South Africa November 2007 Abstract The main goal of this project is to compare mobile game development on the Java Plat- form Micro Edition (Java ME), and the Adobe Flash Lite platform. This has been done by investigating which APIs are available on each platform, and how well suited they are to game development. Developing an arcade-style game in Java ME and Flash Lite concurrently allows us to gather a complete understanding of the mobile game develop- ment using both platforms. Both versions of the completed game are almost identical, which allows us to directly compare the runtime of both the Java ME and Flash Lite environments. Acknowledgements I would like to thank my supervisors, Prof. Greg Foster and Mrs. Madelein Wright, for their invaluable assistance throughout the duration of my research. Your advice, patience and positive attitudes have been a tremendous help in keeping me motivated and inspired throughout the year. Thank you for allowing me to work at my own pace and trusting that I would complete my work. I am forever grateful for your help. I would like to thank to Department of Computer Science for providing me with an outstanding working environment in which to complete my research. Finally I would like to thank my family and friends for the support they have shown through all my years of study. I would not be where I am today without their guidance, support and humour. I acknowledge the financial and technical support of this project of Telkom SA, Business Connexion, Comverse SA, Verso Technologies, Stortech, Tellabs, Amatole, Mars Tech- nologies, Bright Ideas Projects 39 and THRIP through the Telkom Centre of Excellence at Rhodes University. Contents 1 Introduction 8 1.1 Background . 8 1.2 Problem Statement . 9 1.3 Research Goals . 9 1.4 Document Structure and Outline . 9 2 Related Work 11 2.1 Introduction . 11 2.2 Mobile Environments . 11 2.2.1 Mobile Platforms and Application Environments . 12 2.2.2 Market Shares . 13 2.2.3 Game Development on Mobile Devices . 13 2.3 Mobile Gaming . 15 2.3.1 Mobile Gamer Profile . 15 2.3.2 Successful Mobile Game Genres . 16 2.3.3 The Future of Mobile Game Development . 17 2.4 JavaME..................................... 17 1 CONTENTS 2 2.4.1 Java ME APIs . 19 2.4.2 Deployment . 20 2.4.3 Future of Java ME . 20 2.5 Adobe Flash Lite . 21 2.5.1 Flash Lite APIs . 21 2.5.2 Deployment . 23 2.5.3 Future of Flash Lite . 23 2.6 Comparison Matrices . 25 2.6.1 Comparing Development . 25 2.6.2 Comparing the Final Product . 25 2.7 Chapter Summary . 27 3 Game Requirements and Design 29 3.1 Introduction . 29 3.2 Game Requirements . 29 3.2.1 The Game Story and User Interfaces . 30 3.2.2 Control Response and Frame Rate . 30 3.2.3 Graphics and Sound . 31 3.2.4 High Scores and Statistics . 32 3.3 Game Design . 32 3.3.1 Tile-Based Game Engine . 33 3.3.2 Sprites . 35 3.4 Chapter Summary . 35 CONTENTS 3 4 Game Development with Java ME and Flash Lite 37 4.1 Introduction . 37 4.2 Software Installation and Development Environment Configuration . 38 4.2.1 Available Software Packages . 38 4.2.2 Requirements, Installation and Configuration . 39 4.2.3 Compilation and Emulation . 40 4.3 Implementation . 40 4.3.1 Differences between Developing in Java ME and Flash Lite . 40 4.3.2 Background Story and Characters . 41 4.3.3 User Interfaces . 41 4.3.4 Graphics and Sound . 42 4.3.5 Persistent Storage . 43 4.4 Implementation of the Game Engine . 44 4.4.1 Tile-Based . 44 4.4.2 Sprites . 46 4.4.3 Handling User Input . 47 4.4.4 Collision Detection . 47 4.5 Overall Structure . 48 4.6 Documentation . 50 4.7 Chapter Summary . 50 CONTENTS 4 5 Benchmarking Java ME Against Flash Lite 54 5.1 Introduction . 54 5.2 Comparison Tests . 54 5.2.1 Development Time . 55 5.2.2 Number of Lines of Code . 55 5.2.3 Final File Size . 55 5.2.4 Memory Usage . 56 5.2.5 Frame Rate and General Performance . 56 5.3 Deployment . 58 5.4 Chapter Summary . 60 6 Conclusion 61 6.1 Summary . 61 6.2 Assessment of Research Aims . 63 6.3 Future of Mobile Game Development . 64 Bibliography 65 A Black Sky Background Story 68 B Comparison of Java ME and Flash Lite Code 69 List of Figures 2.1 Java ME Architecture [12] . 18 2.2 Over-The-Air Deployment [16] . 20 2.3 Flash Lite 2.0 Architecture [5] . 24 3.1 The title image creates part of the splash screen . 31 3.2 The tile-set that from which the landscape is generated . 31 3.3 Top-down perspective. A) Player controllable ship, B) Enemy ship, C) Shield power-up, D) Explosion, E) Display bar showing health, score, etc. 33 3.4 Tile-set consisting of 4 sections . 34 3.5 Example grid of tiles from the tile-set . 34 3.6 Ship sprite constructed from multiple frames illustrating increasing levels of damage . 35 4.1 Options menu created in Java ME using the Form class . 42 4.2 Class diagram for the Java ME implementation of Black Sky . 49 4.3 The Java ME and Flash Lite implementations of Black Sky emulated side- by-side . 51 5.1 Java ME memory usage during game execution . 57 5.2 Flash Lite memory usage during game execution . 57 5.3 Java ME method profile showing CPU cycle usage . 59 5 List of Tables 2.1 Worldwide Smart Phone Market [8] . 14 2.2 Worldwide Smart Phone OS Market [27] . 15 2.3 Penetration Rate per Game Type [26] . 16 2.4 Comparison of Development Tools. Adapted from [24] . 26 4.1 Comparison of Development Environments . 39 6 List of Code Listings 1 Main game loop performing actions depending on the current game state . 45 7 Chapter 1 Introduction 1.1 Background Recent years have seen the rise of mobile users with PDAs, laptops and particularly mobile phones. Worldwide there are over 2 billion mobile phone users [21] – roughly one third of the world’s population. In South Africa alone there are 30 million mobile phone users [21] out of a population of 47 million. The pervasiveness of mobile devices has created a substantial market for mobile applications and games that continues to grow extremely rapidly. With so many mobile devices, it is crucial for a developer to target the right mobile plat- form and development environment, or a combination thereof. Portability across plat- forms will ensure the maximum target audience is reached. This is specifically important for mobile game development. The mobile game industry has firmly asserted itself as a significant industry with major development houses such as EA Mobile driving it forward. As such, it is possible to make some observations about the mobile game industry. Primarily, we analysed which games have succeeded and which have failed, and determine why this is so. In addition to the nature of the game, user input and hardware limitations also affect the success of a mobile game. A concise investigation of two of the main environments for mobile game development is conducted. The two environments under discussion are Java ME and Flash Lite. The APIs and features of these two development environments are explored in detail. Methods of deploying applications, as well as the future of Java ME and Flash Lite are discussed. 8 1.2. PROBLEM STATEMENT 9 1.2 Problem Statement The problem which we are addressing in this project is to determine which mobile devel- opment platform – Java ME or Flash Lite – is better suited to mobile game development in the current mobile game industry. This research is required because Flash Lite is an emerging technology that may be able to dethrone Java ME as the leader in mobile game development. Side-by-side development of the same game on both platforms makes it possible to accurately compare the development phase, and the final applications yield many opportunities to compare Java ME and Flash Lite as mobile runtime environments. 1.3 Research Goals Our goal was to investigate the current mobile game market to learn which types of games have been successful, and what made those games successful. With these success factors, we aimed to develop a game similar to the most successful mobile games in the industry. With a complete game developed in both Java ME and Flash Lite, we were able to realise our goal of directly comparing both the development phase and the final product of mobile game development on these two platforms. 1.4 Document Structure and Outline This dissertation begins, in chapter 2, with an investigation into the current mobile devices and platforms, such as Symbian and Java ME. We compare the market penetration of these platforms, and take a closer look at mobile game development on these platforms. Next, mobile development is discussed by analysing who plays mobile games, which games are most successful and why, followed by a brief look into the future of mobile game development. Java ME and Flash Lite are investigated, examining the APIs available to each platform, as well as the deployment methods and future of the two platforms.