.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Raging Tiger- Save $9.00
winSPMBT: Main Battle Tank- Save $5.00

   







Go Back   .com.unity Forums > Shrapnel Community > Space Empires: IV & V

Reply
 
Thread Tools Display Modes
  #1  
Old August 16th, 2007, 09:12 PM
narf poit chez BOOM's Avatar

narf poit chez BOOM narf poit chez BOOM is offline
Shrapnel Fanatic
 
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
narf poit chez BOOM is on a distinguished road
Default Re: OT: Looking for a good physics site

Also, I just want the enemy ship to hit the target ship - Missile interception. I can probably manage to work out how to match velocities from that.
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
Reply With Quote
  #2  
Old August 16th, 2007, 10:11 PM
Suicide Junkie's Avatar
Suicide Junkie Suicide Junkie is offline
Shrapnel Fanatic
 
Join Date: Feb 2001
Location: Waterloo, Ontario, Canada
Posts: 11,451
Thanks: 1
Thanked 4 Times in 4 Posts
Suicide Junkie is on a distinguished road
Default Re: OT: Looking for a good physics site

Wasn't that where you were having all the problems before?
Reversing thrust at half way causing all kinds of grief?
Reply With Quote
  #3  
Old August 16th, 2007, 10:26 PM
narf poit chez BOOM's Avatar

narf poit chez BOOM narf poit chez BOOM is offline
Shrapnel Fanatic
 
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
narf poit chez BOOM is on a distinguished road
Default Re: OT: Looking for a good physics site

I've gone through a number of calculations. None of them worked completely. The closest I got was an angle calculation that works for velocity only.

I have never gotten any kind of interception that works perfectly for velocity, acceleration and position, either missile interception or matching interception.

And by 'perfectly', I mean, 'Intercepts, in a straight line, a target moving in a straight line'.
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
Reply With Quote
  #4  
Old August 16th, 2007, 11:54 PM
Jack Simth's Avatar

Jack Simth Jack Simth is offline
Major General
 
Join Date: Oct 2002
Posts: 2,174
Thanks: 0
Thanked 0 Times in 0 Posts
Jack Simth is on a distinguished road
Default Re: OT: Looking for a good physics site

That's not physics, that's math (mind you, Physics IS math, but nowhere are you actually needing to deal with things like, oh, gravity - you're just looking at acceleration).

A position under constant acceleration vs. time for a given axis has an equation that can be formatted as:

P(T)=(1/2)A(T^2)+VT+S

P(T): Position at time T (the function)
T: Time (the only variable)
A: Acceleration (a constant for this exercise)
V: Initial Velocity (at T = 0; a constant)
S: Starting position (P(0); a constant)

You're looking to calculate an intercept - well, you've got a lot to worry about, but basically, you're looking for a way to get two different position functions at the same point at the same time:

So basically, you have P1(T) = P2(T), and want T and A (do I need to reword that?).

As each object has a different starting position (otherwise, T=0 always works; this is the definition of interception), Acceleration, and initial velocity are likely to be different; you're looking to solve:

(1/2)A(T^2)+V T+S = (1/2)A(T^2)+V T+S

Do note that your intercepting ship can potentially control it's acceleration. Well, let's start manipulating:

(1/2)A(T^2)+V T+S = (1/2)A(T^2)+V T+S

(1/2)(A - A)(T^2)+(V - V)T+(S- S) = 0

Oh, hey - we now have a quadratic equation; sub (1/2)(A - A) with a, (V - V) with b, and (S- S) with c, and T with x. The Quadratic formula will do the job:

x = (-b +/- sqrt(b^2 - 4ac))/(2a)

Note: a is a variable, as the interceptor will need to choose it. You've got a variable on both sides - but that's okay, as you'll want at least two dimensions, and you've got a separate equation for each dimension; you'll end up with a system of equations (one for each dimension) and some relationship between the a on the various axes (usually the Pythagorean therom).

Edit:
That is, of course, assuming you don't want to stop at the end, other than ramming the target....
__________________
Of course, by the time I finish this post, it will already be obsolete. C'est la vie.
Reply With Quote
  #5  
Old August 17th, 2007, 01:10 AM
narf poit chez BOOM's Avatar

narf poit chez BOOM narf poit chez BOOM is offline
Shrapnel Fanatic
 
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
narf poit chez BOOM is on a distinguished road
Default Re: OT: Looking for a good physics site

Tankee! Tankee very much!

...But, um, if the enemy acceleration needs to be chosen to use the formula and the formula tells it in which direction to accelerate and thus, how much to accelerate...

...Isn't that a closed loop?

/me goes off to see what happens if /me uses that by inputing '0' for the enemy acceleration.

...Uh, the first one is the pursuer, right?

...'+/-'?
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
Reply With Quote
  #6  
Old August 17th, 2007, 02:21 AM
Fyron's Avatar

Fyron Fyron is offline
Shrapnel Fanatic
 
Join Date: Jul 2001
Location: Southern CA, USA
Posts: 18,394
Thanks: 0
Thanked 12 Times in 10 Posts
Fyron is an unknown quantity at this point
Default Re: OT: Looking for a good physics site

Aren't those pretty much the equations we came up with last time, Narf? I think we used a slightly different form of acceleration equation, but it amounts to the same thing.
__________________
It's not whether you win or lose that counts: it's how much pain you inflict along the way.
--- SpaceEmpires.net --- RSS --- SEnet ModWorks --- SEIV Modding 101 Tutorial
--- Join us in the #SpaceEmpires IRC channel on the Freenode IRC network.
--- Due to restrictively low sig limits, you must visit this link to view the rest of my signature.
Reply With Quote
  #7  
Old August 17th, 2007, 02:26 AM
narf poit chez BOOM's Avatar

narf poit chez BOOM narf poit chez BOOM is offline
Shrapnel Fanatic
 
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
narf poit chez BOOM is on a distinguished road
Default Re: OT: Looking for a good physics site

There's a resemblance, but I'm pretty sure there was no distance, 4ac or 4a.

In any case, something about my implementation is off, possibly having something to do with the questions I asked.
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
Reply With Quote
  #8  
Old August 17th, 2007, 02:29 AM
Jack Simth's Avatar

Jack Simth Jack Simth is offline
Major General
 
Join Date: Oct 2002
Posts: 2,174
Thanks: 0
Thanked 0 Times in 0 Posts
Jack Simth is on a distinguished road
Default Re: OT: Looking for a good physics site

Quote:
narf poit chez BOOM said:
Tankee! Tankee very much!

...But, um, if the enemy acceleration needs to be chosen to use the formula and the formula tells it in which direction to accelerate and thus, how much to accelerate...

...Isn't that a closed loop?

Nope. You have a second, identical equation for the other dimension (or more - it's extendable to as many as you like; most games will use two (X, Y), some will use three (X, Y, Z) but you can have 30 if you feel like it), and you'll have a relationship between the two based on the overall max acceleration for the pursuer (based on the pythagorean therom; max acceleration = sqrt(a(x)^2 + a(y)^2 + a(z)^2 + ... ) and the persuer is picking an acceleration in the x, y, z, ... axises (axen? axes? - what's the plural of axis?); you'll end up with a system of equations, based on how much you're simulating.

It's simultaneous equations. If you've got four variables and three equations that relate them, you can usually solve for everything in terms of a single variable.
Quote:
narf poit chez BOOM said:

/me goes off to see what happens if /me uses that by inputing '0' for the enemy acceleration.

...Uh, the first one is the pursuer, right?

Whichever you'd prefer; the exact choice is completely immaterial. Math's like that, sometimes.
Quote:
narf poit chez BOOM said:

...'+/-'?
The Quadratic formula gives two results. One will usually give you negative time, which you discard. Occasionally it will come back with an imaginary number (by way of the square root of a negative) - in which case, interception is not possible.

Oh, and there's a REASON most games use flat velocities, rather than accelerations.

The simple way to do it, if you're going a little bit at a time anyway, is to simply accelerate in the direction of the target. The computer will have some overshooting issues, and it won't be the most efficient course, but it'll do the job eventually.
__________________
Of course, by the time I finish this post, it will already be obsolete. C'est la vie.
Reply With Quote
  #9  
Old August 17th, 2007, 02:36 AM
Fyron's Avatar

Fyron Fyron is offline
Shrapnel Fanatic
 
Join Date: Jul 2001
Location: Southern CA, USA
Posts: 18,394
Thanks: 0
Thanked 12 Times in 10 Posts
Fyron is an unknown quantity at this point
Default Re: OT: Looking for a good physics site

Quote:
Jack Simth said:
what's the plural of axis?
"axes," pronounced like "ax'eees."
__________________
It's not whether you win or lose that counts: it's how much pain you inflict along the way.
--- SpaceEmpires.net --- RSS --- SEnet ModWorks --- SEIV Modding 101 Tutorial
--- Join us in the #SpaceEmpires IRC channel on the Freenode IRC network.
--- Due to restrictively low sig limits, you must visit this link to view the rest of my signature.
Reply With Quote
  #10  
Old August 17th, 2007, 02:50 AM
narf poit chez BOOM's Avatar

narf poit chez BOOM narf poit chez BOOM is offline
Shrapnel Fanatic
 
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
narf poit chez BOOM is on a distinguished road
Default Re: OT: Looking for a good physics site

Nope. You have a second, identical equation for the other dimension (or more - it's extendable to as many as you like; most games will use two (X, Y), some will use three (X, Y, Z) but you can have 30 if you feel like it), and you'll have a relationship between the two based on the overall max acceleration for the pursuer (based on the pythagorean therom; max acceleration = sqrt(a(x)^2 + a(y)^2 + a(z)^2 + ... ) and the persuer is picking an acceleration in the x, y, z, ... axises (axen? axes? - what's the plural of axis?); you'll end up with a system of equations, based on how much you're simulating.

Er, yes, I'm currently using it for two axis. Three would probably result in a significantly smaller consumer base. Four would limit it to only the seriously dedicated, which does not include me, in both desire and ability.

I do know that equation. My problem is the whole 'Pursuer picking an acceleration' thing. See, the equation helps pick the pursuers' acceleration and the pursuers' acceleration is part of the equation...

Um, there must be something obvious I'm not seeing. Possibly it's in the communication.

It's simultaneous equations. If you've got four variables and three equations that relate them, you can usually solve for everything in terms of a single variable.

I get the general concept. However, my math skills are abysmal. I still carry a grudge with the school system here over that; they were near-genius level before I entered it. (I have a psychiatric assesment to prove it, too).

I am trying to raise my math skills. I have learnt a few things bashing my head against this.

Whichever you'd prefer; the exact choice is completely immaterial. Math's like that, sometimes.

Er, do you mean I can put '0' for the pursuers' acceleration or I can use either for the pursuer or both? Because I can see the second, but I'm not sure about the first.

The Quadratic formula gives two results. One will usually give you negative time, which you discard. Occasionally it will come back with an imaginary number (by way of the square root of a negative) - in which case, interception is not possible.

The negative time would explain the enemy ship accelerating south if it's headed south and sufficiently southward of the target.
If the result is not a number or infinity, it is discarded.

So, uh, how do I make sure the formula is giving me a good result?

Oh, and there's a REASON most games use flat velocities, rather than accelerations.

My left brain is perfectionist, precise and thorough. I believe you are all sufficiently aquanted with my right brain...

...Besides, one of the main features of this game will be multiple FTL and STL systems.

The simple way to do it, if you're going a little bit at a time anyway, is to simply accelerate in the direction of the target. The computer will have some overshooting issues, and it won't be the most efficient course, but it'll do the job eventually.

That would be a whole lot easier. But my brain has consistantly discarded that option in favour of the better (In the end) result.

Although it is getting tempting.

Ok, my brain is seriously fried and it's rather late. I'll look at this again tomorrow.
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 02:36 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.