Project Glider for O2016

Here's the complete source file.

Well, there is only 1 file in there: the single *.cpp . The problem is probably not in there, given that you have linker errors, not compiler errors. It would be good to also have your solution and project files, so we can point out what to change in them to let VS build it properly.

I could plug that CPP into my VS 2015 templates, and I bet it'll run just fine, but this would not help you find the problem you have with your compiler.

---------- Post added at 19:33 ---------- Previous post was at 13:49 ----------

The following is a link to an environment archive for VS 2017 Enterprise (that's what I have here) for the Glider development: https://snoopie.at/face/beta/GliderVSEnvironment.zip

You have to extract it to your Orbiter root folder. It creates VS 2017 compatible property sheets in the /Orbitersdk/resources/ folder (*.props). It also creates solution and project files in the /Orbitersdk/samples/Glider/ folder.
In order to make it work, you have to edit the /Orbitersdk/resources/orbiterroot.props file with a text editor, and change the "Your:\Orbiter\Root\Path" text to your Orbiter root path. With this, all examples in the /Orbitersdk/samples/ should work when converted to 2017.
You also have to copy your CPP into the /Orbitersdk/samples/Glider/ folder, because I did not include it in the archive.

With my VS 2017 Enterprise installation, the solution can compile both Debug and Release versions of your glider CPP with working XRSound. I've tried both the 1.1 and the new beta 2.0 XRSound.

However, the simple PlayWav call in your code does not produce any sound, because the default "slots" are played automatically and are only available for enabling/disabling/changing, not for playing or stopping manually. If I do a LoadWav on e.g. ID 0 and with "XRSound\\Default\\Autopilot On.wav" directly after the CreateInstance and call it with ID 0 in PlayWav, it works though.
 
I don’t know whether to laugh or cry... The code compiles but there’s no .dll!

Build log:
Code:
1>------ Build started: Project: Glider, Configuration: Debug Win32 ------
1>Glider.cpp
1>Glider.cpp(151): warning C4101: 'th_group': unreferenced local variable
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(1198,5): warning MSB8012: TargetPath(C:\Users\toffe\Desktop\Orbiter\Orbitersdk\samples\Glider\Debug\Glider.dll) does not match the Linker's OutputFile property value (C:\Users\toffe\Desktop\Orbiter\Modules\Glider.dll). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
1>   Creating library C:\Users\toffe\Desktop\Orbiter\Orbitersdk\samples\Glider\Debug\Glider.lib and object C:\Users\toffe\Desktop\Orbiter\Orbitersdk\samples\Glider\Debug\Glider.exp
1>Glider.vcxproj -> C:\Users\toffe\Desktop\Orbiter\Orbitersdk\samples\Glider\Debug\Glider.dll
1>Glider.vcxproj -> Debug\Glider.pdb (Full PDB)
1>Done building project "Glider.vcxproj".
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

 
Last edited:
I don’t know whether to laugh or cry... The code compiles but there’s no .dll!

The DLL gets deployed into the /modules/ folder automatically.
 
The compiler's output window shows where the DLL is being created:

build output said:
1>Glider.vcxproj -> C:\Users\toffe\Desktop\Orbiter\Orbitersdk\samples\Glider\Debug\Glider.dll
 
The compiler's output window shows where the DLL is being created:

Yeah, but funny enough VS is lying there. The binaries go to the /modules/ folder with the project settings I've posted. I have explicitly set the linker output to it.
 
Hmm, that's odd. Maybe that's caused by this warning?

Compilation Warning said:
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(1198,5): warning MSB8012: TargetPath(C:\Users\toffe\Desktop\Orbiter\Orbitersdk\samples\Glider\Debug\Glider.dll) does not match the Linker's OutputFile property value (C:\Users\toffe\Desktop\Orbiter\Modules\Glider.dll). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
 
Hmm, that's odd. Maybe that's caused by this warning?

This could be, but I wouldn't do what the warning suggests. Simply because following the suggestion would mean that ALL build artifacts land in the /modules/ folder, which is not what I want.

---------- Post added at 18:17 ---------- Previous post was at 18:16 ----------

Why on the desktop?
Couldn't it be a UAC issue?

I'm pretty sure the binary is in his /modules/ folder, he just did not check.
 
:facepalm: Now I feel stupid... it was there all this time!
Anyway, I've now added flap extension sounds, auto-trim on/off aural indicators and wind sounds that vary with airspeed.
Thanks for all your help, and sorry for my silly questions:cheers:
 
Thanks for all your help, and sorry for my silly questions:cheers:

There are no silly questions. Especially not in C++.

I am VERY happy that my age prevents me from remembering what problems I had 20 years ago. :lol:
 
Thanks for all your help, and sorry for my silly questions:cheers:

You're welcome. We all had to start somewhere, and IMHO the only stupid thing a newcomer can do is to reject help out of arrogance.
 
Glider V0.50 Release

V0.50 has been released! This can be installed over the previous version if you have it. With it comes a host of new features, including:
  • 8 flap stages (positive and negative)
  • Auto-trim is now fully automatic (no need to switch on/off anymore)*
  • XRSound support (more details below)
*in normal circumstances, acrobatics notwithstanding

XRSound Support
This version has custom sounds, and as such requires XRSound. A BIG thanks to Face and dbeachy1 helping me get it to work:tiphat:
Sounds include:
  • Wind sound in-cockpit that varies with airspeed
  • Auto-trim on/off sounds
  • Flap sounds (ext./ret.)
  • Overspeed warning above 60 m/s

Key commands:
  • [E] - Engine on/off**
  • [NUMPAD5] - Auto-trim on/off
  • [V] - Flaps 0 (neutral)
  • - Flaps -1
    [*][N] - Flaps +1
    [*][M] - Flaps full (positive)


** Because of programming laziness safety reasons, engine will only shut down if thrust is idle

To-do: variometer, better mesh (thanks Marijn)
Wishes: thermals, damage

Have fun!
zachary77

EDIT: Linked to correct .lib now, sorry about that
 

Attachments

Last edited:
EDIT: It requires the new XRSound Beta

XRSound Beta is not released AFAIK. So nobody can enjoy your addon's sound feature if dbeachy1 decides to kill the temporary download link. I'd suggest to revert it to 1.1 .
 
XRSound Beta is not released AFAIK. So nobody can enjoy your addon's sound feature if dbeachy1 decides to kill the temporary download link. I'd suggest to revert it to 1.1 .

:facepalm: So sorry! :censored: I'll fix it now.

EDIT: Fixed

---------- Post added at 11:19 PM ---------- Previous post was at 12:54 PM ----------

By the way, how would I get vertical speed (for variomater)?
 
Last edited:
Well, depends on how realistic you want to be. Simple would be using the surface relative velocity of Orbiter (GetHorizonVelocity or so)

More accurate would be using dynamic and static pressure to calculate velocity and altitude change.
 
But how would I know delta time? Each time step is different.

In post- and prestep, you have a parameter called "simdt" in the interface. Thats the predicted length of the current timestep.
 
Back
Top