Tutorial: A DIY Flight Simulator tutorial

How to create a flight simulator with state of the art Flight Dynamics and a Worldwide dataset
Context : Antoinette Project: tools to create the next generation of flight simulators - Unreal Engine

By the Epic Simulation Team

https://dev.epicgames.com/community/learning/tutorials/mmL/unreal-engine-a-diy-flight-simulator-tutorial

3 Likes

So I’m up to the JSBSim part, following the readme on their github and running into some set up errors, help would be appreciated.

Following the readme, I open and build the JSBSimForUnreal.sln with no errors, right click UEReferenceApp.uproject → Generate visual studio project files, open up the solution and try to Build Startup Project on the UnrealVS extension bar. This is the output I get:

Build started…
1>------ Build started: Project: UEReferenceApp, Configuration: DebugGame_Editor x64 ------
1>Using bundled DotNet SDK
1>Log file: C:\Users\rando\AppData\Local\UnrealBuildTool\Log.txt
1>Creating makefile for UEReferenceAppEditor (no existing makefile)
1>UnrealBuildTool : warning : Library ‘C:\jsbsim-master\UnrealEngine\Plugins\JSBSimFlightDynamicsModel\Source\ThirdParty\JSBSim\Lib\JSBSim.lib’ was not resolvable to a file when used in Module ‘JSBSim’, assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning.
1>Parsing headers for UEReferenceAppEditor
1> Running UnrealHeaderTool “C:\jsbsim-master\UnrealEngine\UEReferenceApp.uproject” “C:\jsbsim-master\UnrealEngine\Intermediate\Build\Win64\UEReferenceAppEditor\DebugGame\UEReferenceAppEditor.uhtmanifest” -LogCmds=“loginit warning, logexit warning, logdatabase error” -Unattended -WarningsAsErrors -abslog=“C:\Users\rando\AppData\Local\UnrealBuildTool\Log_UHT.txt” -installed
1>Reflection code generated for UEReferenceAppEditor in 1.5128132 seconds
1>Building UEReferenceAppEditor…
1>Using Visual Studio 2019 14.29.30145 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133) and Windows 10.0.18362.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>[Adaptive Build] Excluded from UEReferenceApp unity file: UEReferenceApp.cpp, UEReferenceAppGameModeBase.cpp
1>Determining max actions to execute in parallel (8 physical cores, 16 logical cores)
1> Executing up to 8 processes, one per physical core
1>Building 19 actions with 8 processes…
1>[1/19] Resource Default.rc2
1>[2/19] Resource Default.rc2
1>[3/19] Resource Default.rc2
1>[4/19] Compile SharedPCH.UnrealEd.NonOptimized.ShadowErrors.cpp
1>[5/19] Compile SharedPCH.Engine.NonOptimized.ShadowErrors.cpp
1>[6/19] Compile UEReferenceApp.init.gen.cpp
1>[7/19] Compile UEReferenceApp.cpp
1>[8/19] Compile UEReferenceAppGameModeBase.gen.cpp
1>[9/19] Compile UEReferenceAppGameModeBase.cpp
1>[10/19] Link UnrealEditor-UEReferenceApp-Win64-DebugGame.lib
1> Creating library C:\jsbsim-master\UnrealEngine\Intermediate\Build\Win64\UnrealEditor\DebugGame\UEReferenceApp\UnrealEditor-UEReferenceApp-Win64-DebugGame.lib and object C:\jsbsim-master\UnrealEngine\Intermediate\Build\Win64\UnrealEditor\DebugGame\UEReferenceApp\UnrealEditor-UEReferenceApp-Win64-DebugGame.exp
1>[11/19] Link UnrealEditor-UEReferenceApp-Win64-DebugGame.dll
1> Creating library C:\jsbsim-master\UnrealEngine\Intermediate\Build\Win64\UnrealEditor\DebugGame\UEReferenceApp\UnrealEditor-UEReferenceApp-Win64-DebugGame.suppressed.lib and object C:\jsbsim-master\UnrealEngine\Intermediate\Build\Win64\UnrealEditor\DebugGame\UEReferenceApp\UnrealEditor-UEReferenceApp-Win64-DebugGame.suppressed.exp
1>[12/19] Compile Module.JSBSimFlightDynamicsModel.gen.cpp
1>[13/19] Compile Module.JSBSimFlightDynamicsModel.cpp
1>[14/19] Link UnrealEditor-JSBSimFlightDynamicsModel-Win64-DebugGame.lib
1> Creating library C:\jsbsim-master\UnrealEngine\Plugins\JSBSimFlightDynamicsModel\Intermediate\Build\Win64\UnrealEditor\DebugGame\JSBSimFlightDynamicsModel\UnrealEditor-JSBSimFlightDynamicsModel-Win64-DebugGame.lib and object C:\jsbsim-master\UnrealEngine\Plugins\JSBSimFlightDynamicsModel\Intermediate\Build\Win64\UnrealEditor\DebugGame\JSBSimFlightDynamicsModel\UnrealEditor-JSBSimFlightDynamicsModel-Win64-DebugGame.exp
1>[15/19] Link UnrealEditor-JSBSimFlightDynamicsModel-Win64-DebugGame.dll
1>LINK : fatal error LNK1181: cannot open input file ‘C:\jsbsim-master\UnrealEngine\Plugins\JSBSimFlightDynamicsModel\Source\ThirdParty\JSBSim\Lib\JSBSim.lib’
1>[16/19] Compile Module.JSBSimFlightDynamicsModelEditor.cpp
1>[17/19] Link UnrealEditor-JSBSimFlightDynamicsModelEditor-Win64-DebugGame.lib
1> Creating library C:\jsbsim-master\UnrealEngine\Plugins\JSBSimFlightDynamicsModel\Intermediate\Build\Win64\UnrealEditor\DebugGame\JSBSimFlightDynamicsModelEditor\UnrealEditor-JSBSimFlightDynamicsModelEditor-Win64-DebugGame.lib and object C:\jsbsim-master\UnrealEngine\Plugins\JSBSimFlightDynamicsModel\Intermediate\Build\Win64\UnrealEditor\DebugGame\JSBSimFlightDynamicsModelEditor\UnrealEditor-JSBSimFlightDynamicsModelEditor-Win64-DebugGame.exp
1>[18/19] Link UnrealEditor-JSBSimFlightDynamicsModelEditor-Win64-DebugGame.dll
1>LINK : fatal error LNK1181: cannot open input file ‘C:\jsbsim-master\UnrealEngine\Plugins\JSBSimFlightDynamicsModel\Source\ThirdParty\JSBSim\Lib\JSBSim.lib’
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command ““C:\Program Files\Epic Games\UE_5.0\Engine\Build\BatchFiles\Build.bat” UEReferenceAppEditor Win64 DebugGame -Project=“C:\jsbsim-master\UnrealEngine\UEReferenceApp.uproject” -WaitMutex -FromMsBuild” exited with code 6.
1>Done building project “UEReferenceApp.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Found my error, paying a little closer attention I noticed it was creating a “LibDebug” folder instead of “Lib”. I realized I wasn’t building the JSBSimForUnreal.sln in RELEASE mode.

I’m embarrassed, hope this helps someone in the future.

2 Likes

Thanks for posting the resolution you found.

The error messages in the build are typically those of a missing lib file.
1>LINK : fatal error LNK1181: cannot open input file 'C:\jsbsim-master\UnrealEngine\Plugins\JSBSimFlightDynamicsModel\Source\ThirdParty\JSBSim\Lib\JSBSim.lib'

Glad that you found the error. It also could have come from the Configuration you choose for the UE Reference Application.

For further reference, yes, the JSBSimForUnreal.sln comes with two different targets - Release and Debug.
For 99% of the cases, just building the Release one is needed - Unreal will still allow you to debug your plugin and application with Release third parties. The debug is really if you want to have symbols of the JSBSim classes to debug JSBSim itself…

UE Application Configuration
DebugGame → Uses Debug JSBSim Libs
DebugGame Editor → Uses Debug JSBSim Libs
Development Game → Uses Release JSBSim Libs
Development Editor → Uses Release JSBSim Libs
Shipping → Uses Release JSBSim Libs

Hello everyone. I am experimenting with the JSBSIM Unreal Engine 5 plugin. In order to understand everything, I like ti simplify as much as possible and build on that. So I created a Pawn, gave it a Static Mesh as the root, and added the JSBSimMovement component. For the model I selected the Cessna 172 (c172p).

Here is my blueprint in the viewport. Note that, to make sure of orientation, I set the static mesh to the UE Axis_Guide model. The X axis if forward, as per UE convention.

With only this done, if I place my blueprint in the level and I hit play, the model moves backwards for about 10 seconds. For it to move, I understand - the default for the JSBSimMovementComponent is for it to start with the engine on. But why does it move backwards?

And while I am here, I might as well ask my second question. I can get the Commands and the EngineCommands members of the component, and I can do things like setting the throttle. And this does change the Engine Commands Throttle (as per the debug information displayed), but it does not change the Engine States - these stay fixed. So it seems like just setting command properties and setting the Commands property of the JSBSimMovementComponent does have an effect, but it not actually applied to the flight model. Any ideas what I am doing wrong?

Thank you for your time.

Hey there everyone.

I got to the point where I wish to build the UEReferenceApp via the VS toolbar.
However, I am getting this error:

Exited with code 6…anyone knows why? I have compiled the project main first without issues. The SDK /dotnet core are all installed. VS 2019.

1>------ Build started: Project: UEReferenceApp, Configuration: DebugGame_Editor x64 ------
1>’“C:\Program Files\Epic Games\UE_5.0EA\Engine\Build\BatchFiles\GetDotnetPath.bat”’ is not recognized as an internal or external command,
1>operable program or batch file.
1>Win64 using Manual SDK 10.0.19041.0
1>Creating makefile for UEReferenceAppEditor (no existing makefile)
1>UnrealBuildTool : error : Unable to find plugin ‘GeoReferencing’ (referenced via UEReferenceApp.uproject). Install it and try again, or remove it from the required plugin list.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(45,5): error MSB3073: The command ““C:\Program Files\Epic Games\UE_5.0EA\Engine\Build\BatchFiles\Build.bat” UEReferenceAppEditor Win64 DebugGame -Project=“C:\i2\jsbsim-master\UnrealEngine\UEReferenceApp.uproject” -WaitMutex -FromMsBuild” exited with code 6.
1>Done building project “UEReferenceApp.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Many thanks.

I managed to overcome this problem by upgrading from Early Access 2 to UE 5.0.1

Glad you find the solution. Indeed, the EA2 was as its name implies a preview, which did not contain all features, especially the georeferencing plugin needed to translate coordinates from JSBSim to Unreal.
All projects need to be done with UE5 now.

Use VS2019 to compile plugin error how to do, ask for help,thks

Hi HouYang,

This is a consequence of adding the ability to build JSBSim as a DLL. I’m working on that issue these days, and will submit an update PR ASAP.

Edit : As of 06/08/2022, this should be fixed… (PR #650)

Hello, I am new to the flight simulation field and to unreal engine in general. I have a specific question concerning the reference UE application that is mentioned in the Tutorial article (A DIY Flight Simulator tutorial) and I don’t know if it’s relevant to ask it in this forum but here I am: I successfully installed the reference UE application with JSBSim plugin to learn on it as recommended. But now my purpose is to be able to implement simple flight control commands in this reference case, instead of using manual inputs. Does anyone have an idea of how I should proceed? If, for example, I want to go from a known point A to a known point B, how can I know what are the corresponding flight commands (and their values) that have to be controlled in order to the give the specific angles needed (roll, pitch, yaw) to acheive this goal ?

Hi RamajJL,

Well, what you are searching for should be similar to an Autopilot feature.
This is for sure outside of the scope of UE and of this plugin, and we won’t be able to help because this is very specific.

However, I have read that there are autopilot features in JSBSim. Maybe you can have a look at it and find a way to integrate it into UE.

3 Likes

Hello, I did put this question on JSBSim Github but I thought it would also be helpful to put it here too: Im using the reference UE application with JSBSim. I want to know how to change the aircraft. What i’m doing is not functionning which is only changing the name in JSBSimMovement Component details>Model>Aircraft Model. When I change the aircarft model it either doesn’t change anything or the default 787-8 starts having bizarre behavior like turning around it self while on ground. This is a glimpse of the error I’m having. Thanks in adavance for your help!!
Blueprint Runtime Error: “Attempted to access index 1 from array EngineStates of length 1!”. Node: Set RightEnginePlayRate Graph: EventGraph Function: Execute Ubergraph ABP Commercial Plane Blueprint: ABP_CommercialPlane
Blueprint Runtime Error: “Accessed None reading structure N1”. Node: Set RightEnginePlayRate Graph: EventGraph Function: Execute Ubergraph ABP Commercial Plane Blueprint: ABP_CommercialPlane
Blueprint Runtime Error: “Attempted to access index 1 from array EngineStates of length 1!”. Node: Set RightEnginePlayRate Graph: EventGraph Function: Execute Ubergraph ABP Commercial Plane Blueprint: ABP_CommercialPlane
Blueprint Runtime Error: “Accessed None reading structure N1”. Node: Set RightEnginePlayRate Graph: EventGraph Function: Execute Ubergraph ABP Commercial Plane Blueprint: ABP_CommercialPlane
Blueprint Runtime Error: “Attempted to access index 1 from array EngineStates of length 1!”. Node: Set RightEnginePlayRate Graph: EventGraph Function: Execute Ubergraph ABP Commercial Plane Blueprint: ABP_CommercialPlane
Blueprint Runtime Error: “Accessed None reading structure N1”. Node: Set RightEnginePlayRate Graph: EventGraph Function: Execute Ubergraph ABP Commercial Plane Blueprint: ABP_CommercialPlane
Blueprint Runtime Error: “Attempted to access index 1 from array EngineStates of length 1!”. Node: Set Scalar Parameter Value Graph: EventGraph Function: Execute Ubergraph BP Airliner Blueprint: BP_Airliner
Blueprint Runtime Error: “Accessed None reading structure N1”. Node: Set Scalar Parameter Value Graph: EventGraph Function: Execute Ubergraph BP Airliner Blueprint: BP_Airliner
Blueprint Runtime Error: “Attempted to access index 1 from array EngineStates of length 1!”. Node: Set RightEnginePlayRate Graph: EventGraph Function: Execute Ubergraph ABP Commercial Plane Blueprint: ABP_CommercialPlane
Blueprint Runtime Error: “Accessed None reading structure N1”. Node: Set RightEnginePlayRate Graph: EventGraph Function: Execute Ubergraph ABP Commercial Plane Blueprint: ABP_CommercialPlane
Blueprint Runtime Error: “Attempted to access index 1 from array EngineStates of length 1!”. Node: Set RightEnginePlayRate Graph: EventGraph Function: Execute Ubergraph ABP Commercial Plane Blueprint: ABP_CommercialPlane
Blueprint Runtime Error: “Accessed None reading structure N1”. Node: Set RightEnginePlayRate Graph: EventGraph Function: Execute Ubergraph ABP Commercial Plane Blueprint: ABP_CommercialPlane
Blueprint Runtime Error: “Attempted to access index 1 from array EngineStates of length 1!”. Node: Set RightEnginePlayRate Graph: EventGraph Function: Execute Ubergraph ABP Commercial Plane Blueprint: ABP_CommercialPlane
Blueprint Runtime Error: “Accessed None reading structure N1”. Node: Set RightEnginePlayRate Graph: EventGraph Function: Execute Ubergraph ABP Commercial Plane Blueprint: ABP_CommercialPlane
Blueprint Runtime Error: “Attempted to access index 1 from array EngineStates of length 1!”. Node: Set Scalar Parameter Value Graph: EventGraph Function: Execute Ubergraph BP Airliner Blueprint: BP_Airliner

I got answers on github, thanks anyway!

Hello RamajJL,I have a problem similar to yours, and I would like to ask you where you found a solution,Thank you!

Hello RamajJL,I have a problem similar to yours, and I would like to ask you where you found a solution,Thank you!

@_Yu2

Click on your error and it will open up the blueprint section where the error is. You have to edit your blueprint. The default blueprint is designed to work with 2 engines. If you want it to work for less or more engines you need to edit it. You can do this edit to make the error go away:

Also is you’re new to Unreal Engine, keep in mind this Flight Sim plugin is not a complete solution. It’s a starting point for developers to make their own.

How can I add a custom airplane to JsbSim, for example I want to add a Mig-21 and I’ve created the xml file for both the plane and the engine but how can I integrate it to work with Unreal
Here are the files

https://drive.google.com/drive/folders/16nCbcSYFgSAd8gFoGYnHG-kFe9-E5hQR?usp=sharing

1 Like

Add your files to the folders below and then you can use the new aircraft name. Open UE5 and in the level editor, click the aircraft blueprint, then select the JSBSimComponent at the bottom of the components of the blueprint, and change the name of the aircraft to yours. It should then load your aircraft.
image