1 / 28

Small Game on Mobile Appliances with J2ME

Small Game on Mobile Appliances with J2ME. Akihiro Minegishi CS491b 12/10/2004. My Project . The numbers of wireless and mobile appliances have been dramatically increased. At the same time, the processing powers of the mobile appliances also have been strengthened.

HarrisCezar
Download Presentation

Small Game on Mobile Appliances with J2ME

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Small Game on Mobile Appliances with J2ME Akihiro Minegishi CS491b 12/10/2004

  2. My Project • The numbers of wireless and mobile appliances have been dramatically increased. At the same time, the processing powers of the mobile appliances also have been strengthened. • Thus, building applications for mobile platforms is becoming more and more attractive. • Also, those are tremendous opportunities to the software developers too.

  3. My Project • The project is intended to learn and experience those new wireless technologies. • small game is suitable to learn programming in new application platform, because it is not too large to build by single person

  4. Reason for Gaming • One of other reports from IDC shows that “the wireless gaming market in Asia-Pacific, excluding Japan, is expected to grow at a compound annual growth rate (CAGR) of 40%, from $237.4 mln last year to $1.3 bln in 2008” (www.itfact.biz, 2004).

  5. Choose • The project started with comparing different platforms for developing application on mobile appliances. There are many, but I choose J2ME because • I am familiar with JAVA • Many devices supports MIDP

  6. MIDP 2.0 or 1.0 • The MIDP 2.0 is released this year and I was planning to use MIDP 2.0, but later, I found that there are not many devices that support MIDP 2.0 because it is new. • I decide to follow the MIDP 1.0

  7. Compatibility • After some more research about the J2ME, I found that even though there is a standard for programming, the result of the program could be different because • Differences of hardware • Carriers and makers has own additional libraries • I decided to code in pure MIDP 1.0 and CDLC

  8. Environment • few weeks to design the game and installing the development environment Environment: • Language: Java • Platform: J2ME (MIDP1.0 + CLDC) • Developing Environment: J2ME wireless tool kit 1.0.3 + Forte CE v3.0 • Running Environment: KVM

  9. Process • Following list shows the usual mobile application development process by using Java 2 Platform Micro Edition. • Write a Java application • Compile it • Pre-verify it • Package it into a JAR file • Create the application descriptor • Publish the MIDlet suite • Install on the device or emulator WLTK does for you!

  10. Game Design • The basic idea of this game came from an old DOS game. I played this game more than 10 years ago • I designed my own scoring system, interfaces, graphics and such, so that even though the idea came from this game, the game is created without intention of restore or imitate the old DOS game.

  11. Game Rules • The rule of the game is simple. It is designed as simple because the game should be played without reading manuals or any effort to learn and start the game. The left picture show the moment just after the game is started. • The player can control single ball, which is called my ball and it is colored in red. On the screen, there are other balls that are called target balls, colored in blue. The target ball does not move and cannot be controlled by the player. If my ball hit the wall, then my ball will bounce off the wall.

  12. Game Rules • As the left picture show, when my ball hit the target balls, then • The target ball disappears and breaks into two green balls. Those are called piece balls and they moves and player does not have controls of moving piece balls. • After a while, approximately ten seconds, those piece balls will disappear from the screen and player will get the score.

  13. Game Rules • The goal of this game is to dodge the piece balls and remove all the target balls and piece balls from the screen. If player successfully removed all the balls then the player wins the game and the program will be stopped. If player want to try another game, pushing the stop talking button in red on left will let player return the launcher menu. • The final score of player will be displayed on the top of the screen. In the case of left picture, the score is at 2400 points.

  14. Game Rules • If the player is failed to dodge the piece balls and any one of the piece balls hit the player’s my ball, then the player looses. • If the player looses the game, the program will stop and the final score of player will be displayed on the top of the screen. • If player want to try another game, pushing the stop talking button in red on left will let player return the launcher menu.

  15. DEMO

  16. Behavior of the Program • When the program starts, my ball will be displayed. • Initially, my ball move at constant speed in one direction. • My ball will change moving direction when a keypad is pressed. • When my ball hit the wall, then my ball will bounce. • When the game starts, the target ball appears. • When my ball hit a target, then the target ball disappears. • When my ball hit a target, then the target will break down into piece ball. • Piece ball moves at constant speed in a direction. • When a piece ball hit the wall, then piece ball will bounce. • Afar a while, piece disappears. • When you hit moving pieces, then the program ends. • When all the target balls and piece balls disappear, then the program ends.

  17. Flow Chart

  18. Implementation • Ball Class • BallCanvas Class • MyBall Class • TargetBall Class • PieceBall Class

  19. Ball Class • Ball: It is the class that controls basic flow of lifecycle of the MIDlet of theprogram, that includes, • Ball()//Ball constructor • startApp()//This method is called when MIDlet Starts, • pauseApp()//This method is called when MIDlet pauses • destroyApp()//This method is called when MiDlet ends • doExit()//Destroys MIDlet and exit

  20. BallCanvas Class • BallCanvas: This class is the canvas of the program. So this Ball canvas extends canvas class. Also, it implements command listener and it is runnable because the program uses threads. Includes, • BallCanvas()//constructor for the ballcanvas • start()//when start method is called, this method will create the new thread and start the thread • stop()//this method is called when the thread is stopped • run()//run method for the thread as long as the program is running, it will repaint the graphics • paint()//paint method will draw the graphics on the canvas • keyPressed()// this method is called when the key is pressed

  21. MyBall Class • MyBall: MyBall is a ball that you can control my ball moves four ways by using key pad. My ball will bounce when it hit the wall. • MyBall()//constructor for my ball • Accessor methods for position and moving direction • Paint()//this method will actually draw the graphics

  22. TargetBall Class • TargetBall: Target ball is a ball that is stationed • TargetBall()////constructor of the targetball • Accessor methods for position and moving direction • Paint()//this method will actually draw the graphics

  23. PieceBall Class • PieceBall: piece ball appears after the target ball is hit by my ball. When the target ball is hit, the piece ball will breaks into two piece balls. Both piece balls’ directions are defined by the moving direction of my ball. • PieceBall()//constructor for my ball • Accessor methods for position and moving direction • Paint()//this method will actually draw the graphics

  24. Algorithm Collisions between target balls and my ball: • Depending on the direction of my ball, the direction of piece ball will be set. Even number indexed object in array of piece ball’s direction will be set to the 45 degree left of direction of my ball and odd number indexed object in array piece ball’s direction is set to the 45 degree right of direction of my ball.

  25. Algorithm Score: • The score is 100 for one ball. There is a bonus for the number of the moving ball at the same time. Although there is no stages in the game, the player have to choose their own play level. Ether the player takes risk and have chance to get higher point or remove balls safely with lower scores. Below formula calculate the points, and the “point” parameter represents the number of currently moving ball and that number times 200 for bonus addition to 100. point--; score=score+100+point*200;

  26. Future Work • The project is a simple program but it includes basic processes to develop typical applications. So, the future work will be extending this project or making new applications such as a scheduler for mobile devices by using the knowledge that came from the first step experience.

  27. Learned • Most of the time for the project had spent on starting the project. One of the most difficult parts was to learn about the technology and to setup new development environment. If a developer knows about the technology and already has environment to develop, then the effort that the developer takes can be reduced dramatically. • One of the success of the project is that the opportunity to know new technology

  28. Thank you

More Related