Files
metaverseDubai/scripts/setup/configure_project_settings.sh

309 lines
9.1 KiB
Bash
Raw Normal View History

#!/bin/bash
#
# Script Name: configure_project_settings.sh
# Description: Configure all Unreal Engine project settings (Nanite, Lumen, World Partition, Plugins)
# Usage: ./configure_project_settings.sh
# Author: Dubai Metaverse Team
# Date: 2025-11-21
# Version: 1.0
set -euo pipefail
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
# Configuration
PROJECT_DIR="${PROJECT_DIR:-$(pwd)}"
PROJECT_FILE="$PROJECT_DIR/DubaiMetaverse.uproject"
ENGINE_INI="$PROJECT_DIR/Config/DefaultEngine.ini"
GAME_INI="$PROJECT_DIR/Config/DefaultGame.ini"
LOG_FILE="$PROJECT_DIR/logs/configure_project_settings.log"
# Create log directory
mkdir -p "$(dirname "$LOG_FILE")"
log() {
local level="${1:-INFO}"
shift
local message="$*"
local timestamp=$(date +'%Y-%m-%d %H:%M:%S')
echo "[$timestamp] [$level] $message" | tee -a "$LOG_FILE"
echo -e "${message}"
}
echo "=========================================="
echo "Dubai Metaverse Project Settings Configuration"
echo "=========================================="
echo ""
cd "$PROJECT_DIR"
# Check project file exists
if [ ! -f "$PROJECT_FILE" ]; then
echo -e "${RED}${NC} Project file not found: $PROJECT_FILE"
echo " Run: ./scripts/setup/create_ue5_project.sh first"
exit 1
fi
echo -e "${GREEN}${NC} Project file found: $PROJECT_FILE"
# Backup existing config files
if [ -f "$ENGINE_INI" ]; then
cp "$ENGINE_INI" "$ENGINE_INI.backup.$(date +%Y%m%d_%H%M%S)"
echo -e "${BLUE}${NC} Backed up DefaultEngine.ini"
fi
if [ -f "$GAME_INI" ]; then
cp "$GAME_INI" "$GAME_INI.backup.$(date +%Y%m%d_%H%M%S)"
echo -e "${BLUE}${NC} Backed up DefaultGame.ini"
fi
# Create Config directory if it doesn't exist
mkdir -p "$PROJECT_DIR/Config"
echo ""
echo "=========================================="
echo "Configuring DefaultEngine.ini"
echo "=========================================="
echo ""
# Create comprehensive DefaultEngine.ini
cat > "$ENGINE_INI" << 'EOF'
; Dubai Metaverse - DefaultEngine.ini
; Configured automatically by configure_project_settings.sh
; Last Updated: 2025-11-21
[/Script/Engine.RendererSettings]
; ============================================
; NANITE SETTINGS
; ============================================
r.Nanite.ProjectEnabled=True
; ============================================
; LUMEN SETTINGS
; ============================================
r.DefaultFeature.LumenSupport=1
r.Lumen.ProjectEnabled=True
r.Lumen.DiffuseIndirect.Allow=1
r.Lumen.Reflections.Allow=1
r.Lumen.ScreenProbeGather.ScreenSpaceBentNormal=1
r.Lumen.ScreenProbeGather.TraceMeshSDFs=1
r.Lumen.ScreenProbeGather.ScreenTraces=1
; ============================================
; VIRTUAL SHADOW MAPS
; ============================================
r.Shadow.Virtual.Enable=1
r.Shadow.Virtual.OnePassProjection=1
; ============================================
; ANTI-ALIASING
; ============================================
r.DefaultFeature.AntiAliasing=2
r.TemporalAA.Quality=4
r.TemporalAA.Upsampling=1
; ============================================
; POST-PROCESS EFFECTS
; ============================================
r.DefaultFeature.AutoExposure=False
r.DefaultFeature.Bloom=True
r.DefaultFeature.MotionBlur=True
r.MotionBlurQuality=4
r.BloomQuality=4
; ============================================
; RENDERING PERFORMANCE
; ============================================
r.VirtualTextures=True
r.VirtualTextures.EnableAutoImport=True
r.VirtualTextures.Enable=1
[/Script/Engine.WorldSettings]
; ============================================
; WORLD PARTITION
; ============================================
bEnableWorldPartition=True
[/Script/Engine.Engine]
; ============================================
; PROJECT SETTINGS
; ============================================
+ActiveGameNameRedirects=(OldGameName="TP_Blank",NewGameName="/Script/DubaiMetaverse")
+ActiveGameNameRedirects=(OldGameName="/Script/TP_Blank",NewGameName="/Script/DubaiMetaverse")
+ActiveClassRedirects=(OldClassName="TP_BlankGameModeBase",NewClassName="DubaiMetaverseGameModeBase")
[/Script/EngineSettings.GameMapsSettings]
; ============================================
; DEFAULT MAPS
; ============================================
GameDefaultMap=/Game/Maps/MainLevel
EditorStartupMap=/Game/Maps/MainLevel
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
; ============================================
; WINDOWS PLATFORM SETTINGS
; ============================================
DefaultGraphicsRHI=Default
+TargetedRHIs=PCD3D_SM6
+TargetedRHIs=PCD3D_SM5
[/Script/LinuxTargetPlatform.LinuxTargetSettings]
; ============================================
; LINUX PLATFORM SETTINGS
; ============================================
DefaultGraphicsRHI=Default
EOF
echo -e "${GREEN}${NC} DefaultEngine.ini configured with:"
echo " - Nanite enabled"
echo " - Lumen enabled (GI + Reflections)"
echo " - Virtual Shadow Maps enabled"
echo " - World Partition enabled"
echo " - Post-process effects configured"
echo ""
echo "=========================================="
echo "Configuring DefaultGame.ini"
echo "=========================================="
echo ""
# Create DefaultGame.ini
cat > "$GAME_INI" << 'EOF'
; Dubai Metaverse - DefaultGame.ini
; Configured automatically by configure_project_settings.sh
; Last Updated: 2025-11-21
[/Script/EngineSettings.GameMapsSettings]
; ============================================
; DEFAULT MAPS
; ============================================
GameDefaultMap=/Game/Maps/Main/MainLevel
EditorStartupMap=/Game/Maps/Main/MainLevel
GlobalDefaultGameMode=/Script/Engine.GameModeBase
[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemUtils.IpNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
[/Script/OnlineSubsystem.IpNetDriver]
NetDriverClassName="OnlineSubsystemUtils.IpNetDriver"
EOF
echo -e "${GREEN}${NC} DefaultGame.ini configured"
echo ""
echo "=========================================="
echo "Verifying Plugins in Project File"
echo "=========================================="
echo ""
# Check and configure plugins in project file
REQUIRED_PLUGINS=(
"ProceduralContentGeneration"
"VirtualProduction"
"MovieRenderQueue"
"ModelingTools"
"GeometryScript"
)
PLUGINS_MISSING=0
for plugin in "${REQUIRED_PLUGINS[@]}"; do
if grep -q "\"Name\": \"$plugin\"" "$PROJECT_FILE"; then
if grep -A1 "\"Name\": \"$plugin\"" "$PROJECT_FILE" | grep -q "\"Enabled\": true"; then
echo -e "${GREEN}${NC} Plugin enabled: $plugin"
else
echo -e "${YELLOW}${NC} Plugin found but not enabled: $plugin"
PLUGINS_MISSING=1
fi
else
echo -e "${RED}${NC} Plugin missing: $plugin"
PLUGINS_MISSING=1
fi
done
if [ $PLUGINS_MISSING -eq 1 ]; then
echo ""
echo -e "${YELLOW}${NC} Some plugins need to be enabled manually:"
echo " 1. Launch Unreal Editor"
echo " 2. Go to Edit > Plugins"
echo " 3. Enable the missing plugins listed above"
echo " 4. Restart editor"
else
echo ""
echo -e "${GREEN}${NC} All required plugins are enabled"
fi
echo ""
echo "=========================================="
echo "Configuration Summary"
echo "=========================================="
echo ""
# Verify settings
echo "Verifying configuration..."
NANITE_OK=0
LUMEN_OK=0
WORLDPARTITION_OK=0
if grep -q "r.Nanite.ProjectEnabled=True" "$ENGINE_INI"; then
echo -e "${GREEN}${NC} Nanite: Enabled"
NANITE_OK=1
else
echo -e "${RED}${NC} Nanite: Not configured"
fi
if grep -q "r.Lumen.ProjectEnabled=True" "$ENGINE_INI"; then
echo -e "${GREEN}${NC} Lumen: Enabled"
LUMEN_OK=1
else
echo -e "${RED}${NC} Lumen: Not configured"
fi
if grep -q "bEnableWorldPartition=True" "$ENGINE_INI"; then
echo -e "${GREEN}${NC} World Partition: Enabled"
WORLDPARTITION_OK=1
else
echo -e "${RED}${NC} World Partition: Not configured"
fi
echo ""
echo "=========================================="
echo "Next Steps"
echo "=========================================="
echo ""
if [ $NANITE_OK -eq 1 ] && [ $LUMEN_OK -eq 1 ] && [ $WORLDPARTITION_OK -eq 1 ]; then
echo -e "${GREEN}✅ All project settings configured successfully!${NC}"
echo ""
echo "Next steps:"
echo "1. Launch Unreal Editor:"
echo " ~/UnrealEngine/Engine/Binaries/Linux/UnrealEditor \\"
echo " ~/projects/metaverseDubai/DubaiMetaverse.uproject"
echo ""
echo "2. Verify settings in editor:"
echo " - Edit > Project Settings > Engine > Rendering"
echo " - Verify Nanite is enabled"
echo " - Verify Lumen (Global Illumination and Reflections) is enabled"
echo " - World Settings > Enable World Partition"
echo ""
echo "3. Verify plugins:"
echo " - Edit > Plugins"
echo " - Verify all required plugins are enabled"
echo ""
log "INFO" "Configuration complete - All settings verified"
exit 0
else
echo -e "${RED}${NC} Some settings may not be configured correctly"
echo " Please review the configuration files manually"
log "WARNING" "Configuration incomplete - Some settings missing"
exit 1
fi