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
1#!/usr/bin/env bash23set -euo pipefail45YAY_BIN="/usr/bin/yay"67ensure_yay() {8 if command -v yay >/dev/null 2>&1; then9 YAY_BIN="$(command -v yay)"10 return 011 fi1213 echo "yay not found."14 read -r -p "Install yay using pacman (requires sudo)? [y/N]: " ans15 if [[ "$ans" =~ ^[Yy]$ ]]; then16 if ! command -v pacman >/dev/null 2>&1; then17 echo "pacman not found -- cannot install yay automatically." >&218 exit 119 fi20 # Install prerequisites for building AUR helpers (optional; adjust as needed)21 sudo pacman -S --needed --noconfirm git base-devel22 tmpdir="$(mktemp -d)"23 trap 'rm -rf "$tmpdir"' EXIT24 cd "$tmpdir"25 git clone https://aur.archlinux.org/yay.git26 cd yay27 makepkg -si --noconfirm28 YAY_BIN="$(command -v yay || echo /usr/bin/yay)"29 if ! command -v yay >/dev/null 2>&1; then30 echo "Failed to install yay." >&231 exit 132 fi33 else34 echo "Aborting: yay is required." >&235 exit 136 fi37}3839pkgs_install() {40 local pkgs=("$@")41 if [ "${#pkgs[@]}" -eq 0 ]; then42 echo "install requires at least one package name." >&243 exit 144 fi45 # -S --noconfirm can be dangerous; prompt user46 echo "About to install: ${pkgs[*]}"47 read -r -p "Proceed? [y/N]: " ans48 if [[ ! "$ans" =~ ^[Yy]$ ]]; then49 echo "Skip."50 else51 "$YAY_BIN" -Sy --needed "${pkgs[@]}"52 fi53}5455pkgs_uninstall() {56 local pkgs=("$@")57 if [ "${#pkgs[@]}" -eq 0 ]; then58 echo "uninstall requires at least one package name." >&259 exit 160 fi61 echo "About to remove: ${pkgs[*]}"62 read -r -p "Proceed? [y/N]: " ans63 if [[ ! "$ans" =~ ^[Yy]$ ]]; then64 echo "Skip."65 else66 "$YAY_BIN" -Rcns "${pkgs[@]}"67 fi68}6970main() {71 # Ensure yay is available for package management72 ensure_yay73 fix_uv_env7475 # Neovim Editor76 pkgs_install neovim7778 # Unreal Engine Dependencies7980}8182main "$@"
CLI & Neovim Integration
1# INFO: Unreal Engine / ue4cli2# 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)"67 # cd to ue location8 if [[ "$1" == "engine" ]]; then9 cd "$engine_path" || exit10 # combine clean and build in one command11 elif [[ "$1" == "rebuild" ]]; then12 $ue4cli clean13 $ue4cli build14 if [[ "$2" == "run" ]]; then15 $ue4cli run16 fi17 # build and optionally run while respecting build flags18 elif [[ "$1" == "build" ]]; then19 if [[ "${@: -1}" == "run" ]]; then20 length="$(($# - 2))" # Get length without last param because of 'run'21 $ue4cli build ${@:2:$length}22 $ue4cli run23 else24 shift 125 $ue4cli build "$@"26 fi27 # Run project files generation, create a symlink for the compile database and fix-up the compile database28 elif [[ "$1" == "gen" ]]; then29 $ue4cli gen30 project=${PWD##*/}31 cat ".vscode/compileCommands_${project}.json" | python3 -c "32import json, sys3334def quote_spaced_dirs(path):35 if not isinstance(path, str):36 return path37 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 seg42 return '/'.join([quote(seg) for seg in path.split('/')])4344def 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 obj56 return obj5758j = json.load(sys.stdin)59j = [process(o) for o in j]6061for 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.json6768 # Pass through all other commands to ue469 else70 $ue4cli "$@"71 fi72}73# Don't forget to create a soft link to the generated compile_commands in the project root74# ln -s "$(pwd)/compile_commands.json" .vscode/compileCommands_Lotwig_Fusel_UE5_CPP.json7576# INFO: warn and redirect to ue77alias 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!
1#!/usr/bin/env xdg-open23[Desktop Entry]4Version=1.05Type=Application6#7# INFO: Use x11 sdl backend8Exec=env SDL_VIDEODRIVER=x11 /home/user/Documents/Development/GitHub/jorlly-collado-castro/UnrealEngine/Engine/Binaries/Linux/UnrealEditor %f9#10# INFO: Let Unreal Engine decide what backend to use11# WARN: may default to wayland which is only partially supported12# Exec=/home/user/Documents/Development/GitHub/jorlly-collado-castro/UnrealEngine/Engine/Binaries/Linux/UnrealEditor %f13#14# INFO: Use x11 sdl backend & gamemode acceleration (for NVIDIA GPU laptops)15# WARN: This requires installing the gamemoderun command16# Exec=gamemoderun env SDL_VIDEODRIVER=x11 /home/user/Documents/Development/GitHub/jorlly-collado-castro/UnrealEngine/Engine/Binaries/Linux/UnrealEditor %f17#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 %f20#21Path=/home/user/Documents/Development/GitHub/jorlly-collado-castro/UnrealEngine/Engine/Binaries/Linux22Name=Unreal Engine23Icon=ubinary24Terminal=false25StartupWMClass=UnrealEditor26MimeType=application/uproject27Comment=Created By Collado Design Studios2829