Diapositiva 1 - An-Najah National University

advertisement
Software Graduation Project
Bundle Of Android Games
Faculty of Engineering
An-Najah National university
Component of Computer Course
Outline
•
•
•
•
•
•
Introduction
Background Theory
Methods & Techniques
The Software
AndEngine
Physics AndEngine Box-2d
Project Idea
Bundle OF “Android Games”
Based on
Box-2d Physics Engine
Why Android Games ??!
Main motivations:
Games are the killer applications for
Smartphone’s today.
mobile games very profitable business.
Open Source.
Methodology
Corona SDK
BUT
the money problem in this library
Methodology
COCOS-2D
BUT
Mainly used in iOS, we didn’t find
much information
Methodology
AndEngine
o 2D Games Engine.
o Developed by “Nicolas Gramlich”.
o We could write our own functions in
Java, using the Android APIs to
implement the components of a
game.
http://www.andengine.org/
Why AndEngine ??
Free, No money.
Support Physics Engine (Box-2d
Extensions).
Support Multiple Touch Extensions.
Support multiple Android SDK’s.
BUT
• There is two versions from AndEngine
1.GLES 1
2.GLES 2
And a lot of JAR files are found, but not
all of them compatible with “AndEngine
Physics Box 2D Extensions” and the
Android SDK version.
How to start ??
•
•
•
•
•
•
Classic Eclipse
Android SDK
Android SDK Tools
ADT Plugins for Eclipse
Oracle/Sun Java Development Kit ( JDK).
AndEngine .JAR files & Physics Box-2D
Extensions.
Problems during coding
• We were not Familiar with android.
• Many problems with Eclips and Emulator
(stop Warking, delete the program and it
take long time to start  ).
AndEngine Game Concepts
Texture
Camera
Base Game
Activity
Texture
Region
Scene
Menus
Sprite
Entity
Physics Engine
• collection of effects that mimic the physics
of the real world.
• simulates the physics of objects to give
them believable real-life movement.
• Box2D is written in C++, but has been
ported to many different languages by the
user community.
Why Physics???
1- It is used to realistically simulate the
interaction of physical objects in the following:
 Simulation of the physics of rigid bodies
 Stable stacking
 Gravity
2- We generally won’t need physics if we
are developing a bored game.
Box2d Physics Engine
Units
Rigid
Body
World
Shape
Sensor
Setting up Box2D
The pattern for building a physics world and
starting the simulation includes the following
steps:
1. Create a PhysicsWorld
2. Create the static objects in the simulation, which
might include a floor, some walls.
3. Attach the shapes to the AndEngine Scene so
they will be displayed.
Cont,
4. Connect the Sprites to the Physics with
PhysicsConnectors.
5. Register the Box2D PhysicsWorld as an
UpdateHandler for our Scene, so it can
update Sprite positions.
After a month and a half
Game Components
Opening (Splash)
Screen
Menu Screen
Scene
Music
Time
Levels
Obstacles
Games Ideas
It’s very difficult to predict which
games will be hits, but a quick
scan of Android Market shows
that hundreds of thousands of
users have downloaded certain
games.
So, What ???
• When we think of Game, We need it :
1.
2.
3.
4.
Funny
Profitable
Used Physics in it.
Scalable.
So, We decide to build
1- Bubble Shooter
• Game Idea
fire a bubble and try to hit at least two
touching bubbles of the same color to
burst them.
3 Worlds (Levels)
Another Scene
GameOver
Problems
• Problem 1: direction of the ball released.
• Solution:
1. We have traced the equations of motion to determine
the right direction
2. take the initial place of ball and take the position of
mouse where it touched the screen of the emulator
then and according to this coordination we give the
ball linear velocity.
Problems
• Problem 2: Color detection of bubbles that
should be burst after shooting the ball.
• Solution :
This problem not resolved 100%
Another Problems
• Descent of bubbles for a specific distance
and a certain period of time.
• Detect the scene if empty to go to win
page.
2- Shoot Game
Game Idea
 It is based on the principle straighten the ball on the
goal and dropping it, like famous Angry Birds game.
 To play this game you have to pull the ball strongly by
certain distance that you want to reach and the angle at
which you will throw out.
 If you drop all the targets will pass the stage, you can try
3 times
3 Levels
Problems
• Main problem
How to shoot the projectile in the correct
direction with correct angle based on
amount of tensile played by the player and
also the direction in which he wants during
the checkout process.
Solution
We need to do equations, and these
equations based on the initial position and
the final one when we pull the ball on the
scene.
- Action Move
- Action Up
3-Billiard Game
• Game Idea
focus a stick on a white ball in a specific
angle to shoot the ball in a given force that
chosen by user then this ball will collides
with the other colored balls.
Level 1
Level 2
FOUL
Problems
• Problem 1
How do we make the stick move by the
movement of the finger remains constant
head toward the white ball ??!
• Solution :
“RevoluteJoint” it takes two bodies and a
connection line between them, the first
body will rotate around the second body
and the two ends of the connection line
attached to the centers of these two
bodies.
• Problem 2
The detection if a ball is matched a hole in
order to drop it and delete it from balls
• Solution :
We use hidden bodies in the holes and
detect collisions.
• Problem 3
When we need to shoot the ball after the first
time, we need to detect if it’s velocity = 0, to reshoot it another time, so we need to recreate the
connection line (stick) near the white ball.
• Solution :
We change the ball body :
1. AngularDamping
2. LinearDamping
3. Torque
• Then we estimate the time based on this
setting values.
• Problem 4
We need to detect that the last ball is
black, so every shoot we check the balls
color dropped in the holes.
• Solution :
We make a sensor to detect that and
count the remains balls.
4- AndEngine & Box2d Simple
application
It is a simple application that contains of
some features of Box2d integrated with
AndEngine to show the effect of physics
engine on a certain bodies.
snapshots
Accelometer
Animations
Mass
Pendulum
Features
 User friendly: games can be played by
any user easily and it is suitable for all
ages
Availability: games are available any time.
Any time users like to play he installs it
from Play store.
Features
Portable and Platform: there are able to
run on any device use android operating
system like series of Samsung, HTC, LG
phones.
Future Work
• In future we can develop these games to
have more features and function.
• Adding more levels and more work on GUI
and Could become in the future global
games.
Testing
• For testing games we firstly use android
Emulator but this was inefficient, So we
had to install the driver for Samsung
Galaxy S2 and use it for
debugging and testing.
DEMO
Finally.
THANK YOU
Download