Design thoughts for ISimObject and SimConnect weapons integration.

Any issues, problems or troubleshooting topics related to the additional features present in the Prepar3D Professional Plus client application.
Posts: 1198
Joined: Mon Jun 10, 2013 4:33 pm

Post by minime »

Quote from Adam Breed on January 9, 2014, 14:41

For your question about design, a large focus on the weapon system is a move to the ISimObject style of interaction. Many pieces were added to SimConnect, but the full suite of weapon interaction is done through the ISimObject interface.

(I write this in its own post, as it seems to be a new topic.)

Every usage scenario for Prepar3d I see (at my place) involves LAN/WAN connected Prepar3d stations with an instructor station and full control over the network, which means full SimConnect access. Simulators that are not connectable are being phased out right now.

While ISimObject definitely is nice if you want to create a new vehicle from scratch, it seems to be of limited use otherwise. If I understand it correctly, ISimObject does not follow the object oriented approach, which means I cannot inherit the functionality from the base object and then only override what I need overridden. For example my main use would have been to add SimVars to all the existing aircraft by changing their basetype to my own ISimObject class, but I think this is not possible because I cannot inherit or override behaviour. I have to reimplement everything, which is not useful to me as I will lose the original handling of SimObjects (and of course it takes a lot of time as well).

Now there seems to be the basic SimObject type "aircraft" for example. If I could use that functionality as a base class and then add my own SimVars to it, so that any existing aircraft functions with total backwards compatibility while giving me access to my own SimVars via SimConnect, THAT would be very useful for me. So if we had access to the functionality of the existing ISimObjectAircraftBase, the ISimObjectHelicopterBase and the other basic legacy SimObject types, now THAT would be very nice.

I am not sure that a weapons integration that is not fully tied in with SimConnect is a good idea.

Also I do not see a reason why it should be done that way, it should be fairly simple to add SimConnect functions to do the basic "add weapon", "aim", "shoot", "reload" process. If a weapons integration requires more you can add SimVars with the ISimObject and access them via SimConnect, which again is full control via SimConnect. But actually it would be much better if most existing aircraft could be retrofitted with like four basic standard SimConnect functions that expose functionality that every weapons implementation needs anyway.

But from what I see right now, it IS in fact possible to do all that, the ways to do it are just hidden and distributed across SimConnect / SimVars / EventIDs.

Add weapon - There is a function to attach weapons to SimObjects that do not have them (Perfect).

Aiming - For aiming you need to use a currently undocumented eventID or a SimVar for AI (slightly hackish).

Shooting - For shooting you have to use SimVars to transmit a trigger signal (very hackish).

Reloading - For reloading you probably have to attach weapons again (which is a problem as you do not know the original config in the file).

So now if these were all SimConnect functions, I would be completely happy, as that seems to be a straight and clean API.

If more functionality is needed, ISimObject has to be used anyway, which then again ties in nicely with SimConnect. But I am sure most people will want to avoid ISimObject unless they need it, so the basic functionality should be cleanly implemented in SimConnect.

That being said, as long as I am able to pull off what I need by badly hacking my way through the API, I am fine with it in general. I just think a clean and useful SimConnect API will make it much easier for everyone in the long run, and the ISimObject, while not my favorite design, actually ties into that nicely.