Board index FlightGear Development AI Traffic

animating AI PA-28 lights  Topic is solved

Intelligent, computer controlled vehicles that drive/fly over the planet!

animating AI PA-28 lights

Postby wkitty42 » Tue Jul 24, 2018 3:29 pm

i'm trying to figure out how to use the beacon object from the AI/Aircraft/pa-28/Models/pa-28.ac file... the name of the object in the ac file is "Beacon"... in the end, i want to assign an effect to it to make it blink...this is procedural lighting... the following code is taken from the c182 and modified to fit the pa-28... i did this mainly because it has all of the lights as separate models and that made it easier for me to put things together and understand how they work... i have the individual light models stuff from the c182 working but now i want to use the light objects that already exist in the pa-28's ac file...

in AI/Aircraft/pa-28/pa-28-main.xml, i've added this code...
Code: Select all
  <!-- Add Navigation Lights Objects -->
  <model>
    <path>Lights/pa28-NavLights.xml</path>
  </model>
  <!-- Enable Beacons and Strobes Pulse Behaviour -->
  <nasal>
    <load><![CDATA[
        aircraft.light.new("/sim/model/pa28/lighting/beacon", [0.7, 1.3]);
        aircraft.light.new("/sim/model/pa28/lighting/strobes", [0.7, 1.98]);
        setprop("/sim/model/pa28/lighting/beacon/enabled", 1);
        setprop("/sim/model/pa28/lighting/strobes/enabled", 1);
      ]]></load>
    <unload></unload>
  </nasal>

then i created AI/Aircraft/pa-28/Lights/pa28-NavLights.xml and have this code for the beacon (on top of the front of the vertical stabilizer)... i have commented out the offsets code because it was used with a stand alone beacon model but since i'm trying to use the built-in beacon, i should not need this offset code to position the light, right? it should already be positioned in the ac, right?
Code: Select all
  <!--procedural lights - ALS only-->
  <model>
    <condition>
      <property>/sim/rendering/shaders/skydome</property>
    </condition>
    <path>beacon.xml</path>
<!--
    <offsets>
      <x-m>3.625</x-m>
      <y-m>0.000</y-m>
      <z-m>2.800</z-m>
    </offsets>
-->
  </model>

so the above loads AI/Aircraft/pa-28/Lights/beacon.xml which has this... here is where we finally load the Beacon model from the AI/Aircraft/pa-28/Models/pa-28.ac file and assign the effect to it from the eff file... i've commented out the scale and dist-scale in this because i just want the beacon to come on and be visible... i can put these back in later if the size is not right...
Code: Select all
  <path>AI/Aircraft/pa-28/Models/pa-28.ac</path>
  <nopreview/>
<!--
  <animation>
    <type>scale</type>
    <object-name>Beacon</object-name>
    <x-offset>0.5</x-offset>
    <y-offset>0.5</y-offset>
    <z-offset>0.5</z-offset>
  </animation>
-->
<!--
  <animation>
    <type>dist-scale</type>
    <object-name>Beacon</object-name>
    <interpolation>
      <entry>
        <ind>0</ind>
        <dep>1</dep>
      </entry>
      <entry>
        <ind>300</ind>
        <dep>4</dep>
      </entry>
      <entry>
        <ind>1500</ind>
        <dep>8</dep>
      </entry>
    </interpolation>
  </animation>
-->
  <effect>
    <inherits-from>beacon</inherits-from>
    <object-name>Beacon</object-name>
  </effect>

the effect tag loads the following eff renderer file... this uses the property added in the pa-28-main.xml code to cause the beacon to flash...
Code: Select all
  <name>Effects/beacon</name>
  <inherits-from>Effects/procedural-light</inherits-from>
  <parameters>
    <texture n="0">
      <type>white</type>
    </texture>
    <light_color_base_r type="float">0.98</light_color_base_r>
    <light_color_base_g type="float">0.2</light_color_base_g>
    <light_color_base_b type="float">0.2</light_color_base_b>
    <light_color_center_r type="float">0.98</light_color_center_r>
    <light_color_center_g type="float">0.8</light_color_center_g>
    <light_color_center_b type="float">0.4</light_color_center_b>
    <intensity_scale type="float"><use>/sim/model/pa28/lighting/beacon</use></intensity_scale>
    <pointing_x type="float">1.0</pointing_x>
    <pointing_y type="float">0.0</pointing_y>
    <pointing_z type="float">0.0</pointing_z>
    <is_directional type="bool">false</is_directional>
    <is_strobe type="bool">false</is_strobe>
    <inner_angle type="float">0</inner_angle>
    <outer_angle type="float">0</outer_angle>
    <zero_angle type="float">0</zero_angle>
    <outer_gain type="float">0.0</outer_gain>
  </parameters>

all of the above works fine with the standalone beacon model... all i'm trying to do is to use the one in the pa-28 model since it exists... what am i missing?
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5568
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: animating AI PA-28 lights

Postby BecOzIcan » Thu Jul 26, 2018 1:02 pm

The one thing I can think of is your main xml has the nasal to enable the beacon pulse BUT I cannot see where you actually trigger its actual rendering.

that is, comparing with my AI 735-NavLights.xml file which loads, re-position and then activate (select) the lights

Code: Select all
 <!-- Show Beacons when Aircraft is moving -->
  <animation>
    <type>select</type>
    <object-name>BeaconGrouped</object-name>
    <nopreview />
    <condition>
      <and>
        <property>/sim/model/Boeing/lighting/beacon/state</property>
        <greater-than>
          <property>transponder-id</property>
          <value type="string">0</value>
        </greater-than>
        <equals>
          <property>valid</property>
          <value type="bool">true</value>
        </equals>
      </and>
    </condition>
  </animation>


I have started implementation of ALS lighting on my most recent model, re purposing the c172 code. For the beacons I will use the strobe function included in the effect (called strobe but a bit too weak for that purpose) and no nasal at all.
See last line of the below test file where I am "pulsating" my Left Nav ( <is_strobe type="bool">true</is_strobe>)

Code: Select all
<PropertyList>
  <name>procedural-light-nav-left</name>
  <inherits-from>Effects/procedural-light</inherits-from>
  <parameters>
    <light_color_base_r type="float">1.000</light_color_base_r>
    <light_color_base_g type="float">0.320</light_color_base_g>
    <light_color_base_b type="float">0.320</light_color_base_b>
    <light_color_center_r type="float">1.0</light_color_center_r>
    <light_color_center_g type="float">1.0</light_color_center_g>
    <light_color_center_b type="float">1.0</light_color_center_b>
    <intensity_scale type="float">1.0</intensity_scale>
    <!-- Arc is 110 deg, is 55 deg per side, giving 35 deg from wing -->
    <pointing_x type="float">1.0</pointing_x>
    <pointing_y type="float">0.7002075382097097</pointing_y>
    <pointing_z type="float">0.0</pointing_z>
    <is_directional type="bool">false</is_directional>
    <is_strobe type="bool">true</is_strobe>
    </parameters>
</PropertyList>


I am not that good at explaning code anyway so I ll just proceed with my adjustments and hopefully you can re use part of my next commit.

Cheers
Ian

Image
Current Projects: AI Traffic, Models & Liveries
User avatar
BecOzIcan
 
Posts: 1038
Joined: Tue Oct 04, 2011 10:43 pm
Location: Sydney, NSW, Australia
Version: 2.12
OS: Win10

Re: animating AI PA-28 lights

Postby wlbragg » Thu Jul 26, 2018 4:19 pm

I have started implementation of ALS lighting on my most recent model, re purposing the c172 code.


I'm not sure what version of the c172p your using. It didn't have ALS procedural strobes until I added them yesterday (development repository). The current c172p in the dev repo supports both ALS and non-ALS implementations so it can be a bit confusing if your not totally versed. I am also using the same flash mechanism for both, I am not using the ALS flash mechanism of
Code: Select all
<is_strobe type="bool">false</is_strobe>

which you absolutely would if you were doing this for AI.


@wkitty42

These are the pertinent files and/or code blocks

see both left and right...
Models/Effects/lights/procedural_light_left_strobe.xml
Models/Effects/lights/procedural_light_left_strobe.eff (make sure you set the is-strobe bool to "true" in this file)
Models/Effects/lights/strobe_light.ac

and in the ai-xml (don't forget to change paths where appropriate)

Code: Select all
    <model>
        <name>strobe-light-left</name>
        <path>Aircraft/c172p/Models/Effects/lights/procedural_light_left_strobe.xml</path>
        <offsets>
            <x-m> 0.15</x-m>
            <y-m>-5.66</y-m>
            <z-m> 0.53365</z-m>
        </offsets>
     </model>
    <model>
        <name>strobe-light-right</name>
        <path>Aircraft/c172p/Models/Effects/lights/procedural_light_right_strobe.xml</path>
        <offsets>
            <x-m>0.15</x-m>
            <y-m>5.66</y-m>
            <z-m>0.53459</z-m>
        </offsets>
     </model>


use below only if you are using a dual implementation with non-ALS
Code: Select all
    <animation>
        <type>select</type>
        <object-name>strobe-light-left</object-name>
        <nopreview/>
        <condition>
                <property>/sim/rendering/shaders/skydome</property>
        </condition>
    </animation>
    <animation>
        <type>select</type>
        <object-name>strobe-light-right</object-name>
        <nopreview/>
        <condition>
                <property>/sim/rendering/shaders/skydome</property>
        </condition>
    </animation>
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4809
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: animating AI PA-28 lights

Postby BecOzIcan » Fri Jul 27, 2018 2:33 pm

wlbragg wrote in Thu Jul 26, 2018 4:19 pm:I'm not sure what version of the c172p your using. It didn't have ALS procedural strobes until I added them yesterday (development repository). The current c172p in the dev repo supports both ALS and non-ALS implementations so it can be a bit confusing if your not totally versed. I am also using the same flash mechanism for both, I am not using the ALS flash mechanism of
Code: Select all
<is_strobe type="bool">false</is_strobe>

which you absolutely would if you were doing this for AI.

Thanks a lot for that. I looked at FGData and FGAddon repos on Sourceforge but couldn't find the code mentioned. In any case I can use the above is_strobe tag for both beacons and strobes at this point. My main priority is to move away from nasal for the AI fleet strobes. I ll revisit later if needed.

Cheers
Ian
Current Projects: AI Traffic, Models & Liveries
User avatar
BecOzIcan
 
Posts: 1038
Joined: Tue Oct 04, 2011 10:43 pm
Location: Sydney, NSW, Australia
Version: 2.12
OS: Win10

Re: animating AI PA-28 lights

Postby wlbragg » Fri Jul 27, 2018 4:06 pm

is_strobe tag for both beacons and strobes at this point.

Yes, I think so.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4809
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: animating AI PA-28 lights

Postby wkitty42 » Fri Jul 27, 2018 6:47 pm

wlbragg wrote in Thu Jul 26, 2018 4:19 pm:
I have started implementation of ALS lighting on my most recent model, re purposing the c172 code.


I'm not sure what version of the c172p your using.

the highly stripped AI one in FGData/AI/Aircraft/c172...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5568
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: animating AI PA-28 lights

Postby wkitty42 » Fri Jul 27, 2018 8:26 pm

wlbragg wrote in Thu Jul 26, 2018 4:19 pm:I am also using the same flash mechanism for both, I am not using the ALS flash mechanism of
Code: Select all
<is_strobe type="bool">false</is_strobe>

which you absolutely would if you were doing this for AI.

actually not... not when we can easily have differing blink patterns for different craft models... in other words, all pa-28 blink with the same pattern but c172 blink with a different pattern... right now i have 8 or 10 different models using this... KRDU never looked so colorful! CRJs, MD80s, Boeings, Airbuses, etc... i am not using is_strobe... it is still set to false because i want the various blink patterns that are set in the nasal code to work...


wlbragg wrote in Thu Jul 26, 2018 4:19 pm:@wkitty42

These are the pertinent files and/or code blocks

see both left and right...
Models/Effects/lights/procedural_light_left_strobe.xml
Models/Effects/lights/procedural_light_left_strobe.eff (make sure you set the is-strobe bool to "true" in this file)
Models/Effects/lights/strobe_light.ac

and in the ai-xml (don't forget to change paths where appropriate)

yes, i've been unable to use ian's single ac file with multiple objects in it so my current solution is using the individual object ac files that came out of the c182... i just don't know how to reference each object in ian's .ac file with multiple objects when the whole thing is loaded in one fell swoop... i don't know how to load each individual object individually from one large .ac file, either... i'm pretty sure i've also converted the existing craft that ian has done to use the ALS procedural lighting... the troubling thing i'm running into is having to duplicate so many files for one or two lines being different between them... i'll try to post some more as i'm working on adding the lights to more AI craft...

i do like ian's method of having the XXX-main.xml file and including that in each of the craft's xml files that simply load a texture... it seems to work very well except that i ran into one case where -main.xml loads some nasal to set some values for doors and i'm guessing that's for the animated jetways... anyway, no matter what i tried, i could not get ALS to work that way... i had to revert to adding it to each craft's blahblah.xml that loads blah-main.xml... that was the AI MD80...

while dealing with that problem, i ran across some code that might allow us to move the property from /sim/model into the AI's actual node tree in /ai/models... then each craft will have their own settings and the blinks will be based on when they are created... so two 787's sitting beside each other will not blink in unison... that's the idea anyway... i haven't gotten that to work and so have just gone on with the current implementation...

i've also changed the selection code so that
1. the beacons turn on when the craft is "valid=true".
2. the navigation lights turn on when the craft gets its transponder code.
3. the strobes flash any time the craft's velocities/true-airspeed/kts is not zero.

this works pretty well and seems to be, for now, pretty close to RL... at least with the few triggers we have access to... i'm still working on a way to latch the strobes on once they are initially turned on so when the craft is stopped, they will still flash... i think i've figured to use the velocities/vertical-speed-fps as part of the unlatching so when they land, they'll strobe all the way to parking and then when speed is zero, then all the lights will turn off until the craft is valid and gets a transponder code...

@ian, i just cannot figure out your animation translation stuff to move the light objects into place... i'm using simple offsets x-m, y-m, and z-m when i load the models... basically the same thing you're doing except much easier... the only other thing i'm using is the animation scale so be able to size the flashes... strobes of size 20 are beautiful and you can see the strobes from a long way off... they definitely get your attention! i can now see, on a nice clear night, craft blinking when they are 18-25nm away and up at altitude... it is a huge difference...

so real quick rundown of the order of loading... i'll use the Embraer-Legacy that i just did yesterday... now that i have the pattern down, it only takes maybe 10 minutes to add the code and then start aligning the light blobs with the locations on the craft... that's not too bad to do, though...

so we're going to load the Embraer-Legacy-UnitedAirlines.xml...
  1. AI/Aircraft/Embraer-Legacy/Embraer-Legacy-UnitedAirlines.xml
    1. loads AI/Aircraft/Embraer-Legacy/Embraer-Legacy-main.xml
      1. loads the AI/Aircraft/Embraer-Legacy/Models/legacy.ac
      2. sets up a gear animation
      3. loads the model AI/Aircraft/Embraer-Legacy/Lights/Embraer-Legacy-NavLights.xml
        1. loads the light models via AI/Lights/Embraer-Legacy-Lights.xml
          1. loads AI/Lights/Embraer-Legacy-beacon-top.xml and sets its x,y,z coordinates
            1. loads AI/Lights/Models/beacon-top.ac (we can't use one beacon.ac file for all the beacons because they each have different names in the .ac)
            2. uses animation to set the object's scale
            3. uses animation to set the object's dist-scale (i don't think this is working or needed with the ALS procedural lights)
            4. associates AI/Lights/Effects/Embraer-Legacy-beacon-top.eff with this object

              the step above is the important part!
              1. each object has its own effect (and effect file) for specific settings like effect name, visibility direction and the object's intensity-scale.
              2. the intensity-scale property uses one of the properties in /sim/model/Embraer-Legacy to make each object light up when it is supposed to.
              3. this uses the blink pattern coded into the property when it is set in Embraer-Legacy-main.xml later on.
              4. there are no graphics files for any of the objects. no png, no jpg, no rbg... the eff file sets the texture as "white"

          2. loads AI/Lights/Embraer-Legacy-beacon-bottom.xml and sets its x,y,z coordinates
            1. loads AI/Lights/Models/beacon-bottom.ac
            2. uses animation to set the object's scale
            3. uses animation to set the object's dist-scale
            4. associates AI/Lights/Effects/Embraer-Legacy-beacon-bottom.eff with this object
          3. loads AI/Lights/Embraer-Legacy-navlight-left.xml and sets its x,y,z coordinates
            1. loads AI/Lights/Models/navlight-left.ac
            2. uses animation to set the object's scale
            3. uses animation to set the object's dist-scale
            4. associates AI/Lights/Effects/Embraer-Legacy-navlight-left.eff with this object
          4. loads AI/Lights/Embraer-Legacy-navlight-right.xml and sets its x,y,z coordinates
            1. loads AI/Lights/Models/navlight-right.ac
            2. uses animation to set the object's scale
            3. uses animation to set the object's dist-scale
            4. associates AI/Lights/Effects/Embraer-Legacy-navlight-right.eff with this object
          5. loads AI/Lights/Embraer-Legacy-navlight-tail.xml and sets its x,y,z coordinates
            1. loads AI/Lights/Models/navlight-tail.ac
            2. uses animation to set the object's scale
            3. uses animation to set the object's dist-scale
            4. associates AI/Lights/Effects/Embraer-Legacy-navlight-tail.eff with this object
          6. loads AI/Lights/Embraer-Legacy-strobe-left.xml and sets its x,y,z coordinates
            1. loads AI/Lights/Models/strobe-left.ac
            2. uses animation to set the object's scale
            3. uses animation to set the object's dist-scale
            4. associates AI/Lights/Effects/Embraer-Legacy-strobe-left.eff with this object
          7. loads AI/Lights/Embraer-Legacy-strobe-right.xml and sets its x,y,z coordinates
            1. loads AI/Lights/Models/strobe-right.ac
            2. uses animation to set the object's scale
            3. uses animation to set the object's dist-scale
            4. associates AI/Lights/Effects/Embraer-Legacy-strobe-right.eff with this object
        2. group the beacons together
        3. group navigation lights together
        4. group strobe lights together
        5. set select animations for each of the groups
          • BeaconGrouped turns on when "Valid" equal true and when (currently) /sim/model/Embraer-Legacy/lighting/beacons/state is true
          • StaticGrouped turns on when "transponder-id" is not equal to zero and when (currently) /sim/model/Embraer-Legacy/lighting/navlights/state is true
          • StrobeGrouped turns on when "velocities-true-airspeed-kts" is not equal to zero and when (currently) /sim/model/Embraer-Legacy/lighting/strobes/state is true
      4. load the beacons and strobes pulse behavior and i've added navlights too.
        (this is where we can set the various blink patterns for the beacons and strobes.)
    2. loads the AI/Aircraft/Embraer-Legacy/Textures/United Airlines texture for the craft
  2. and we're done!
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5568
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: animating AI PA-28 lights

Postby BecOzIcan » Sat Jul 28, 2018 3:20 am

wkitty42 wrote in Fri Jul 27, 2018 8:26 pm:actually not... not when we can easily have differing blink patterns for different craft models... in other words, all pa-28 blink with the same pattern but c172 blink with a different pattern...

I had the same approach initially, but limited to two strobe blinking patterns (Airbus vs Boeing). Issue is the effect is obtained with Nasal which apparently -from what I can read in forums and tech doc- has a huge impact on performance, hence my current approach to reverting to basic 'is-strobe' as I deploy lights to more and more AI models

wkitty42 wrote in Fri Jul 27, 2018 8:26 pm:yes, i've been unable to use ian's single ac file with multiple objects in it so my current solution is using the individual object ac files that came out of the c182...

Same issue for me, I guess the problems comes from the need to add the effect for each light. I have not persisted in this avenue either because -still from performance concern- I am trying to limit the number of objects used.

wkitty42 wrote in Fri Jul 27, 2018 8:26 pm:it seems to work very well except that i ran into one case where -main.xml loads some nasal to set some values for doors and i'm guessing that's for the animated jetways...

Correct., my older AI models had animated jetways compatibility code but I moved away from that as very little airports have it and again concerns about nasal impact on performance

Also from a previous post, you can easily identify any and all of the objects in an .ac file by simply opening said file in notepad++ See below extract which shows the number of objects (Kids) as well as the name for each of them (just browse for lines starting with "name" )

Code: Select all
AC3Db
MATERIAL "ac3dmat1" rgb 1 1 1  amb 0.2 0.2 0.2  emis 0 0 0  spec 0.2 0.2 0.2  shi 128  trans 0
OBJECT world
kids 8
OBJECT poly
name "Left_Wing_Strobe"
loc -36.6311 3.64398 0
texture "NavLights.png"
crease 45.000000
numvert 25
41.6311 -3.64398 0
...



Cheers
Ian
Current Projects: AI Traffic, Models & Liveries
User avatar
BecOzIcan
 
Posts: 1038
Joined: Tue Oct 04, 2011 10:43 pm
Location: Sydney, NSW, Australia
Version: 2.12
OS: Win10

Re: animating AI PA-28 lights

Postby wkitty42 » Mon Jul 30, 2018 12:15 pm

BecOzIcan wrote in Sat Jul 28, 2018 3:20 am:
wkitty42 wrote in Fri Jul 27, 2018 8:26 pm:actually not... not when we can easily have differing blink patterns for different craft models... in other words, all pa-28 blink with the same pattern but c172 blink with a different pattern...

I had the same approach initially, but limited to two strobe blinking patterns (Airbus vs Boeing). Issue is the effect is obtained with Nasal which apparently -from what I can read in forums and tech doc- has a huge impact on performance, hence my current approach to reverting to basic 'is-strobe' as I deploy lights to more and more AI models

i think i've run into that... i added the lights to another craft the other day and suddenly some beacons work and others do not... some navs work and others do not... some strobes work and others do not... it is vexing to say the least... i've wondered about maybe i'm running into a limit of the number of effects i can have but it very well could be the nasal... i'll go switch mine to use the isStrobe property, comment out the nasal loader, and see if that frees things up... if it does, we could switch to using the properties in each AI craft's controls/lighting tree... all AI craft on my system have

/ai/models/aircraft[0]/controls/lighting/beacon (bool set to true by something)
/ai/models/aircraft[0]/controls/lighting/nav-lights (bool set to false by something)
/ai/models/aircraft[0]/controls/lighting/strobe (bool set to true by something)

beacon and strobe are CTRL-Clickable to toggle them between true/false but nav-lights, even though it says it is a bool, will not CTRL-Click toggle... the only problem i think there may be with this is how to tell the eff files to use these properties... maybe, but i'm not sure, they can be referenced in the same way as the craft does with (eg) the valid and transponder-id properties??

BecOzIcan wrote in Sat Jul 28, 2018 3:20 am:
wkitty42 wrote in Fri Jul 27, 2018 8:26 pm:yes, i've been unable to use ian's single ac file with multiple objects in it so my current solution is using the individual object ac files that came out of the c182...

Same issue for me, I guess the problems comes from the need to add the effect for each light. I have not persisted in this avenue either because -still from performance concern- I am trying to limit the number of objects used.

2 beacons, 2 strobes and 3 navs is what i understand to be the minimum... however, i think the problem with trying to use your original NavLights.ac file is that you have texture assigned to the objects... there is no texture in any of the individual ones...

i'm also still not sure how to load only one of the objects in your NavLights.ac file if only one is desired...

BecOzIcan wrote in Sat Jul 28, 2018 3:20 am:
wkitty42 wrote in Fri Jul 27, 2018 8:26 pm:it seems to work very well except that i ran into one case where -main.xml loads some nasal to set some values for doors and i'm guessing that's for the animated jetways...

Correct., my older AI models had animated jetways compatibility code but I moved away from that as very little airports have it and again concerns about nasal impact on performance

oh! ok... i guess the AJ code in the MD80 can be removed then? plus there seems to be some changes wanted for the AJ's... there's already the thing about they shouldn't need to write to disk which has held them up from being totally accepted... now there's talk about maybe adding them to the groundnets but that's not really a good place...

BecOzIcan wrote in Sat Jul 28, 2018 3:20 am:Also from a previous post, you can easily identify any and all of the objects in an .ac file by simply opening said file in notepad++ See below extract which shows the number of objects (Kids) as well as the name for each of them (just browse for lines starting with "name" )

yeah, i figured that out when i was digging around trying to figure out why i could load the individual ac files but not your all-in-one... i ended up renaming the objects in the individual ac files from the 182 so they matched your's in your all-in-one file... that way the code would be identical and IF i could ever figure out how to load your all-in-one ac file, i wouldn't have to change anything...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5568
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: animating AI PA-28 lights

Postby BecOzIcan » Mon Jul 30, 2018 1:25 pm

wkitty42 wrote in Mon Jul 30, 2018 12:15 pm:IF i could ever figure out how to load your all-in-one ac file, i wouldn't have to change anything...


Not sure I understand your problem. All my AI models used the same set of lights (until I switched to Procedural yesterday for the A220

Geometry itself is in AI\Lights\NavLights.ac and contains the 8 light objects (3 nav, 3 strobe, 2 beacons)
Geometry is referenced by AI\Lights\NavLights.xml (sole purpose is to name the ac for use in property files)

Each aircraft then has a Lights config file in its directory as (example) \AI\Aircraft\777\Lights\77L-NavLights.xml which loads the above generic set of lights and then reposition them for the particular aircraft configuration. It also contains the conditions for showing them (Speed, Altitude, Transponder) but they are generic ie same in all my models xml.

Finally, each Aircraft main ie \AI\Aircraft\777\\77L-main.xml has the code to load the lights config above and the nasal to set the pulsing frequency of strobes.

I could have handled the config and main xmls with a single main file but prefer my main to remain simple ie be a command file which loads all of the others (like the lightmap or the navlights)

So really, to add the lights to an AI aircraft you only need to copy across the 77L-NavLights.xml, rename for your aircraft then change the lights position inside; then add the same lines I do in your main

The only trick I can think of is the nasal part in the config file. The name (B777) in my example below can be whatever but must match the one you will use in your main to code the pulsing sequence

ie in my 77L-main.xml

Code: Select all
 <!-- Enable Beacons and Strobes Pulse Behaviour -->
  <nasal>
    <load><![CDATA[
        aircraft.light.new("/sim/model/B777/lighting/beacon", [0.7, 1.3]);
        aircraft.light.new("/sim/model/B777/lighting/strobes", [0.02, 1.98]);
        setprop("/sim/model/B777/lighting/beacon/enabled", 1);
        setprop("/sim/model/B777/lighting/strobes/enabled", 1);
      ]]></load>
    <unload></unload>
  </nasal>


and in my 77L-Navlights.xml

Code: Select all
 <!-- Show Strobes when Aircraft on runway or airborne -->
  <animation>
    <type>select</type>
    <object-name>StrobeGrouped</object-name>
    <nopreview />
    <condition>
      <and>
        <property>/sim/model/B777/lighting/strobes/state</property>
        <greater-than>
          <property>velocities/true-airspeed-kt</property>
          <value>40</value>
        </greater-than>
      </and>
    </condition>
  </animation>



I am not sure either how you expect a property to trigger (CTRL-something) the lights of an AI models as AI does not contain any user interaction/property AFAIK. Maybe you are building an FDM aircraft?

Finally, I wouldn't recommend you rely on my existing AI NavLight material, I am switching all my models to non nasal and these files will be removed in about a month time.

Cheers
Ian
Current Projects: AI Traffic, Models & Liveries
User avatar
BecOzIcan
 
Posts: 1038
Joined: Tue Oct 04, 2011 10:43 pm
Location: Sydney, NSW, Australia
Version: 2.12
OS: Win10

Re: animating AI PA-28 lights

Postby wkitty42 » Mon Jul 30, 2018 1:29 pm

i've been thinking that we should ask if the eff stuff can have a feature added to it for the strobes and beacons... maybe something like this...

for strobes:
Code: Select all
    <is_strobe type="bool">true</is_strobe>
    <strobe_pattern>[0.2, 0.75, 0.2, 0.75, 0.2, 1.5]</strobe_pattern>


for beacons:
Code: Select all
    <is_strobe type="bool">true</is_strobe>
    <strobe_pattern>[0.25, 0.25]</strobe_pattern>


it would provide defined blink rates like your nasal code did... the numbers would be just like you were using... on period, off period... allow to define what? maybe a max of five on/off pairs to keep things from getting too weird? set strobe_pattern to [0.0, 0.0] to use the existing pattern?

either way we go, some craft are going to have to bring their own if the centralized stuff in /AI/Lights is too generic... like you have your existing B777 and 757/767 stuff in there... i looked to see if there was some way for them to use one set and have the different parts be in the craft's localized directory but had a time figuring out the flow... i finally figured it out when working on the GA craft i did... you can see that in my code flow outline above... except now all of the specific light eff and xml files are in the craft's Lights directory... that mainly because of the one or two line differences between them... i had added my work into the central directory, too, but found that i was having to provide a slightly different set for each one... since each one had its own it made no sense to put them in the centralized directory so i went and moved them all back into each craft's localized directory... i can't count how many times i've typed "beacon-bottom" and the others over and over while adjusting all of the craft i've been working with... that's 15 files per base craft and i have done a dozen or so craft :lol:
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5568
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: animating AI PA-28 lights

Postby wkitty42 » Mon Jul 30, 2018 1:38 pm

BecOzIcan wrote in Mon Jul 30, 2018 1:25 pm:
wkitty42 wrote in Mon Jul 30, 2018 12:15 pm:IF i could ever figure out how to load your all-in-one ac file, i wouldn't have to change anything...


Not sure I understand your problem.

here's the two problems i face... it may be that i just have not seen what i'm trying to figure out explained very simply...

let's say you have groupedobjs.ac that contains obj1, obj2, and obj3.
in your code, you simply load groupedobjs.ac and all the objects are loaded.
Code: Select all
<path>groupedobjs.ac</path>

1. how do you reference them? they're all loaded in one fell swoop so how do you access each one individually?

2. then let's say that you only want to load just obj2 from that file and none of the others... how do you do that?
i haven't seen anything like namespaces where you might use
Code: Select all
<path>groupedobjs.ac[obj2]</path>
or
Code: Select all
<path>groupedobjs.ac</path>
<object>obj2</object>
to load only obj2... i know about object-name referencing the name but i don't know if that is giving the object a name or referencing the one it was given in the ac file...


does that explain the problem(s) better?
Last edited by wkitty42 on Mon Jul 30, 2018 2:02 pm, edited 3 times in total.
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5568
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: animating AI PA-28 lights

Postby BecOzIcan » Mon Jul 30, 2018 1:50 pm

The answer is in \AI\Aircraft\777\Lights\77L-NavLights.xml (and in my previsou post)

If you look at this config file more closely you'll see that

The first line <path> references the full geometry (via its naming xml)
but
the rest of the lines (animation) reference individual objects in the geometry via <object-name> as per http://wiki.flightgear.org/Howto:Animate_models

you do not need to use/animate every object in the geometry, they can be in there but not shown/used.
See for example the two different main.xml for AI Aircraft 735, one will show the winglets, the other won't (even if the object is still loaded with the geometry)

Cheers
Ian
Last edited by BecOzIcan on Mon Jul 30, 2018 2:00 pm, edited 1 time in total.
Current Projects: AI Traffic, Models & Liveries
User avatar
BecOzIcan
 
Posts: 1038
Joined: Tue Oct 04, 2011 10:43 pm
Location: Sydney, NSW, Australia
Version: 2.12
OS: Win10

Re: animating AI PA-28 lights

Postby wkitty42 » Mon Jul 30, 2018 1:59 pm

BecOzIcan wrote in Mon Jul 30, 2018 1:25 pm:Each aircraft then has a Lights config file in its directory as (example) \AI\Aircraft\777\Lights\77L-NavLights.xml which loads the above generic set of lights and then reposition them for the particular aircraft configuration. It also contains the conditions for showing them (Speed, Altitude, Transponder) but they are generic ie same in all my models xml.

there's no path or property name differences between those for the (eg) 777 and the 747?

BecOzIcan wrote in Mon Jul 30, 2018 1:25 pm:Finally, each Aircraft main ie \AI\Aircraft\777\\77L-main.xml has the code to load the lights config above and the nasal to set the pulsing frequency of strobes.

yeah, that was the nasal stuff... how are you doing different blink patterns now without nasal?

BecOzIcan wrote in Mon Jul 30, 2018 1:25 pm:I could have handled the config and main xmls with a single main file but prefer my main to remain simple ie be a command file which loads all of the others (like the lightmap or the navlights)

yeah, yesterday i brought all mine back to the same level you have... it allowed me to get rid of AI/Lights/%craft%-Lights.xml and just put all that into AI/Aircraft/%craft%/Lights/Lights.xml and move all of the %craft%-beacon-bottom.xml to AI/Aircraft/%craft%/Lights/beacon-bottom.xml... the same was done with my effects files, too...

BecOzIcan wrote in Mon Jul 30, 2018 1:25 pm:So really, to add the lights to an AI aircraft you only need to copy across the 77L-NavLights.xml, rename for your aircraft then change the lights position inside; then add the same lines I do in your main

yeah, that's how i started until i realized that there were some parts that were different if only a few characters in one line...

eg: these lines from beacon-top.eff for various craft
Code: Select all
    <intensity_scale type="float"><use>/sim/model/c177/lighting/beacons</use></intensity_scale>
    <intensity_scale type="float"><use>/sim/model/c172/lighting/beacons</use></intensity_scale>
    <intensity_scale type="float"><use>/sim/model/beech-200/lighting/beacons</use></intensity_scale>
    <intensity_scale type="float"><use>/sim/model/MD80/lighting/beacons</use></intensity_scale>
    <intensity_scale type="float"><use>/sim/model/ERJ195/lighting/beacons</use></intensity_scale>
but every one of the individual light-position.xml files has the same one or two line differences, too... i am able to centralize only the individual object ac files so that's seven files less that has to be copied around...

BecOzIcan wrote in Mon Jul 30, 2018 1:25 pm:The only trick I can think of is the nasal part in the config file. The name (B777) in my example below can be whatever but must match the one you will use in your main to code the pulsing sequence

i thought you said you dropped the nasal? but yeah, that's another place where there's a slight difference in otherwise duplicate code across the lighted craft...

BecOzIcan wrote in Mon Jul 30, 2018 1:25 pm:I am not sure either how you expect a property to trigger (CTRL-something) the lights of an AI models as AI does not contain any user interaction/property AFAIK. Maybe you are building an FDM aircraft?

dude... you're not thinking ;) in the sim, hit "/" to bring up the property tree... now go to ai/models/aircraft/controls/lighting... see those three booleans defined? hold your CTRL key down and click on the beacon line and watch it toggle from 'true' to 'false'... CTRL-click it again and watch it toggle back... the nav-lights one is broken and won't toggle but beacon and strobe will... every single boolean in the property tree can be toggled with CTRL-click...

BecOzIcan wrote in Mon Jul 30, 2018 1:25 pm:Finally, I wouldn't recommend you rely on my existing AI NavLight material, I am switching all my models to non nasal and these files will be removed in about a month time.

you're too late... i'm already there :lol: :mrgreen:
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5568
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: animating AI PA-28 lights

Postby wkitty42 » Mon Jul 30, 2018 2:06 pm

BecOzIcan wrote in Mon Jul 30, 2018 1:50 pm:See for example the two different main.xml for AI Aircraft 735, one will show the winglets, the other won't (even if the object is still loaded with the geometry)

so object-name is not assigning the object's name that we're going to use?

you can't do this?
Code: Select all
<model>
  <path>object1.ac</path>
  <object-name>beacon-top<object-name>
</model>
<model>
  <path>object1.ac</path>
  <object-name>beacon-bottom<object-name>
</model>

where we have one ac file with one object but we load it and reference it via two different names???
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5568
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Next

Return to AI Traffic

Who is online

Users browsing this forum: No registered users and 2 guests