Unreal Engine 5 auf Linux?

C++ Spieleentwicklung mit Unreal Engine 5 auf Linux


Aber geht das eigentlich überhaupt?

Ich meine klar, fast alle Server laufen mit Linux und auch für Game Studios, Universitäts Rechenzentren, und C++ Entwickler ist es das bevorzugte System. Games lassen sich ja auch wunderbar zu Android exportieren (dazu vielleicht in einem andern Post mehr), aber kann man den hochmodernen Unreal Engine 5 Editor wirklich auf Linux nutzen?

Fazit: Ja! Das geht prima. Es gibt aber auch ein paar wichtige Details damit es auch wirklich super klappt.


Und nun heisst es Lichter aus, Vorhang auf, zurücklehnen und ein modernes Wunder der Entertainment Technologie geniessen...


Reiseplan

Heute werden wir den Unreal Engine 5 Editor auf ArchLinux installieren und professionell konfigurieren:

  • Unreal Engine 5 vom Source Code kompilieren
  • Shell und Neovim Integration
  • Launcher Integration und Leistungsprofile


Unreal Engine 5 vom Source Code kompilieren


typescript
1#!/usr/bin/env bash
2
3set -euo pipefail
4
5YAY_BIN="/usr/bin/yay"
6
7ensure_yay() {
8 if command -v yay >/dev/null 2>&1; then
9 YAY_BIN="$(command -v yay)"
10 return 0
11 fi
12
13 echo "yay not found."
14 read -r -p "Install yay using pacman (requires sudo)? [y/N]: " ans
15 if [[ "$ans" =~ ^[Yy]$ ]]; then
16 if ! command -v pacman >/dev/null 2>&1; then
17 echo "pacman not found -- cannot install yay automatically." >&2
18 exit 1
19 fi
20 # Install prerequisites for building AUR helpers (optional; adjust as needed)
21 sudo pacman -S --needed --noconfirm git base-devel
22 tmpdir="$(mktemp -d)"
23 trap 'rm -rf "$tmpdir"' EXIT
24 cd "$tmpdir"
25 git clone https://aur.archlinux.org/yay.git
26 cd yay
27 makepkg -si --noconfirm
28 YAY_BIN="$(command -v yay || echo /usr/bin/yay)"
29 if ! command -v yay >/dev/null 2>&1; then
30 echo "Failed to install yay." >&2
31 exit 1
32 fi
33 else
34 echo "Aborting: yay is required." >&2
35 exit 1
36 fi
37}
38
39pkgs_install() {
40 local pkgs=("$@")
41 if [ "${#pkgs[@]}" -eq 0 ]; then
42 echo "install requires at least one package name." >&2
43 exit 1
44 fi
45 # -S --noconfirm can be dangerous; prompt user
46 echo "About to install: ${pkgs[*]}"
47 read -r -p "Proceed? [y/N]: " ans
48 if [[ ! "$ans" =~ ^[Yy]$ ]]; then
49 echo "Skip."
50 else
51 "$YAY_BIN" -Sy --needed "${pkgs[@]}"
52 fi
53}
54
55pkgs_uninstall() {
56 local pkgs=("$@")
57 if [ "${#pkgs[@]}" -eq 0 ]; then
58 echo "uninstall requires at least one package name." >&2
59 exit 1
60 fi
61 echo "About to remove: ${pkgs[*]}"
62 read -r -p "Proceed? [y/N]: " ans
63 if [[ ! "$ans" =~ ^[Yy]$ ]]; then
64 echo "Skip."
65 else
66 "$YAY_BIN" -Rcns "${pkgs[@]}"
67 fi
68}
69
70main() {
71 # Ensure yay is available for package management
72 ensure_yay
73 fix_uv_env
74
75 # Neovim Editor
76 pkgs_install neovim
77
78 # Unreal Engine Dependencies
79
80}
81
82main "$@"



CLI & Neovim Integration


typescript
1# INFO: Unreal Engine / ue4cli
2# source: https://neunerdhausen.de/posts/unreal-engine-5-with-vim/
3ue() {
4 ue4cli="env SDL_VIDEODRIVER=x11 $HOME/.local/bin/ue4"
5 engine_path="$($ue4cli root)"
6
7 # cd to ue location
8 if [[ "$1" == "engine" ]]; then
9 cd "$engine_path" || exit
10 # combine clean and build in one command
11 elif [[ "$1" == "rebuild" ]]; then
12 $ue4cli clean
13 $ue4cli build
14 if [[ "$2" == "run" ]]; then
15 $ue4cli run
16 fi
17 # build and optionally run while respecting build flags
18 elif [[ "$1" == "build" ]]; then
19 if [[ "${@: -1}" == "run" ]]; then
20 length="$(($# - 2))" # Get length without last param because of 'run'
21 $ue4cli build ${@:2:$length}
22 $ue4cli run
23 else
24 shift 1
25 $ue4cli build "$@"
26 fi
27 # Run project files generation, create a symlink for the compile database and fix-up the compile database
28 elif [[ "$1" == "gen" ]]; then
29 $ue4cli gen
30 project=${PWD##*/}
31 cat ".vscode/compileCommands_${project}.json" | python3 -c "
32import json, sys
33
34def quote_spaced_dirs(path):
35 if not isinstance(path, str):
36 return path
37 def quote(seg):
38 seg = seg.strip()
39 if ' ' in seg and not (seg.startswith(\"'\") and seg.endswith(\"'\")):
40 return \"'{}'\".format(seg.replace(\"'\", \"'\\''\"))
41 return seg
42 return '/'.join([quote(seg) for seg in path.split('/')])
43
44def process(obj):
45 if isinstance(obj, str):
46 return quote_spaced_dirs(obj)
47 if isinstance(obj, list):
48 return [process(x) for x in obj]
49 if isinstance(obj, dict):
50 for k, v in obj.items():
51 if k in ('file', 'directory'):
52 obj[k] = process(v)
53 elif k == 'arguments':
54 obj[k] = [process(arg) for arg in v]
55 return obj
56 return obj
57
58j = json.load(sys.stdin)
59j = [process(o) for o in j]
60
61for o in j:
62 file = o[\"file\"]
63 arg = o[\"arguments\"][1]
64 o[\"arguments\"] = [\"clang++ -std=c++20 -ferror-limit=0 -Wall -Wextra -Wpedantic -Wshadow-all -Wno-unused-parameter \" + file + \" \" + arg]
65print(json.dumps(j, indent=2))
66" > compile_commands.json
67
68 # Pass through all other commands to ue4
69 else
70 $ue4cli "$@"
71 fi
72}
73# Don't forget to create a soft link to the generated compile_commands in the project root
74# ln -s "$(pwd)/compile_commands.json" .vscode/compileCommands_Lotwig_Fusel_UE5_CPP.json
75
76# INFO: warn and redirect to ue
77alias ue4='echo "Deprecated, use $(ue) instead. Substituting ..." && ue'
78alias ue5='echo "Deprecated, use $(ue) instead. Substituting ..." && ue'
79



Launcher Integration und Leistungsprofile


Wusstest du das der UE5 Editor mit 8 GB RAM und 2 Threads prima läuft? Das schont prima die Akkulaufzeit des Laptops für unterwegs!


UE5 Dashboard


UE5 Editor


typescript
1#!/usr/bin/env xdg-open
2
3[Desktop Entry]
4Version=1.0
5Type=Application
6#
7# INFO: Use x11 sdl backend
8Exec=env SDL_VIDEODRIVER=x11 /home/user/Documents/Development/GitHub/jorlly-collado-castro/UnrealEngine/Engine/Binaries/Linux/UnrealEditor %f
9#
10# INFO: Let Unreal Engine decide what backend to use
11# WARN: may default to wayland which is only partially supported
12# Exec=/home/user/Documents/Development/GitHub/jorlly-collado-castro/UnrealEngine/Engine/Binaries/Linux/UnrealEditor %f
13#
14# INFO: Use x11 sdl backend & gamemode acceleration (for NVIDIA GPU laptops)
15# WARN: This requires installing the gamemoderun command
16# Exec=gamemoderun env SDL_VIDEODRIVER=x11 /home/user/Documents/Development/GitHub/jorlly-collado-castro/UnrealEngine/Engine/Binaries/Linux/UnrealEditor %f
17#
18# INFO: Use wayland sdl backend (clicking didnt work)
19# Exec=env SDL_VIDEODRIVER=wayland /home/user/Documents/GitHub/unbroken-cipher/UnrealEngine/Engine/Binaries/Linux/UnrealEditor %f
20#
21Path=/home/user/Documents/Development/GitHub/jorlly-collado-castro/UnrealEngine/Engine/Binaries/Linux
22Name=Unreal Engine
23Icon=ubinary
24Terminal=false
25StartupWMClass=UnrealEditor
26MimeType=application/uproject
27Comment=Created By Collado Design Studios
28
29


UE5 Performance Profile