View topic - How to make a ballistic weapon arc just a little



All times are UTC + 1 hour


Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: 21 Aug 2011, 11:18 
User avatar

Joined: 20 Aug 2009, 19:49
Hijacking: How to make a ballistic weapon arc just a little, i only saw the "hightrajectory" tag (which has a ridiculus arc height)?


Top
 Offline Profile  
 
PostPosted: 21 Aug 2011, 15:25 
Moderator
User avatar

Joined: 23 Nov 2005, 06:16
Location: Dunedin, New Zealand
Don't hijack threads. You're allowed to make your own.


Top
 Offline Profile  
 
PostPosted: 21 Aug 2011, 16:50 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
Play around with gravityAffected = true and various myGravity = x settings, as well as the velocity of the weapon.


Top
 Offline Profile  
 
PostPosted: 21 Aug 2011, 17:36 
Moderator

Joined: 12 Oct 2007, 08:24
For a Cannon make the weaponVelocity high or myGravity low.


Top
 Offline Profile  
 
PostPosted: 22 Aug 2011, 02:11 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
Location: Raegquitting Spring on 04/24/12
Google_Frog wrote:
For a Cannon make the weaponVelocity low or myGravity high.


Fixed :-)


Top
 Offline Profile  
 
PostPosted: 22 Aug 2011, 02:25 
Moderator

Joined: 12 Oct 2007, 08:24
From my understanding he wants it to arc "just a little" not a lot, as in a mostly flat trajectory. Your fixes are wrong forb.


Top
 Offline Profile  
 
PostPosted: 22 Aug 2011, 09:19 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
Location: Raegquitting Spring on 04/24/12
If your ballistic shot is so fast that the trajectory is flat, you slow down the projectile and it will start being fired in an arc. OR You increase gravity on the projectile so that the unit must aim higher to get more distance. My fixes are very right.


Top
 Offline Profile  
 
PostPosted: 22 Aug 2011, 10:58 
User avatar

Joined: 20 Aug 2009, 19:49
a problem i encountered with this is that the procetile isn't fired at the maximum range and also has problems with targeting higher terrain.

What i want would be: behaviour similar to "hightrajectory" aka fire in the air with at least 45 degrees angular but without the shot going to the moon and back.
Perhaps the missile weapontype is more usefull for that?


Top
 Offline Profile  
 
PostPosted: 22 Aug 2011, 11:50 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
Erik wrote:
Perhaps the missile weapontype is more usefull for that?
imo yes, it has the TrajectoryHeight tag.
ie TrajectoryHeight = 2.5
->arc is 2.5 times as high as long
usually needs turnrate to hit though.


Top
 Offline Profile  
 
PostPosted: 22 Aug 2011, 18:58 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
Location: Raegquitting Spring on 04/24/12
Yeah knorke is right. Achieving that kind of angle and still getting maximum range on a cannon weapontype is very difficult if not outright impossible. In this way, missiles are a lot easier to get along with.


Top
 Offline Profile  
 
PostPosted: 23 Aug 2011, 07:16 
Moderator

Joined: 12 Oct 2007, 08:24
Forboding Angel wrote:
If your ballistic shot is so fast that the trajectory is flat, you slow down the projectile and it will start being fired in an arc. OR You increase gravity on the projectile so that the unit must aim higher to get more distance. My fixes are very right.
This appears to be a misunderstanding stemming from the colloquial phrase 'just a little'. I interpret it that he wants a reduction of value; 'just a little, not a lot'. Whereas you interpreted it as 'just a little more than the current nothing'.

Using a missile is not a good solution. A missile will not look like a ballistic projectile, the arc and velocity is not quite the same, it doesn't gain or lose ranged based on height in the same way (I know this one can be modified, but it wouldn't look balistic).

A 45 degree firing is easy but a bit tedious. Set myGravity on the weapon to something around 0.1-0.2 depending on weaponVelocity and range. Here is an example:
  • range = 820
  • weaponVelocity = 300
  • myGravity = 0.11
Those are some values to give you a sense of scale, if weaponVelocity is higher or range lower you can set myGravity higher.

Then execute this algorithm:
Code:
While (not fedUp)

    if actualRange < range then
         decrease myGravity

    if angle < 45 degrees then
         increase myGravity

    restart Spring
end while
actualRange can be measured by spawning a unit in the top left corner of the man and checking the position of the range ring. Check the tooltip for position numbers, they have the same units as range.

angle can be measured by 'eyeing-off' the projectile as your unit fires, scroll down to look at it side on.


Top
 Offline Profile  
 
PostPosted: 23 Aug 2011, 07:54 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
Location: Raegquitting Spring on 04/24/12
45 degrees isn't just a little. It's quite a bit. But as I originally stated. You would achieve it by increasing gravity or decreasing velocity.

Google, I dunno when the last time you messed with ballistic projectiles was, but the synopsis is this: Lower velocity = more arc (come on, this just makes sense... When you are throwing a baseball as far as you can you don't throw it flat, you arc it so you get more distance, it works the same way in spring).

Increasing gravity is similar to lowering velocity (in effect, you actually are lowering velocity... in a way). But that's all retarded theory of BS bla bla. If you want a faster projectile, then increase velocity and gravity and you will have your arc with a fast moving projectile. The inverse applies, etc etc.


Top
 Offline Profile  
 
PostPosted: 23 Aug 2011, 12:08 
Moderator

Joined: 12 Oct 2007, 08:24
Google_Frog wrote:
Forboding Angel wrote:
If your ballistic shot is so fast that the trajectory is flat, you slow down the projectile and it will start being fired in an arc. OR You increase gravity on the projectile so that the unit must aim higher to get more distance. My fixes are very right.
This appears to be a misunderstanding stemming from the colloquial phrase 'just a little'. I interpret it that he wants a reduction of value; 'just a little, not a lot'. Whereas you interpreted it as 'just a little more than the current nothing'.


Top
 Offline Profile  
 
PostPosted: 23 Aug 2011, 14:00 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
Getting ballistic weapons to fire exactly (well, so long as map gravity is ~120) at 45 degrees at their maximum range is easy btw.

Code:
local GRAVITY = 120

for weapName in pairs(WeaponDefs) do
   if WeaponDefs[weapName].customparams then
      if WeaponDefs[weapName].customparams.howitzer then
         WeaponDefs[weapName].weaponvelocity = math.sqrt(WeaponDefs[weapName].range * GRAVITY)
      end
   end
end


Top
 Offline Profile  
 
PostPosted: 23 Aug 2011, 14:20 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
FLOZi wrote:
GRAVITY = 120
Game.gravity?
or does that not work in _post file?

missile/ballistic depends on what you need.
if you just want a slight arc so that tanks can fire over each other when in close formation, I found missiles easier to use.


Top
 Offline Profile  
 
PostPosted: 23 Aug 2011, 14:31 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
knorke wrote:
FLOZi wrote:
GRAVITY = 120
Game.gravity?
or does that not work in _post file?.


Bingo, not available at defs loading stage.


Top
 Offline Profile  
 
PostPosted: 23 Aug 2011, 17:52 
Game Developer
User avatar

Joined: 25 Jun 2006, 07:44
Location: Germany
Just force it with myGravity, keeps maps from fucking with your balancing.

Anyway, cannons in Spring are simulated according to physics and since the bullets are fired at a fixed speed the angle varies according to the target distance. If you want a hightrajectory shot to stay low then slow the projectile down. If that decreases the range then you are asking the impossible from your gun, that it shoots a bullet further than physically possible given the velocity it's fired at. Many games cheat and vary gravity or something to make their shots arc at 45┬░ at any range but Spring isn't designed for that nonsense.


Top
 Offline Profile  
 
PostPosted: 30 Aug 2011, 16:52 
Zero-K Developer
User avatar

Joined: 14 Mar 2007, 03:44
Location: Fillydelphia
Old page by Evil4Zerggin, dunno if it's still accurate.

Quote:
Weaponvelocity and Range
If a weapon with a ballistic trajectory does not have enough weaponvelocity, it will not be able to hit its listed range.

To hit a target at the same level as the firer, the required weaponvelocity is given as follows:

v >= sqrt(gR)

where v is the weaponvelocity, R is the desired maximum range, and g is the map gravity. If the target is directly above the firer, this becomes

v >= sqrt(2gR)

Map gravity rarely exceeds 150 or so, and most firing points are elevated above surface level, so 150 is generally a good minimum value to use for g.

Weaponvelocity and Firing Angle

More generally speaking, if the firing angle is a, the angle needed to hit a target at the same level as the firer is given by

a = arcsin(gr/v^2)/2

where r is the distance to the target. From this, the following will cause the firing angle to differ more from 45 degrees:
  • Low map gravity.
  • A close target.
  • High weaponvelocity.


Top
 Offline Profile  
 
PostPosted: 16 Feb 2012, 09:36 
User avatar

Joined: 16 Feb 2012, 09:19
Location: SEA
KDR_11k wrote:
Just force it with myGravity, keeps maps from fucking with your balancing.

Anyway, cannons in Spring are simulated according to physics and since the bullets are fired at a fixed speed the angle varies according to the target distance. If you want a hightrajectory shot to stay low then slow the projectile down. If that decreases the range then you are asking the impossible from your gun, that it shoots a bullet further than physically possible given the velocity it's fired at. Many games cheat and vary gravity or something to make their shots arc at 45┬░ at any range but Spring isn't designed for that nonsense.

Nicely done.
In second thought, if a high powered ballistic weapon fired at its maximum or limit distance that would probably do a curve trajectory on it bullet,right?


Vindicator wrote:
Field target cross bows are usually hand-made, often home-made by their users.


Last edited by SirDario on 21 Feb 2012, 08:53, edited 1 time in total.

Top
 Offline Profile  
 
PostPosted: 16 Feb 2012, 09:42 
Moderator

Joined: 12 Oct 2007, 08:24
Idk exactly what you mean so I'll just say a few broad things. Some may be relevant.

A weapon cannot shoot further than it's range. The physical properties (velocity, gravity etc...) have no effect on this fact.

More distance fired = greater fire pitch. Weapon velocity is unchanged, pitch is used to aim between distances.

Projectiles with gravity always curve.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.