Flak Turrets implementation
-
The effect itself is done. However I’m trying to figure out an implementation of this that won’t fall apart under lag. In a lag-less environment it works spectacularly. But because the weapons are missile based, when you get those one or two second pauses due to lag, the missiles stay in their barrels and explode right on top of you.
Yes, you cannot use such a flak weapon with a server with poor performance.
1-2 second pauses sounds really bad!PvP oriented servers should never exceed ~60ms serverload. Anyways, here is our flak implementation so far:
[Motor] nickname = rh_battleship_flak_turret01_a_motor lifetime = 0.100000 accel = 10000 delay = 0 [Explosion] nickname = rh_battleship_flak_turret01_a_explosion effect = flak_explosion lifetime = 0.000000, 0.000000 process = disappear strength = 80 radius = 55 hull_damage = 180 energy_damage = 280 impulse = 1800 [Munition] nickname = rh_battleship_flak_turret01_a_ammo explosion_arch = rh_battleship_flak_turret01_a_explosion motor = rh_battleship_flak_turret01_a_motor DA_archetype = equipment\models\weapons\li_rad_missile.3db material_library = equipment\models\li_equip.mat hp_type = hp_gun requires_ammo = false lifetime = 0.600000 hit_pts = 2 one_shot_sound = fire_capship detonation_dist = 30 HP_trail_parent = HPExhaust seeker = DUMB force_gun_ori = false const_effect = sp_doomsday_03_proj mass = 1 volume = 10 ids_name = 1 ids_info = 1 [Gun] nickname = rh_battleship_flak_turret01_as ids_name = 263483 ids_info = 264483 DA_archetype = equipment\models\turret\sp_turret01.cmp material_library = equipment\models\sp_turret.mat HP_child = HPConnect hp_gun_type = hp_turret_special_10 hit_pts = 30580 explosion_resistance = 1 debris_type = debris_turret_small parent_impulse = 20 child_impulse = 80 volume = 0 mass = 10 damage_per_fire = 0 power_usage = 0 refire_delay = 0.250000 muzzle_velocity = 1 toughness = 10.600000 flash_particle_name = rtc_nomadtorpedo_flash flash_radius = 15 light_anim = l_gun01_flash projectile_archetype = rh_battleship_flak_turret01_a_ammo separation_explosion = sever_debris auto_turret = true turn_rate = 270 lootable = false
This is balanced for vanilla-style servers and works great with good performing servers.
-
It’s funny that you use such a short-lasting projectile, because that’s what kills my flak. The problem with the short lasting projectiles was that if the server hiccups, any projectiles caught in that hiccup never left the barrel, causing them to explode on top of you. It is a very interesting implementation, I will try it and see if it helps. In my experience such a weapon should not work at all, because I found that very unusual things happen when you have either a very low muzzle velocity (1), with a very high motor, or vice versa. Also your seeker = DUMB, I have never heard of such thing. However it would definitely streamline my code.
[Edit] I just tried your idea and I found out why I never used a super motor with a tiny muzzle velocity. No matter which direction your guns are aiming, the missiles only fly in your current velocity vector.
Also the server I tested it on was not a very good server, but thats partially the point, to make sure it runs well under all circumstances.
-
The seeker = DUMB is nothing special, any other vanilla FLAK turret uses that.
The whole flak idea is in that regard not new, its just tuning some parameters to make it work effectively.
And yeah, the problem is that it does not run good under any circumstances and I have not found a setting that would always work good, no matter what serverload - simply because the whole FL missile/physics calculation thing is very unstable and reacts allergically to any slowdowns.Oh and I re-checked my code on the server, the lifetime actually is 0.9. One of the main problems is also tuning the explosion radius and the refire delay so that there is no chain reaction.
-
Btw.: There is a logical explanation for the lag-problem.
With a acceleration time of 0.1 seconds, that means the serverload MUST be less than 100ms for the physics engine to actually accelerate the projectile. (since in that case the server tics at around 100ms, “forgetting” the acceleration event)
Im not really sure how the physics engine works in detail, but I think that is basically the reason for slow acceleration times not working good on slow servers.
-> Try a longer acceleration time.
-
Why not give no acceleration and simply put a muzzle_velocity? I do believe that’d work fine, although I can’t test anything ATM…
Also, I remember FLWT also uses pseudo-flak guns, but they aren’t missiles. We just strapped an explosion on top of a normal weapon and it works. Only thing I’m not sure of is whether the detonation distance works in that case.
-
The way I had it working before is the best implementation so far. It is a combination of muzzle velocity and acceleration from the missile. I have managed to get the “kill yourself” bug under control. It still happens every once in awhile, but its nowhere near as bad as before. Also the flak itself works perfectly. Too perfectly actually. It completely destroys my idea of balance, but that’s a discussion for somewhere else.
Also no, you cannot have a muzzle velocity with no acceleration. I cannot remember off the top of my head why not, but I know for a fact it does not work.
Also, you cannot attach an explosion to a bullet. Freelancer will not correctly apply an explosion to a projectile unless it is clearly defined as a missile. If you apply an explosion to a bullet, the explosion effect will play, but none of its gameplay values such as explosion radius, hull damage, etc, are calculated.
-
[Gun] nickname = CAPITAL_1 ids_name = 458972 ids_info = 0 DA_archetype = ..\DATA\equipment\models\weapons\li_laser_beam.cmp material_library = ..\DATA\equipment\models\li_equip.mat HP_child = HPConnect hit_pts = 52400 explosion_resistance = 1.000000 debris_type = debris_normal parent_impulse = 20 child_impulse = 80 volume = 0.000000 mass = 50 hp_gun_type = hp_turret_special_07 damage_per_fire = 0 power_usage = 9000000 refire_delay = 1 muzzle_velocity = 1500 use_animation = Sc_fire toughness = 1.000000 flash_particle_name = sp_distortion_02_flash flash_radius = 45 light_anim = l_gun01_flash projectile_archetype = CAPITAL_1_AMMO separation_explosion = sever_debris auto_turret = true turn_rate = 90 lootable = true LODranges = 0, 20, 60, 100 [Munition] nickname = CAPITAL_1_AMMO hp_type = hp_gun requires_ammo = false hit_pts = 2 weapon_type = W_Global one_shot_sound = fire_capship munition_hit_effect = ci_capgun_01_impact const_effect = CAPITAL_1_PROJ lifetime = 1 force_gun_ori = false mass = 1 volume = 0.000100 detonation_dist = 25 explosion_arch = CAPITAL_1_EXPLOSION hull_damage = 2500 energy_damage = 750 [Explosion] nickname = CAPITAL_1_EXPLOSION effect = CAPITAL_1_EXPLOSION lifetime = 0.000000, 0.000000 process = disappear strength = 100 radius = 50 impulse = 10000
I don’t actually NEED the damage to be spread over the radius, so for me this works just fine. Impulse is dealt properly. If you absolutely need to have damage dealt over a certain damage radius or if you want it to have a detonation distance, fine, but otherwise this makes a much lighter version of the flak gun, all while retaining its graphical look and feel.
-
A flak gun without a detonation distance and without explosion radius is not really a flak gun.
And yeah, I also cannot remember the reason for muzzle velocity alone not working, but the bottom line was: not working
Anyways, on our server the flaks work pretty good
-
The flak is working perfectly for the moment. I have not had any stuck flak missiles at all yet. I can’t exactly say what fixed it, but I am happy. I also found a way to put my flak in and be balanced. In the video I am not the one using the flak, but rather the Battleship piloted by another is. It’s great fun to watch and fly through. I am piloting a support gunboat for taking out fighters.
-
Wow Why, that is pretty ace stuff. Who was that with you? I take it none of the server lag issues were really worked out? lol
Also, I really need to try out some of you and KJ’s Cap Ship work. I might as well start working it into RC122, since I want to wait for M0tah to finalize his next Hook build before release.
-
Wow Why, that is pretty ace stuff. Who was that with you? I take it none of the server lag issues were really worked out? lol
Also, I really need to try out some of you and KJ’s Cap Ship work. I might as well start working it into RC122, since I want to wait for M0tah to finalize his next Hook build before release.
I’m waiting for you and M0tah of great mod long long time. ;D
-
Wow Why, that is pretty ace stuff. Who was that with you? I take it none of the server lag issues were really worked out? lol
Also, I really need to try out some of you and KJ’s Cap Ship work. I might as well start working it into RC122, since I want to wait for M0tah to finalize his next Hook build before release.
I’m not sure what did it, but I haven’t had any problem at all with the flak exploding the barrels anymore. I’m pretty sure it had to do with setting the missiles to dumbfire, also giving their turret turn speed a really high value helped some as well. I’ve been testing on the KJs server the whole time. He was the other pilot.
-
@w0dk4, I’m monkeying about with the flak cannons using your code up there but I’m finding that a lot of the ‘bullets’ are exploding as soon as they leave the barrel. Should I be increasing the lifetime a bit?
R
Try increasing the hit points of the actual ammunition (its 2) to 2000 or something, this way the bullets dont destroy themselve
-
As a believer in open source material, here is the source code for my flak guns. Highlighted are the important bits.
[Motor]
nickname = li_battleship_flak_turret01_motor
lifetime = 1
accel = 500
delay = 0[Explosion]
nickname = li_battleship_flak_turret01_explosion
effect = explosion_super_flak
lifetime = 0.000000, 0.000000
process = disappear
strength = 0
radius = 250
hull_damage = 750
energy_damage = 0
impulse = 50[Munition]
nickname = li_battleship_flak_turret01_ammo
ids_name = 263383
explosion_arch = li_battleship_flak_turret01_explosion
hp_type = hp_gun
requires_ammo = false
hit_pts = 1000000 ;so that flak doesnt kill itself
one_shot_sound = null
detonation_dist = 75
lifetime = 1
Motor = li_battleship_flak_turret01_motor
force_gun_ori = false
const_effect = li_flakcannon01_proj
HP_trail_parent = HPExhaust
seeker = DUMB
time_to_lock = 0
DA_archetype = equipment\models\torpedoes\ge_torpedo.3db
material_library = equipment\models\ge_equip.mat
mass = 200
volume = 0.000100
;type = LOOT[Gun]
nickname = li_battleship_flak_turret01
ids_name = 263383
ids_info = 264383
DA_archetype = equipment\models\turret\li_turret04.cmp
material_library = equipment\models\li_turret.mat
HP_child = HPConnect
hit_pts = 25000 ;LEquip
explosion_resistance = 0.1
debris_type = debris_turret_small
parent_impulse = 0
child_impulse = 0
volume = 16.000000
mass = 10
hp_gun_type = hp_turret_special_9
damage_per_fire = 0
power_usage = 170
refire_delay = 0.5
muzzle_velocity = 500
toughness = 10
light_anim = l_gun01_flash
projectile_archetype = li_battleship_flak_turret01_ammo
separation_explosion = sever_debris
auto_turret = true
turn_rate = 1000
lootable = true
dispersion_angle = 18 -
@ w0dk4 and Why485. May I have permission to add your effects and some of your code into my mod as well?
Thanks,
RoboOh, and while I’m awaiting permissions, I’m testing as a learning experience. This is my code so far:
<data file="data\equipment\weapon_equip.ini" method="sectionreplace" options="1:0, 1:1">[Motor] nickname = li_battleship_flak_turret01_motor <dest>lifetime = 1 accel = 166.666702</dest> <source> lifetime = 0.100000 accel = 10000</data> <data file="data\equipment\weapon_equip.ini" method="sectionreplace" options="1:0, 1:1">[Explosion] nickname = li_battleship_flak_turret01_explosion <dest>effect = gf_explosion_super_flak lifetime = 0.000000, 0.000000 process = disappear strength = 100 radius = 16 hull_damage = 81.500000 energy_damage = 0 impulse = 0</dest> <source> effect = flu_flakcannon01_impact lifetime = 0.000000, 0.000000 process = disappear strength = 80 radius = 250 hull_damage = 1000 energy_damage = 500 impulse = 1800</data> <data file="data\equipment\weapon_equip.ini" method="sectionreplace" options="1:0, 1:1">[Munition] nickname = li_battleship_flak_turret01_ammo <dest>hit_pts = 2 one_shot_sound = fire_capship detonation_dist = 4 lifetime = 5 Motor = li_battleship_flak_turret01_motor force_gun_ori = false const_effect = li_flakcannon01_proj HP_trail_parent = HPExhaust seeker = DUMB DA_archetype = equipment\models\weapons\li_rad_missile.3db material_library = equipment\models\li_equip.mat mass = 1 volume = 0.000100</dest> <source> hit_pts = 2000 one_shot_sound = fire_capship detonation_dist = 100 lifetime = 0.900000 Motor = li_battleship_flak_turret01_motor force_gun_ori = false const_effect = sp_doomsday_03_proj HP_trail_parent = HPExhaust seeker = DUMB time_to_lock = 0 DA_archetype = equipment\models\weapons\li_rad_missile.3db material_library = equipment\models\li_equip.mat mass = 1 volume = 0.0 ids_name = 1 ids_info = 1</data> <data file="data\equipment\weapon_equip.ini" method="sectionreplace" options="1:0, 1:1">[Gun] nickname = li_battleship_flak_turret01 <dest>hit_pts = 4800 explosion_resistance = 1.000000 debris_type = debris_turret_small parent_impulse = 20 child_impulse = 80 volume = 50.000000 mass = 10 damage_per_fire = 0 power_usage = 0 refire_delay = 0.500000 muzzle_velocity = 83.300003 toughness = 1.600000 flash_particle_name = li_flakcannon01_flash flash_radius = 15 light_anim = l_gun01_flash projectile_archetype = li_battleship_flak_turret01_ammo separation_explosion = sever_debris auto_turret = true turn_rate = 90</dest> <source> hit_pts = 69500 explosion_resistance = 1.000000 debris_type = debris_turret_small parent_impulse = 20 child_impulse = 80 volume = 0.000000 mass = 10 damage_per_fire = 0 power_usage = 0 refire_delay = 0.250000 muzzle_velocity = 1 toughness = 10.600000 flash_particle_name = rtc_nomad_torpedo_flash flash_radius = 35 light_anim = l_gun01_flash projectile_archetype = li_battleship_flak_turret01_ammo separation_explosion = sever_debris auto_turret = true turn_rate = 270 dispersion_angle = 18 hp_gun_type = hp_turret_special_10</data> <data file="data\FX\WEAPONS\weapons_ale.ini" method="append" options="1:0, 1:1"><source> [VisEffect] nickname = gf_explosion_super_flak ;created by Why485, modded by w0dk4 alchemy = fx\explosions\gf_explosion_super_flak.ale effect_crc = 290209852 textures = fx\sarma.txm textures = fx\lightbeam.txm textures = fx\standardeffects.txm textures = fx\kioncannon.txm</data> <data file="data\FX\effects.ini" method="append" options="1:0, 1:1"><source> [Effect] nickname = gf_explosion_super_flak effect_type = EFT_WEAPON_IMPACT vis_effect = gf_explosion_super_flak</data>
I downloaded the effects file at the link you gave w0dk4, renamed the extension from *.tale to *.ale (was I supposed to do that?), and put the file in the FX\EXPLOSIONS directory.
The problem I’m seeing so far is that the effect just isn’t working. Do I need to do something else that I’ve missed?