height dependant range
Moderator: Moderators
height dependant range
towers and cannons and units and such should have height dependent ranges, so it would make it more strategic to place a gun turret on a tall hill.
Depends on the weapon, ballistics fly further I think but e.g. lasers obviously don't get a boost (and can disappear before reaching the target if the height difference is too big). Of course there's no logical reason for a laser to get more range from a higher location, all they get is less chance that terrain or features block their line of fire.
Im pretty sure that range functions on a cylinder capped with a sphere at the top.. could be wrong but it has always seemed to me that when a unit is up on a hill it can still fire out to its max range in the flat, even though looking at it in 3d you can see that it has actually surpassed its max range, this conveys a massive advantage to units up on high ground with a medium difference in height as they can essentially fire as though they were on perfectly flat ground, but they arent, where as units attack up the hill are acting as they they are firing up and thus are limited by their max range..
Part of the problem of units firing up and not hitting is that targetting code uses a cylinder, but actual projectile is limited by a sphere (at least by upper half of a sphere, I haven't tested firing down). This can be seen easily by giving an aircraft a high CruiseAlt (like 1000) and then flying it over some enemy ground units so they shoot at it. The units will shoot even if their max range is something like 500. They won't actually hit the plane (projectiles will exceed max range and disappear/fall back, depending on projectile type), but targetting code doesn't account for that.
You're using fancy words to say "the unit on the hill shoots farther". Did you realize between pulling out all these words like delta that that's not a counterargument as the unit on the hill can already shoot farther?MadRat wrote:It sounded like he wanted the actual delta between shooter and target in relationship to maximum range limits to be influenced by the height delta.
yuritch: Strange, I'm fairly sure units in Gundam won't shoot until the com is pretty much right above them and some can't even shoot that high (try flying gunperries over Zakus). However, the com will shoot back even at ranges twhere its shots just disappear. The projectile is always limited to a sphere (well, line of sight projectiles, ballistics are limited to a parable) but the aim is limited to a sphere only when aiming up, to a cylinder when aiming down. I.e. I second Fanger's observations.
- LathanStanley
- Posts: 1429
- Joined: 20 Jun 2005, 05:16
its conical on the lower end. The top end is is a semicircle.
make a map to test on, with a ramp and a flat distance on the other side (parallel to the ramp)
make the map small, and play with TAB view, direct down.
measure as the unit walks up the ramp.
its circle off the ramp ALWAYS gets bigger. thus, it meets a tangental line on the semicircle up top, and continues in a straight line down.
(the degree it is tangental at, I do not know.)
here is a graphic to show the info:

make a map to test on, with a ramp and a flat distance on the other side (parallel to the ramp)
make the map small, and play with TAB view, direct down.
measure as the unit walks up the ramp.
its circle off the ramp ALWAYS gets bigger. thus, it meets a tangental line on the semicircle up top, and continues in a straight line down.
(the degree it is tangental at, I do not know.)
here is a graphic to show the info:

My test was made witn Spring 0.74b3, maybe it's different in latest svn. The plane had CruiseAlt=1000, ground units had range=750, they constantly fired at the plane and no projectiles actually reached it. The weapon on those units was of non-beam laser type.KDR_11k wrote:yuritch: Strange, I'm fairly sure units in Gundam won't shoot until the com is pretty much right above them and some can't even shoot that high (try flying gunperries over Zakus). However, the com will shoot back even at ranges twhere its shots just disappear. The projectile is always limited to a sphere (well, line of sight projectiles, ballistics are limited to a parable) but the aim is limited to a sphere only when aiming up, to a cylinder when aiming down. I.e. I second Fanger's observations.
Thing with the Gundam com is probably that it's very large. AFAIK wepon ranges are calculated relative to target's center, so while a part of that flying fortress may be over a unit, its center is still out of range.
If you understood the fancy stuff then you'd of realized its different than what you believed it to be saying. If you don't understand the terminology you could ask me to explain. The terms are pretty standard in the phyics world and I can assume you didn't take any class on the subject matter. Whenever you see delta its a difference in relative measurement between two objects. The measurements could be most anything, but in this example its the difference in positions measured in all three dimensions. The original poster was in my opinion asking for units to be able to exploit their longer potential range if they enjoy a height advantage relative to the target. It is not just about shooting farther, its about being able to actually aim on those targets because it has that advantage. Otherwise you have to use a kludge like manually forced fire to get the desired result. So before you're a smart ass with someone try not to be ignorant.KDR_11k wrote:You're using fancy words to say "the unit on the hill shoots farther". Did you realize between pulling out all these words like delta that that's not a counterargument as the unit on the hill can already shoot farther?MadRat wrote:It sounded like he wanted the actual delta between shooter and target in relationship to maximum range limits to be influenced by the height delta.
I looked into weapon code and found this:Fanger wrote:I call for someone with some knowledge of coding (IE who can read the crap, as I cant or I would do it myself) go into the source code, and look up the aiming weapon stuff to confirm or deny our theories..
Code: Select all
bool CWeapon::TryTarget(const float3 &pos,bool userTarget,CUnit* unit)
{
if(unit && !(onlyTargetCategory&unit->category))
return false;
if(weaponDef->stockpile && !numStockpiled)
return false;
float3 dif=pos-weaponPos;
float r=range+(owner->pos.y-pos.y)*heightMod;
if(dif.SqLength2D()>r*r)
return false;
if(maxMainDirAngleDif>-0.999f){
dif.Normalize();
float3 modMainDir=owner->frontdir*mainDir.z+owner->rightdir*mainDir.x+owner->updir*mainDir.y;
// geometricObjects->AddLine(weaponPos,weaponPos+modMainDir*50,3,0,16);
if(modMainDir.dot(dif)<maxMainDirAngleDif)
return false;
}
return true;
}
Code: Select all
if(dif.SqLength2D()>r*r)
return false;
Code: Select all
r=range+(owner->pos.y-pos.y)*heightMod;