UPBGE 0.3 - SuperGuepard Aircraft

Hi,

Flyable microlight aircraft.

  • Quite realistic but very simple flight model.
  • Joystick support and configuration menu
  • Flight recorder (key O) and playback (key P)
  • Slalom course

Walk with your 1st person to the left door, press E (or joystick button 5) to open the doorr, enter, close the door, start Engine.

Welcome:
    Enter the Aircraft through the left door(E), close the door, start the Engine (E), 
    -Fly the slalom - try to beat your own time, (the next way point is also indicated by the Heli instruments.)
        Your flight will be recorded and played back the next time you fly the slalom: You can see how you flew.
        You can turn off the Slalom recorder by setting the property 'slalom_recorder' of the object 'ZSE' to false.

    Exiting the Aircraft is only possible with stopped Engine (E).

Default is Joystick for the Aircraft.
You can use the mouse instead for the Aircraft unplugging all joysticks or by setting
'Controller-Joystick' to None in Joystick Menu (key J)
In this menu you can also choose a 'Tracking-Joystick' for HeadTracking in Cockpit view
More info about Joysticks down below.

Joystick Assignment:
    Key J:  Open/Close Menu
            On Top choose Controller-Joystick with LeftMouseClick
            Left Mouse Button:  enable/disable listening, then move Axis to full extend or press Button 
            Right Mouse Button: delete Entry
            
            Axes Sensitivity: MouseWheel up/down. LeftClick to reset to 100.
            
            You can test buttons and Axes:  assigned function will highlight in pink 
            
            On Bottom Choose HeadTracking-Joystick with LeftMouseClick   
                 
            When Menu is closed the settings are saved to disk ('name'.bgeconf)
            
            
View:     
    Key F or JoyButton 7: Fly-by Camera
            (CTRL+)MouseWheel or PgUp/PgDown or JoyButton 3/4: Zoom
            (CTRL+)Mouse or Arrow Keys or JoyHat: rotate Camera  
            MiddleMouseButton or JoyButton 2: From Top-View            
            Or when in FirstPerson-Modus switch back to FirstPerson-View (from Ground-Camera)
                
    Key G: Ground Camera
            hit G again to switch between 4 different Views 
            SHIFT+G previous View
            
    Key C or JoyButton 8: Aircraft Cockpit Camera
            (CTRL+)MouseWheel or PgUp/PgDown or JoyButton 3/4: Zoom
            (CTRL+)Mouse or Arrow Keys or JoyHat: Look around  (disabled when using HeadTracking-Joystick)
            MiddleMouseButton or JoyButton 2: Center View
            
    
    
    ENTER key: restart game
    
Controls:       
        
    Aircraft:
        Controls:
        E or JoyButton 5: start/stop Rotor-Engine
        W/S or JoyThrottle: Throttle
        A/D or JoyZ-Axis: Yaw
        Mouse or Joy-Axes: Pitch and Roll                                     
        Q or JoyButton 6: Toggle Follow mode in Flyby view 

        T: toggle Trails
        
        Left Mouse Button or JoyButton 1: Wheel Brakes
                
    FirstPerson-View:
        Controls:
        Mouse: View
        W/A/S/D: Move
        Shift: Run
        Space: Jump
        
        E or JoyButton 5: Open/Close Aircraft Door 
           Enter/Exit Aircraft
           Start/Stop Aircraft Engine
           
Manual recorder:
    Key O: start recording
    Key P: (stop recording and) playback recording
    
Debug shortcut keys:
    Key 1: 1st person View
    Key 2: Focus on SuperGuepard
    Key 3: Focus on SuperGuepard Dummy  (useful when playing back manual recording)
                          
    
Sensibility of Aircraft Controls with mouse:
    set the properties of object 'SuperGuepard'

    
About Controller-Joystick:
For a Microsoft SideWinder Force Feedback 2 to be recognized by Blender add this SDL2 code:
030000005e0400001b00000000000000,SideWinder Force Feedback 2 Joystick,platform:Windows,a:b7,b:b4,x:b6,y:b5,leftshoulder:b2,rightshoulder:b3,leftstick:b0,rightstick:b1,leftx:a2,lefty:a3,rightx:a0,righty:a1,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,
to the file:
UPBGE-0.30-windows-x86_64->3.0->datafiles->gamecontroller->gamecontrollerdb.txt

Or for your joystick create a SDL2 code with one of these Tools:
    https://generalarcade.com/gamepadtool/
    https://github.com/AntiMicroX/antimicrox
and edit your joystick Axes and Buttons in the Joystick Menu (Key J)
    
About HeadTracking-Joystick:
Setup your favorite HeadTracking software (TrackIR, OpenTrack, FreeTrack, LinuxTrack) to output to a virtual Joystick (vJoy, PPJoy). And set 'Center-Button' to the same as in this game (Joystick-Button 2)
E.g. on Windows you can use TrackIR->FreePie->vJoy. For FreePie the Python script from here is used:
https://www.avsim.com/forums/topic/497411-workaround-trackir-chaseplane-vjoy-freepie/
I use my TrackIR3 Device with Freetrack->FreePie->vJoy with another script.
You can find a copy of both scripts for FreePie in this blend here.

    
Credits:
hdri from
https://polyhaven.com/hdris

Landscape by SHINN THANT
https://blendswap.com/blend/15976

Aircraft model by Helijah
Super GuƩpard 912 by Helijah
https://blendswap.com/blend/17865
License: CC-BY-SA

Field recording by samarobryn
https://freesound.org/people/samarobryn/sounds/400396/
License: CC-0

Sounds:
    https://www.pacdv.com/sounds/
    https://freesound.org
3 Likes

Now somebody give me a better scenery please :slight_smile:

3 Likes

Collecting some info and links here
There already was an extremely advanced project (now dead):

The plane model is still available here:

Cockpit-View now supports HeadTracking (via a Virtual Joystick).

Setup your favorite HeadTracking software (TrackIR, OpenTrack, FreeTrack, LinuxTrack) to output to a virtual Joystick (vJoy, PPJoy). And set ā€˜Center-Buttonā€™ to the same as in this game (Joystick-Button 2)
E.g. on Windows I use TrackIR->FreePie->vJoy. For FreePie the Python script from here is used:

You can find a copy of that script in this blend here.

(vJoy has the big advantage that it is recognized by UPBGE out of the box.)
The Joystick Configuration menu now allows to enable/disable different connected Joysticks.

Lots of small improvements for Propeller start/stop, Enter/Exit animation etc.
Outside view can now also be rotated by HeadTracking:

Instead of the old TrackIR3 Software Iā€™m now using this old Camera with Freetrack which gives more precision (because I can use it with a homebuilt 3point system which really are only some reflective dots on a cap, you would laugh seeing it)
The Python script for FreePie to read Freetrack is now also included in the blend.

Chasing my recorded flight with HeadTracking in Cockpit

Test flight with a freeware non-commercial Scenery
Venice obj mtl
Frame drops keep falling on my thread :notes:

(Nice and boring :slight_smile: )

File down below

1 Like

It bothered me that my SuperGuepard always fell like a wet sack at low speeds.
As I said the flight model is very simple.
It still is but now got much better especially at low speeds.
A wing behaves differently at different Angles of Attack due to its airfoil.
I had no idea how to implement airfoil data and used a simple sinus function before.
This is now replaced by using an animation action graph as data source for the lift coefficient at different angles of attack:

This is the python line:
Coefficient_Lift=bpy.data.actions["Airfoil"].fcurves[0].evaluate(math.degrees(AngleOfAttack)+1)

My (manually editable) graph is inspired by the graphs shown and mentioned in this video (the author implemented a much more sophisticated/complicated system)
Starting at minute 6.09

The graph from the mentioned PDF looks like this:

I just took the black version and now SuperGuepard can glide much better at lower speeds and land more safely on Piazza San Marco in Venetia :slight_smile:
Original SuperGuepard can fly really slow.

There is a difference in the behaviour of slow-parent in newer UPBGE Release (0.35). Itā€™s much stronger than in 0.3.
Added compensation:

    SuperGuepardCam.timeOffset=0.8
    if bge.app.version>(3, 0, 0): SuperGuepardCam.timeOffset=0.2

When did this change? Or better: at which factor?

1 Like

Hit T to toggle trails.

The Trails are an edited version of @BluePrintRandom s FireTrail

Some hacks to save fps, make them longer and be able to toggle on/off.

4 Likes

Nice! Iā€™m trying to learn UPBGE, so I can do some good game like yours :slight_smile:

1 Like

video above

Hereā€™s the file for happy pilots :slight_smile: :

BTW:
Here you can see the pilot wearing my ā€œHigh-techā€-HeadTracking Device with 3 reflector-Dots

2 Likes

Both demo files are updated with better flight physics and low-fps-compensation.
A bit of slipstream

and much better handling at low speed and when falling or near stall. Also the yaw now works properly. You can now fly beautiful U-Turns.

The compensation of lower fps (like in the Venetia-demo) sets LogicTicRate to the Average FrameRate, calculates Delta-time and multiplies all Movements of static objects like Camera with it. Physics and animations donā€™t need to be multiplied with Delta-Time.
This is the code:

import bge
cont = bge.logic.getCurrentController()
own = cont.owner

# give 60 frames time to get a reliable AverageFrameRate
if "AVRskip" not in own:
    own['AVRskip']=60

own["AVR"]=bge.logic.getAverageFrameRate()
if own['AVRskip']<0 and own["AVR"]>0:
    bge.logic.deltaTime=1/own["AVR"]
else:
    bge.logic.deltaTime=1/60
        
if own["AVR"]<=0.0: own["AVR"]=60

if own['AVRskip']<0 and  0<own["AVR"] < 60: 
    bge.logic.setLogicTicRate(own["AVR"]+1)

own['AVRskip']-=1

As reference Framerate I use 60 fps so deltatime can be applied like eg.:
Propeller.applyRotation([0,PropellerSpeed*bge.logic.deltaTime*60,0],True)

Happy Flying!!!

2 Likes

Awesome project!!

1 Like

For the first demo I had to disable the logicTic Rate setting because the Trails are somehow incompatible with it and slow down the framerate massively doen to 35fps.
I usually get 60 Frames and with Trails 50 so it is ok.

For the Venetia demo it is enabled because there I get 30fps anyway and the Trails donā€™t have an impact. But the physics feel much better.

(UPBGE 0.36 has problems with the Trails in Venetia. UPBGE 0.3 is better here)

1 Like

Trails-Performance increasement 10% faster
No Physics slow down despite low fps.
Better rendering of Water vs Ground (no more Z-fighting flickering).
The fix for that was to increase the cameras ā€œstartā€-value.

A bad landing though :wink:

2 Likes

Wow! fantastic work! I am very impressed.

2 Likes