FS2004 FSUIPC variable in asm?

#1
Hello guys,


I have never developed anything with FSUIPC yet. FSUIPC reads out a lot of variables from FS. Is it possible to read these values in a scenery asm file.

For example, FSUIPC can read the visibility variable from fs, can I somehow reach this variable in my asm code?

I have checked the FSUIPC SDK there is a variable for visibility: 04C0
Can I use this in my asm code to create a condition for example?

Thanks for lighting me up :)
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#2
Hi,

No, unfortunately that is not possible. In the asm code you can only use the variables that are listed in the FS sdk. Others are not accessible from the bgl file.

The only way to access FSUIPC variables is to copy them in a module to user variables (there are 5 of them). These can be used from the asm code. This could be done with a module or application.

Btw, this works for fs2004 only. With fsx FSUIPC can't write to the user variables anymore.
 
#3
Thanks Arno for your answer, really appreciate it.

As you can pretend, my goal is to switch on some lights during low visibility.


There is a way definitaly, but we do not know it.
Aerosoft is aware of this technique, Oliver Pabst (creator of AES) developed it. If you check for example the scenery of LGAV, there are custom runway lights and approach lights, they are turned on when the visibility drops. During the installation you need to install a special aerosoft program (module). But this module has a limited licence. It means Oliver can make runway lights for us but only if we sell our product via aerosoft. Of course they are not fool enough to tell us the technique.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#4
Hi,

The fact that a special module is used, probably means it is using the approach described above. A bit like the actigate module I am for gates some time ago.

For fsx a similar approach could work, but then the module/application should probably place the object through simconnect.
 
#5
I have been thinking about this concept.

I know that FSUIPC can access usrvars, and I could use that for visibility controlled lighting in FS9. However neither FSUIPC nor SimConnect can access User vars in FSX.

I was thinking about using another variables available.
One idea is to write a nonsense but valid value into one of transparent (to the user) variables, that could be either used in a switch directly, or command (on change) a switch to uservar.
Example: 0284 crash has valid values of 0, 2, 4, 8, 14. If I could add a value of "1", code could be made to check for the bit "1" iso "0" and turn the lights on or off.

Is it possible to access 0284 via FSUIPC or Simconnect? Maybe set 028C to 3, at least momentarily? What would happen to the sim? Immediate rewrite? Crash?


Another way would be to set a visible value, and reset it back. For ex. set ADF freq to 565 for a second, and then back. That could make some problems, though, I am afraid. Could sim (specifically, FSX) handle writing something in first/third place of extended ADF var?
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#6
Hi,

Most of those variables are bit mask. So for example time of day 3 would be both day and dusk/dawn at the same time. Not sure what would happen in that case.

Most of these variables will also be written by FS itself, so your values are most likely to be overwritten.

For FSX I think a better approach is to move the logic to your application and then selectively place certain sim objects. So instead of having all conditions in one mdl, you just switch different mdl files.
 
#7
Hi,

Most of those variables are bit mask. So for example time of day 3 would be both day and dusk/dawn at the same time. Not sure what would happen in that case.
Either way it does not seem to be writeable, at least as far as I have tried yet (not far). Crash would be the best if it indeed is a bitmask since it seems to only have values with the last bit "0" (0, 10, 100, 1000 and 1110). However if FSUIPC can not write to that variable, I sure cannot.

Intelliscene would have been a solution, probably, and when I contacted Vista Mare software they indicated it was possible to license it, however, nothing ever came from this, and Vista Mare does not seem to exist anymore.
My best guess is, that Aerosoft now handles it (based on tsgucci post in Oct12). I think it may work with some heavy hacking into memory to inject data in normally inaccessible variables... or something like that. I can get nowhere near that level.

Most of these variables will also be written by FS itself, so your values are most likely to be overwritten.
That would not be a problem if it stayed changed long enough for BGL code to note. I could have a function watching some variable, and if that variable is set to predetermined number, set a local variable to light state (simple on/off, or different states, RAIL on/off, middle line on/off, rwy centerline on/off)...

Question is, how long is long enough, especially if a non-transparent variable is used (ADF or so), I do think it would not be completely unfeasible if it can be done in one tick. (with either slow updates, or updates only on case change). Another question is how often does FS update transparent variables, if found injectable, i.e. does it update ToD every tick or every second, minute, on change? Crash? Any other variable usable in this manner?

For FSX I think a better approach is to move the logic to your application and then selectively place certain sim objects. So instead of having all conditions in one mdl, you just switch different mdl files.
If a simobject .mdl (or a library call) could use the asm tweaks such as separation planes and so, then it could work and all I can do is wonder why it is not done at least occasionally...

Alas, I will go and try it. One of these days.
 
#8
Very interesting what you write.

I believe the giants (Orbx, flytampa, fsdreamteam, aerosoft) are using a simconnect dll. They extraxt from simconnect the date and according this date they place the respsctive object (summer or winter mdl) in the scenery.
To achive this two things neede. Simconnect dll to get the date, and the know-how how to place objects with simconnect.
 
#9
It is (well, relatively) easy to place an object with simconnect. The idea as you know since you want to place a copyprotection object with it :)

(a tiny OT idea, make the dll if/else switch to show also some important object, elsewhere someone will quickly figure that to get rid of the copyprotection object all he has to do is delete the .dll. If he loses the terminal by doing that... better protection)

However looking at ORBX scenery it does not seem to include any simobjects...
They have an xml which cointains (among other things) library GUIDs. Maybe they found how to place scenery object directly by GUID reference.
 
#10
No offense, you know for me simconnect is like the wife of Culombo. Everybody talks about her but nobody actualy see her.
I have not seen any example code on simconnect any tutorial. I even do not know how to program it. The SDK is full with variable but I do not know where to put it. If somebody could deliver me an example code which place a simobjects into the scenery with simconnect I would be very happy and I would pay for it.

I dumb for programming except the Visual Basic Macro in Microsoft Excel.

We should try...
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#11
Hi,

The sdk has some sample programs for simconnect.

But given the recent discussions about this topic, I am thinking that we should make such a exe/dll that can place objects based on conditions as a community. Then it can be available for all developers. Better then everybody making their own. I am going to do some thinking about the requirements for such a framework.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#12
Hi,

Regarding the seasonal changes and orbx scenery. If you are using autogen, you don't need a module to swap objects, the autogen can do it for you. So that might explain the lack of sim objects. But just guessing of course :)
 
#14
It is not just season. I think.

I will post here a snippet of an .xml of a free scenery from ORBX, I hope it is not against anything, since this is a freeware scenery and for educational purposes (so to say :) )

Code:
<GUID>{85910463-497e-4730-ac9c-8bbe3d427e80}</GUID>
        <Condition>TIME_OF_DAY EQUAL 1 AND MONTH_OF_YEAR GREATER_THAN 3 AND MONTH_OF_YEAR LESS_OR_EQUAL 10</Condition>
For example, this object will be only placed if time of day is "day". This may also be done in asm code, but I imagine that this is easier for orbx. Apparently they have their internal development tools, I would expect that putting an xml as an output is rather easier than modifying .asm via a tool.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#15
Hi,

This indeed seems to indicate they have some module or tool that is placing the object based on the conditions.
 
#16
Hi,

The sdk has some sample programs for simconnect.

But given the recent discussions about this topic, I am thinking that we should make such a exe/dll that can place objects based on conditions as a community. Then it can be available for all developers. Better then everybody making their own. I am going to do some thinking about the requirements for such a framework.
Please let me know. Since I want to try and do a placement of an AI airplane as a static object as well (might be handy for the museum at my airport, or placing airplanes at various different airports, such as Pragues OK-XDM), I will start looking at code
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#17
I will also do some more testing. Placing the objects is not hard. And making some logic to show them in certain conditions is also not difficult in a tool. But I would also like to control animations, so I can have CAT like functionality again. Hopefully I find some time this week to experiment a bit.
 
Top