harfang3d / dogfight-sandbox-hg2

Air to air combat sandbox, created in Python 3 using the HARFANG 3D 2 framework.
GNU General Public License v3.0
145 stars 44 forks source link
3d autopilot directx-11 flight-simulator game harfang3d network opengl pbr python simulation tensorflow virtual-reality vr

Dogfight 2 (Air to air combat Sandbox)

Air to air combat sandbox, created in Python 3 using the HARFANG 3D 2 framework.

Table of content

The game features :

The source code and the graphics assets are made available for studying purpose. However, you are free to fork this repository, extend the game or release anything that is based on it.

How to run the Dogfight Sandbox

Using the official release

  1. Download the most recent release (dogfight-sandbox-hg2-win64.7z)
  2. Unzip it
  3. run start.bat
  4. Select a scenario using the right and left keys
    • Press space if you want to control the aircraft using the keyboard
    • Press the start button of the gamepad or the joystick depending on the device you want to use
    • If you press the start/fire button on the gamepad, the Sandbox will automatically define this controler as the input device of the aircraft (see Aircraft keyboard Commands below for the details of the keyboard inputs)

Using the cloned repository

  1. :warning: If you want to run the sandbox from the cloned repository, you will need install the requirements, following the requirements.txt files found in the source\ and Agent\ folders.
    1. or run 0-install-requirements.bat
  2. open a cmd line, enter the source folder (cd source) and run python main.py
    1. or run start.bat or 1-start.bat
    2. or, in VSCode press CTRL-F5

About VR mode

Recorder API overview

  1. Choose the mission you want to record.
  2. Type "F9" to open the recorder interface:
    Recorder

Replay

Recorder

Events

Hits (missiles, machine gun, crashes) are recorded and displayed as circles during replay:
Recorder Yellow circles : before the event
Red circles : after the event
The maximum size of the circle depends on the power of the collision.

Network mode overview

The "Network" mode allows you to control the planes from a third party machine.

Startup

  1. On the server machine:

    • Start the DogFight SandBox (start.bat file)
    • Choose the Network mode mission
      ServerID
    • Note the IP and port number of the server, in the upper left corner of the screen ServerID
  2. On the client machine:

    • Make sure you have a version of python 3 installed
    • Copy the content of the directory network_client_example.
    • Open the file client_sample.py with a text editor.
    • Enter the server ids in the "df.connect ()" function.
      ServerID
    • Start the file client_sample.py

Aircraft keyboard Commands

Command Key
Increase thrust level Home
Decrease thrust level End
Increase brake level B
Decrease brake level N
Increase flaps level C
Decrease flaps level V
Roll left Left
Roll right Right
Pitch up Up
Pitch down Down
Yaw left Suppr
Yaw right PageDown
Switch post combustion Space
Next target T
Switch gear G
Activate IA I
Activate Autopilot A
Switch easy steering mode E
Fire machine gun Enter
Fire missile F1
Increase health level P
Decrease health level M
Rearm F5
HUD on /off H

Commons Views commands

Command Key
Roll cameras carousel (aircrafts, FPS) 1
Increase FoV angle PageUp
Decrease FoV angle Insert

Aircrafts views commands

Command Key
Back view 2
Front view 8
Left view 4
Right view 6
Satellite view 5
Tactical view 7
Pursuit view 9
Cockpit view 3

FPS camera views commands

Command Key
Head orientation LMB + mouse move
Move forward Up, Z
Move backward Down, S
Move left left, Q
Move right right, D
Fast speed 1 Left Shift + move
Fast speed 2 Left Ctrl + move
Fast speed 3 Right Ctrl + move

Supported control devices

How to configure input devices

There are two types of command configuration files.

Devices configuration

The devices_config.json file contains the inputs parameters of the device.

Input of "axis" type

"GA_LeftX": {
            "type": "axis",
            "name": "Left pad horizontal",
            "reset": "true",
            "invert": "false",
            "id": 0,
            "min": -1,
            "max": 1,
            "zero": -0.0156,
            "zero_epsilon": 0.01
        }

Input of "button" type

"GB_Start": {
            "type": "button",
            "id": 7,
            "name": "Start"
        },

Inputs mapping files

The XXX_inputs_mapping.json files contains the inputs mapping for the systems commands:

For Keyboard, inputs ids are the same as HARFANG3D Keys enums


Contributors

Screenshots

screenshot

screenshot

screenshot

screenshot

screenshot

screenshot

Publications, citations and research projects

📎 Harfang3D Dog-Fight Sandbox: A Reinforcement Learning Research Platform for the Customized Control Tasks of Fighter Aircrafts

(Muhammed Murat Özbek, Süleyman Yıldırım, Muhammet Aksoy, Eric Kernin, Emre Koyuncu)

Harfang3D Dog-Fight Sandbox: A Reinforcement Learning Research Platform on arxiv.org

How to cite this publication:

@misc{2210.07282,
  Author = {Muhammed Murat Özbek,  Süleyman Yıldırım,  Muhammet Aksoy, Eric Kernin and Emre Koyuncu},
  Title = {Harfang3D Dog-Fight Sandbox: A Reinforcement Learning Research Platform for the Customized Control Tasks of Fighter Aircrafts},
  publisher = {arXiv},
  doi = {10.48550/ARXIV.2210.07282},
  Year = {2022},
  Eprint = {arXiv:2210.07282},
}

🧠 Highly Imitative Reinforcement Learning for UCAV

Air to air combat sandbox, created in Python 3 using the HARFANG 3D 2 framework. This project provides a rich environment for air combat simulation and has been utilized in advanced research projects, including the latest in reinforcement learning strategies for unmanned combat aerial vehicles (UCAV), developed at a leading Chinese university. For more on this innovative approach, see the HIRL4UCAV project on GitHub.