3 Replies Latest reply: Jul 6, 2010 4:41 PM by 843853

# Target position prediction

Hi all,

I am currently working on a simple Java game and was looking for some help regarding position / route prediction of targets. Every target consists of a current position (latitude / longitude), a course, a heading and a position history (ie a list of past positions). My maths are terrible and it's my first time at this, so I basically copied the IBM robocode tutorials on target prediction, which basically is:
`````` futureLongitude = currentLong + speed * time * sin(course)
futureLatitude = currentLat + speed * time * cos(course)``````
Now, I was wondering whether people could suggest any algorithms / resources that could help me improve such prediction (for example, take into account future change in heading / bearing, past positions, uncertainty etc). I saw that some games (including robocode) use a radar style approach, whereby a target's future position is visualized as a cone moving out from the target. That is, further ahead in time that we want to predict the target's position, the more "uncertain" this prediction becomes, eventually
forming a type of cone.

Any thoughts (outside of googling?) or ideas? Are there any good Java APIs out there that achieve this?

Thanks for your time,
• ###### 1. Re: Target position prediction
arawen2007 wrote:
My maths are terrible...
With this as part of your design criteria, the very best thing that I can tell you is to go back and LEARN MATH or you are going to find yourself continually in the same prediciment that you are in now--not able to do what you want without the significant help of others to do what you don't understand. You cannot be a decent programmer or game developer without MATH SKILLS.
• ###### 2. Re: Target position prediction
Ok, other than that, would you have any recommendations regarding the issue?
• ###### 3. Re: Target position prediction
You're not going to understand, most of what you ask is rooted in Math, and as such, is going to very quickly (like istantly) zoom over your head. I make that assumption since you cannot work with basic trig to plot coordinates if given an angle.