[This entry has been imported from my old blog, therefore, links and images might now show correctly. Sorry about that]
As some of you have noticed, on the latest screenshots of the game, was an attitude indicator gauge on the lower left corner of the screen. The placement of this instrument was becoming annoying so I decided I would put it at its proper place that is, inside the cockpit, screwed to the instrument panel.
To create an instrument, I had to go through a few steps.
1 - Create an object in the model editor (A plane, with a dummy texture)
2 – Assign an xml tag to this object. This tag contains the name of the gauge class to use on this particular object. The texture of the gauge will replace the dummy texture.
3 – Load the airplane, and find all objects that reference a gauge in their xml properties
4 – Load the specified gauges from the code
5 – Every interval (1 second by default), call the Paint() method of every gauge, for them to update and render their stuff on their internal bitmap.
6 – After the Paint() call, copy each gauge bitmap to dynamic textures
7 – At 3D object rendering, replace the dummy texture by the gauge dynamic texture.
Two great things about this:
- I can place a gauge almost anywhere on the airplane.
- The drawing part is done with GDI+ so I don’t need to implement some sort of API for drawing stuff in gauges.
One thing that I fear:
- I don’t know how this will behave with lots of gauges
- I already know that big textures (>512) slow the game during the copying from system memory to video memory. That’s why I do this every 1 second. So far, I have not witnessed any slow downs with current gauges. Their sizes vary from 128x128 to 256x256.
I had already coded some gauges back when I was working on the instrument panel so it only took a couple minutes to adapt the code of each one to the new system.
So now, there are 4 gauges inside the Cessna 421 :
- An attitude indicator (Artificial horizon)
- A variometer
- An Altimeter
- A Garmin 430 only showing Com1 and Com2 radios for now.
Screenshots :
![[Gauges] Inside view](/cs/photos/matt/images/8986/secondarythumb.aspx)
Stress test and new Garmin 430
![[Gauges] Zooming on the cockpit](/cs/photos/matt/images/8988/secondarythumb.aspx)
Views from oustide of the airplane
Close up showing Com1 and Com2 radio settings and Inside view
![[Gauges] Panel from oustide](/cs/photos/matt/images/8982/secondarythumb.aspx)
Another outside view
There is no user interaction yet but I’ll implement that soon. I’ll try to make something better that FS2004 system. I hate it; it’s a pain to change radio frequencies. I think I’m going to do something similar to what we had in Flight Unlimited 2 and 3, the click and drag method…
Since this is a big update to the game, I’ve released a version today, it’s downloadable on my website here:
http://matt-online.homeip.net/flightsimulatorbeta.aspx
Happy Landings,
Matt