Jump to content
The simFlight Network Forums

andqui

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by andqui

  1. That would probably explain it, then. The hex conversion was a stretch, I agree. As to deleting with simconnect, there's this: http://www.fsdeveloper.com/wiki/index.php?title=Traffic_-_SimConnect_-_Removal_of Which says that unless you're an embedded DLL or module within FSX (mine is a standalone exe), you need to go via FSUIPC, which is what led me to ask here. There's also this, http://msdn.microsoft.com/en-us/library/cc526983.aspx#SimConnect_AIRemoveObject, which only applies to traffic you've added through code, not traffic present in bgl's (I tried). I used simconnect to get the aircraft because of the 200 km radius and the unlimited # of aircraft, which matches what I'm trying to do to delete them to improve performance. Anyways, I'll give transforming the ID a try, and if it doesn't work I'll focus on trying to slew them out of range, unless you think there's a better way to do it. Thanks for your time.
  2. I was looking things up and stumbled upon this old thread, which probably confused me, with regards to the 12-byte length. http://forum.simflight.com/topic/9716-ai-offsets-2900%E2%80%93200b/ But I stand corrected. I wouldn't say I'm new to programming, but the only programs I've written are for my own use and for parsing/dealing with large amounts of data only really using the standard c++/java libraries/functions/methods. I'm quite proficient when it comes to things I already understand but learning new stuff is challenging, as you probably have already noticed ;) And I didn't start with something simpler because I couldn't find anyone interested in writing this for me; I'm trying to write a program that takes in a "focus" ICAO and then deletes all AI traffic that isn't going to or leaving that airport, to maintain 100% traffic density at the focus airport and save FPS in really busy areas by removing "irrelevant" AI. I've been able to grab all the AI details with simconnect, and then this is the code I have once I've decided that a particular AI aircraft is irrelevant and needs to go: DWORD FsuipcResult; if (FSUIPC_Open(SIM_FSX,&FsuipcResult)) { cout << "\nFSUIPC connected to Flight Simulator!"; } else { cout << "\nFSUIPC NOT connected to Flight Simulator!"; } printf("\nObjectID=%d registration=\"%s\ from=\"%s\ to=\"%s\"", ObjectID, pS->registration, pS->from, pS->to); //delete aircraft DWORD writeResult; DWORD dwCmd[3]; dwCmd[0]=ObjectID; dwCmd[1]=0xFFFF; dwCmd[2]=0; if(FSUIPC_Write(0x2900, 12, (BYTE*) dwCmd, &writeResult)) { cout << "\nWrite succesful"; } else { cout << "\nWrite unsuccesful"; } if(FSUIPC_Process(&writeResult)) { cout << "\nProcess succesful"; } else { cout << "\nProcess unsuccessful"; } FSUIPC_Close(); The program is picking out the right traffic to delete- the line where I print out ID/tail#/from/to fires for each target aircraft is working correctly and fires for each of the "bad" aircraft I see in the traffic toolbox. I get the FSUIPC is connected message for each of these aircraft (its probably unnecessary opening/closing over and over, but early on can't hurt until I confirm things are working), and the &FsuipcResult DWORD is 0, so FSUIPC is connecting OK each time. Then, I get the "write successful" and "process successful" messages each time, and the writeResult DWORD is 0 as well, so the command is being written and processed correctly for each aircraft. The only problem is that nothing happens in the sim- in the traffic toolbox explorer, each of the target AI aircraft that I know the program is correctly identifying keeps on going as if nothing happened, which seems likely, so one of the inputs is wrong somewhere. Maybe the ID's that I have are wrong or in the wrong format? In the traffic explorer, the container ID's are listed as hex values, whereas DWORD is an unsigned int, correct? Is there a hex conversion I need to perform to pass in as the input ID? thanks again for the help
  3. My apologies, I misunderstood what you wrote, I thought that pertained to the zapper. Anyways, I have my DWORD object id. The way I understand it, 0x2900 for 4 bytes long is the where to enter this ID, and 0x2904 for 4 bytes long is where to enter 65535 for the delete command, correct? What I've tried is this: FSUIPC_Write(0x2900, 4, WHATGOESHERE, &writeResult) to write the object ID into 2900 and FSUIPC_Write(0x2904, 4, WHATGOESHERE, &writeResult) to write the command for that object, and then in the if under those two booleans is FSUIPC_Process to execute it. As you can see, I'm confused as to what goes in the command parameter, and I've tried casting the DWORD and the int as various things to get it to compile without seeing an effect in the sim. To sum it up, what do I replace "WHATGOESHERE" in the above lines with in order to enter 1. the DWORD object ID and 2. the 65535 delete command. Better yet, is there a way to combine the two into one write command? Thanks for your patience, my programming skills are amateur-level and this is all very new.
  4. Thanks for the help- I've now gotten the program to look through all of the AI aircraft being handled and then put the Object ID's of the ones I want to delete into a list. How should I use these IDs to remove the aircraft? The simconnect SDK talks about how to delete traffic that your program has added, but not ones that are added by traffic files. Does FSUIPC povide a handy deletion function? Maybe the simplest way would just be to remove the aircraft from AI control and then teleport it to the south pole or something like that? EDIT: I just tried using simconnect to teleport the AI aircraft to the south pole, which works correctly, but many of them are still being kept track of by the sim even when they are outside of the bubble, so that's out.
  5. Hope this is the right place to post this, sorry if it isn't. I'm trying to create a program that will remove AI traffic that isn't going to or departing a particular airport to save on FPS. I've never coded anything for FS for at all, so apologies if some of my questions seem daft. I've managed to succesfully write an "empty" program that simply connects and disconnects from FSUIPC, so far so good. Now the part where I'm completely lost is in figuring out how to then access the AI details- whats the simplest way to access the list of current AI traffic. The SDK mentions the offset area from D000-FFF contains AI information- I understand the premise of the memory offsets and the hexadecimal notation, but I think I'm misunderstanding what they are for; for example, what is the "base" address they are offset from, or is there a simpler sort of get method which will let me not have to worry about the exact memory addresses? Basically, in my C++ code, what do I need to do to get a list/table/array of pointers to all AI traffic being processed by the sim at a given time? From there, the SDK seems to be pretty straightforward about how to interact with an individual aircraft once I have the pointer to it, but I'm confused as how I get to that part. Second, once I identify the aircraft I plan on removing, I wanted to use the traffic zapper in FSUIPC, and I can't find any documentation about this. Does the traffic zapper work as some kind of "at will" traffic remover, or have I misunderstood? How do I call it and how do I specify which AI to use it on? thanks
×
×
  • 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.