Jump to content
Sign in to follow this  
Guest KenAdam

AI Objects and Waypoints example

Recommended Posts

Guest KenAdam

As you may note from another thread, I am working on converting the SDK examples to Delphi as part of proving the SimConnect.pas conversion of SimConnect.h.I'm struggling with the above example for a few reasons (some resolved).1) there is no hot_air_balloon - the ones in the tutorial are scenery2) there is no default flight at SEA-TAC3) the cbUnitSize parameter of SetDataOnSimObject is the total size of the array not of one element as stated in the documentation.4) the example controls the throttle of your own aircraft not the non-existent hot air balloonWhere I'm stuck:It seems that you can only control the throttle of a air vehicle, (so elephants and buses aren't a substitute for balloons...)I tried creating a helicopter, and I can control the throttle (at least without errors), but the engine isn't running. When I try to add a master engine switch to the defintion I get DATA_ERROR when I try to send the data.Does anyone have a version of this (any langauge) that actually works to control the throttle of something other than your own aircraft? (i.e. something created by AICreateSimulatedObject).I only want this to complete the example so that it looks as close to the original as possible; I'm not looking for other ways to solve the problem, such as creating a nonATC aircraft, or giving it a flight plan (both of which work), as does controlling the throttle of the "USER" aircraft.Regards,Ken

Share this post


Link to post
Share on other sites
Guest lc0277

Hello Ken,>3) the cbUnitSize parameter of SetDataOnSimObject is the total>size of the array not of one element as stated in the>documentation.The problem with cbUnitSize is that the client library is confusing between unit size and total size. A total of cbUnitsize*ArrayCount of data bytes are read from memory and sent to FSX, but the information contained in the request says that cbUnitSize is the total data size. This can cause problems for large data requests, see http://www.fsdeveloper.com/forum/showthread.php?t=3398>>I tried creating a helicopter, and I can control the throttle>(at least without errors), but the engine isn't running. When>I try to add a master engine switch to the defintion I get>DATA_ERROR when I try to send the data.Not many variables works for AI objects, since their simulation mode is "simpler" than for user aircraft. You don't really need to simulate fuel systems for instance.As stated by the documentation, there are no AI pilots for helicopters, so even less controls switches may be available. Moreover the function you are using to inject AI traffic may cause different behaviour. For example I'm able to switch on smoke system on an AI aircraft created by AICreateNonATC, but not on the same aircraft created with CreateSimulatedObject. That's probably the case for many other variables/events.

Share this post


Link to post
Share on other sites
Guest KenAdam

Thanks for the response.It looks from your other response that you understand that (say):An array of 10 elements, each of 16 bytes (160 bytes), which neds to be passed as a count of 10 and a size of 160, will actually try to transfer 1600.This is even worse than I thought! I assumed that it was just the documentation that was wrong in specifying the unit size when it meant the array size.Regarding the throttle control:It does seem like this example is seriously flawed, and probably written at an earlier stage in the development of FS X.I guess I'll go for the simplistic translation - put an elephnt were the Balloon was meant to be (so at least something appears and you don't get an error), and use the throttle to control the USER aircraft like the MS version does.It is also interesting where they put the Whale - took me a while to find it underground....Ken

Share this post


Link to post
Share on other sites
Guest lc0277

>Thanks for the response.>This is even worse than I thought! I assumed that it was just>the documentation that was wrong in specifying the unit size>when it meant the array size.>That's right. I didn't test in the SP1 SDK but it does not seemto have simconnect updates.>written at an earlier stage in the development of FS X.>I guess I'll go for the simplistic translation - put an>elephnt were the Balloon was meant to be (so at least>something appears and you don't get an error), and use the>throttle to control the USER aircraft like the MS version>does.I only tested this example in the beta 3 and the balloon was a big pink fluo ball. Not really a big loss ;)Concerning animals there is another caveat; it seems that they don't have simulation model in FSX. You cannot send them waypoints, and they just fall down if they're not created on ground.You need to edit the simobject container configuration file and change the category to "GroundVehicle" if you want to display moving herds.

Share this post


Link to post
Share on other sites
Guest KenAdam

I wasn't going to bother making the elephant move - it just seems an appropriate symbol for a faulty example. I wonder if it would accept a throttle if I made it a ground vehicle....200MPH elephant?It stands up OK in the right place, but when I create a red bus at the same location it hovers in the air - despite setting "OnGround" and the airfield altitude in both cases. A flatbed truck appears with the wheels inserted into the ground. Looks like some of the models may have datum errors.Ken

Share this post


Link to post
Share on other sites
Guest CocoLoco

I have managed to create AI vehicles and get them to move around an airport at different speeds. It was a little while ago though so my memory is a bit fuzzy as to how I did it.I believe I used AI_DESIRED_SPEED with SimConnect_SetDataOnSimObject. I think if you call SimConnect_AIReleaseControl first then it just moves in the direction you tell it at your specified speed. If you provide waypoints instead then it tries to maintain the AI_DESIRED_SPEED between waypoints but may slow down to turn. I also remember not having much luck with the animals though...

Share this post


Link to post
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
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...