Testing Your Mods
Testing your mods to ensure that content is accessible and there are no bugs present is an important step in development. Careful testing before release can save you from having to release multiple versions in quick succession in order to fix a bug.
This page lists some helpful resources and information regarding testing your mods.
SML Logging
SML Logging is a valuable troubleshooting and testing tool, especially for blueprint mods.
You can find more information on how to use and configure it on the Logging page.
If you select text in the log terminal window, it will freeze the game until you press 'enter' to deselect it. This can help with reading things before they would normally scroll by.
Since the log terminal is a regular Windows Command Prompt window, you can right click on its top bar and set some default customization values, such as where the window spawns and how wide it is, which will be applied every time the terminal opens. You can use this to have it always open on a second monitor, for example. Be aware that the values you set here will affect every instance of Command Prompt on your system. See the Launch Script Enhancements section below for another method of controlling where the window will appear.
Quick Launch Script
Testing mods often involves frequent restarts of the game.
You can shave some time off of this process by launching via a script that loads you directly into the game world.
In order to use this script, create a file with the .ps1
extension somewhere convenient to you.
Next, copy the contents of the below codeblock into the file. Note that you will have to modify the section near the top to match the location of files on your system.
param (
[string]$branch = "EA",
[switch]$multiplayer = $false,
[switch]$loadLatestSave = $false
)
# Configure these to match your system and preferences
$GameDir_EA = "C:\EpicGamesGames\SatisfactoryEarlyAccess"
$GameDir_EXP = "C:\EpicGamesGames\SatisfactoryExperimental"
$SaveFolder = "C:\Users\YourUserName\AppData\Local\FactoryGame\Saved\SaveGames\YourID"
$Username1 = "Host" # Note - Unreal Engine 5 has broken the Username functionality, so this is currently ignored
$Username2 = "Client"
$CommonArgs = "-EpicPortal", "-NoSteamClient", "-NoMultiplayer", "-log"
# End configuration section
$AutolaunchTempFileName = "AutolaunchScript_Temp.ini"
if ($branch -eq "EA") {
$GameDir = $GameDir_EA
} elseif ($branch -eq "EXP") {
$GameDir = $GameDir_EXP
} else {
Write-Error "Unknown branch type: '$branch'"
return
}
# You can optionally configure the window size and position on the screen per instance
$Args1 = "$CommonArgs", "-Username=`"$Username1`""#, "-WinX=0", "-WinY=32", "ResX=960", "ResY=1040"
# TODO multiplayer and loadLatestSave arguments incompatible. direct loading into a save does not allow joining via `open 127.0.0.1` in the client, the host must manually load another save file for that to be set up
if ($loadLatestSave) {
# https://stackoverflow.com/questions/9675658/powershell-get-childitem-most-recent-file-in-directory
$latestSaveFile = (Get-ChildItem $SaveFolder | sort LastWriteTime | select -last 1)
$latestSaveFileName = $latestSaveFile.Basename
$AutolaunchFilePath = "$GameDir\$AutolaunchTempFileName"
New-Item $AutolaunchFilePath -ItemType File -Force -Value "[/Script/EngineSettings.GameMapsSettings]`n"
Add-Content $AutolaunchFilePath "LocalMapOptions=??skipOnboarding?loadgame=$latestSaveFileName"
Add-Content $AutolaunchFilePath "GameDefaultMap=/Game/FactoryGame/Map/GameLevel01/Persistent_Level.Persistent_Level`nGameInstanceClass=/Script/FactoryGame.FGGameInstance"
$Args1 = "$Args1", "EngineINI=`"$AutolaunchFilePath`""
}
$Args2 = "$CommonArgs", "-Username=`"$Username2`""#, "-WinX=960", "-WinY=32", "ResX=960", "ResY=1040"
function BGProcess(){
Start-Process -NoNewWindow @args
}
BGProcess "$($GameDir)\FactoryGame.exe" $Args1
if ($multiplayer) {
sleep -m 5000
} else {
return
}
BGProcess "$($GameDir)\FactoryGame.exe" $Args2
Usage
After the launch script has been set up, use flags when running it to controls its behavior. Note that in order to use the branch feature you must have separate copies of the game installed in the locations you specified in the config section.
Assuming your powershell file is named SFLaunch_Advanced
:
-
.\SFLaunch_Advanced.ps1
will launch the Early Access version of the game -
.\SFLaunch_Advanced.ps1 -loadLatestSave
will automatically load you into the last save file you made. -
.\SFLaunch_Advanced.ps1 -branch EXP
will launch the Experimental copy of the game -
.\SFLaunch_Advanced.ps1 -multiplayer
will launch two copies of the game -
.\SFLaunch_Advanced.ps1 -branch EXP -multiplayer
will launch two copies of the Experimental game
Note that the -multiplayer
flag is currently incompatible with the -loadLatestSave
flag
and that the -loadLatestSave
flag requires
extra configuration to work with saves made in custom levels
and doesn’t guarantee that you’ll be put into the same player pawn.
Launch Script Enhancements
Unreal supports many
other command-line arguments, some of which may prove to be useful with MP testing.
For example, -WinX=0 -WinY=0
will open the game in the top left corner of the screen.
Similar arguments also exist for the console window (ConsoleX
and ConsoleY
).
You can also specify what resolution you want the game to run at: -WinX=1280 -WinY=720
.
If you want windows to open on other monitors, you will need to use either negative or larger numbers for the arguments. The top left corner of your primary monitor is X=0, Y=0.
Combining these options, you could end up with launch args like those shown below, which will give each instance as much screen space as possible (while accounting for Title Bar and Start Menu height) on a 1920x1080 resolution screen, at the cost of an unusual aspect ratio.
$Args1 = "-EpicPortal", "-NoSteamClient", '-Username="'+$Username1+'"', "-WinX=0", "-WinY=32", "ResX=960", "ResY=1040"
$Args2 = "-EpicPortal", "-NoSteamClient", '-Username="'+$Username2+'"', "-WinX=960", "-WinY=32", "ResX=960", "ResY=1040"
Multiplayer Testing
Locally testing multiplayer functionality requires running two copies of the game at once. Normally the Steam and Epic Games client don’t allow you to do this, but the launch script in the previous section will allow you to do so.
Instructions
-
First, run the launch script with the
-multiplayer
flag to open two copies of the game. -
Open up your save file in either copy of the game - this one will be the host, the other copy is the client.
-
Once you’ve loaded in, go to the client game instance and open the in-game console. Learn how to do this here. Then type in
open 127.0.0.1
and hit enter. The second instance will now connect to the game hosted by the first instance.
Load a Custom Level on Launch
The launch script demonstrates how to make the game to automatically load to the game world on launch, as opposed to the main menu, cutting down on load time and clicks when testing your mod. However, you will need to tweak it slightly if the level you want to load is a custom level.
To do this, you’ll need to either need to modify the powershell script, create a file with some configuration settings or add them to the default game configuration.
To get started, create a .ini
file in a convenient location
(such as your Satisfactory game install directory)
that contains the following:
[/Script/EngineSettings.GameMapsSettings]
LocalMapOptions=??skipOnboarding?loadgame=LastLight_autosave_0
GameDefaultMap=/Game/FactoryGame/Map/GameLevel01/Persistent_Level.Persistent_Level
GameInstanceClass=/Script/FactoryGame.FGGameInstance
In place of LastLight_autosave_0
you should put the name of your desired save file.
Note that loading last autosaves of a map works as well if you format it correctly.
The example will load the latest autosave of a save called LastLight
.
Note that doing this will prevent you from returning to the main menu in that game session - when you try to do so, you will instead re-load your selected game save.
There are a few other flags you can use as well:
FG Map Options Switches from Archengius:
Switches found in AFGGameMode::InitGame:
?skipOnboarding (skip landing animation)
?allowPossessAny (allow possessing any pawn on the map, even if player IDs don't match)
?loadgame=<SaveGame Name Here Without Path and extension>
?startloc<Start Location Tag Name> (see AFGGameMode::ChoosePlayerStart_Implementation)
?sessionName=<Session Name> (sets mSaveSessionName, so apparently it determines autosave file name and probably name visible to other players?)
?DayLength=<Day Length In Minutes>
?NightLength=<Night Length In Minutes>
General notes:
Regarding Start Location Tag Name:
- TRADING_POST is the hub APlayerStart actor tag
- Any APlayerStart actor with matching PlayerStartTag is selected
Regarding Session Name:
- Apparently there is a system of "bundled saves" that I know nothing about. Further investigation is required.
Switches found in AFGGameSession:
?Visibility=SV_Private/SV_Public (Session visibility)
?adminpassword=<Admin Password used in console command AdminLogin to gain host privileges>
There is also ?bUseIpSockets linked with offline sessions
Apparently it disables EOS sockets and makes the game fall back to normal IPv4 sockets
You can launch the game with these settings in one of two ways.
Option 1 - Custom Configuration with Startup Script
You can launch the game from command line
with the path to your configuration file
specified in the EngineINI
command flag.
For example, if your file was called LoadMapEngineConfiguration.ini
,
your launch command could look like this:
"D:\SatisfactoryExperimental\FactoryGame\Binaries\Win64\FactoryGame-Win64-Shipping.exe" -EpicPortal -NoMultiplayer -Username=Player1 EngineINI="D:\SatisfactoryExperimental\LoadMapEngineConfiguration.ini"
Note that you will have to modify this example command so that it points to where you have the game installed.
You might want to save it in a batch file or powershell script for easy execution later.
Option 2 - Add to Default Game Configuration
Instead of creating a new file for your configuration,
you can edit your default game configuration, found at
%APPDATA%/Local/FactoryGame/Saved/Windows/Engine.ini
.
If you choose this option, the game will always launch using this config no matter where you launch it from, even when mods are not installed.
Modify Online Subsystem Behavior
Additional information about the Online Subsystem.
Example command line:
True offline mode information from Archengius:
[/Script/EngineSettings.GameMapsSettings]
GameDefaultMap=/Game/FactoryGame/Map/MenuScenes/Map_MenuScene_Update_06.Map_MenuScene_Update_06
ServerDefaultMap=/Game/FactoryGame/Map/DedicatedserverEntry.DedicatedserverEntry
LocalMapOptions=
[URL]
Name=Player
Port=7777
[/Script/Engine.Engine]
NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/OnlineSubsystemUtils.IpNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")
NetDriverDefinitions=(DefName="BeaconNetDriver",DriverClassName="/Script/OnlineSubsystemUtils.IpNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")
NetDriverDefinitions=(DefName="DemoNetDriver",DriverClassName="/Script/Engine.DemoNetDriver",DriverClassNameFallback="/Script/Engine.DemoNetDriver")
[OnlineSubsystem]
DefaultPlatformService=NULL
NativePlatformService=NULL
[OnlineSubsystemSteam]
bEnabled=false
bRelaunchInSteam=false
[OnlineSubsystemEOS]
bEnabled=false
[OnlineSubsystemNull]
bEnabled=true
FactoryGame-Win64-Shipping.exe -NoEpicPortal -EngineIni="C:\EpicLibrary\SatisfactoryExperimental\OfflineEngineIni2.ini" -Multiprocess -Log
-Multiprocess
prevents game writing to any files (which is really what you want if you plan running multiple instances simultaneously) and -Log
opens the console log window