Board index FlightGear Development Aircraft

Multiplayer Aircraft Properties  Topic is solved

Questions and discussion about creating aircraft. Flight dynamics, 3d models, cockpits, systems, animation, textures.

Multiplayer Aircraft Properties

Postby D-ECHO » Sat Jun 13, 2020 3:07 pm

Hi there

I'm trying to make animations over MP visible. The properties are transmitted via sim/multiplay/generic/. To use human-readable property names in the XML file, I want to use the method described in this wiki article: http://wiki.flightgear.org/Howto:Transm ... es_over_MP
Code: Select all
var rplayer = cmdarg();
# Set up property aliases for animations.
rplayer.getNode("engines/engine/prop-pos-norm", 1).alias(rplayer.getNode("sim/multiplay/generic/float[10]"));

(inside the animation .xml file, under <nasal><load>).

Unfortunately this doesn't seem to work, because engines/engine/prop-pos-norm is not existing in the multiplayer aircraft sub-tree. Am I missing something or is this a bug?

Regards and thanks
User avatar
D-ECHO
 
Posts: 2080
Joined: Sat May 09, 2015 12:31 pm

Re: Multiplayer Aircraft Properties

Postby wlbragg » Sat Jun 13, 2020 5:22 pm

Only the obvious question, is sim/multiplay/generic/float[10] defined in the set as

Code: Select all
<multiplay>
  <chat_display>1</chat_display>
   <generic>
     ~~~
     <float n="10" alias="/engines/engine/prop-pos-norm"/>
     ~~~
   </generic>
</multiplay>
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5607
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Multiplayer Aircraft Properties

Postby D-ECHO » Sat Jun 13, 2020 5:38 pm

Yes it is
User avatar
D-ECHO
 
Posts: 2080
Joined: Sat May 09, 2015 12:31 pm

Re: Multiplayer Aircraft Properties

Postby SurferTim » Sun Jun 14, 2020 11:00 am

I played with that yesterday, and couldn't get any nasal script to execute in nasal load.
This is from the link in your OP. Any idea what this means?
Code: Select all
##############################################################################
   # The on-load Nasal is not executed when this file is loaded as the user
   # aircraft.
   ##############################################################################
Fly low, fly slow, land on a dime. Twin Otter DHC6-300+. https://github.com/SurferTim/dhc6p
PirateAir videos at https://www.youtube.com/user/SurferTim850
User avatar
SurferTim
 
Posts: 953
Joined: Sun Dec 09, 2018 5:49 pm
Location: Miramar Beach, FL
Callsign: Pirate
Version: 2019.2.0
OS: Ubuntu 18.04

Re: Multiplayer Aircraft Properties

Postby D-ECHO » Sun Jun 14, 2020 11:28 am

It basically means exactly what it states - the block in <nasal> is only loaded when the aircraft is shown as a multiplayer aircraft, not when being the user aircraft
User avatar
D-ECHO
 
Posts: 2080
Joined: Sat May 09, 2015 12:31 pm

Re: Multiplayer Aircraft Properties

Postby wlbragg » Sun Jun 14, 2020 4:04 pm

Have you tried making a filter for /engines/engine/prop-pos-norm to be a different property and trying to pass that property instead?

Where does /engines/engine/prop-pos-norm come from?
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5607
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Multiplayer Aircraft Properties

Postby wlbragg » Sun Jun 14, 2020 4:20 pm

We used different property for spin in both c172p and Cub

c172p
In set.xml
Code: Select all
    <controls>
        <flight>
            <speedbrake alias="/engines/active-engine/rpm"/>
        </flight>
    </controls>

Models/
Code: Select all
    <params>
        <engine>
            <rpm>controls/flight/speedbrake</rpm>
            <crashed>sim/multiplay/generic/int[3]</crashed>
        </engine>
    </params>


J3Cub
set
Code: Select all
        <engine n="2">
            <rpm alias="/engines/active-engine/rpm"/>
        </engine>

Models/
Code: Select all
        <engine>
            <rpm>engines/engine[2]/rpm</rpm>
        </engine>


A shot in the dark, is there an initialization in the set file for /engines/engine/prop-pos-norm as in
Code: Select all
<engines>
 <engine>
  <prop-pos-norm type="float">0.0</prop-pos-norm>
 </engine>
</engines>
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5607
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Multiplayer Aircraft Properties

Postby D-ECHO » Sun Jun 14, 2020 4:25 pm

The property is coming from a nasal script.
Code: Select all
         interpolate("/engines/engine/prop-pos-norm", 1.00, 5);


I have tried with a completely different property, which is not modified by anything (once declared in -set.xml) and it worked, so now I'm going to try and find out the reason it didn't work at first :P

Will keep you updated!

[EDIT] Yes it is initialized in the set file, it was a double but changing to a float didn't change the situation
User avatar
D-ECHO
 
Posts: 2080
Joined: Sat May 09, 2015 12:31 pm

Re: Multiplayer Aircraft Properties  

Postby D-ECHO » Sun Jun 14, 2020 4:35 pm

Turns out my mistake was that you have to purposefully look at the other model in order for it to be loaded and thus in order for the on-load nasal to be executed. Thanks everyone for the help though!
User avatar
D-ECHO
 
Posts: 2080
Joined: Sat May 09, 2015 12:31 pm

Re: Multiplayer Aircraft Properties

Postby wlbragg » Sun Jun 14, 2020 4:54 pm

FYI

Using rplayer.initNode, may have meaning for you?

I don't know why we use the nasal initNode and then the normal MP alias property?

initNode
Code: Select all
    <nasal>
        <load>
            var rplayer = cmdarg();

            # Gear
            rplayer.initNode("sim/multiplay/generic/int[6]", 0, "BOOL");
            rplayer.initNode("sim/multiplay/generic/int[7]", 0, "BOOL");
            rplayer.initNode("sim/multiplay/generic/int[8]", 0, "BOOL");
        </load>
    </nasal>

and
Code: Select all
    <params>
        <gear_nose_broken>
            <property>sim/multiplay/generic/int[6]</property>
        </gear_nose_broken>
        <gear_left_broken>
            <property>sim/multiplay/generic/int[7]</property>
        </gear_left_broken>
        <gear_right_broken>
            <property>sim/multiplay/generic/int[8]</property>
        </gear_right_broken>
    </params>


Could this be written as

<nasal>
<load>
var rplayer = cmdarg();

rplayer.initNode("sim/multiplay/generic/int[6]", 0, "FLOAT");
or
rplayer.initNode("engines/engine/prop-pos-norm", 0, "FLOAT");

rplayer.getNode("engines/engine/prop-pos-norm", 1).alias(rplayer.getNode("sim/multiplay/generic/int[6]"));
</load>
</nasal>
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5607
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Multiplayer Aircraft Properties

Postby wlbragg » Sun Jun 14, 2020 4:55 pm

OK, scratch my last post.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5607
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480


Return to Aircraft

Who is online

Users browsing this forum: cyyz_spotter and 4 guests