Hello ,
Two patch that solve for me , multiscreen problematic .
The first patch solve the problem that on my second screen , i don't see rotor
turn .
The second patch introduce a new variant for the option multiplayer .
This variant is a repeat mode .
The idea is to propagate all multiplayer event to a another instance of
flightgear .
The major effect is i can see other player on my second screen .
Example :
On my master ( 192.168.12.10 )
fgfs --aircraft=bo105 --disable-auto-coordination \
--native-fdm=socket,out,90,192.168.12.8,5505,udp
--native-ctrls=socket,out,90,192.168.12.8,5506,udp \
--multiplay=in,20,192.168.12.10,5000
--multiplay=out,20,mpserver01.flightgear.org,5000
--multiplay=repeat,20,192.168.12.8,5510 \
On my slave ( 192.168.12.8 )
fgfs --aircraft=bo105 \
--native-fdm=socket,in,90,192.168.12.8,5505,udp
--native-ctrls=socket,in,90,192.168.12.8,5506,udp \
--fdm=null \
--multiplay=in,10,192.168.12.8,5510
--
____________________________________________________________
/ Erwan MAS /\
| mailto:[EMAIL PROTECTED] |_/
___|________________________________________________________ |
\___________________________________________________________\__/
--- FlightGear-1.0.0.orig/src/Network/net_fdm.hxx 2006-03-21
19:51:57.000000000 +0100
+++ flightgear-1.0.0/src/Network/net_fdm.hxx 2008-05-22 10:55:50.000000000
+0200
@@ -22,7 +22,7 @@
// I am not aware of any platforms that don't use 4 bytes for float
// and 8 bytes for double.
-const uint32_t FG_NET_FDM_VERSION = 24;
+const uint32_t FG_NET_FDM_VERSION = 26;
// Define a structure containing the top level flight dynamics model
@@ -35,7 +35,9 @@
enum {
FG_MAX_ENGINES = 4,
FG_MAX_WHEELS = 3,
- FG_MAX_TANKS = 4
+ FG_MAX_TANKS = 4,
+ FG_MAX_ROTOR_BLADE = 4 ,
+ FG_MAX_TAIL_BLADE = 2
};
uint32_t version; // increment when data values change
@@ -120,6 +122,20 @@
float nose_wheel;
float speedbrake;
float spoilers;
+
+ // helicopter variables
+ float rotors_main_rpm ;
+ float rotors_main_roll ;
+ float rotors_main_yaw ;
+ uint32_t num_rotors_main_blade ;
+ float rotors_main_blade_flap[FG_MAX_ROTOR_BLADE];
+ float rotors_main_blade_incidence[FG_MAX_ROTOR_BLADE];
+ float rotors_main_blade_position[FG_MAX_ROTOR_BLADE];
+ uint32_t num_rotors_tail_blade ;
+ float rotors_tail_rpm ;
+ float rotors_tail_blade_incidence[FG_MAX_TAIL_BLADE];
+ float rotors_tail_blade_position[FG_MAX_TAIL_BLADE];
+
};
--- FlightGear-1.0.0.orig/src/Network/native_fdm.cxx 2007-11-17
09:37:46.000000000 +0100
+++ flightgear-1.0.0/src/Network/native_fdm.cxx 2008-05-22 12:24:20.000000000
+0200
@@ -197,14 +197,38 @@
net->gear_steer[i] = node->getDoubleValue("steering-norm");
net->gear_compression[i] = node->getDoubleValue("compression-norm");
}
-
+ // ----------------------------------------------
+ // helicopter -- main rotor
+ SGPropertyNode *node = fgGetNode("/rotors/main", true);
+ net->rotors_main_rpm = node->getDoubleValue("rpm") ;
+ net->rotors_main_roll = node->getDoubleValue("roll-deg");
+ net->rotors_main_yaw = node->getDoubleValue("yaw-deg");
+ // helicopter -- blade for main rotor
+ net->num_rotors_main_blade = FGNetFDM::FG_MAX_ROTOR_BLADE;
+ for (i = 0; i < net->num_rotors_main_blade; ++i ) {
+ SGPropertyNode *node = fgGetNode("/rotors/main/blade", i, true);
+ net->rotors_main_blade_flap[i] = node->getDoubleValue("flap-deg");
+ net->rotors_main_blade_incidence[i] =
node->getDoubleValue("incidence-deg");
+ net->rotors_main_blade_position[i] =
node->getDoubleValue("position-deg");
+ }
+ // helicopter -- tail rotor
+ node = fgGetNode("/rotors/tail", true);
+ net->rotors_tail_rpm = node->getDoubleValue("rpm") ;
+ // helicopter -- blade for main rotor
+ net->num_rotors_tail_blade = FGNetFDM::FG_MAX_TAIL_BLADE;
+ for (i = 0; i < net->num_rotors_tail_blade; ++i ) {
+ SGPropertyNode *node = fgGetNode("/rotors/tail/blade", i, true);
+ net->rotors_tail_blade_incidence[i] =
node->getDoubleValue("incidence-deg");
+ net->rotors_tail_blade_position[i] =
node->getDoubleValue("position-deg");
+ }
+ // ----------------------------------------------
// the following really aren't used in this context
net->cur_time = globals->get_time_params()->get_cur_time();
net->warp = globals->get_warp();
net->visibility = fgGetDouble("/environment/visibility-m");
// Control surface positions
- SGPropertyNode *node = fgGetNode("/surface-positions", true);
+ node = fgGetNode("/surface-positions", true);
net->elevator = node->getDoubleValue( "elevator-pos-norm" );
net->elevator_trim_tab
= node->getDoubleValue( "elevator-trim-tab-pos-norm" );
@@ -292,6 +316,24 @@
htonf(net->nose_wheel);
htonf(net->speedbrake);
htonf(net->spoilers);
+
+ htonf(net->rotors_main_rpm);
+ htonf(net->rotors_main_roll);
+ htonf(net->rotors_main_yaw);
+
+ for (i = 0; i < net->num_rotors_main_blade; ++i ) {
+ htonf(net->rotors_main_blade_flap[i]);
+ htonf(net->rotors_main_blade_incidence[i]);
+ htonf(net->rotors_main_blade_position[i]);
+ }
+ net->num_rotors_main_blade=htonl(net->num_rotors_main_blade);
+ htonf(net->rotors_tail_rpm);
+ for (i = 0; i < net->num_rotors_tail_blade; ++i ) {
+ htonf(net->rotors_tail_blade_incidence[i]);
+ htonf(net->rotors_tail_blade_position[i]);
+ }
+ net->num_rotors_tail_blade=htonl(net->num_rotors_tail_blade);
+
}
}
@@ -373,6 +415,23 @@
htonf(net->nose_wheel);
htonf(net->speedbrake);
htonf(net->spoilers);
+
+ htonf(net->rotors_main_rpm);
+ htonf(net->rotors_main_roll);
+ htonf(net->rotors_main_yaw);
+ net->num_rotors_main_blade = htonl(net->num_rotors_main_blade);
+ for (i = 0; i < net->num_rotors_main_blade; ++i ) {
+ htonf(net->rotors_main_blade_flap[i]);
+ htonf(net->rotors_main_blade_incidence[i]);
+ htonf(net->rotors_main_blade_position[i]);
+ }
+ htonf(net->rotors_tail_rpm);
+ net->num_rotors_tail_blade = htonl(net->num_rotors_tail_blade);
+ for (i = 0; i < net->num_rotors_tail_blade; ++i ) {
+ htonf(net->rotors_tail_blade_incidence[i]);
+ htonf(net->rotors_tail_blade_position[i]);
+ }
+
}
if ( net->version == FG_NET_FDM_VERSION ) {
@@ -458,7 +517,29 @@
node->setDoubleValue("steering-norm", net->gear_steer[i] );
node->setDoubleValue("compression-norm", net->gear_compression[i] );
}
-
+ // ----------------------------------------------
+ // helicopter -- main rotor
+ SGPropertyNode *node = fgGetNode("/rotors/main", true);
+ node->setDoubleValue("rpm", net->rotors_main_rpm );
+ node->setDoubleValue("roll-deg", net->rotors_main_roll );
+ node->setDoubleValue("yaw-deg", net->rotors_main_yaw );
+ // helicopter -- blade for main rotor
+ for (i = 0; i < net->num_rotors_main_blade; ++i ) {
+ SGPropertyNode *node = fgGetNode("/rotors/main/blade", i, true);
+ node->setDoubleValue("flap-deg",net->rotors_main_blade_flap[i]
);
+
node->setDoubleValue("incidence-deg",net->rotors_main_blade_incidence[i] );
+
node->setDoubleValue("position-deg",net->rotors_main_blade_position[i] );
+ }
+ // helicopter -- tail rotor
+ node = fgGetNode("/rotors/tail", true);
+ node->setDoubleValue("rpm", net->rotors_tail_rpm );
+ // helicopter -- blade for main rotor
+ for (i = 0; i < net->num_rotors_tail_blade; ++i ) {
+ SGPropertyNode *node = fgGetNode("/rotors/tail/blade", i, true);
+
node->setDoubleValue("incidence-deg",net->rotors_tail_blade_incidence[i] );
+
node->setDoubleValue("position-deg",net->rotors_tail_blade_position[i] );
+ }
+ // ----------------------------------------------
/* these are ignored for now ... */
/*
if ( net->cur_time ) {
@@ -469,7 +550,7 @@
last_warp = net->warp;
*/
- SGPropertyNode *node = fgGetNode("/surface-positions", true);
+ node = fgGetNode("/surface-positions", true);
node->setDoubleValue("elevator-pos-norm", net->elevator);
node->setDoubleValue("elevator-trim-tab-pos-norm",
net->elevator_trim_tab);
--- FlightGear-1.0.0.orig/src/Network/native_ctrls.cxx 2006-02-21
02:19:47.000000000 +0100
+++ flightgear-1.0.0/src/Network/native_ctrls.cxx 2008-05-22
12:46:49.000000000 +0200
@@ -293,7 +293,7 @@
int i;
SGPropertyNode * node;
-/***************
+
if ( net_byte_order ) {
// convert from network byte order
net->version = htonl(net->version);
@@ -350,7 +350,7 @@
net->speedup = htonl(net->speedup);
net->freeze = htonl(net->freeze);
}
-*************/
+
if ( net->version != FG_NET_CTRLS_VERSION ) {
SG_LOG( SG_IO, SG_ALERT,
"Version mismatch with raw controls packet format." );
--- FlightGear-1.0.0.orig/src/Main/options.cxx 2007-11-17 09:37:46.000000000
+0100
+++ flightgear-1.0.0/src/Main/options.cxx 2008-05-23 17:34:01.000000000
+0200
@@ -232,8 +232,10 @@
fgSetString("/sim/multiplay/callsign", "callsign");
fgSetString("/sim/multiplay/rxhost", "0");
fgSetString("/sim/multiplay/txhost", "0");
+ fgSetString("/sim/multiplay/repeathost", "0");
fgSetInt("/sim/multiplay/rxport", 0);
fgSetInt("/sim/multiplay/txport", 0);
+ fgSetInt("/sim/multiplay/repeatport", 0);
}
static bool
--- FlightGear-1.0.0.orig/src/MultiPlayer/multiplaymgr.cxx 2007-12-08
12:16:49.000000000 +0100
+++ flightgear-1.0.0/src/MultiPlayer/multiplaymgr.cxx 2008-05-24
14:49:34.000000000 +0200
@@ -199,6 +199,7 @@
mSocket = 0;
mInitialised = false;
mHaveServer = false;
+ repeatHaveServer = false ;
} // FGMultiplayMgr::FGMultiplayMgr()
//////////////////////////////////////////////////////////////////////
@@ -247,11 +248,19 @@
mHaveServer = true;
mServer.set(txAddress.c_str(), txPort);
}
+ short repeatPort = fgGetInt("/sim/multiplay/repeatport");
+ string repeatAddress = fgGetString("/sim/multiplay/repeathost");
+ if (repeatPort > 0 && !repeatAddress.empty()) {
+ repeatHaveServer = true;
+ repeatServer.set(repeatAddress.c_str(), repeatPort);
+ }
SG_LOG(SG_NETWORK,SG_INFO,"FGMultiplayMgr::init-txaddress= "<<txAddress);
SG_LOG(SG_NETWORK,SG_INFO,"FGMultiplayMgr::init-txport= "<<txPort );
SG_LOG(SG_NETWORK,SG_INFO,"FGMultiplayMgr::init-rxaddress="<<rxAddress );
SG_LOG(SG_NETWORK,SG_INFO,"FGMultiplayMgr::init-rxport= "<<rxPort);
SG_LOG(SG_NETWORK,SG_INFO,"FGMultiplayMgr::init-callsign= "<<mCallsign);
+ SG_LOG(SG_NETWORK,SG_INFO,"FGMultiplayMgr::init-repeataddress=
"<<repeatAddress);
+ SG_LOG(SG_NETWORK,SG_INFO,"FGMultiplayMgr::init-repeatport= "<<repeatPort );
Close(); // Should Init be called twice, close Socket first
// A memory leak was reported here by valgrind
mSocket = new netSocket();
@@ -515,6 +524,7 @@
int bytes;
do {
char Msg[MAX_PACKET_SIZE];
+ char MsgOriginal[MAX_PACKET_SIZE];
//////////////////////////////////////////////////
// Although the recv call asks for
// MAX_PACKET_SIZE of data, the number of bytes
@@ -539,6 +549,9 @@
//////////////////////////////////////////////////
// Read header
//////////////////////////////////////////////////
+ if (repeatHaveServer ) {
+ memcpy(MsgOriginal,Msg,MAX_PACKET_SIZE) ;
+ }
T_MsgHdr* MsgHdr = (T_MsgHdr *)Msg;
MsgHdr->Magic = XDR_decode_uint32 (MsgHdr->Magic);
MsgHdr->Version = XDR_decode_uint32 (MsgHdr->Version);
@@ -568,6 +581,9 @@
ProcessChatMsg(Msg, SenderAddress);
break;
case POS_DATA_ID:
+ if ( repeatHaveServer ) {
+ mSocket->sendto(MsgOriginal, bytes, 0, &repeatServer);
+ }
ProcessPosMsg(Msg, SenderAddress, bytes, stamp);
break;
case UNUSABLE_POS_DATA_ID:
--- FlightGear-1.0.0.orig/src/MultiPlayer/multiplaymgr.hxx 2006-10-10
07:17:07.000000000 +0200
+++ flightgear-1.0.0/src/MultiPlayer/multiplaymgr.hxx 2008-05-23
18:11:47.000000000 +0200
@@ -88,7 +88,9 @@
netSocket* mSocket;
netAddress mServer;
+ netAddress repeatServer;
bool mHaveServer;
+ bool repeatHaveServer ;
bool mInitialised;
string mCallsign;
};
--- FlightGear-1.0.0.orig/src/Network/multiplay.cxx 2006-10-10
07:17:07.000000000 +0200
+++ flightgear-1.0.0/src/Network/multiplay.cxx 2008-05-23 18:04:48.000000000
+0200
@@ -59,6 +59,11 @@
set_hz(rate);
+ if (dir == "repeat" ) {
+ set_direction("out");
+ fgSetInt("/sim/multiplay/repeatport", port);
+ fgSetString("/sim/multiplay/repeathost", host.c_str());
+ } else {
set_direction(dir);
if (get_direction() == SG_IO_IN) {
@@ -72,6 +77,7 @@
fgSetString("/sim/multiplay/txhost", host.c_str());
}
+ }
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel