Project page

BallJump 3D, a 3D time attack game for Android


Looks like I'm heavily backing Android nowadays. After the success of Chessmind3D (cough Cough !), I'm launching another game project on Android.

The idea is to capitalize on the Android 3D framework, that I have developed since Speedroid3D. Chessmind3D has convice me that impressive visual is one of the key to success for an app.

My inspiration this time is games like Monkey Ball, Neverball and a very old Hp48 game called "Babal". On Android casual gaming makes a great opportunity in reaching a large audience with reasonable development time.

I'm expecting to be able to release an initial version in less that 2 weeks from now. My first experience with Ad supported supported was ok so I think I will continue this way.

How to jump ?
http://hypertextbook.com/facts/2007/mariogravity.shtml
Achieving a good gameplay for the jump move is not an easy task, to a point where people are studying Super Mario's own implementation.

Fast ArcCosinus
ArcCosinus is a slow calculation especially for phones, approximation using Lagrange polynomial was invaluable to me.
 
double acos(double x) {
return (-0.69813170079773212 * x * x - 0.87266462599716477) * x + 1.5707963267948966;
}
 


Physics Engine
My Kivy project was a great step to introduce me to some physics calculation (collision detection and reaction), starting in 2D really helped me to understand the underlying maths better than I would have by starting from scratch in 3D.
Actually in Speedroid3D I did get away with limiting the problem to two dimension. This time I will stand my ground and resolve the problem completely.
This article was a good start:
http://www.flipcode.com/archives/Basic_Collision_Detection.shtml

I found the way to determine whether a point belongs to a polygon by summing up the inner angles very well thought even though I had to find the right tune of precision.

Devlog

04/03/2012
The game development is quite advanced by now, I already have some glimpse of the gameplay.
I'm not yet satisfied in anyway, although the physics being quite accurate I don't find the feeling of the ball I'm looking for.

Proper use of glOrtho for diplaying HUD in OpenGL. Since a long time I've used the wrong method for displaying text in OpenGL, I was display my text textured quads in game space coordinate, which is plain wrong : it got automatically resized and was showed ugly scaling artifact.

The right path for me: (OK the screen resolution is still written, I will fix that)
 
//Font rendering
mGl.glMatrixMode(GL11.GL_PROJECTION);
mGl.glPushMatrix();
mGl.glDisable(GL11.GL_DEPTH_TEST);
mGl.glMatrixMode(GL11.GL_PROJECTION);
mGl.glLoadIdentity();
 
mGl.glOrthof(0, 800, 480, 0, -1, 1);
mGl.glMatrixMode(GL11.GL_MODELVIEW);
mGl.glLoadIdentity();
this.mBmpFont.mGl = mGl;
this.mBmpFont.renderText();
 
mGl.glEnable(GL11.GL_DEPTH_TEST);
mGl.glMatrixMode(GL11.GL_PROJECTION);
mGl.glPopMatrix();        
 


08/03/2012

I was looking for tutorial about making fancy Text logo for BallJump3D.
found this: http://gimp-tutorials.net/node/91



09/03/2012

My current problem is about generating the level choice menu by reading available data in my asset and generating a button for each level (limited to about ten per page).
I will probably create a gridlayout to hold my structure.

10/03/2012

An important feature that I've overlooked in Android is that while UI element cannot be touched by anything but the main UI thread, there's of mean to send task job to the UI thread.

My game running thread can send a call to make the UI interface visible again when the game is over:
 
Sd3dRessourceManager.Manager.getActivity().runOnUiThread(new Runnable() {
public void run() {
Sd3dRessourceManager.Manager.getActivity().findViewById(R.id.layoutMainMenu).setVisibility(View.VISIBLE);
}
});
 


11/03/2012

Today, my goal is to fix and tune the gameplay to obtain something enjoyable to play.

12/03/2012

I'm very close to the final gameplay so that I can focus on creating levels for the game (I hope to reach the hundred figures).
To be able to play multiple level, I still have to add one hole in my engine: the ability to release allocated ressources.

13/03/2012

There's a 3 visual effects that I'd like to add :
* Moving clouds
* Lens flare
* Animated textures (and mesh)
I think that a good hi-score lib like Scoreloop could really bring something to this game. Maybe using one would be better than bringing my own in-house solution.

14/03/2012
=>Scoreloop added
Now working on my 3 fx.

About the lens flare effect:
1. Determine whether light source is within camera frustum view
2. Draw the lens flare along a line starting form the light source to the center of the screen.


http://devcry.heiho.net/2010/03/real-time-rendering-lens-flare.html
http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/lens-flare-tutorial-r813
http://nehe.gamedev.net/tutorial/3d_lens_flare_with_occlusion_testing/16007/
1. Can be done
* In 3D by projecting the light source to the screen space => Does not hand occlusion without further testing.
* by reading a framebuffer where the light source is written with a certain color component => Does handle occlusion, might be slow as the whole scene has to be rendered 1 time.

2. Should be simple but the textured quads could be rendered in 2D (orthogonal projection) or in 3D (need more math.)

Lens flare done !
Actually, I've started with 2. to validate the drawing of the flare, then I moved to 1., which was done entirely with the NEHE tutorial which work perfectly.
Still some things to fix, but overall it already look pretty decent.(Awesome would be the right word).
I did pass on the occlusion testing because it's not really important on my current scene configuration (very few possible occlusions).

17/03/2012

Engine close to completion.
* Clouds added (actually on the bottom, not on top as inteded on the first place)
* In-game menus completed
* Abitility to pause and resume play

=> Working now on my banner and icon, levels and gfx assets

18/03/2012

This time I didn't made my banner at the last minute:


I'm gradually becoming a Gimp expert, with a little bit of POV-RAY this time.

Here is the script for generating my red sphere:
 
#include "rad_def.inc"
 
global_settings{
     ambient_light rgb <1.000000, 1.000000, 1.000000>
}
background { rgb <0.300000, 0.300000, 0.300000> }
#declare camera_location = <-0.292298, 1.906861, 6.515391>;
camera{
     perspective
     location camera_location
     right (320 / 240) * x
     up y
     angle 57.822402
     sky <0.012571, 0.957571, -0.287922>
     look_at <-0.008490, -0.051367, 0.015104>
}
light_source {
     <5.402298, 7.906861, 7.509391>
     color rgb <1.000000, 1.000000, 1.000000>
     parallel
     point_at <0.000000, 0.000000, 0.000000>
}
#declare wm_default2 = texture{
     pigment{
         color rgbf <1.000000, 0.000000, 0.000000, 0.000000>
     }
 
     finish {
         #ambient rgb <0.200000, 0.200000, 0.200000>
#phong 1.0
         diffuse 0.900000
         #brilliance 1.000000
         #metallic 1.000000
         #specular 1.000000
         #roughness 0.010000
 
     }
}
sphere{< 0,0, 0>,1.0 texture{wm_default2}}
 


17/04/2012
I've been able to split the game logic and the 3d engine into two separated components.
The engine now support OpenGL ES 2.0 with the same level of functionnality provided by the OpenGL ES 1.1 renderer.
Performances of the new renderer are not even close to the former one, I have to know why.