Building PSUnreal on Windows: Difference between revisions

From PSwiki
Jump to navigation Jump to search
 
(35 intermediate revisions by 3 users not shown)
Line 4: Line 4:
Check this page as reference: https://wiki.unrealengine.com/Dedicated_Server_Guide_%28Windows_%26_Linux%29
Check this page as reference: https://wiki.unrealengine.com/Dedicated_Server_Guide_%28Windows_%26_Linux%29


== Compiling ==
There are two ways to compile and run your project:
* Generate project files, by right clicking on MyProject2.uproject and "Generate Visual Studio project files"
* Compiling the editor and then running/debugging the game within the editor. Please note VS breakpoints will work also in this mode. THIS IS THE ONE WE USE AS DEFAULT.
* Open Visual Studio '''2015'''
* Compiling the client without editor, and you will then need cooked content (prepared art files). All non-editor builds require cooked content, however, you can run an editor build with the "-game" command line flag to run the game directly using the editor data; please note however that this will be slower than a cooked build as the editor is essentially processing assets on the fly.
* Open MyProject2.sln
 
* Select "MyProject2" project from the left tree view and "DebugGame Client" as configuration from the top dropdown
== Compiling Unreal Engine ==
* Compile (about 30 minutes on my PC)
 
* Select "MyProject2" project from the left tree view and "DebugGame Editor" as configuration from the top dropdown
High level steps:
* Compile
 
* Select "MyProject2" project from the left tree view and "DebugGame Server" as configuration from the top dropdown
* Step 1:  Register an account at UnrealEngine and GitHub
* Step 2:  Add your GitHub username to in your UnrealEngine profile under your dashboard
* Step 3:  Download the source code from UE4 Repo
** list remote branches with: git ls-remote https://github.com/EpicGames/UnrealEngine.git
** get source code with: git clone -b 5.4.3-release https://github.com/EpicGames/UnrealEngine.git
** this will create a "Unreal Engine" directory as child of the dir where you run the command
* Step 4:  Install Visual Studio 2022, follow [https://docs.unrealengine.com/en-us/Programming/Development/VisualStudioSetup#optionsforanewvisualstudioinstallation these instructions] to get the right components in your Visual Studio
* Step 5:  Run Setup.bat to download and install the prerequisites
* Step 6:  Run GenerateProjectFiles.bat to make project files
** if it complains about windows 8.1 sdk, just install it from [https://developer.microsoft.com/en-us/windows/downloads/windows-8-1-sdk here]
** If you get the error "The reference assemblies for framework ".NETFramework,Version=v4.6.2" were not found." just install it from [https://www.microsoft.com/en-us/download/details.aspx?id=53321 here]
* Step 7:  If you dont have it yet, you need to make an account to login to Visual Studio.
* Step 8:  Launch Visual Studio, open UE5.sln and Build Unreal Engine 5 with Development Editor configuration and Win64 Platform
* Step 9: Copy F:\UnrealEngine\Engine\Source\ThirdParty\zlib\v1.2.8\lib\Win64\VS2015\zlib.dll to F:\Unreal Projects\MyProject2\PSUnreal\Binaries\Win64
* Step 10:  Run the UnrealEditor.exe from Engine\Binaries\Win64\ subdirectory
 
== Compiling PSUnreal ==
 
You need to install MariaDB Connector from: https://mariadb.com/downloads/#connectors
 
* Select C connector , version 3.3.1GA and MS Windows (64-bit) as platform
* It will install it in C:\Program Files\MariaDB\MariaDB Connector C 64-bit
* From the MariaDB install directory, copy both lib/ and include/ (with subfolders) into PSUnreal\ThirdParty\MariaDB\
 
Compile Wordnet
* Open PSUnreal\ThirdParty\Wordnet\Wordnet.sln with Visual Studio
* Click on Compile
* Copy this file: PSUnreal\ThirdParty\Wordnet\x64\Debug\Wordnet.lib in PSUnreal\ThirdParty\Wordnet\lib\x64\Wordnet.lib
 
In this mode you will use the Editor to run/debug the game
 
* Generate project files, by right clicking on PSUnreal.uproject and "Generate Visual Studio project files"
* Open Visual Studio '''2017'''
* Open PSUnreal.sln
* Be sure you have PSUnreal selected as startup project
[[File:Psunreal compile1.png|400px]]
 
* Select "PSUnreal" project from the left tree view and "DebugGame Editor" as configuration from the top dropdown
[[File:Psunreal compile2.png]]
* NOTE: DebugGame configuration builds the engine as optimized, but leaves the game code debuggable. This configuration is ideal for debugging only game modules.
* Compile
* Compile


== Checking default map ==
== Preparing the server ==
 
* Install mysql server and launch it
* Create the PlaneShift database
  > mysql -u username -ppassword
 
* IF you get 'mysql' is not recognized command, means windows cannot find it. Do the following
** press start, type "advanced setting", the click on "View advanced system settings"
** Click on "Environment Variables" at the bottom
** Click on PATH line, end "Edit".
** Then click on "New" to add a new element in the PATH variable
** Copy paste the directory where your mysql.exe is , for me is "F:\Develop\MySQL\MySQL Server 5.5\bin"
** Click on OK on both windows to apply
** open A NEW command prompt, now it will work
 
The default username is root with no password.
 
Then from within mysql:


In your project directory there is a DefaultEngine.ini which tells the client and server which map to load as default in particular:
  mysql> create database planeshift;
  mysql> GRANT ALL PRIVILEGES ON planeshift.* TO planeshift@localhost IDENTIFIED BY 'planeshift';
  mysql> quit


   GameDefaultMap=/Game/ThirdPerson/Maps/MainMenu
   > cd PSUnreal\Scripts
   ServerDefaultMap=/Game/ThirdPerson/Maps/MainMenu
   > mysql -u planeshift -pplaneshift


  mysql> use planeshift;
  mysql> source psunreal_mysql_20200401.sql;
  mysql> quit


== Launching the client ==
* To test if you can connect to your database install: https://dbeaver.io/
* Provide the connect information : locahost , port 3306, you should see the planeshift schema with a set of tables.


All non-editor builds require cooked content, however, you can run an editor build with the "-game" command line flag to run the game directly using the editor data; please note however that this will be slower than a cooked build as the editor is essentially processing assets on the fly.
== Launching the server and client ==


There are different ways to launch the client in debug mode:
There are different ways to launch the client in debug mode:


1)
1) PREFERRED. PSUnreal\Scripts\client.bat (you may need to adapt the path to your installation)


2) From Visual Studio
* Select the DebugGameEditor configuration
* Select the DebugGameEditor configuration
* From VS properties on MyProject2 add command line -debug -game
* From VS properties on PSUnreal add command line -debug -game
* It will launch directly without going through the editor
* It will launch directly without opening the editor app
 
2)


3) From Visual Studio with the Editor first
* Select the DebugGameEditor configuration
* Select the DebugGameEditor configuration
* From VS properties on MyProject2 remove -game from command line
* From VS properties on PSUnreal remove -game from command line
* It will launch the Editor, then you press "Play" in the editor. The breakpoints placed in VS are working as expected.
* It will launch the Editor, then you press "Play" in the editor. The breakpoints placed in VS are working as expected.


== Launching the server ==


* Select the DebugGameEditor configuration
If you want to launch the server:
* From VS properties on MyProject2 add this in the command line: -server -log
1) PREFERRED. Use PSUnreal\Scripts\server.bat (you may need to adapt the path to your installation)
 
2) from VS:
* Select the "DebugGame Editor" configuration (if you select Development Editor then the Editor will start instead of the server)
* From VS properties on PSUnreal , select "Debugging" and then add this in the command line: -server -log
* The resulting property will be like: "$(SolutionDir)$(ProjectName).uproject" -server -log
* It will launch directly without going through the editor
* It will launch directly without going through the editor


== Cooking content ==


Optionally (instead of launching inside the editor) you can cook the content:
== Updating your database ==
 
From time to time a new database is posted under \Scripts, example: psunreal_mysql_20200401.sql
 
To update your database you need to:
 
  > cd PSUnreal\Scripts
  > mysql -u root -p
 
  mysql> drop database planeshift;
  mysql> create database planeshift;
  mysql> GRANT ALL PRIVILEGES ON planeshift.* TO planeshift@localhost IDENTIFIED BY 'planeshift';
  mysql> quit
 
  > mysql -u planeshift -pplaneshift
 
  mysql> use planeshift;
  mysql> source psunreal_mysql_20200401.sql;
  mysql> quit
 
 
== Troubleshooting ==
 
If you need to debug the server or the client in Visual Studio:
 
# Keep the configuration "DebugGame Editor"
# Right click on PSUnreal project -> Properties
# Select the "Debugging" category
# To debug the client add -game to the "Command Arguments"
# To debug the server add -server to the "Command Arguments"
 
[[File:Vs_debug.png|500px]]
 
 
Running the PSLauncher I got this error:
Assetion failed: GraphicsContext. There is no active graphics context on this command list. There may be a missing call to Switchpipeline().
It was caused by this line in Target.cs
bUseChecksInShipping = true;
seems to be broken in UE5
 
=== GetObjectFromNetGUID: Network checksum mismatch. ===
In 5.4.3 I was getting this error, as there is a UE bug in the replication code. use my patch UESource\replication_bug.diff
LogNetPackageMap: Warning: GetObjectFromNetGUID: Network checksum mismatch. FullNetGUIDPath: [19]/Game/Blueprints/dummyChar.[17]Default__dummyChar_C, 124483537, 159126252
LogNetPackageMap: Warning: InternalLoadObject: Unable to resolve object from path. Path: Default__dummyChar_C, Outer: /Game/Blueprints/dummyChar, NetGUID: 17
LogNetPackageMap: Warning: InternalLoadObject: Unable to resolve object. FullNetGUIDPath: [19]/Game/Blueprints/dummyChar.[17]Default__dummyChar_C
LogNetPackageMap: Error: UPackageMapClient::SerializeNewActor. Unresolved Archetype GUID. Path: Default__dummyChar_C, NetGUID: 17.
LogNetPackageMap: Error: UPackageMapClient::SerializeNewActor Unable to read Archetype for NetGUID 21904 / 17
LogNet: Warning: UActorChannel::ProcessBunch: SerializeNewActor failed to find/spawn actor. Actor: None, Channel: 4
 
== cmake command for libzip ==
  mkdir build
  cd build
  C:\PSUnreal\ThirdParty\Libzip\libzip\build>"F:\My Programs\Develop\CMake\bin\cmake" -DZLIB_LIBRARY=C:\UnrealEngine\Engine\Source\ThirdParty\zlib\v1.2.8\lib\Win64\VS2015\Release\zlibstatic.lib -DZLIB_INCLUDE_DIR=C:\UnrealEngine\Engine\Source\ThirdParty\zlib\v1.2.8\include -DENABLE_COMMONCRYPTO=OFF -DENABLE_GNUTLS=OFF -DENABLE_MBEDTLS=OFF -DENABLE_OPENSSL=OFF -DENABLE_WINDOWS_CRYPTO=OFF -DENABLE_BZIP2=OFF -DENABLE_LZMA=OFF -G "Visual Studio 15 2017 Win64" ..
 
== LoadConfig - import failed ==
I got this error:
 
LogInit: Display: LogObj: Error: LoadConfig (/Script/GLTFExporter.Default__GLTFExportOptions): import failed for DefaultMaterialBakeSize in: POT_1024


* Cook your content with C:\Luca\UnrealEngine\Engine\Binaries\Win64\UE4Editor-cmd.exe "C:\Users\Luke\Documents\Unreal Projects\MyProject2\MyProject2.uproject" -run=cook -targetplatform=Windows
I solved it by deleting G:\PSUnreal511\Saved\Config . You must have the Editor closed, or the editor is resaving those ini files.

Latest revision as of 18:53, 5 February 2025

Reference docs

Check this page as reference: https://wiki.unrealengine.com/Dedicated_Server_Guide_%28Windows_%26_Linux%29

There are two ways to compile and run your project:

* Compiling the editor and then running/debugging the game within the editor. Please note VS breakpoints will work also in this mode. THIS IS THE ONE WE USE AS DEFAULT.
* Compiling the client without editor, and you will then need cooked content (prepared art files). All non-editor builds require cooked content, however, you can run an editor build with the "-game" command line flag to run the game directly using the editor data; please note however that this will be slower than a cooked build as the editor is essentially processing assets on the fly.

Compiling Unreal Engine

High level steps:

  • Step 1: Register an account at UnrealEngine and GitHub
  • Step 2: Add your GitHub username to in your UnrealEngine profile under your dashboard
  • Step 3: Download the source code from UE4 Repo
  • Step 4: Install Visual Studio 2022, follow these instructions to get the right components in your Visual Studio
  • Step 5: Run Setup.bat to download and install the prerequisites
  • Step 6: Run GenerateProjectFiles.bat to make project files
    • if it complains about windows 8.1 sdk, just install it from here
    • If you get the error "The reference assemblies for framework ".NETFramework,Version=v4.6.2" were not found." just install it from here
  • Step 7: If you dont have it yet, you need to make an account to login to Visual Studio.
  • Step 8: Launch Visual Studio, open UE5.sln and Build Unreal Engine 5 with Development Editor configuration and Win64 Platform
  • Step 9: Copy F:\UnrealEngine\Engine\Source\ThirdParty\zlib\v1.2.8\lib\Win64\VS2015\zlib.dll to F:\Unreal Projects\MyProject2\PSUnreal\Binaries\Win64
  • Step 10: Run the UnrealEditor.exe from Engine\Binaries\Win64\ subdirectory

Compiling PSUnreal

You need to install MariaDB Connector from: https://mariadb.com/downloads/#connectors

  • Select C connector , version 3.3.1GA and MS Windows (64-bit) as platform
  • It will install it in C:\Program Files\MariaDB\MariaDB Connector C 64-bit
  • From the MariaDB install directory, copy both lib/ and include/ (with subfolders) into PSUnreal\ThirdParty\MariaDB\

Compile Wordnet

  • Open PSUnreal\ThirdParty\Wordnet\Wordnet.sln with Visual Studio
  • Click on Compile
  • Copy this file: PSUnreal\ThirdParty\Wordnet\x64\Debug\Wordnet.lib in PSUnreal\ThirdParty\Wordnet\lib\x64\Wordnet.lib

In this mode you will use the Editor to run/debug the game

  • Generate project files, by right clicking on PSUnreal.uproject and "Generate Visual Studio project files"
  • Open Visual Studio 2017
  • Open PSUnreal.sln
  • Be sure you have PSUnreal selected as startup project

  • Select "PSUnreal" project from the left tree view and "DebugGame Editor" as configuration from the top dropdown

  • NOTE: DebugGame configuration builds the engine as optimized, but leaves the game code debuggable. This configuration is ideal for debugging only game modules.
  • Compile

Preparing the server

  • Install mysql server and launch it
  • Create the PlaneShift database
 > mysql -u username -ppassword
  • IF you get 'mysql' is not recognized command, means windows cannot find it. Do the following
    • press start, type "advanced setting", the click on "View advanced system settings"
    • Click on "Environment Variables" at the bottom
    • Click on PATH line, end "Edit".
    • Then click on "New" to add a new element in the PATH variable
    • Copy paste the directory where your mysql.exe is , for me is "F:\Develop\MySQL\MySQL Server 5.5\bin"
    • Click on OK on both windows to apply
    • open A NEW command prompt, now it will work

The default username is root with no password.

Then from within mysql:

 mysql> create database planeshift;
 mysql> GRANT ALL PRIVILEGES ON planeshift.* TO planeshift@localhost IDENTIFIED BY 'planeshift';
 mysql> quit
 > cd PSUnreal\Scripts
 > mysql -u planeshift -pplaneshift
 mysql> use planeshift;
 mysql> source psunreal_mysql_20200401.sql;
 mysql> quit
  • To test if you can connect to your database install: https://dbeaver.io/
  • Provide the connect information : locahost , port 3306, you should see the planeshift schema with a set of tables.

Launching the server and client

There are different ways to launch the client in debug mode:

1) PREFERRED. PSUnreal\Scripts\client.bat (you may need to adapt the path to your installation)

2) From Visual Studio

  • Select the DebugGameEditor configuration
  • From VS properties on PSUnreal add command line -debug -game
  • It will launch directly without opening the editor app

3) From Visual Studio with the Editor first

  • Select the DebugGameEditor configuration
  • From VS properties on PSUnreal remove -game from command line
  • It will launch the Editor, then you press "Play" in the editor. The breakpoints placed in VS are working as expected.


If you want to launch the server: 1) PREFERRED. Use PSUnreal\Scripts\server.bat (you may need to adapt the path to your installation)

2) from VS:

  • Select the "DebugGame Editor" configuration (if you select Development Editor then the Editor will start instead of the server)
  • From VS properties on PSUnreal , select "Debugging" and then add this in the command line: -server -log
  • The resulting property will be like: "$(SolutionDir)$(ProjectName).uproject" -server -log
  • It will launch directly without going through the editor


Updating your database

From time to time a new database is posted under \Scripts, example: psunreal_mysql_20200401.sql

To update your database you need to:

 > cd PSUnreal\Scripts
 > mysql -u root -p
 
 mysql> drop database planeshift;
 mysql> create database planeshift;
 mysql> GRANT ALL PRIVILEGES ON planeshift.* TO planeshift@localhost IDENTIFIED BY 'planeshift';
 mysql> quit
 > mysql -u planeshift -pplaneshift
 mysql> use planeshift;
 mysql> source psunreal_mysql_20200401.sql;
 mysql> quit


Troubleshooting

If you need to debug the server or the client in Visual Studio:

  1. Keep the configuration "DebugGame Editor"
  2. Right click on PSUnreal project -> Properties
  3. Select the "Debugging" category
  4. To debug the client add -game to the "Command Arguments"
  5. To debug the server add -server to the "Command Arguments"


Running the PSLauncher I got this error:

Assetion failed: GraphicsContext. There is no active graphics context on this command list. There may be a missing call to Switchpipeline().

It was caused by this line in Target.cs

bUseChecksInShipping = true;

seems to be broken in UE5

GetObjectFromNetGUID: Network checksum mismatch.

In 5.4.3 I was getting this error, as there is a UE bug in the replication code. use my patch UESource\replication_bug.diff

LogNetPackageMap: Warning: GetObjectFromNetGUID: Network checksum mismatch. FullNetGUIDPath: [19]/Game/Blueprints/dummyChar.[17]Default__dummyChar_C, 124483537, 159126252
LogNetPackageMap: Warning: InternalLoadObject: Unable to resolve object from path. Path: Default__dummyChar_C, Outer: /Game/Blueprints/dummyChar, NetGUID: 17
LogNetPackageMap: Warning: InternalLoadObject: Unable to resolve object. FullNetGUIDPath: [19]/Game/Blueprints/dummyChar.[17]Default__dummyChar_C
LogNetPackageMap: Error: UPackageMapClient::SerializeNewActor. Unresolved Archetype GUID. Path: Default__dummyChar_C, NetGUID: 17.
LogNetPackageMap: Error: UPackageMapClient::SerializeNewActor Unable to read Archetype for NetGUID 21904 / 17
LogNet: Warning: UActorChannel::ProcessBunch: SerializeNewActor failed to find/spawn actor. Actor: None, Channel: 4

cmake command for libzip

 mkdir build
 cd build
 C:\PSUnreal\ThirdParty\Libzip\libzip\build>"F:\My Programs\Develop\CMake\bin\cmake" -DZLIB_LIBRARY=C:\UnrealEngine\Engine\Source\ThirdParty\zlib\v1.2.8\lib\Win64\VS2015\Release\zlibstatic.lib -DZLIB_INCLUDE_DIR=C:\UnrealEngine\Engine\Source\ThirdParty\zlib\v1.2.8\include -DENABLE_COMMONCRYPTO=OFF -DENABLE_GNUTLS=OFF -DENABLE_MBEDTLS=OFF -DENABLE_OPENSSL=OFF -DENABLE_WINDOWS_CRYPTO=OFF -DENABLE_BZIP2=OFF -DENABLE_LZMA=OFF -G "Visual Studio 15 2017 Win64" ..

LoadConfig - import failed

I got this error:

LogInit: Display: LogObj: Error: LoadConfig (/Script/GLTFExporter.Default__GLTFExportOptions): import failed for DefaultMaterialBakeSize in: POT_1024

I solved it by deleting G:\PSUnreal511\Saved\Config . You must have the Editor closed, or the editor is resaving those ini files.