Skip to content

Instantly share code, notes, and snippets.

@pabsan-0
Created January 29, 2025 15:12
Show Gist options
  • Save pabsan-0/c7b90909fa6e2e128c8c54efc1fa1e43 to your computer and use it in GitHub Desktop.
Save pabsan-0/c7b90909fa6e2e128c8c54efc1fa1e43 to your computer and use it in GitHub Desktop.
Install Airsim && UE 4.27 in Ubuntu 22.04

Installing UE4+Airsim on Ubuntu 22.04 Jammy

Install Unreal Engine 4

Register on epic and all that, then once you have access to the source code, clone and build.

This step gets us:

  • Unreal Engine 4: core simulation engine
sudo mkdir          /opt/epicgames
sudo chown -r $USER /opt/epicgames
cd                  /opt/epicgames

git clone -b 4.27 https://github.com/EpicGames/UnrealEngine
cd UnrealEngine
./Setup.sh
./GenerateProjectFiles.sh
make

Install Airsim

Instead of the classic Airsim, we will install from a fork that includes changes for Ubuntu 22.04. Optionally, you could modify the original AirSim instead. See more at AirSim/issues/4892.

This step will get us two components:

  • Airsim Plugin dir: which we will import into UE projects to give us an API to the sim
  • Airsim Python client: the library we will use to interact with UE simulations
sudo mkdir -p       /opt/microsoft  # -p because may exist already
sudo chown -r $USER /opt/microsoft
cd                  /opt/microsoft

git clone -b v1.8.1_ubuntu_22.04 https://github.com/Kanaderu/AirSim
cd AirSim
./setup.sh
./build.sh

cd PythonClient
# there is a requirements.txt but not all are needed, so we'll keep it minimal
pip3 install msgpack-rpc-python  
pip3 install .
# Check the python3 library works
( cd ~ && python3 -c "import airsim" && echo OK )

Setting up a project

Here are the steps to set up Airsim in your new/existing project.

# Run bare launcher to create a project
UE4Engine  # https://github.com/pabsan-0/dotfiles/tree/master/bash/.bashrc.d/90-unreal-engine.sh

# Navigate to projects and import airsim plugin
cd ~/Documents/Unreal\ Projects/MyProject
mkdir Plugins
cp -r /opt/microsoft/AirSim/Unreal/Plugins Plugins

# Rebuild project
UE4Magic .  # https://github.com/pabsan-0/dotfiles/tree/master/bash/.bashrc.d/90-unreal-engine.sh

# If it fails because of mono, you need to link it to the system
pushd /opt/epicgames/UnrealEngine/Engine/Binaries/ThirdParty/Mono/Linux
sudo ln -s $PWD/bin/mono /bin/mono
sudo ln -s $PWD/etc/mono /etc/mono
sudo ln -s $PWD/lib/mono /lib/mono
popd

# Open project
cd ~/Documents/Unreal\ Projects/MyProject
UE4Editor .

Then, in the editor:

  • Do not rebuild if already did so with Mono (UE4Magic)
  • Enable plugin project-wise
  • Set Airsim Game Mode as default for project
  • Play in editor and check that it works
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment