Jump to content
The simFlight Network Forums

Programming weather,traffic,position,DLL


Recommended Posts

Hello Pete !

I'm interested to transfer weather and dynamic traffic data in realtime from one PC with FS, to an other PC with FS, using FSUIPC. The TCP/IP transfer I will handle my self, but need some help with FS read/write using FSUIPC.

The weather and traffic (visual moving airplanes on ground and in air) should appear in the receiving PC with FS, same as in the transmitting PC with FS.

I assume this is possible since e.g. Squawkbox write this data using FSUIPC.

I don't need to know any details what the data mean, but offsets used for reading/writing weather and traffic in FS2004. And I want to avoid transfer lot of data that anyway is read only.

I use the document "FSUIPC SDK 25th Release April 25th 2005", but I get little confused what offsets to use.

WEATER:

I found following in document about weather:

"0E9A 112 byte, Current Weather as Set: details follow."

"0F1C 114 byte, Global Weather setting area: details follow."

"C000 4096 byte, FS2004 New Weather Interface areas,"

What offsets and sizes are valid and make sense for writing in FS2004 ?

TRAFFIC:

I found some details in document about AI:

"FS2002/4 A.I. Traffic Data. The offset area from D000 to FFFF inclusive is reserved for this. It is nearly all read-only."

"2900 12 A.I. traffic control. Write all 3 32-bit values"

I don't know what offsets to use. I suppose I first can read number of airplanes, then read from offset, and multiply the size with number of airplanes writing into the other PC with FS.

What offsets and sizes should I use for writing in FS2004 ?

POSITION:

Moving the player's airplane position.

When I change the FSUIPC parameters "0560 8 Latitude of aircraft in FS units." and "0568 8 Longitude of aircraft in FS format", the airplane jump to the new position without sceneries, while sceneries seams flying in the air start update slowly. This will look strange to a user, as well I'm afraid it might cause some crash or failure.

Is there a way to force FS to load the new position by the FS progress dialog "Loading sceneries/traffic/weather etc", so that all is updated before going back to normal display mode ?

Remark:

When I change time "023A 1 Second of time in FS (0–59). to 0240.", FS display the progress dialog automatically, but not for the position change.

DLL:

I would like to have a DLL module with menus running in FS. I've try some example, using a Cyril Hruscak's template from Avsim, just partly succeed. (I do pass a parameter "FS98MAIN" to find the FS2004 window, I get a FS2004 message "Old module, do you want to load anyway..", but I don't know what parameter to pass for FS2004).

May you know what parameter to pass instead of "FS98MAIN" ?

I know there is a way to add menus in FS and get there response by using FSUIPC. But is there a way to load, run and unload an external DLL (or even an external EXE) I have created, by call from FSUIPC ?

Regards and thanks !

Link to comment
Share on other sites

I'm interested to transfer weather and dynamic traffic data in realtime from one PC with FS, to an other PC with FS, using FSUIPC. The TCP/IP transfer I will handle my self, but need some help with FS read/write using FSUIPC.

The weather and traffic (visual moving airplanes on ground and in air) should appear in the receiving PC with FS, same as in the transmitting PC with FS.

You will have some difficulty with weather. It is dynamic and depends more on the settings at local weather stations. You cannot set the weather at the aircraft directly. Weather changes with time no matter what you do, so they'll never be exactly matched, especially with regard to clouds. Winds, temperature, visibility and pressure should be easier, but the viual impact is mainly clouds and that's next to impossible to synchronise visually.

With traffic that depends what traffic you are talking about. If you mean AI traffic, then whilst you can read thraffic data through FSUIPC, you cannot write AI traffic data into FS for it to obey. AI traffic follows the routes and timings and rules local to its own pre-compiled traffic files.

Ordinary dynamic traffic are just moving scenery, and are controlled precisely by scenery files.

The only type of traffic you can actually create in FS and control is multiplayer traffic, but that uses the FS multiplayer interface, not FSUIPC. I suppose you could read AI data from one PC using FSUIPC and send it as MP data to the other. I'm afraid I know nothing about the MP interface, but there is an MS SDK.

I assume this is possible since e.g. Squawkbox write this data using FSUIPC.

It writes some weather. I think this is optional -- some folks prefer the more sophisticated weather from ActiveSky or FSMeteo.

It certainly does not input other traffic via FSUIPC. It uses the MP interface for that.

What offsets and sizes are valid and make sense for writing in FS2004 ?

It isn't that easy. You have to write complete weather sets for all the individual weather stations around your position. You can write just "global" weather instead, but that just sets initial defaults -- to stop it changing or to control it you have to keep re-writing it at intervals and this is likely to cause cloud re-drawing (flicker) and hesitations.

The only interface for setting all weather in FS2004 which makes sense is the New Weather Interface which is defined in a separate package in the SDK. Programs like ActiveSky and FSMeteo use that.

I suppose I first can read number of airplanes, then read from offset, and multiply the size with number of airplanes writing into the other PC with FS.

What offsets and sizes should I use for writing in FS2004 ?

As I said, there is absolutely no way for creating and controlling AI traffic in FS other than via the TrafficToolBox from MS or using one of the traffic compilers like TTools to compile new routes and aircraft assignments. You will have to think in terms of Multiplayer.

Moving the player's airplane position.

When I change the FSUIPC parameters "0560 8 Latitude of aircraft in FS units." and "0568 8 Longitude of aircraft in FS format", the airplane jump to the new position without sceneries

If you move the aircraft so far to cause that you need to send a Refresh Scenery control afterwards. It will then load the scenery -- you see the scenery loading bar on the screen.

I get a FS2004 message "Old module, do you want to load anyway..", but I don't know what parameter to pass for FS2004).

You don't pass anything. That message is produced by the version check FS makes on the version number in the Linkage structure. See other DLLs and Gauges and you will see. I cannot possible tutor on writing DLLs for FS. Sorry. You can add your module to the [OldModules] section of FS9.CFG to suppress the message.

I know there is a way to add menus in FS and get there response by using FSUIPC. But is there a way to load, run and unload an external DLL (or even an external EXE) I have created, by call from FSUIPC ?

There's no such thing as an "external DLL". DLLs have to be part of the process of the routines which call them. Gauges are DLLs loaded and unloaded by FS, but they are far from being "external".

There are no facilities for running EXEs from FSUIPC. Just run them (using the Run Programs options in FSUIPC.INI if you like) and program them to wait for a signal through the FSUIPC interface -- for instance one of the virtual buttons.

Much of what you want to do is done by Luciano Napolitano's WidevieW. I'm sure he would dearly like to synchronise clouds and AI traffic too. He has over six years experience with all this stuff on versions of FS starting at least with FS98. I'm sure if it were possible to do it all, he would have done it by now. I think you should check his programs out before you do too much.

We've been pressing MS for facilities to do this sort of thing better in the future, so maybe, with luck, things may improve in the next release, or maybe the one after.

Regards,

Pete

Link to comment
Share on other sites

Thank you a lot for all information. :D

WEATHER:

You will have some difficulty with weather.

Ok I do understand it will not look or act exactly the same in both PC. Primary I'm pleased if both PC has similar weather condition, updated like in FS "load real weather every 15 minutes".

I'll try use FSUIPC "New Weather Interface for FS2004" relevant part for read and set, to transfer weather.

TRAFFIC:

I have thinking about the issue with traffic some days. Preliminary I thought presumably traffic can be set by FSUIPC. :(

I suppose you could read AI data from one PC using FSUIPC and send it as MP data to the other.

I want to copy the traffic independent if traffic come from FS-traffic, addon-traffic or from online player's traffic like VATSIM. To make good sense, airplanes must appear the same poitions in both PC. I'll try as you suggest and I will try to find a programmer, to cooperate (in %) for this DirectX MultiPlay implement FS traffic.

Question: Can the traffic be read using FSUIPC, as number of aircrafts, Latitude, Longitude, Altitude, Pitch, Bank, Heading and aircraft type ?

I have seen the WidevieW website. Since I will create a product, I can't buy WidevieW for each box I sell. As well I find it hard to cooperate with Luciano Napolitano about his implementation. The reason is, even if I don't intend to create same product, it will be difficult for me to prevent the user to use the product similar as WidevieW.

DLL (no question, just reply as my info):

Sorry I may explained bad, I did mean external created DLL (not any technical meaning). And I do pass a parameter "FS98MAIN" to a Windows SDK function FindWindow("FS98MAIN", NULL) with return me a handle to the FS2004 window. If I pass "DUMMY" then I get no handle.

Regards and thanks again !

Link to comment
Share on other sites

Question: Can the traffic be read using FSUIPC, as number of aircrafts, Latitude, Longitude, Altitude, Pitch, Bank, Heading and aircraft type

Pitch and Bank were only added recently, but they are there. There's a limit of 96 airborne and 96 ground aircraft, priority being to the nearest. But that shouldn't worry you. You shouldn't be trying to add that many MP aircraft to FS or it'll slow nearly to a stop. You'd only do the nearest few.

There are alternatives for the identifying information. Check the Programmer's Guide document. It's all listed near the beginning.

I have seen the WidevieW website. Since I will create a product, I can't

Ah, sorry. I thought you wanted to solve a problem for yourself, not make a product. That is certainly a different matter.

Regards,

Pete

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.