cRPG
cRPG => Beginner's Help and Guides => Topic started by: RamsesXXIIX on November 07, 2011, 12:22:11 pm
-
Hey guys.
I messaged Paul about this, but since he hasn't answered and I'm anxious to get the truth, I'm posting here in the hope one of you guys know the answer.
So, here's the deal.
I'm confused if/if not your speed is calculated when you are firing a ranged weapon (Be it throwing, x-bows or bows). Or said in other words, if speed bonus is calculated for you as well as your opponent.
To try and investigate, I went through some of Pauls posts: I found this quote when searching in this thread: http://forum.c-rpg.net/index.php/topic,17211.msg247332.html#msg247332 (http://forum.c-rpg.net/index.php/topic,17211.msg247332.html#msg247332)
You only get no speed bonus from your own movement speed. The targets speed does count. For the damage calc(but not for trajectory calc) every projectile is handled as if it is launched from a static position.
This has some interesting effects with horse archery too. So imagine a HA who is chased by another cav, both at same speed and the HA is shooting backwards at the cav. Irl one would expect normal damage because shooter and target are moving at the same speed. But it is different in Warband physics. Here it thinks the arrow is launched from static postion and the target is moving towards the arrow, resulting in extra damage. A mounted thrower would even profit the most from this glitch because the smaller the projectile speed compared to the movement speed, the higher the damage bonus/malus.
On the other hand this makes advisable for a victim to ride away from the HA. Same here, irl one would expect normal damage if a HA chases another cav when both move at the same speed. In Warband only the victim speed counts and he rides away from the arrow resulting in less damage than normal. Mounted thrower suffer the most from this.
Same for infantry but of course the impact is small because of the low movement speed.
Bolded the important part.
From this, it appears that your speed bonus is not calculated.
However, I've also found a Warband Manual: http://cdn.steampowered.com/Manuals/48700/PDX5505US_Warband_Manual_US.pdf?t=1271189104 (http://cdn.steampowered.com/Manuals/48700/PDX5505US_Warband_Manual_US.pdf?t=1271189104)
Taken from page 45-46:
"SPEED BONUSES are also very important for ranged weapons. Your missiles will lose most of their starting speed at long ranges, and therefore will do much less damage. On the other hand, hurling a javelin forward while riding a horse at full gallop will devastate any opponent you hit, since the speed of the horse will be added to the speed of your hurling motio"
From this, it appears your speed bonus IS calculated in ranged.
So which exactly is right in cRPG?
Hope anybody knows the answer.
-
Nevermind, Paul sent me a message explaining everything. For anyone interested, I don't think he minds me pasting it here:
The manual is wrong. Cmp got the speed bonus code and motivated by my previous tests that suggested a fuck up, we found the part where it fucks up.
if missile:
missile_speed_vec = missile.get_direction()
if (receiver_agent_no >= 0):
missile_speed_len = (receiver_speed_vec - missile_speed_vec).length() # sqrt(x²+y²+z²)
else:
missile_speed_len = missile_speed_vec.length()
damage = pow(missile_speed_len / missile.speed, module_settings.missile_damage_speed_power) * missile.damage * attack_rec.unknown_value
This is the code for the speed bonus for projectiles. The problem is the last line.
It basicly should be damage = (combined_impact_speed / starting_speed ) ^ missile_damage_speed_power * damage
Important here is that starting_speed should be the normal speed of the projectile if thrown from a standing position. Purpose of the speed bonus thingy is in the end to compare combined impact speed(which includes movement speed of the thrower at the beginning of the throw, friction&gravity loss/gain and relative movement speed of the target) with the normal throwing speed at point blank.
Should it be that the projectile is half as fast as normally because of whatever reason(friction, throwing upwards, target running away) then damage should be about quartered. If double speed on impact, damage is about multiplied by 4. The speed bonus thingy reflects the kinetic energy concept(Ekin = 1/2 m * v^2) with its square relation between speed and energy, although not exactly because missile_damage_speed_power is 1.9 in the module.ini and not 2.
So if I throw at someone right in front of me I should do 100% normal damage if thrower and target have both the same relative speed. This is where it fucks up. starting_speed in the code is DOES include the movement speed of the thrower at the beginning of the throw because they it is easier to do code wise. And this make the damage behave physically incorrect.
Example:
Lets say thrower and target are so close to each other and at the same height level that friction loss and gravitational gain/loss for the projectile speed are neglectible. With that only the relative speed should have an impact on damage.
final_damage = damage gain * damage =(combined_impact_speed / starting_speed) ^ 1.9 * damage
damage_gain = (combined_impact_speed / starting_speed) ^ 1.9 = ((v_missile+v0_thrower+v_target)/v_missile)^1.9
v_missile is the velocity of the missile only depending on power throw and the item stat of the weapon. It is constant if we assume the no friction and gravity loss&gain thingy.v0_thrower is the movement speed of the thrower when he throws and v_target is the movement speed of the target. Let's assume all speed vectors have the same direction to be able to use them as scalars.
Should be(real world):
damage_gain_rw = (combined_impact_speed / starting_speed) ^ 1.9 = ((v_missile+v0_thrower+v_target)/v_missile)^1.9
Done in code(Warband):
damage_gain_wb = ((v_missile+v0_thrower+v_target)/(v_missile+v0_thrower))^1.9
Case 1: Target and thrower do not move.
damage_gain_rl = ((v_missile+0+0)/v_missile)^1.9=1
damage_gain_wb = ((v_missile+0+0)/(v_missile + 0))^1.9=1
No damage gain or loss in both cases.
Case 2: Target is moving towards the thrower at missile speed(v_target = v_missile). Thrower is not moving.
damage_gain_rl = ((v_missile+0+v_missile)/v_missile)^1.9=2^1.9= 3.7
damage_gain_wb = ((v_missile+0+v_missile)/(v_missile + 0))^1.9= 3.7
Almost quadrupled damage in both cases. No problem.
Case 3: Thrower is moving at missile speed(v0_thrower=v_missile) towards the target during the throw. Target is not moving.
damage_gain_rl = ((v_missile+v_missile+0)/v_missile)^1.9=2^1.9= 3.7
damage_gain_wb = ((v_missile+v_missile+0)/(v_missile + v_missile))=1.9= 1^1.9=1
Here the problem shows for the first time. While in real life the damage should be about quadrupled in Warband it is the same as if the thrower is not moving.
Case 4: Mounted thrower is moving at half missile speed AWAY from the target(v0_thrower=-v_missile/2). Target is chasing the thrower on horseback also with half missile_speed(v0_thrower=v_missile/2).
damage_gain_rl = ((v_missile-v_missile/2+v_missile/2)/v_missile)^1.9=1^1.9= 1
damage_gain_wb = ((v_missile-v_missile/2+v_missile/2)/(v_missile - v_missile/2))^1.9=(v_missile/(v_missile/2))^1.9=2^1.9=3.7
This is the biggest fuckup. While of course logic tells us that if thrower and chaser move at the same speed the damage should be normal too, it's different in Warband. There you can get a big damage bonus thanks to the nature of the implementation.
Cmp too lazy to fix though.
Thanks a lot for the answer.