Real lasers tutorial O.o

  • Hola amigos!
    I'm new here, so i ought to make something useful (:


    Now i will tell you how to make real beams.
    What? Beams eh? Did you think that FL cannot have the beams, cuz they're limited by an engine?
    If yes, that tutorial is for you.


    First of all, i have to tell what we will do.
    There're some screenshots:




    As you see, ray can be different. You can color it, you can use different textures (for lightning for example).
    Of course, there aren't any ideal thing in the world, so this technology has the minuses too.


    They are:
    1) You may not to see the ray sometimes when you rotate your ship. Thats because:


    2) Ray is unstoppable :D
    I mean, effect goes through the target. You can notice this at the first screenshot.
    But only effect, not the damage. Damage will be made to the first object on the ray's way.
    This one is ignorable too - they look so cute anyway.


    3) Worst bug, i really had the facepalm when tested the lasers.
    As you know, weapon shoots particle 45 degrees more than the hardpoint on shop allows.
    The laser is the same, of course. But... only particle, not the muzzle flash effect (yeah, the secret of these lasers's - they're just flashes, thats why they don't fly forward xD). It can be rotated only as hardpoint allows. So, you can sometimes damage targets by invisible particles, when ray stays at the limit and cannot be rotated more. This is most noticable, when you will simply try to shoot lower than a screen center: you can deal damage, but ray will stay at the center.
    Anyway, this bug may be fatal only with front guns. I never noticed that one with turrets. NPC's can use them well too.


    If you still want to continue, hold on.


    All we need:
    1) Encoded inis:
    - equipment/weapon_equip.ini
    - equipment/weapon_good.ini
    - fx/effects.ini
    - fx/weapons/weapon_ale.ini
    2) "ALE Editor"
    Despite the pathetic name, this is just coder/decoder of ALE's.
    3) Notepad
    4) DBHashCRC tool.
    You can download it here: lancersreactor.org/index.php?attachment/228/.
    5) Photoshop *optionally*
    To draw your own textures, or increase vanilla ones dimensions (because they're ugly - 64x64 (i remade them to 512x512)).
    Btw, i may share them - take: lancersreactor.org/index.php?attachment/229/. Replacing original won't hurt the FL - it make it better.
    6) Basic knowlege of weapon INI coding.


    So, lets begin, at last.


    Open your weapon_equip.ini. Copypaste to the end of a file any of the guns.


    In [munition] section:


    Imagine the nickname. The cattest_laser for example.
    So:
    nickname = cattest_laser_ammo


    Configure the damage.


    Erase line "const_effect = *"


    Configure the lifetime. I suggest to make about 0.2 or 0.3.


    Go to [gun] section.


    nickname = cattest_laser


    If you pay attention to name/description, make them.


    Configure the hp type. For easiest test use
    hp_gun_type = hp_gun_special_1


    Configure power usage.


    Configure the delay. I suggest to use 0.2 or 0.15, not less.


    Configure muzzle velocity. If we set the lifetime to 0.2, optimal velocity can be about 5000.


    flash_particle_name = cattest_laser_flash


    projectile_archetype = cattest_laser_ammo


    Right. Now configure weapon in weapon_good.ini and set it to market where you can buy.


    Next ini - fx/effects.ini


    Add the lines to the end of file:
    [Effect]
    nickname = cattest_laser_flash
    effect_type = EFT_WEAPON_LARGE_PROJ
    vis_effect = cattest_laser_flash


    Now go to weapons folder. Open weapons_ale.ini.


    Add new entry to the end of a file:
    [VisEffect]
    nickname = cattest_laser_flash
    alchemy = fx\weapons\cattest_laser_flash.ale
    effect_crc = ;calculate it - look next step
    textures = fx\beam.txm ;this texture must be
    textures = fx\planetflare.txm ;this one is optional
    textures = fx\sarma.txm ;same


    Now open the DBHashCRC tool and calculate the Unsigned CRC for your nickname.
    For cattest_laser_flash it is -137620881
    Notice. Line includes 3 values:
    0xF7CC126F <> 4157346415 <> -137620881
    If first value more than 80000000, use third value. If less - the second.


    Roger. Now the hardest - ALE.
    Create new notepad file with extension *.AEL - cattest_laser_flash.ael
    It is better to create it in the "ALE Editor"'s TEMP folder.


    Open it.


    Start with:


    [ALE]
    Version = 1.1
    Type = Layer0
    [Section]
    Effect_Name = cattest_laser_flash
    ULParams = 0, 0, 1


    ANL_Nickname = Main_Node
    Parent = NULL
    FX_Slot = 1
    Slot_Flag = 0


    Now we will make a base of effect.


    ANL_Nickname = cattest_laser_flash.app
    Parent = 1
    FX_Slot = 3
    Slot_Flag = 0


    ANL_Nickname = cattest_laser_flash.emt
    Parent = 1
    FX_Slot = 2
    Slot_Flag = 1


    Notice about Slot_Flag. This parameter must be written on the last Emitter (.emt) and it is the count of all Emitters.


    Now, finish our AEL with
    Slot_Order = 1, 2, 3
    It is: <main node>, <emitter FX slot>, <appearance (.app) FX slot>
    If you want to use several effects (for creating additional visualisations), it is:
    <main node>, <first emitter FX slot>, <first appearance (.app) FX slot>, <second emitter FX slot>, <second appearance (.app) FX slot>, <third emitter FX slot>, <third appearance (.app) FX slot>... etc
    FX slots have to be unique.


    Create second file - cattest_laser_flash.anl


    As we wrote in AEL, we must have the Appearance and Emitter for it.
    So, here we go.
    Common start:
    [ALE]
    Version = 1.1
    [Section]


    Beam? Yes, beam. Next line:
    FX_Type = FLBeamAppearance


    Nickname of Appearance:
    Node_Name = cattest_laser_flash.app


    Next lines:
    Node_LifeSpan = Infinite
    Node_Transform = {}


    And the next. Nothing special.
    Appearance_LODCurve = {
    Entry = 0.0000000000000000
    EFlag = 4
    SubEntry = 0.0000000000000000, 1.0000000000000000
    SubFlag = 3
    }


    Now the color settings:
    BasicApp_Color = {
    Flag = 4
    Entry = 0.0000000000000000
    SubFlag = 4
    SubEntry = 0.0000000000000000, 0.8, 0.4, 0.8
    SubEntry = 1.0000000000000000, 0.4, 0.2, 0.4
    }

    Notice. Color's SubEntry = <dunno what>, Red, Green, Blue.
    R, G, B values are from 0 to 1.


    Next is the alpha settings. I used such:
    BasicApp_Alpha = {
    Entry = 0.0000000000000000
    EFlag = 4
    SubEntry = 0.0000000000000000, 0.8000000119209290, 0.5000000000000000, 0.8000000119209290, 1.0000000000000000, 0.0000000000000000
    SubFlag = 1
    }

    This is not something special - use the same.


    Next - scale of the effect.
    RectApp_Scale = {
    Entry = 0.0000000000000000
    SubEntry = 0.0000000000000000, 3.0000000000000000
    }

    Multiple the texture size by 3 is ok for fighter gun or turret. Use higher value for fatter ray.


    Almost the same as a scale - width.
    RectApp_Width = {
    Entry = 0.0000000000000000
    EFlag = 4
    SubEntry = 0.0000000000000000, 3.0000000000000000, 0.5000000000000000, 3.0000000000000000, 1.0000000000000000, 8.0000000000000000
    SubFlag = 1
    }


    Texture name:
    BasicApp_TexName = beam_4
    There're beam_4, beam_5 and beam_6 usable in the vanilla beam.txm. You can look available textures or add your own if you will open beam.txm in UTF Editor.


    A strange value.
    BasicApp_BlendInfo = 5, 2
    Known values are
    BasicApp_BlendInfo = 5, 2 (This one makes effect use black color as transparent)
    and
    BasicApp_BlendInfo = 5, 6 (This one makes effect use the texture's alpha map (so you can make a black effect O.o))


    Also necessary value:
    BasicApp_TexFrame = {
    Flag = 4
    Entry = 0.0000000000000000
    SubFlag = 4
    SubEntry = 0.0000000000000000, 0.0000000000000000
    }


    And the finishing of Appearance:
    BasicApp_QuadTexture = False
    BeamApp_DisablePlaceHolder = True
    BeamApp_DupeFirstParticle = True
    BeamApp_LineAppearance = True


    Now the Emitter. This is extremely strange and unexplored feature.
    Nvm, lets go. Thats almost the end of base of effect.


    [Section]
    FX_Type = FxConeEmitter
    Node_Name = cattest_laser_flash.emt
    Node_LifeSpan = Infinite


    NodeTransform. The strange thing. -800 may be a beam lenght, not sure :D


    Node_Transform = {
    Flag = 4
    Header = 0.0000000000000000, 0.0000000000000000
    HFlag = 4
    HTail = 0
    Header = 0.0000000000000000, 0.0000000000000000
    HFlag = 4
    HTail = 0
    Entry = 0.0000000000000000, 0.0000000000000000
    EFlag = 4
    EType = 1
    ETail = 0
    SEntry = 0.0000000000000000, 0.0000000000000000, 0.0000000000000000, 0.0000000000000000, 0.0010000000474975, -800.0000000000000000, 0.0000000000000000, 0.0000000000000000
    SFlag = 0
    Entry = 0.0000000000000000, 0.0000000000000000
    EFlag = 4
    EType = 1
    ETail = 0
    Entry = 0.0000000000000000, 0.0000000000000000
    EFlag = 4
    EType = 1
    ETail = 0
    Entry = 0.0000000000000000, 0.0000000000000000
    EFlag = 4
    EType = 1
    ETail = 0
    Entry = 0.0000000000000000, 0.1000000014901161
    EFlag = 4
    EType = 1
    ETail = 0
    Entry = 0.0000000000000000, 0.1000000014901161
    EFlag = 4
    EType = 1
    ETail = 0
    Entry = 0.0000000000000000, 0.1000000014901161
    EFlag = 4
    EType = 1
    ETail = 0
    }


    Nothing special:
    Emitter_LODCurve = {
    Entry = 0.0000000000000000
    EFlag = 4
    SubEntry = 0.0000000000000000, 1.0000000000000000
    SubFlag = 1
    }


    Emitter_InitialParticles = 1


    Frequency. Playing with this gives very interesting effects in particle effects. Nothing to configure for our purposes, just copypyaste.
    Emitter_Frequency = {
    Flag = 4
    Entry = 0.0000000000000000, 100.0000000000000000
    EFlag = 0
    SubFlag = 1
    SubEntry = 0.0000000000000000, 50.0000000000000000, 0.0000000000000000, 0.0000000000000000
    }


    Same as next
    Emitter_MaxParticles = {
    Flag = 4
    Entry = 0.0000000000000000, 10000.0000000000000000
    EFlag = 0
    }


    Emitter_EmitCount = {
    Entry = 0.0000000000000000, 0.0000000000000000
    }


    This one configures the death of a ray.
    Emitter_InitLifeSpan = {
    Flag = 4
    Entry = 0.0000000000000000, 1.0000000000000000
    EFlag = 0
    SubFlag = 1
    SubEntry = 0.0000000000000000, 0.5000000000000000, 0.0000000000000000, 0.0000000000000000
    }


    Pressure. Similar to Frequency.
    Emitter_Pressure = {
    Flag = 4
    Entry = 0.0000000000000000, 20.0000000000000000
    EFlag = 0
    SubFlag = 1
    SubEntry = 0.0000000000000000, 0.0000000000000000, 0.0000000000000000, 0.0000000000000000
    }


    Copypaste these ones too:
    Emitter_VelocityApproach = {
    Entry = 0.0000000000000000, 0.0000000000000000
    }


    ConeEmitter_MinRadius = {
    Entry = 0.0000000000000000, 0.0000000000000000
    }


    ConeEmitter_MaxRadius = {
    Entry = 0.0000000000000000, 1.0000000000000000
    SubEntry = 0.0000000000000000, 0.0000000000000000, 0.0000000000000000, 0.0000000000000000
    }


    ConeEmitter_MinSpread = {
    Entry = 0.0000000000000000, 0.0000000000000000
    }


    ConeEmitter_MaxSpread = {
    Flag = 4
    Entry = 0.0000000000000000, 0.0000000000000000
    EFlag = 0
    SubFlag = 1
    SubEntry = 0.0000000000000000, 180.0000000000000000, 0.0000000000000000, 0.0000000000000000
    }


    Save the file. You must have the:
    cattest_laser_flash.ael
    cattest_laser_flash.anl


    Open "ALE Editor". Make the ALE. It will create *.tale file in TEMP folder. Rename it to cattest_laser_flash.ale and copypaste to Data/FX/Weapons.


    FINALLY, launch the game and test your stuff.


    Notice, that you may add as much effects to laser as you want. You can add effect to smooth the laser, of make the flash at the gun's point. Anything you want. You may open vanilla ALEs and take the trial.


    GL HF (:


  • What?! no way! cattest_laser_flash does 0xE81346AC <> 3893577388 <> -401389908 . If I'm wrong how have you do 0xF7CC126F <> 4157346415 <> -137620881 .

  • Quote

    3) Worst bug, i really had the facepalm when tested the lasers.
    As you know, weapon shoots particle 45 degrees more than the hardpoint on shop allows.
    The laser is the same, of course. But... only particle, not the muzzle flash effect (yeah, the secret of these lasers's - they're just flashes, thats why they don't fly forward xD). It can be rotated only as hardpoint allows. So, you can sometimes damage targets by invisible particles, when ray stays at the limit and cannot be rotated more. This is most noticable, when you will simply try to shoot lower than a screen center: you can deal damage, but ray will stay at the center.
    Anyway, this bug may be fatal only with front guns. I never noticed that one with turrets. NPC's can use them well too.



    I dealt with that by setting force_gun_ori to true in the munition section of the weapon_equip.ini. Now, that presents other problems, since the gun fires only where the gun itself points with that setting. You'll need to tweak the hardpoints on your ships to make this work effectively. Still, it's better than firing invisible projectiles a mile away from where the beam is firing.