1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need API's to build a team radar

Discussion in 'SimConnect' started by wserra, 4/8/07.

  1. wserra

    wserra

    Joined:
    4/8/07
    Messages:
    7
    Country:
    unitedstates
    Hello,

    I'm new to SimConnect. I’ve downloaded a few samples and tried extremely simple projects. I’d like to contribute to the fsdeveloper community with a more ambitious project.

    Being new to SimConnect I’m afraid I will ask questions that have already been asked before; I beg for your patience and understanding.

    I’ve been programming in C++ since it came out 20 years ago and with Direct3D in the last 3 years. These credentials don’t make one a good programmer but certainly a fearless one:D

    I’ve noted a deficiency in FSX’s multiplayer mode. When you fly with a group of friends it’s quite difficult to keep track of everybody’s position, heading, altitude and speed.

    The project I have in mind is a team radar to do just that.

    FSX has a view from above which is quite helpful as long as the planes stick within a 20 nautical mile radius (effective 10nm since you’re in the middle of the view). As you know, teams tend to scatter and disappear from the view quickly. The view is not programmable and therefore not useful as a team’s radar.

    Also, strangers connect to sessions. While they are welcome they pollute the view.

    I’ve read the SimConnect SDK Reference but couldn’t find the relevant API’s to build a team radar.

    Hopefully I’m wrong about this but as far as I have read, none of the SimConnect samples show how to be notified when a new player joins/leaves a session. Also it doesn’t show how to get a list of logged in players and how to get an aircraft’s current vectors.

    In other words, to build a team radar I would need to be able to get the following:

    a) List of the current aircrafts.
    b) Notification of creation/destruction of aircraft XYZ.
    c) Vectors for aircraft XYZ (especially speed to determine whether or not XYZ is in the air).
    d) Name tag and call sign associated with aircraft XYZ.

    Has this project been done before? If it has, is the source code available? If not, can you direct me to the relevant documentation?

    I will make the source code available to the FsDeveloper community... assuming this project ever flies:p

    Most grateful for your help,

    Bill
  2. rhysa

    rhysa

    Joined:
    23/3/05
    Messages:
    42
    Country:
    australia
    Easy, subscribe to the system event ObjectAdded, so when a player joins and the aircraft model is added to the world you will receive an event. You receive the object ID and from there just track the object by requesting position data every now and again. Then use the ObjectRemoved event to find out when a player leaves.

    You may need to check that the theory works but I'm pretty sure it will.

    Rhys
  3. FlapsOut

    FlapsOut

    Joined:
    29/5/07
    Messages:
    75
    Country:
    us-texas
    oooh! Interesting Post!

    What about a Radar Program that tracked Everyone in Any Game, Single OR Multiplayer?

    What about filtering out the unacceptables?

    What about displaying the other Aircraft in your game, Single or Multi-Player (within 20 miles)?

    Now, we talking! Thats what I design for!

    Bill Is a SMART-ASS...and I like him :)

    Rysa? He not talking bout SimConnect...Different Ball-Game :D

    It is possible, but ya gotta think outside the 'Box' ;)

    I've had a Platform for 3 years waiting for this. I just knew someone would have this idea...

    Bill? I got the API...I need the RADAR! :)

    We talking .Net Remoting and an SQL Database for Global usage...oooh...

    Take the Game to the next Level!

    Platform El Maximus!

    Flaps
    Last edited: 7/8/07
  4. rhysa

    rhysa

    Joined:
    23/3/05
    Messages:
    42
    Country:
    australia
    Actually I am talking SimConnect, I'm using this very method in my own programs.

    Yes the above method would give you the details and you could track them.

    You would need to program a filter based on some criteria.

    That would require servers etc, its really not that complex. I get the feeling Bill just wants a gauge or similar so he can find his mates in game, and can choose which players to show on it.
  5. wserra

    wserra

    Joined:
    4/8/07
    Messages:
    7
    Country:
    unitedstates
    Rhysa,

    For performance reasons I'd rather implement the core of the Team Radar in a DLL. That is, I'd rather talk with FSX through a direct interface.

    However, Joris "JVD" told me in the thread "Are the FSX's interfaces documented anywhere??" that FSX doesn't support any interfaces. Ok, it surely does but they are not documented anywhere.

    I haven't coded any heavy-duty application based on SimConnect; I've only written small tests. I suspect SimConnect would not be able to handle the stream of messages at the speed a radar would require for a smooth operation.

    Then there's the overhead it would impose on FSX. The traffic "per se" wouldn't kill FSX. What kills FSX is the cumulative penalties incurred by each view. FSX supports multiple views which are CPU/GPU intensive. If you monitor the CPU usage you will notice that FSX is quite a heavy duty application, even with scenery settings set to minimal.

    If an external application taxes an already overloaded FSX the effects will be quite noticeable. If you take 5 FPS from an application which renders at 30FPS that's fine but if you start from 10 FPS, the 5 FPS penalty is very noticeable. No one would want to use a tool which slows down an already slow application.

    Bill
  6. FlapsOut

    FlapsOut

    Joined:
    29/5/07
    Messages:
    75
    Country:
    us-texas
    Radars

    My 1st implementation of this was via a gauge .DLL. You installed the gauge in the aircraft and voila! Instant access to all the aircraft data, but for a Radar? You only need a small subset.

    The gauge was not visible, so it didn't matter how or where you placed it.

    Then, there was an interface component, to which any number of Apps could talk to. One of those Apps fired the data to an SQL database in California.

    For a Radar, the data need only be sent what? Once every 5 seconds? Although, I have tested as fast as once every 200-300ms. (for my little Co-Pilot Application)

    There was absolutely no impact on FS9 performance. You could not even tell it was running.

    All information was sent to my Microsoft SQL database in California, and then I wrote web-pages to look up current users and display their data.

    I even wrote an interface to grab their data, feed it to my Flight Sim, and could jump into their aircraft so to speak.

    Several users tested it, perhaps some here remember it?

    I remember Geoff tested it.

    I wrote a short blurb on it here:
    http://www.innergears.com/flight_simulator.htm

    Since then? It's just one of my many widgits laying around :p

    btw, this did not use FSUIPC at all...but it could.

    Lastly, there is a Central Server version, which could see anyone in any game, anywhere and I worked out all the details for a .Net Remoting, Peer-to-Peer or Team version, which would be only subscribers who know the connect information.

    Now, if we had someone to take that data, insert it into your game? Only people within 15 miles or so you need to be visible. Imagine seeing EVERYONE flying Flight Sim and never having to join a session. :)

    Imagine a Radar, that could see EVERYONE flying Flight Sim! lol

    All do-able.

    FlapsOut
    Last edited: 10/8/07
  7. wserra

    wserra

    Joined:
    4/8/07
    Messages:
    7
    Country:
    unitedstates
    Would you mind posting the i/f API for FS9?

    FlapsOut

    I wouldn’t write a Team Radar for FSX with a fixed refresh rate, whether it’s 1ms or 1 minute. The refresh rate would vary proportionally to how close two planes are. The closer the plane the more critical the accuracy.

    Teams tend to flock together. This means many calls to SQRT() per second, an intensive operation no matter how much you optimize it. If you want to make predictive calculations, the overhead adds up quickly.

    Also take into account that it’s not just you who are requesting vector updates but every member of the team who uses the radar. Conceivably, every player could be a member of a team so the number of updates increases by f(x) = players^moving_planes. In a game with 20 players -not unusual in popular sites- you could have 400 round-trip transactions per update. That’s probably why ATC’s have a radar and pilots don't. For this reason, a pilot view refreshes the other players vectors at low rates.

    There are workarounds to minimize the overhead but all come with a price. You can trade off accuracy or loss of smoothness. If push comes to shove you do what you have to do but why start with a gratuitous penalty when you can avoid it?

    You said that you already wrote a DLL-based gauge for FS9. What interfaces did you use? I'm sure the interfaces are still supported since backwards compatibility is one of COM’s tenets.

    If you used C++ would you mind posting the initialization code and the supported API’s? I don’t mind writing long pieces of code and the graphics for the radar but I do mind wasting time calling API’s blindly without knowing what to expect.

    Thanks in advance for your help,

    Bill
  8. rhysa

    rhysa

    Joined:
    23/3/05
    Messages:
    42
    Country:
    australia
    My current application requests a large amount of data from two sources every visual frame, as well as some extensive processing every time the data arrives, and Im having no troubles. Testing on an pc running an XP1600+ and 512mb ram shows no issues. I would suggest you try it and see what happens before you go digging for direct methods.

    Also how are you going to display the data? Remember that there is no point in precise calculations if the method you use to display the data can't match it.

    Also is this a client only solution or some sort of client-server-peer network solution?
    Last edited: 11/8/07
  9. FlapsOut

    FlapsOut

    Joined:
    29/5/07
    Messages:
    75
    Country:
    us-texas
    Flaps Reply

    FlapsOut

    I wouldn’t write a Team Radar for FSX with a fixed refresh rate, whether it’s 1ms or 1 minute. The refresh rate would vary proportionally to how close two planes are. The closer the plane the more critical the accuracy.

    Me neither

    Teams tend to flock together. This means many calls to SQRT() per second, an intensive operation no matter how much you optimize it. If you want to make predictive calculations, the overhead adds up quickly.

    huh?

    Also take into account that it’s not just you who are requesting vector updates but every member of the team who uses the radar. Conceivably, every player could be a member of a team so the number of updates increases by f(x) = players^moving_planes. In a game with 20 players -not unusual in popular sites- you could have 400 round-trip transactions per update. That’s probably why ATC’s have a radar and pilots don't. For this reason, a pilot view refreshes the other players vectors at low rates.

    You using this as an ATC Radar? Or, an ATIS system?!?

    There are workarounds to minimize the overhead but all come with a price. You can trade off accuracy or loss of smoothness. If push comes to shove you do what you have to do but why start with a gratuitous penalty when you can avoid it?

    nah...you misunderstand the technology. Or? I mis-understand what you're trying to accomplish? :)

    You said that you already wrote a DLL-based gauge for FS9. What interfaces did you use? I'm sure the interfaces are still supported since backwards compatibility is one of COM’s tenets.

    um...it was a gauge...it updates like any other gauge...pretty fast ;) You will remember that getting Info from FS9 and earlier was a Beeatch, therefore? FSUIPC! However? Gauges can exchange info just fine! Go figure...Helps to read all the docs :D

    What I did? Was use a little known...well, unknown capability of the Old C-DLLs (remember, I wrote the 1st ones with IBM Austin for OS/2 when I worked in Switzerland). Allows me to interface to and access ALL the data that any gauge can get, and thats a lot. Have you read all my posts? I made mention of this in previous posts...

    If you used C++ would you mind posting the initialization code and the supported API’s? I don’t mind writing long pieces of code and the graphics for the radar but I do mind wasting time calling API’s blindly without knowing what to expect.

    Nope, C...If your using C++ at this point? You're a Tard! LOL, but my API is smooth and I have tested with C and C#. And, BTW I document my APIs (hate blind code) :) But think some more? Recall, the API is at the User Level, i.e. YOUR FS9 to my API...All local. Next? We need do something with all this data. I like my verision that posts to a Central Server. For Radar? That works Wunderbar. For Peer-to-Peer and .Net Remoting? We're looking 100-200ms State-side, up to 500ms if a team-mate is in Australia or West Virginia or somewhere :p If it takes over a second, total turn-around using FSUIPC and my API? I'll kill myself and go drive a Truck! :)

    P.S. Tried FSUIPC/FSUIPCClient version threaded off PROPERLY! No problem within the 100-200ms capability. Now thats Programming! Thx Pete (and Phenty!) ;)

    And, finally...one more time: "There is ZERO impact on your FPS rate!" using my API :)
    Don't ask me about FSX, because until PMDG has a B747-400 for FSX? I not bothering with the FSX and toy-airplanes >.<
    In the meantime? I've written a series of utilities for use with the PMDG 747-400 under FS9 and FSUIPC/FSUIPCClient (Easily translated to FSX) and have sent you a note, Bill :)


    Thanks in advance for your help,

    Bill
    Last edited: 15/8/07

Share This Page