PSUnreal: Difference between revisions

From PSwiki
Jump to navigation Jump to search
Rigwyn (talk | contribs)
No edit summary
 
(65 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Import a level ==


In the FBX exporter set the Units to "Centimeters", this will scale the model up 100 times, as in UE the units are 1 unit = 1cm, while in CS they are 1 unit = 1 meter
== Introduction ==


This is page at the moment is just a collection of my tests and notes. I hope it will be more structured in the future.


== Import a char ==
We are collecting here our findings on Unreal Engine.


You cannot import a skeleton by itself, if you export only the skeleton from max with FBX, UE will import nothing, you need some geometry associated
If you want to know why we are doing this, check [http://www.planeshift.it/article/2015/Lets%20make%20PlaneShift%20Unreal this post].


OLD (Bake Animations fixes this problem): FBX export seems to have issues if the controllers or bones have a "orientation constraint" on the Motion panel under assign controller. With that it doesn't export, without it does


OLD (Bake Animations fixes this problem): UE doesn't import skeletons with multiple root bones, need to have one
We are currently using <font size=5>Unreal engine 5.1.1-release </font> (use only this tag when checking out sources)


You cannot import DDS files, unless they are specific format. Better to just import PNGs.
== Roadmap ==


Only way I found to import a char is to hide all helpers, shapes, then select geometry and bones, and "Export Selected" to FBX with "Bake Animations" selected.
[[UE Roadmap]]


[[File:Banner roadmap.jpg]]


== Engine inner working ==


[[PSUnreal Programming]]


> MyProjectServer.exe!UIpNetDriver::InitListen(FNetworkNotify * InNotify, FURL & LocalURL, bool bReuseAddressAndPort, FString & Error) Line 152 C++
http://www.planeshift.it/element/%7B%22width%22%3A1000%2C%22height%22%3A4000%7D/Site%20images/Pages/Development/engine_department2.jpg
MyProjectServer.exe!UWorld::Listen(FURL & InURL) Line 3927 C++
MyProjectServer.exe!UEngine::LoadMap(FWorldContext & WorldContext, FURL URL, UPendingNetGame * Pending, FString & Error) Line 8983 C++
MyProjectServer.exe!UEngine::Browse(FWorldContext & WorldContext, FURL URL, FString & Error) Line 8144 C++
MyProjectServer.exe!UGameInstance::StartGameInstance() Line 262 C++
MyProjectServer.exe!UGameEngine::Init(IEngineLoop * InEngineLoop) Line 465 C++
MyProjectServer.exe!FEngineLoop::Init() Line 1967 C++
MyProjectServer.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 138 C++
MyProjectServer.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 191 C++




[[PSUnreal Art]]


== Code convertion ==
http://www.planeshift.it/element/%7B%22width%22%3A1000%2C%22height%22%3A4000%7D/Site%20images/Pages/Development/3d_department.jpg




=== Types ===
[[How to test]]


 
[[Unreal Engine resources]]
csString -> psString or FString
 
psStringArray with TArray<psString>
 
uint -> uint32
 
csHash<Value,Key> -> TMap<Key,Value> (notice the swap of Key and Value)
 
csArray<> -> TArray
 
csTicks -> time_t
 
csGetTicks() -> time(0)
 
=== Types conversion ===
 
 
FString to char*  -> const char *myData = TCHAR_TO_ANSI(*NameString);
 
FString to TCHAR -> *myFString
 
char* to FString  -> ANSI_TO_TCHAR(NameString);
 
 
 
=== Functions ===
 
 
Replace string.Format("hey %s", string) with string.Printf(TEXT("hey %s"), string)
 
csString.Truncate(5) -> FString.Left(5)
 
csString.DeleteAt(start,count) -> FString.RemoveAt(start,count)
 
csString.Downcase() -> FString.ToLower()
 
output.Insert(0, time_buffer) -> output.InsertAt(0, time_buffer)
 
output.GetAt(output.Length()-1) -> output [ output.Len()-1 ]
 
Cross platform types are defined in Platform.h , like uint32. Those can be included with #include "EngineMinimal.h"
 
CS_ASSERT() -> check()
 
strcasecmp and strcmp, I added those two defines, so the code can stay as it is
 
  #define strcasecmp(expr1,expr2) FCString::Strcmp( ANSI_TO_TCHAR(expr1), ANSI_TO_TCHAR(expr2)) == 0
  #define strcmp(expr1,expr2) FCString::Stricmp( ANSI_TO_TCHAR(expr1), ANSI_TO_TCHAR(expr2)) == 0
 
CPrintf(CON_CMDOUTPUT,str.GetDataSafe()); -> UE_LOG(LogTemp, Warning, TEXT("%s"), str);
 
time(NULL) -> FString buf = FDateTime().GetDate().ToString();
 
=== FText and Localization ===
 
FText is Unreal's class for user viewable strings. It is localizable. See https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/StringHandling/FText/index.html
 
=== Platform specific includes ===
 
If you want to include some code for a specific platform you can use:
 
 
#ifdef PLATFORM_WINDOWS
your stuff here
#endif
 
== Building UEEditor on Linux ==
 
 
''Note, in the snippets below, I installed to /home/user/Development Obviously, your home directory and installation directory may be different.''         
 
 
Closely follow all of the steps on the following pages.
 
  https://wiki.unrealengine.com/Building_On_Linux
  https://wiki.unrealengine.com/Running_On_Linux
  https://wiki.unrealengine.com/Cooking_On_Linux
 
 
# Register for a free account at github.com
# Per the first link above, join the unreal project
# Upon being persmissioned, download and build the UnrealEditor
 
 
'''Be sure to install all dependencies first'''
 
 
=== Some errors that you may encounter along the way ===
 
<code>
  [2015.05.03-06.32.22:451][ 0]LogModuleManager:Warning: ModuleManager: Unable to load module 'PakFile' because the file '/home/user/Development/UnrealEngine/Engine/Binaries/Linux/' was not found.
</code>
 
I don't think this warning is that important right now
 
 
=== First Attempt at starting UEEditor is horribly slow and Fails: I had to kill it. ===
 
 
'''I want to point out a few of the RED error messages that came up and how I fixed them:'''
 
 
<code>
user@u13:~/Development/UnrealEngine/Engine/Binaries/Linux$ ./UE4Editor
./UE4Editor: error while loading shared libraries: libLND.so: cannot open shared object file: No such file or directory
</code>
 
To fix this, copy libLND.so (there are several flavors) from another directory to the Binaries/Linux directory. Do not use a symbolic link, just make a copy of the file. On my installation, a sym link worked in some places but failed in miserably others.
 
<code>
$ find ../../../../ -name libLND.so -print
../../../../UnrealEngine/Engine/Source/ThirdParty/LinuxNativeDialogs/UELinuxNativeDialogs/lib/Linux/x86_64-unknown-linux-gnu/libLND.so
cp ../../../../UnrealEngine/Engine/Source/ThirdParty/LinuxNativeDialogs/UELinuxNativeDialogs/lib/Linux/x86_64-unknown-linux-gnu/libLND.so .
</code>
 
 
=== Some fonts are in the wrong place. Its important to fix this ===
 
<code>
[2015.05.03-07.28.52:548][  0]LogSlate:Warning: Failed to load font data from '../../../Engine/Content/Slate/Fonts/Roboto-Italic.ttf'
$ find ../../../ -name Roboto-Italic.ttf -print
../../../Engine/Content/Editor/Slate/Fonts/Roboto-Italic.ttf
../../../Engine/Content/Slate/Testing/Fonts/Roboto-Italic.ttf
cp ../../../Engine/Content/Editor/Slate/Fonts/*  ../../../Engine/Content/Slate/Fonts/
cp ../../../Engine/Content/Slate/Testing/Fonts/* ../../../Engine/Content/Slate/Fonts/
</code>
 
=== I don't know what to do do about these two errors yet ===
 
<code>
[2015.05.03-07.29.12:524][  0]LogDirectoryWatcher:Error: inotify_add_watch cannot watch folder /home/user/Development/UnrealEngine/Engine/Plugins/Experimental/CharacterAI/Content/
[2015.05.03-07.29.12:524][  0]LogDirectoryWatcher:Warning: Failed to begin reading directory changes for ../../../Engine/Plugins/Experimental/CharacterAI/Content/.
</code>
 
 
=== Create and Save the "Blank" project from the Blueprint Tab ===
 
once you have the Editor open and working, create the "Blank" project and save it. We need to do this, otherwise we will not be able to cook content later on and will get an error message stating that some folder ( /Saved/Sandbox/DefaultGame/ ? )  is missing. This seems to be some sort of a bug or perhaps lazy initialization.
 
# Open the editor
# Click on New Project
# Click on "Blank"  ( In the Blueprint tab, not the one in the C++ tab )
# Click "Create Project"
# Save All and exit for now.
 
=== Clone and Import the psunreal project: ===
 
Get the svn password and the link from Talad. We are going to download the source and put it into the UnrealEngine directory in order to work around yet another bug. After that, we run GenerateProjectFiles.sh once more to add our project to The Makefile.
 
<code>
cd ~/Development/UnrealEngine/
svn co svn://super.secret.source.path
</code>
 
we now have ~/Development/UnrealEngine/psunreal. Run the script below to add our project to the Makefile
 
<code>
./GenerateProjectFiles.sh
</code>
 
 
=== Open the PSUNREAL project ( finally.. ) ===
 
Click File and then Open Project
 
You will now see the Blank Project and another named MyProject2 ( that's ours )
 
Click MyProject2 and then open.
 
You will get an error message that looks like this:
 
This project was made with a different version of the Unreal Engine. Converting to this version will rebuild your code projects.
 
New features and improvements sometimes cause API changes, which may require you to modify your code before it compiles. Content saved with newer versions of the editor will not open in older versions.
 
We recommend you open a copy of your project to avoid damaging the original.
 
Just click "Convert in Place".
 
''This is a real annoyance. It seems to happen every time you open the project. I don't have a solution for this yet''
 
 
You will get another error message:
 
<code>
Error: CDO Constructor (MyProject2GameMode): Failed to find /Game/ThirdPerson/Blueprints/ThirdPersonCharacter.ThirdPersonCharacter_C
[2015.05.03-08.12.44:709][  0]Error: CDO Constructor (MyProject2GameMode): Failed to find
 
/Game/ThirdPerson/Blueprints/ThirdPersonCharacter.ThirdPersonCharacter_C
</code>
 
Just click "OK" for now. I don't know how to fix these yet.
 
There are a few errors about missing Android stuff. I don't we need to worry about this.
<code>
[2015.05.03-08.14.15:716][  0]LogModuleManager:Warning: ModuleManager: Unable to load module 'AndroidRuntimeSettings' because the file '/home/user/Development2/UnrealEngine/Engine/Binaries/Linux/' was not found.
 
[2015.05.03-08.14.15:719][  0]LogModuleManager:Warning: ModuleManager: Unable to load module 'AndroidPlatformEditor' because the file '/home/user/Development2/UnrealEngine/Engine/Binaries/Linux/' was not found.
</code>
 
For this missing font, we need to repeat the solution above for Roboto-Italic...
 
<code>
[2015.05.03-08.14.18:469][  0]LogSlate:Warning: Failed to load font data from '../../../Engine/Content/Editor/Slate/Fonts/Roboto-Regular.ttf'
[2015.05.03-08.14.18:471][  0]LogSlate:Warning: Failed to load font data from '../../../Engine/Content/Editor/Slate/Fonts/Roboto-Bold.ttf'
</code>
 
=== Building, cooking, packaging... oh my. ===
 
So when you build the game there are several things that need to be built:
* shaders
* the code itself
* some lighting resources
 
You also need to cook the game's content. This means, you are taking all the art, models, textures, etc.. and converting them into a format that the Unreal engine likes. When you go to build the game for another platform - like an android tablet, pc, mac, or whatever, it will convert those "assets" into a format that is more suitable for the target platform.
 
After you have cooked the content, you should be able to "package" the game. This simply means, you are setting up the files that will be distributed to the client. They will be formatted to work on the target platform and will be laid out into a directory structure.
 
 
=== Setting up the server ===
 
Follow the instructions in the "Planeshift Compiling Guide" for setting up the mysql database. You'll need to set it up ( either Mariadb or mysql ) and then run a few scripts to get a planeshift user account set up along with some needed data.
 
When you run the new unreal server ( make target is: MyProject2Server ), it will attempt to connect to the DB. If successful, you will see something like this in the shell that you ran it from:
 
<code>
[2015.05.02-08.25.58:359][  0]LogWorld: Bringing up level for play took: 0.000330
[2015.05.02-08.25.58:359][  0]LogTemp:Warning: Hello world! BEFORE
[2015.05.02-08.25.58:359][  0]LogTemp: Hello world! AFTER 4 5
[2015.05.02-08.25.58:371][  0]LOG_STARTUP:Display: Database Host: 'localhost' User: 'planeshift' Databasename: 'planeshift' Port: 128880496
[2015.05.02-08.25.58:559][  0]LOG_STARTUP:Display: Started Database with version: 1279
</code>
 
You can also check to see if the server connected to your mysql or mariadb server by making a simple script
 
<code>
 
SELECT SUBSTRING_INDEX(host, ':', 1) AS host_short,
            GROUP_CONCAT(DISTINCT USER)  AS users,
            COUNT(*)
    FROM  information_schema.processlist
    GROUP  BY host_short
    ORDER  BY COUNT(*),
              host_short;
 
 
</code>
 
Save this to a file called show_connected.sql and then log into the db and run it from there.
             
<poem>
$ mysql -u root -pMYSECRETPASSWORD
 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
 
Your MariaDB connection id is 51
 
Server version: 5.5.41-MariaDB-1ubuntu0.14.10.1 (Ubuntu)
 
 
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
 
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
 
MariaDB [(none)]> \. show_connected.sql
 
+------------+-----------------+----------+
 
| host_short | users          | COUNT(*) |
 
+------------+-----------------+----------+
 
| localhost  | planeshift,root |        2 |
 
+------------+-----------------+----------+
 
1 row in set (0.03 sec)
 
 
MariaDB [(none)]>
</poem>
 
--[[User:Rigwyn|Rigwyn]] 17:12, 3 May 2015 (UTC)

Latest revision as of 10:37, 15 October 2023

Introduction

This is page at the moment is just a collection of my tests and notes. I hope it will be more structured in the future.

We are collecting here our findings on Unreal Engine.

If you want to know why we are doing this, check this post.


We are currently using Unreal engine 5.1.1-release (use only this tag when checking out sources)

Roadmap

UE Roadmap


PSUnreal Programming

engine_department2.jpg


PSUnreal Art

3d_department.jpg


How to test

Unreal Engine resources