Board index FlightGear Support Multiplayer

Multiplayer & smoke

Trouble getting online, setting up a server?
Forum rules
In order to help you, we need to know a lot of information. Make sure to include answers to at least the following questions in your initial post.

- what OS (Windows Xp/Vista, Mac etc.) are you running?
- what FlightGear version do you use?
- copy&paste your commandline.

Please, also see Requesting Technical Help.

Note: If you did not get a reponse, even after 7 days, you may want to check out the FlightGear mailing lists to ask your question there.

Multiplayer & smoke

Postby Albert » Mon Jul 26, 2010 9:57 am

Hi.

In multiplayer mode I can see the smoke (based on particle system http://wiki.flightgear.org/index.php/Ho ... _contrails) of my aircraft but I can't see the smoke of the other aircrafts.

Is it a limitation of the multiplayer protocol or do I need to set some option?

Thanks.

Alberto
Albert
 
Posts: 20
Joined: Mon Jun 07, 2010 1:10 pm

Re: Multiplayer & smoke

Postby AndersG » Mon Jul 26, 2010 10:18 am

Albert wrote:Hi.

In multiplayer mode I can see the smoke (based on particle system http://wiki.flightgear.org/index.php/Ho ... _contrails) of my aircraft but I can't see the smoke of the other aircrafts.

Is it a limitation of the multiplayer protocol or do I need to set some option?


Particle systems are loaded together with the model (if included) for MP/AI aircraft but the controlling property is not likely to be sent over MP unless the aircraft designer configure it that way.

A standard way to do that is to alias one of the generic MP enabled properties to the property controlling the particle system.
E.g. in the set file:
Code: Select all
...
 <sim>
...
  <multiplay>
   <generic>
    <float n="0" alias="/sim/model/some-particle-system-trigger"/>
...
   </generic>
  </multiplay>
...
 </sim>
...


The reverse alias mapping needs to be set for the MP/AI model, which is easiest done via "onload" Nasal block in the 3d model XML file:
Code: Select all
...
 <nasal>
  <load>
##############################################################################
# The on-load Nasal is not executed when this file is loaded as the user aircraft.
##############################################################################
var rplayer = cmdarg();
# Set up property aliases for animations.
rplayer.getNode("sim/model/some-particle-system-trigger", 1).
  alias(rplayer.getNode("sim/multiplay/generic/float[0]"));
##############################################################################
  </load>
...
 </nasal>
...


Cheers,

Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2463
Joined: Wed Nov 29, 2006 9:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: Multiplayer & smoke

Postby Albert » Wed Jul 28, 2010 1:57 pm

AndersG wrote:Particle systems are loaded together with the model (if included) for MP/AI aircraft but the controlling property is not likely to be sent over MP unless the aircraft designer configure it that way.
A standard way to do that is to alias one of the generic MP enabled properties to the property controlling the particle system.

Thanks.

But I'm a bit confused.

My goal: I modify a property, for example "/something/value", and I want to modify the same property in my aircraft on the other players FlightGear.

In the file aircraft-set.xml I have written
Code: Select all
<sim>
  <multiplay>
    <generic>
      <int n="0" alias="/something/value">
    </generic>
  </multiplay>
</sim>


If I change the value of "/something/value" then I also change the value of "/sim/multiplay/generic/int[0]" and sent it to my aircraft on the other players Flightgear, didn'it?

How can I use it on the "receiver side" (my aircraft in the other players FlightGear)? What is the property that receive the value sent by "/sim/multiplay/generic/int[0]"?

"/something/value" (local) -> "/sim/multiplay/generic/int[0]" (local) -> Multiplayer protocol -> ??? (remote) -> "/something/value" (remote)

Thanks.

Alberto
Last edited by Albert on Thu Jul 29, 2010 2:32 pm, edited 1 time in total.
Albert
 
Posts: 20
Joined: Mon Jun 07, 2010 1:10 pm

Re: Multiplayer & smoke

Postby AndersG » Wed Jul 28, 2010 9:45 pm

Albert wrote:If I change the value of "\something\value" then I also change the value of "\sim\multiplay\generic\int[0]" and sent it to my aircraft on the other players Flightgear, didn'it?


Yes.

Albert wrote:How can I use it on the "receiver side" (my aircraft in the other players FlightGear)? What is the property that receive the value sent by "\sim\multiplay\generic\int[0]"?


The MP system gives you
"/something/value" (local) -> "/sim/multiplay/generic/int[0]" (local) -> Multiplayer protocol -> /ai/models/multiplayer[x]/sim/multiplay/generic/int[0] (remote)

When loaded as a MP/AI model your aircraft gets its own subtree in the property tree rooted at /ai/models/multiplayer[x] (x depends on what other players are present but there is usually no need to know it anyway). Relative paths in animations of your 3d model, e.g. 'something/value', will be treated as /ai/models/multiplayer[x]/something/value. Absolute paths (i.e. starting with '/') will still start from the real root of the property tree - this is very seldom what you want so one should almost always use relative paths in animations.

To do the last step, that is, get the value into /ai/models/multiplayer[x]/something/value you need the Nasal code I showed above in the 3d model file for your aircraft.

Also, note that the separator for property paths is '/' not '\'.

/Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2463
Joined: Wed Nov 29, 2006 9:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: Multiplayer & smoke

Postby Albert » Thu Jul 29, 2010 2:30 pm

Thank you Anders.

But it doesn't work. On local aircraft it's all OK, but on remote aircraft nothing happens.

I have modified my model in this way:

FILE: aircraft-set.xml
Code: Select all
...
<sim>
  ...
  <multiplay>
    <generic>
      <int n="0" alias="/something/value"/>
    </generic>
  </multiplay>
</sim>
...
<something>
  <value>0</value>
</something>
...
<key n="107">
  <name>k</name>
  <desc>Do it</desc>
  <binding>
    <command>property-assign</command>
    <property>/something/value</property>
    <value>1</value>
  </binding>
</key>
...

FILE: models/aircraft.xml
Code: Select all
...
<nasal>
  <load>
    var s=cmdarg();
    s.getNode("something/value").alias(s.getNode("sim/multiplay/generic/int[0]"));
  </load>
</nasal>
...

FILE: models/doit.xml
Code: Select all
...
<condition>
  <property>something/value</property>
</condition>
...

What's wrong?

Thanks.

Alberto

PS: Thank you for "\", I have corrected my post.
Last edited by Albert on Fri Jul 30, 2010 10:42 am, edited 2 times in total.
Albert
 
Posts: 20
Joined: Mon Jun 07, 2010 1:10 pm

Re: Multiplayer & smoke

Postby AndersG » Thu Jul 29, 2010 2:52 pm

Albert wrote:Thank you Andres.

But it doesn't work. On local aircraft it's all OK, but on remote aircraft nothing happens.


I can't see anything obviously wrong. You could use the property browser (File->Browse internal properties) to check whether the sim/multiplay/generic/int value is propagated over MP or not (i.e. look at /sim/multiplay/generic/int on the sender side and /ai/model/multiplayer[x]/sim/multiplay/generic/int on the remote side).
Is the file doit.xml file loaded by models/aircraft.xml? (Otherwise it is most likely not loaded on the remote side.)

/Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2463
Joined: Wed Nov 29, 2006 9:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: Multiplayer & smoke

Postby Albert » Fri Jul 30, 2010 10:25 am

AndersG wrote:I can't see anything obviously wrong.


Now it works.

I have added "type" in property:
Code: Select all
...
<something>
  <value type="int">0</value>
</something>
...


I have also found http://www.mail-archive.com/flightgear- ... 18962.html
I think it could be useful to make a simple wiki page on this topic.

Thank you again, Anders.

Alberto
Albert
 
Posts: 20
Joined: Mon Jun 07, 2010 1:10 pm

Re: Multiplayer & smoke

Postby sim » Sun Aug 08, 2010 6:08 pm

What aeroplanes does smoke work on Albert?
User avatar
sim
 
Posts: 1445
Joined: Tue Jun 30, 2009 2:13 pm
Location: Shropshire England
Callsign: Fly4Fun
Version: 0.9.10 up
OS: 64 Win 10 HD6450

Re: Multiplayer & smoke

Postby Albert » Wed Aug 18, 2010 9:50 am

sim wrote:What aeroplanes does smoke work on Albert?

viewtopic.php?t=8604&start=15
Albert
 
Posts: 20
Joined: Mon Jun 07, 2010 1:10 pm

Re: Multiplayer & smoke

Postby sim » Wed Aug 18, 2010 8:34 pm

Cheers Albert for showing me the gen, still using FG 1.9.1. at the present time but will get round to testng MP PAN 2 next time I load FG 2.0.0. Was hoping to get smoke effect on a 777. Thought it would look great for my zero feet inverted runs down the KSFO runway 28 centreline etc. The 777 that comes with FG 1.9.1. has better flying characteristics upside down than the latest version which becomes less predictable inverted! I crash frequently enough pushing my luck with the new 'un !
Cheers, sim
User avatar
sim
 
Posts: 1445
Joined: Tue Jun 30, 2009 2:13 pm
Location: Shropshire England
Callsign: Fly4Fun
Version: 0.9.10 up
OS: 64 Win 10 HD6450


Return to Multiplayer

Who is online

Users browsing this forum: No registered users and 2 guests