File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Game Development and the fly likes Game Physics for J2ME Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "Game Physics for J2ME" Watch "Game Physics for J2ME" New topic
Author

Game Physics for J2ME

Krisp Sigh
Greenhorn

Joined: May 11, 2006
Posts: 9
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
Charles Lyons
Author
Ranch Hand

Joined: Mar 27, 2003
Posts: 836
Looking for the relevant physics that can be implemented in J2ME.
or links to some good articles on web.
I'm not totally clear what you're asking... is it the mathematics you're looking for, or help with the actual programming?

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?


Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )
Renato Losio
Ranch Hand

Joined: Nov 23, 2005
Posts: 99
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

Joined: May 11, 2006
Posts: 9
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 ]
Krisp Sigh
Greenhorn

Joined: May 11, 2006
Posts: 9
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Game Physics for J2ME