Affichage des articles dont le libellé est unreal engine. Afficher tous les articles
Affichage des articles dont le libellé est unreal engine. Afficher tous les articles

mercredi 28 décembre 2016

Dedicated Server packaging

Dedicated server packaging


I found that Url in the wiki : https://wiki.unrealengine.com/Dedicated_Server_Guide_(Windows_%26_Linux)

But I don't know it is outdated, or I have particular case, but following this, didn't success for me.
So I will give you my way to do, and few tricks, because some configuration steps are necessary and there is no place aggregating those informations.

In my game, I will have one server per map, because each map must be persistent, and is not upon a player.
So I have to generate one server per map.

Tricks & Settings


If you have already launched your game through commandLine like "ue4editor projectName mapName -server/-game", it is quite simple, because you give in parameters the name of your map.
So in your test, you can go map/through map just changing your command line parameters.

When you generate/package your game, it will fix these setting once per package.
First step, you will have to configure under the editor the maps & modes settings.
In these window, you precise which map the client will start with, and which map the server will start with.


Another trick is about package non ue4 files. I manage some configurations files, or data files (json files) in my game to store dialogs, missions, ..., and these files are open by C++ code.
So Ue4editor didn't consider them like assets. In consequence, when you package your game, those directory, and files are not packaging. so bad....
So go to your settings, packaging settings, I recommand to uncheck use pak file in a first time, because you will be happy to see the package content in the first time to validate its content.

Go down, to to Additionnal non assets directories to package, and browse to your directory to add it to your package.


You can refer to the wiki for other steps until unreal front cooking. I don't use unreal Front to package & prepare my game.
I use Ue4editor, through file->package project.

Packaged


At the end of the processus, you will have a directory "game" with WindowNoEditor, with two directories Engine, and yourGame.
Go through yourGame/Binaries/<platform>/ you must find a yourgame.exe, and yourgameserver.exe.
If you don't have your executable, maybe you forget to generate with visual studio (see the step in the wiki).
In certain case, you have to copy the binaries yourself, from your building directory, to your game package.

That's it. I recommand to through a shell script, or command line to launch with "-log" parameters to check that your server & games runs without problem.

I hope it will help people who want to manage dedicated server.

Thyshimrod

jeudi 18 février 2016

ue4 : AI in a space game : relative coordinate : part 1

I will make some articles about AI I am building.
I will not use for the moment, tooling set in ue, because I will not have change of behaviour (attack, defense, patrol).
I will for the moment make only one behaviour, and one goal to reach, without modification depending of the situation of the AI.

My goal is to put in space 2 cubes, and to spawn an AI pawn controlled by an AI controller.
The AI will retrieve first cube, and will fly to this one. It will shoot at it, destroy it, next it will change of target, and fire on the second one.

I ve created a pawn, with a static mesh, with physic enabled.
Don't forget to precise that the pawn is possessed by your specific AIController blueprint:





For my purpose, one of the central need I have, it to be able to orient my pawn to my target.

In AIController,  I ve defined a variable TargetToGo
and create a function to associate a value to the target


I retrieve all object in the scene which are from class gopoint (my cubes, there are two of them). If actual targetToGo is different of the one retrieve in foreach loop, I affect it, and break the loop.
Quite simple.

Ok, for now, I have a target for my pawn... The difficulty is to know how to orient my ship to the target, to move near it, and shoot at it.

Ue4 gives possibilities through transformation tools, to make world location, in local location relative to the ship.

From my pawn, and target, I retrieve static mesh.
From AI ship, I create a transform object (world transform) and I connect it to an inverse transform location object. This last one is the way to make world location into relative location (transform location does the inverse, relative to world).
In parameter, you give actual world location of the target, and you will have a vector in output.




Now, if you break the vector, y which is a left/right coordinate, and z a up/down coordinate. When z and y are at 0, target must be in front of you.
X value in case of y and z at 0 will be the distance to the target.
X can give you clue, if your spaceship is going to, or going away of. If x is equal to - (distance), you are going away from the target.

You have to make rotation, to make x near from distance, and then re apply torque to reduce y and z to 0





dimanche 14 février 2016

Third Party server with UE4 : part 3 : C++ : connect and read socket

I ve created mainly two functions, one to connect, one other to read socket


I think it is quite easy to understand, and easy to modify to what you need, because apart port and ip, you don't have to modify lot of thing :D.

this->connected, is a variable to store connection status, you can use in a function like isConnected :D


This function will read the socket, retrieve the data in receivedData.
In my case, I will deserialize data from string to json, and I will store the message into a customize class, which will store all message.

This function is called each tick, because I have not lot of information send into these socket.
If you prefer to thread it, you can