Board index FlightGear Development Tutorials and missions

[Canceled] FGjobs - Jobs & Airlines Service Tool

Interactive in-sim tutorials and missions

Re: FGjobs - Jobs & Airlines Service Tool

Postby m1ndgames » Mon Aug 06, 2012 5:10 pm

didnt think it would be THAT easy to collect player data o.0

m1ndgames@fgjobs:~/scripts/FGjobs$ ./FGjobs.pl
# This is FGjobs
# FlightGear Multiplayer Server v0.10.16
# using protocol version v1.1 (LazyRelay enabled)
# 1 pilot(s) online
m1nd@LOCAL: -2709553.220515 -4270669.891474 3872888.782485 37.628710 -122.393339 6.016502 -1.938535 1.151760 -0.087846 Aircraft/c172p/Models/c172p.xml


now... lets get it on :D
FGjobs - Virtual Airlines & Jobs Service Tool
m1ndgames
 
Posts: 22
Joined: Fri Aug 03, 2012 8:43 am
Location: Düsseldorf, Germany
Callsign: m1ndDE
IRC name: m1ndgames
Version: 2.6
OS: Windows 7 / debian

Re: FGjobs - Jobs & Airlines Service Tool

Postby Johan G » Mon Aug 06, 2012 8:36 pm

FGjobs will auto-cancel the job if a player leaves the server or if the job timer reaches 0.

What if someone (like me) has a very unstable internet connection? :(

Just have a look at flights 107-140 in my "log" on the FlightGear tracker site. They are pretty much three flights separated by two crashes. :roll: That's about 30 glitches in 2 hours (please excuse any miscalculations, I'm too tired for mental calculations now).
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 5545
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit

Re: FGjobs - Jobs & Airlines Service Tool

Postby Hooray » Mon Aug 06, 2012 9:05 pm

@m1ndgames:

Note that you can easily convert the previously mentioned *.h/*.hxx files used by FG/FGMS to Perl files using h2xs/h2ph.
Just saying it, to save you some time and lots of manual copy/paste conversion ...
You can then easily remove everything that you don't need.

http://docs.activestate.com/activeperl/ ... /h2ph.html
http://docs.activestate.com/activeperl/ ... /h2xs.html
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11375
Joined: Tue Mar 25, 2008 8:40 am

Re: FGjobs - Jobs & Airlines Service Tool

Postby m1ndgames » Tue Aug 07, 2012 9:51 am

Johan G wrote in Mon Aug 06, 2012 8:36 pm:
FGjobs will auto-cancel the job if a player leaves the server or if the job timer reaches 0.

What if someone (like me) has a very unstable internet connection? :(

Just have a look at flights 107-140 in my "log" on the FlightGear tracker site. They are pretty much three flights separated by two crashes. :roll: That's about 30 glitches in 2 hours (please excuse any miscalculations, I'm too tired for mental calculations now).


i think i'll add a counter for this... so if youre disconnected for more then 2 minutes the flight gets canceled... but thats finetuning :)

i need a bit help with the coordinates, can someone give me a quick overview what each colon is?

cti@LOCAL: 3304995.501337 4199655.641280 3492631.694056 33.342395 51.798379 41109.850304 -1.477888 -2.248279 1.432895 Aircraft/CitationX/Models/Citation-X.xml

1=user, 2=server, 3=?, 4=?, 5=?...

im currently workin on the function that determines where a player is, and trigger an event when he reaches a certain point (which will actually be a defined grid later)

cti is connected to LOCAL
His location is z: 3126017.427717 x: 4439400.056703 y: 3359236.430816


i can use carttogeod() to convert fg's coordinates to a usable one, right?
FGjobs - Virtual Airlines & Jobs Service Tool
m1ndgames
 
Posts: 22
Joined: Fri Aug 03, 2012 8:43 am
Location: Düsseldorf, Germany
Callsign: m1ndDE
IRC name: m1ndgames
Version: 2.6
OS: Windows 7 / debian

Re: FGjobs - Jobs & Airlines Service Tool

Postby m1ndgames » Tue Aug 07, 2012 12:40 pm

m1ndgames@fgjobs:~/scripts/FGjobs$ ./FGjobs.pl
player cti is currently on lat/lon: 27.436496 89.405328
degrees minutes:27 26.18976 89 24.31968


(needed the degrees to measure points around the world...)

1st small step done, need a break now...
FGjobs - Virtual Airlines & Jobs Service Tool
m1ndgames
 
Posts: 22
Joined: Fri Aug 03, 2012 8:43 am
Location: Düsseldorf, Germany
Callsign: m1ndDE
IRC name: m1ndgames
Version: 2.6
OS: Windows 7 / debian

Re: FGjobs - Jobs & Airlines Service Tool

Postby Hooray » Tue Aug 07, 2012 3:01 pm

m1ndgames wrote in Tue Aug 07, 2012 9:51 am:i need a bit help with the coordinates, can someone give me a quick overview what each colon is?

cti@LOCAL: 3304995.501337 4199655.641280 3492631.694056 33.342395 51.798379 41109.850304 -1.477888 -2.248279 1.432895 Aircraft/CitationX/Models/Citation-X.xml

1=user, 2=server, 3=?, 4=?, 5=?...

im currently workin on the function that determines where a player is, and trigger an event when he reaches a certain point (which will actually be a defined grid later)


You really need to take a look at the headers, i.e. the source code - it's all there, and not at all complicated.
The MP protocol is really simple and dumb, which is your advantage now ;-)

The data you receive is just a plain C struct, with XDR-encoded values. The format depends on the message types.
All message types are listed in http://gitorious.org/fg/flightgear/blob ... ssages.hxx

Properties are never transmitted verbatim, they are using so called "property IDs" which are unique and specified here: http://gitorious.org/fg/flightgear/blob ... cxx#line70

So whenever you have a property field, you need to do a lookup to see which property is referenced, using the integer ID.

That's why I suggested to convert the C/C++ header to a Perl header.

To see how the position messages are decoded, just see: http://gitorious.org/fg/flightgear/blob ... x#line1095

To see how the headers are decoded, just see: http://gitorious.org/fg/flightgear/blob ... xx#line900

You can use lots of FG/SimGear helpers to convert between geographic coordinates: http://wiki.flightgear.org/Geographic_C ... te_Systems

Also, I don't mind providing additional help/support, as long as you use the wiki to document your findings, i.e. by adding to the multiplayer protocol page in the wiki, so that others can also use that information.

I'd also suggest to take a look at the fgms side of things (i.e. the server), let me know if you need help understanding the C++ source code.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11375
Joined: Tue Mar 25, 2008 8:40 am

Re: FGjobs - Jobs & Airlines Service Tool

Postby m1ndgames » Wed Aug 08, 2012 12:12 pm

thanks again :)

i can now measure a players distance from EDDL (EDDL is currently the fixed end-point... i currently dont know how i will implement ICAO->lat/lon)

Code: Select all
m1ndgames@fgjobs:~/scripts/FGjobs$ ./FGjobs.pl
player 0xigen is currently 955.99 kilometers away from EDDL


and im fiddling around with the server connection... still getting "bad client" but hey.. time will tell...
FGjobs - Virtual Airlines & Jobs Service Tool
m1ndgames
 
Posts: 22
Joined: Fri Aug 03, 2012 8:43 am
Location: Düsseldorf, Germany
Callsign: m1ndDE
IRC name: m1ndgames
Version: 2.6
OS: Windows 7 / debian

Re: FGjobs - Jobs & Airlines Service Tool

Postby Hooray » Wed Aug 08, 2012 12:16 pm

You may get better debugging messages by running your own local fgms copy, setting up fgms locally isn't too difficult actually: http://wiki.flightgear.org/Howto:Set_up ... yer_server

EDIT: That is, easy on *nix based systems-It may be a bit more tricky on Windows 7 (which you use according to your profile?)
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11375
Joined: Tue Mar 25, 2008 8:40 am

Re: FGjobs - Jobs & Airlines Service Tool

Postby m1ndgames » Wed Aug 08, 2012 12:25 pm

im currently running a server on my dev-box... (fgjobs.org) ive put win7 in the profile because thats the os i use on my desk... unix is only for servers imho ;)

btw.: i had enough of the client/server thing, so ive made a function that determines where a airport is...

Code: Select all
m1ndgames@fgjobs:~/scripts/FGjobs$ ./FGjobs.pl
location of EDDL is 51.289453 6.766775


so i can
1. determine where a player is
2. determine whats the lat/lon location of any airport over the ICAO code
3. measure distance between 2 lat/lon locations

next step in locations would be writing a function that makes a small square "overlay" over the airports location, so i can check if a player arrives on a certain airport...

this will produce headache, i know it :D
FGjobs - Virtual Airlines & Jobs Service Tool
m1ndgames
 
Posts: 22
Joined: Fri Aug 03, 2012 8:43 am
Location: Düsseldorf, Germany
Callsign: m1ndDE
IRC name: m1ndgames
Version: 2.6
OS: Windows 7 / debian

Re: FGjobs - Jobs & Airlines Service Tool

Postby Hooray » Wed Aug 08, 2012 2:59 pm

m1ndgames wrote in Wed Aug 08, 2012 12:25 pm:next step in locations would be writing a function that makes a small square "overlay" over the airports location, so i can check if a player arrives on a certain airport...

this will produce headache, i know it :D


You probably mean a "bounding box": http://stackoverflow.com/questions/2382 ... g-location

PS: Also, see: http://williams.best.vwh.net/avform.htm
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11375
Joined: Tue Mar 25, 2008 8:40 am

Re: FGjobs - Jobs & Airlines Service Tool

Postby m1ndgames » Thu Aug 09, 2012 9:26 am

yep... and im currently using the cpan GEO module for measuring... ive seen it supplies a function which could be used for this box...

but this day is dedicated to the client/server issue im having... darn XDR!
FGjobs - Virtual Airlines & Jobs Service Tool
m1ndgames
 
Posts: 22
Joined: Fri Aug 03, 2012 8:43 am
Location: Düsseldorf, Germany
Callsign: m1ndDE
IRC name: m1ndgames
Version: 2.6
OS: Windows 7 / debian

Re: FGjobs - Jobs & Airlines Service Tool

Postby Hooray » Thu Aug 09, 2012 9:34 am

make sure your headers are correct, after all it's just a plain C struct ...
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11375
Joined: Tue Mar 25, 2008 8:40 am

Re: FGjobs - Jobs & Airlines Service Tool

Postby m1ndgames » Thu Aug 09, 2012 2:38 pm

09.08.2012 18:36:44 FG_SERVER::AddBadClient() - 62.108.37.223 Client sends insufficient position data, should be 232.00 is: 3825205248.00

gwar....
FGjobs - Virtual Airlines & Jobs Service Tool
m1ndgames
 
Posts: 22
Joined: Fri Aug 03, 2012 8:43 am
Location: Düsseldorf, Germany
Callsign: m1ndDE
IRC name: m1ndgames
Version: 2.6
OS: Windows 7 / debian

Re: FGjobs - Jobs & Airlines Service Tool

Postby m1ndgames » Wed Aug 22, 2012 9:53 am

im really having a hard time encoding the xdr packets... and after 2 weeks, im done with it... :'(

i opened a feature request that would really solve all the issues: http://code.google.com/p/flightgear-bug ... ail?id=853

so if you're a c++ coder and would like to see the fgjobs project progress, feel free to contact me here, in irc, or reply to my feature request :)
FGjobs - Virtual Airlines & Jobs Service Tool
m1ndgames
 
Posts: 22
Joined: Fri Aug 03, 2012 8:43 am
Location: Düsseldorf, Germany
Callsign: m1ndDE
IRC name: m1ndgames
Version: 2.6
OS: Windows 7 / debian

Re: FGjobs - Jobs & Airlines Service Tool

Postby Hooray » Wed Aug 22, 2012 11:12 am

Please understand that fgms is de facto unmaintained at the moment, and has been for many years now.
It's unlikely to be touched, that includes the MP protocol.
That said, we expect that it will be depreciated by the HLA work: http://wiki.flightgear.org/HLA

Also, I am not sure if I agree with your feature request in the first place :D

One of the simpler options would be directly using the C++ code in FG and wrap it as a Perl module - then you'd use the same code as the rest of FG/FGMS.
That would at least allow you to make progress, and turning a C++ file into a Perl module is well documented in lots of tutorials.

You could probably post some Perl code here demonstrating how you are trying to decode/encode the packets, so that we may have a look.
Probably, that's where the problem is - in other words, how familiar are you with Perl (and network programming) in the first place?
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11375
Joined: Tue Mar 25, 2008 8:40 am

PreviousNext

Return to Tutorials and missions

Who is online

Users browsing this forum: No registered users and 0 guests