# Game Physics for J2ME

Krisp Sigh

Greenhorn

Posts: 9

posted 10 years ago

Hi,

Am Implementing a sky shooter game in J2ME.

I want to implement Projectile motion for the bulletes.

And bulletes Moving out at a tangent from a rotating Shooter.

Looking for the relevant physics that can be implemented in J2ME.

or links to some good articles on web.

Thanx,

Regards

Krisp

Am Implementing a sky shooter game in J2ME.

I want to implement Projectile motion for the bulletes.

And bulletes Moving out at a tangent from a rotating Shooter.

Looking for the relevant physics that can be implemented in J2ME.

or links to some good articles on web.

Thanx,

Regards

Krisp

Charles Lyons

Author

Ranch Hand

Ranch Hand

Posts: 836

posted 9 years ago

Is this is a 2D or 3D game (I'm unfamiliar with J2ME, so I don't know what it supports; I'm guessing it's 2D only)?

How do the bullets move, on an (x,y) coordinate system, or in an (x,y,z) system projected down into two dimensions on the screen? What is the viewing angle like?

These are all decisions which you need to make before looking at the dynamics of the problem... After that, if it's the mathematics you're unfamiliar with, you would need to decide on the approximations you're prepared to make. Given it's a small device, I would suggest a search for "kinematics" would turn up several articals which would approximate the motion of the bullet readily enough (of course, if the bullet is travelling very fast horizontally, and the target is quite close, gravitational effects are minimal and you might as well model it as a straight line trajectory).

If you want to make the model more realistic, you would need to factor in air resistance, but then you've got a differential equation on your hands to solve (which can be done analytically for some resistance types, but requires a numerical approximation for others). This is probably unnecessary for your requirements.

So can you be more specific about your requirements, how the game works and what level of accuracy you'll settle for?

I'm not totally clear what you're asking... is it the mathematics you're looking for, or help with the actual programming?Looking for the relevant physics that can be implemented in J2ME.

or links to some good articles on web.

Is this is a 2D or 3D game (I'm unfamiliar with J2ME, so I don't know what it supports; I'm guessing it's 2D only)?

How do the bullets move, on an (x,y) coordinate system, or in an (x,y,z) system projected down into two dimensions on the screen? What is the viewing angle like?

These are all decisions which you need to make before looking at the dynamics of the problem... After that, if it's the mathematics you're unfamiliar with, you would need to decide on the approximations you're prepared to make. Given it's a small device, I would suggest a search for "kinematics" would turn up several articals which would approximate the motion of the bullet readily enough (of course, if the bullet is travelling very fast horizontally, and the target is quite close, gravitational effects are minimal and you might as well model it as a straight line trajectory).

If you want to make the model more realistic, you would need to factor in air resistance, but then you've got a differential equation on your hands to solve (which can be done analytically for some resistance types, but requires a numerical approximation for others). This is probably unnecessary for your requirements.

So can you be more specific about your requirements, how the game works and what level of accuracy you'll settle for?

Renato Losio

Ranch Hand

Posts: 99

posted 9 years ago

There are two good books out there, J2Me Game Programming by Martin J Wells and Physics for Game Programmers by Grant Palmer. Check on http://books.google.com if the classic bullet example is there and (maybe you are very lucky!) those pages are there in the archive...

Renato Losio - www.arsenio.it - renatoweb@arsenio.it

Krisp Sigh

Greenhorn

Posts: 9

posted 9 years ago

Hi Charles,

Thanks for the reply.

yes its the mathematics am not clear with and what formulas to apply for the game.

And actually the design of my project is changed and so am working on a different module all together.

am working on a 2d game sorry dint made it clear in my post.

Actually we cannot use floating points in J2ME so we need to work on Fixed point maths.

And we can use sin and cos by using lookup tables.

with help of these we can implement the circular motion required.

thanks

Regards

Krisp

[ June 14, 2006: Message edited by: Krisp Sigh ]

Thanks for the reply.

yes its the mathematics am not clear with and what formulas to apply for the game.

And actually the design of my project is changed and so am working on a different module all together.

am working on a 2d game sorry dint made it clear in my post.

Actually we cannot use floating points in J2ME so we need to work on Fixed point maths.

And we can use sin and cos by using lookup tables.

with help of these we can implement the circular motion required.

thanks

Regards

Krisp

[ June 14, 2006: Message edited by: Krisp Sigh ]

Krisp Sigh

Greenhorn

Posts: 9

posted 9 years ago

Hi Renato,

Thanks for the reply i did managed to find the book "J2Me Game Programming by Martin J Wells"

it has a section "Moving at an Angle" which answer to the problem i was facing. thanks for this.

I was not able to find the other book "Physics for Game Programmers by Grant Palmer" but will surely try for it.

thanks

regards

krisp

Thanks for the reply i did managed to find the book "J2Me Game Programming by Martin J Wells"

it has a section "Moving at an Angle" which answer to the problem i was facing. thanks for this.

I was not able to find the other book "Physics for Game Programmers by Grant Palmer" but will surely try for it.

thanks

regards

krisp