• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2004 Rotate prob

Messages
231
Country
us-alabama
I was trying to write an .xml turn coodinator gauge, using the stock Baron as my starting point. When I got to the point of writing the Rotate/Nonlinearity for the bank needle. I plotted the rotation as the tutoial instructed by overlaying the needle .bmp in place on top of the back gound .bmp and taking location info from the top left corner of the needle.bmp as I rotated it to the -1, -.5, 0, +.5, +1 locations. I punched the numbers in to my code and when I flight tested the gauge the needle starts out about -98 degrees out of top dead center of the gauge as in this pic:

needletfu%20copy.jpg


Here is the code I wrote to produce the above gauge:

Code:
<Gauge Name="f4u1 turn coordinator" Version="1.0">
   <Image Name="f4u1_turn_coord_background.bmp"/>
   <Element>
              <Image Name="f4u1_Indicator_Ball_Icon.bmp">
                <Axis X="31" Y="31"/>
              </Image>
      <Shift>
         <Value Minimum="-1" Maximum="1">(A:Turn coordinator ball,position)</Value>
         <Nonlinearity>
            <Item Value="-1" X="92" Y="302"/>
            <Item Value="0" X="227" Y="306"/>
            <Item Value="1" X="362" Y="302"/>
         </Nonlinearity>
         <Delay PixelsPerSecond="60"/>
         <Failures>
            <GAUGE_TURN_COORDINATOR Action="Freeze"/>
         </Failures>
      </Shift>
   </Element>
   <Element>
      <Position X="225" Y="410"/>
      <Image Name="f4u1_bank_needle.bmp">
         <Axis X="29.5" Y="370"/>
      </Image>
      <Rotate>
         <Value Minimum="-1" Maximum="1">(A:Delta heading rate,rpm)</Value>
         <Nonlinearity>
            <Item Value="-0.5" X="140" Y="51"/>
            <Item Value="0" X="197" Y="41"/>
            <Item Value="0.5" X="254" Y="41"/>
         </Nonlinearity>
         <Delay PixelsPerSecond="90"/>
      </Rotate>
   </Element> 
</Gauge>

I had this same problem when writing the cage knob for the attitude gauge. I solved that by removing the Nonlinearity and just letting the Value control the cage knob.bmp. I tried the same thing with the bank needle.bmp and with a few adjusment I have it working perfectly now.

My question. What am I doing wrong with my Nonlinearity to throw the needle.bmp out of position? The needle seems to function correctly as far as movement goes when flight tested, it just does it from the -98 degree location. Am I taking my location data incorrectly? Is the Nonlinearity conflicting with the A:Delta heading rate,rpm?

Carl
 
Last edited:
The unit value for Delta heading rate is "radians per second" why you are using "rpm" is a mystery.

The "position" value for the ball returns a number from -127 to +127, but you've set yours to be limited from -1 to +1...
 
N4gix

I am working with the stock Baron as my base of information for this code. That and the .xml tutorials from fs2x.com. I used those values because they are the values used in the stock Baron. Sorry about the slow reply I had about given up on getting a response.

Carl
 
The unit value for Delta heading rate is "radians per second" why you are using "rpm" is a mystery.

I said the same thing today when i opened the default aircraft xml turn coordinator. So the example above came from the same source. I too wonder how the heck the default got away with this.
Even the <Delay DegreesPerSecond="180" /> is correct. The code above is using pixels which i am sure is ok as well.

But the mystery is the default coding is using the rpm as the units.:eek: When it should Degrees Per Second.
 
A standard rate turn is 3 degrees per second. This is 180 degrees per minute or 0.5 RPM.
In terms of radians per second, a standard turn would be about 0.05.
They both describe rate of rotation so should be interchangeable.
Roy
 
A standard rate turn is 3 degrees per second. This is 180 degrees per minute or 0.5 RPM.
In terms of radians per second, a standard turn would be about 0.05.
They both describe rate of rotation so should be interchangeable.
Roy

Oh right so it's just revolutions per minute but for degrees and not engine cycles.
 
This is the turn coordinator from the VC10. And it works perfectly!
(A:DELTA HEADING RATE,RPM) is used in all the analog turn coordinator gauges in all my other a/c.
Code:
<Gauge Name="Turn Coordinator" Version="1.0">
   <Image Name="TURN.bmp" ImageSizes="80,80" Luminous="1"/>
   <Element>
      <Position X="39" Y="55"/>
      <Image Name="NEEDLE_5.bmp" PointsTo="North" ImageSizes="11,33" Luminous="1">
         <Axis X="5" Y="33"/>
      </Image>
      <Rotate>
         <Value Minimum="-1" Maximum="1">(A:DELTA HEADING RATE,RPM)</Value>
         <Nonlinearity>
            <Item Value="-0.5" X="22" Y="26"/>
            <Item Value="-0.25" X="29" Y="21"/>
            <Item Value="0" X="39" Y="23"/>
            <Item Value="0.25" X="50" Y="21"/>
            <Item Value="0.5" X="57" Y="26"/>
         </Nonlinearity>
         <Delay DegreesPerSecond="120"/>
         <Failures>
            <GAUGE_TURN_COORDINATOR Action="Freeze"/>
            <SYSTEM_ELECTRICAL_PANELS Action="0"/>
         </Failures>
      </Rotate>
   </Element>
 
   <Element>
      <Position X="0" Y="41"/>
      <MaskImage Name="TURN MASK.bmp">   
      </MaskImage>
   </Element>
 
   <Element>
      <Position X="21" Y="35"/>
      <Select>
         <Value>(A:CIRCUIT GENERAL PANEL ON, bool)</Value>
         <Case Value="0">
            <Image Name="TURN_FLAG.bmp" ImageSizes="16,8"/>
         </Case>
      </Select>
   </Element>
 
   <Element>
      <Image Name="TURN_BALL.bmp" ImageSizes="10,8" Luminous="1">
         <Axis X="5" Y="4"/>
      </Image>
      <Shift>
         <Value Minimum="-1" Maximum="1">(A:TURN COORDINATOR BALL,position)</Value>
         <Nonlinearity>
            <Item Value="-1" X="20" Y="63"/>
            <Item Value="0" X="40" Y="64"/>
            <Item Value="1" X="60" Y="63"/>
         </Nonlinearity>
         <Delay PixelsPerSecond="30"/>
      </Shift>
   </Element>
 
   <Mouse>
      <Tooltip ID="TOOLTIPTEXT_TURN_COORDINATOR_RATE"/>
   </Mouse>
</Gauge>
 
Last edited:
Hello. Okay, I'm really confused. I am doing a test to find out why some XML code runs smoothly and others don't. I am trying two examples:

// first example:

Code:
<Gauge Name="Needle" Version="1.0">

<Image Name="Background.bmp"/>  

<Element Name="Rotate">
    <Position X="79" Y="79"/>
         <Image Name="Needle_blue.bmp" Bright="Yes" PointsTo="West">
     <Axis X="1" Y="0"/>    
      </Image>

       <Rotate>
        <Value>(A:Plane heading degrees gyro,radians) /-/</Value>
       </Rotate>
   </Element>

</Gauge>

//      second example:

<Gauge Name="Compass" Version="1.0">

<Image Name="CompassBackground.bmp"/>  

<Element>
       <Position X="53" Y="53"/>
      <Image Name="Compass.bmp">
         <Axis X="53" Y="53"/>
      </Image>

   <Rotate>
<Value>(A:Plane heading degrees gyro,radians) /-/ </Value>    
   </Rotate>

</Element>

</Gauge>

The first code is a simple BMP of a needle, the second a compass. The needle does not run (rotate) as smoothly as the compass, why? I tried to attach a 10 second video but it's too large for this website. I've attached a picture instead to give an idea what what I'm seeing. I tried to attach a *.CAB but it was not an acceptable format for this website - strange since it accepts *.ZIP but not *.CAB (format for FS!). Anyways, any ideas?
 

Attachments

Last edited:
Did you solve the issue or do you still need help? I am thinking the bmp is too large in size. Normally we design the needle from code not a image. Let me know i can show a sample.
 
Hello delivery guy. Thank you for your reply. Sorry for the late response. I got caught up in honey-do's. Well, here's the ironic thing. If I use just the needle.bmp of a size at 2x39, its rotation is not as smooth as if I make the needle at 158x158, which is full size of the background. When you mean, "you design a needle from code," do you mean using a polygon?

Update: I tried using a polygon (highlighted in a red box) but it rotated at the same "roughness" as the small needle of 2x39. Picture attached.

Update 2: but still confused. I made a simpler polygon for the needle. I then placed that polygon in the gauge with the 2x39 needle and in the gauge with the 158x158 needle. Again, the gauge with the 158x158 needle ran smoother than the one with the 2x39 needle. The polygon "followed" the rate of the needle.BMP. Confused as to why... Picture attached.

Update 3: So confused. Please see the attached picture as I describe the following letters in that picture.
A. Just a rotating compass at 158x158; rotation is smooth.
B. Needle is 2x39 with a polygon added; rotation in rough, even with BMP removed.
C. Needle is 158,158 with polygon added; rotation is smooth. Then I added a nested rotation, see the code. The CDI is a bit
smoother (updates faster anyway) than the default (D) VOR's CDI movement but still not as smooth as the HSI's CDI (E).

Code:
<Element>
  <Position X="0" Y="0"/> 
  <Image Name="needle_black.bmp">  //set to 0,0,0
      <Axis X="53" Y="53"/>  // axis #1
    </Image>

  <Element>
    <Position X="55" Y="60"/>
    <Image Name="needle_purple.bmp" PointsTo="West">
      <Axis X="53" Y="53"/>  // axis #2
    </Image>
    <Clip/>
    <Shift>
      <Value>(A:NAV1 CDI, number,)</Value>
    <Scale X="0.27"></Scale>
    </Shift>
  </Element>
 
  <Rotate> A:NAV2 OBS
     <Value>((A:Plane heading degrees gyro, radians) /-/</Value>
   </Rotate>   
</Element>

D. Two default gauges XML coding of VOR.
E. My HSI; with smooth CDI movement.

Also, I noticed that if I make the gauges themselves larger, they run smoother but then can't be used in a normal panel... What is the deal?
 

Attachments

  • polygon test.PNG
    polygon test.PNG
    726.7 KB · Views: 392
  • 2x39 vs 158x158.PNG
    2x39 vs 158x158.PNG
    703.1 KB · Views: 343
  • vor comparison.PNG
    vor comparison.PNG
    886.7 KB · Views: 398
Last edited:
I only make analog gauges in 3D not 2D for fsx or p3d. i have never developed for 2004 so not sure i can be of much help. I too am confused why any of your tests have lag.
 
A hunch,
Just downloaded your example.
Perhaps it is the needle itself @ 4 bit / 16 colors..
When it rotates anti-aliasing is going to happen, inside the sim it will have to resample it to 24 bit for AA then draw it - each draw?, perhaps your stumble lies there.
I just stick to 24 bit for anything except difficult images with alpha (0,0,0) or masking, they go to 8 bit, but only if absolutely needed.

Another thing. The more windows you have open, specially undocked, the slower your sim will get. Regardless of the simplicity of the gauges.
 
Last edited:
Hello delivery guy and spokes2112. Thank you for your replies and information. So, Spokes2112, do I understand you correctly? You are saying bmp's should all be 24-bit color? And delivery guy, the panels are popups, but I undock them because I use a multi-screen (2) as I test or observe other gauges, etc. Still, though, why a rotating gauge runs smoother than one that does not rotate? Seems to me that more updating is required for something rotating than being static. I know that the VC is popular but I need 2D gauges since I have most of the hardware. So using VC actually makes it more unrealistic. Again, thank you for your time and information.
 
So, Spokes2112, do I understand you correctly? You are saying bmp's should all be 24-bit color?
Not saying they should, only 24bit & 8 bit are somewhat native to the sim in gauges. I almost always use 24bit, rarely 8.

Just a hypothesis here -
The needle is stationary, each pixel takes up 1 nibble, memory is allocated for just that.
Now the needle moves:
24 bit is needed for antialias in the movement.
Conversion takes place 4 bit to 24 bit.
Now each pixel takes 6 nibbles, ( 3 bytes, 24 bits )
Memory (more of it) will have to be reallocated for the new bitmap to draw it.
Compute the antialias.
Draw the bitmap.
Each time this happens each pixel has to be converted, more memory allocated etc..


Wouldn't be hard to test, just take your 4 bit bitmap, load it up in your editor, save it as 24, reload the gauge.

EDIT - Just tested with 2 gauges; 1 original, 1 all 24 bit.. Made no difference.
 
Last edited:
Hello Spokes2112. Thanks for your information. Okay, now you got me going on a hunting trip. I don't know what anti-aliasing is so I will have to research this. Am I suppose to activate it within FS or through the video card's software? You wrote: Wouldn't be hard to test, just take your 4 bit bitmap, load it up in your editor, save it as 24, reload the gauge. Shouldn't I make a 4-bit gauge and compare it with a 24-bit gauge or am I still confused :) ? Also, what is more strange is I have a couple of VOR's that run on a remote computer and they run much smoother than any VOR gauge within FS. Their movements are more accustom to what I see in a real airplane (C182). These gauges use FSUIPC; but doesn't FSUIPC also run at or about 18Hz (perhaps because of no overhead that the main computer has to contend)?
 
Last edited:
Hello Spokes2112. I observed the difference between 4-bit bmp gauge and 24-bit bmp gauge and did not see any significance in speed/updating. I think there there is something that FS9 is doing weird with the CDI because the remote gauges are very smooth and they receive the exact data from FS, through FSUIPC, not to mention 2 Ethernet adapters and an Ethernet switch. I just wished I could make the CDI run better within FS. Eric Marciano made a basic 6 package using Vector graphics that runs excellently but won't make any VOR/HSI, etc. anymore - too bad. I appreciate your time and information. BTW: What do the lines in the above message (#15) mean?
 
To WarpD and DragonflightDesign. It was nice to respond but neither of you explained WHY. As I mentioned before, I could not notice a difference in gauge movement anyway. And what do the lines in message #15 mean? How did they get there?
 
Back
Top