PSUnreal

From PSwiki
Revision as of 17:12, 3 May 2015 by Rigwyn (talk | contribs)
Jump to navigation Jump to search

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


Import a char

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

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

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

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.


Engine inner working

> MyProjectServer.exe!UIpNetDriver::InitListen(FNetworkNotify * InNotify, FURL & LocalURL, bool bReuseAddressAndPort, FString & Error) Line 152 C++

	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++


Code convertion

Types

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:


  1. ifdef PLATFORM_WINDOWS

your stuff here

  1. 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


  1. Register for a free account at github.com
  2. Per the first link above, join the unreal project
  3. Upon being persmissioned, download and build the UnrealEditor


Be sure to install all dependencies first


Some errors that you may encounter along the way

  [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.

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:


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

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.

$ 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 .


Some fonts are in the wrong place. Its important to fix this

[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/

I don't know what to do do about these two errors yet

[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/.


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.

  1. Open the editor
  2. Click on New Project
  3. Click on "Blank" ( In the Blueprint tab, not the one in the C++ tab )
  4. Click "Create Project"
  5. 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.

cd ~/Development/UnrealEngine/ svn co svn://super.secret.source.path

we now have ~/Development/UnrealEngine/psunreal. Run the script below to add our project to the Makefile

./GenerateProjectFiles.sh


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:

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

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. [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.

For this missing font, we need to repeat the solution above for Roboto-Italic...

[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'

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:

[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

You can also check to see if the server connected to your mysql or mariadb server by making a simple script

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;


Save this to a file called show_connected.sql and then log into the db and run it from there.

$ 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)]>

--Rigwyn 17:12, 3 May 2015 (UTC)