Low Entry Plugins

Need help with a few questions regarding LE TCP Socket connection BP Plugin

Not sure this is the right place to ask, but here goes several questions:

Background:
I am connecting UE4 to my microcomputer via a web socket connection. The micro has a server that collects data and UE4 will use the data to update a static mesh actor on screen. I am using your TCP socket connection. UE4 BP is able to connect to my micro using the “Create Socket Connection (Not UDP and Not Raw)”. The server on the micro gets the connection and accepts it. Then from UE4 BP, I then send a test message using “Send Function Call”. The micro server sees the message come in as follows(colons only on debug for clarity):
02:4C:16:41:42:43:44:45:46:47:48:49:4A:4B:4C:4D:4E:4F:50:51:52:53:54:55:56:
For testing, the server just changes the first byte to “03” and replies back:
03:4C:16:41:42:43:44:45:46:47:48:49:4A:4B:4C:4D:4E:4F:50:51:52:53:54:55:56:

Question 1. The “Send Function Call” does not accept the response and fails out. Does the server have to send something else for the message to be acceptable on a Function Call response?

Question 2. How can the server properly determine when it will get 1 or 4 byte length and 1 or 4 Function ID bytes, for that matter. It seems random and can start a few messages with 1byte length and then after a few messages, the server starts getting 4 byte length fields/and or Function ID bytes, even though the message is always the same length. Will the first length byte always start with 0x80 if there are 4 bytes? Wiil the FunctionID also start with 0x80 on the first byte if there will be 4 bytes?
Here is a sample when server gets a 4-byte length message: 02:80:00:00:95:16:41:42:43:44:45:46:47:48:49:4A:4B:4C:4D:4E:4F:50:51:52:53:54:55:56:
and the micro server responds as:03:80:00:00:95:16:41:42:43:44:45:46:47:48:49:4A:4B:4C:4D:4E:4F:50:51:52:53:54:55:56:
but this message gets rejected as well.

Question 3. Which Java Server example can I use to validate the “UE4 Send Function Call”. I tried Socket Examples 1-4 and none of them respond to the incoming Function Call requests. They just accept a connection and then disconnect.

Sorry if I missed something in your documentation, but I have read them over and over and watched your Youtube demo and can’t figure these things out.
Please point me in the right direction so that I can get back on track.

Thanks for a great product and I am sure I just missed something in the translation :slight_smile:

Don’t know how to edit the post I just submitted, but I resolved my first question. I was chopping off the first byte of the reply and that is why the Send Function Call was failing on my response. The function call now gets all my responses correctly. Sorry about that. But I would still like answers to the other questions.

Also, is there a way to automatically try to restart a failed connection? The micro should always be up and responding back to UE4 function calls, but if for some reason my server reboots, is there a way for UE4 socket to try to reconnect after a few tries?

Well, the not-raw socket connection blueprints in UE4 use a specific protocol, the socket server has to use the exact same protocol or else it won’t work.
If you are creating a server with the Java library, you could use this protocol easily, else it would be easier to use the raw socket connection blueprints instead (they don’t use any protocol whatsoever, so you are free to do things your own way).

The 1-4 byte thing works like this:

When a function ID integer is converted to bytes, it will always be 0 or higher, therefor the first bit (the signed bit) is useless.
Because of this, the protocol checks if the function ID is <= 127, and if it is, it sends the integer in a single byte.
If the integer is higher than 127, it will be send as 4 bytes, and then the first bit of the first byte will be set to 1 (the signed bit of the integer basically).
The max is 127, because that is the maximum value a byte can have with the first bit set to 0.

Anyway, when the integer byte(s) is/are read again, it checks if the first bit of the first byte is 0, and if it is, it just takes the first byte as the integer.
When the first bit is 1 however, it takes 4 bytes, converts the first bit of the first byte to 0, and then converts those bytes to an integer.

This is also happening for the message length, which is also always 0 or higher. This is useful for small messages, because it saves 3 bytes this way without any downsides.

Anyway, like I said, if you don’t use the Java socket server, it makes more sense to use raw socket connection blueprints instead.
Then you can just send the message length in 4 bytes before you send the message itself, and then on the server side you just convert the first 4 bytes to an integer and then just keep reading bytes until you have as many as the value of the integer.

Also, besides this, the protocol also does some other things, the client and the server for example are expected to send the TCP and UDP port they are using when the client connects to the server.
If you really want to recreate the protocol, you should take a look at the SocketServerClientHandler class inside the Java library (package .ue4.classes.sockets).

Lastly, you could restart a connection when the OnDisconnected event is fired.
Automatically reconnecting build into the protocol usually doesn’t make sense, because most servers (and clients as well) destroy the clients session data when the client disconnects, automatic reconnecting at the protocol-level would be a pain to deal with.
Instead, you can just create a loop of a Delay+IsConnected+BranchIsFalse+Connect in blueprint yourself, and when Connect returns true, just follow your own connect/authenticate/initialize protocol again, similar to a normal authenticate and login.

Hey guys. Thanks for the plugin. I have meet some problem in LE File Manager Plugin in android. I tried to make a file browser to get a .mp4 file that in the user storage (such as SD Card / Usb storage or somewhere user can save the video file). But when I use “Directories” and “Files” node to listed directories and files in that path, there are nothing here. But if I use some file browser , I can see all the directories and files there. I don’t know why. Could you give me some advice?

Hi, smartphones protect certain folders which makes it impossible for your app/game to access them. Because of this, the UE4 filesystem uses a folder that is readable/writable as its root. Any file reading and writing should be done with files placed in this folder.

To know what the path of the folder is, you could do: [Get Root]->[Get Path], use that with [Convert Relative Path To Absolute Path], then [Print String] that.

If you want the plugin to load files from a different folder, you should use the low level blueprints and absolute paths (like [Get File Data] with ‘/media/somefolder/somefile.mp4’). You will probably have to request certain permissions from the user then with your app, I don’t know how to accomplish that with the UE4.

How do I attach the “Was Request Successful” node to the “Execute Request (Event)” node. I’ve got this far…

But I’m definitely missing something!

EDIT:

I’m using UE 4.15.2. I have used the Low Entry HTTP plug-in successfully in previous projects but in this project I don’t seem to have the “Execute Request” node, I only have the “Execute Request (Event)” node.

Is this code placed in a function?
The “Execute Request” node is a latent node (like “Delay”), which means that it cannot be used in certain circumstances.

Anyway, with the “Execute Request (Event)” node you can get it to work as well, but you have to create a function with parameters IN=[RequestResponse] and OUT=] then.
You then have to select that function in the “Create Event” function dropdown.
Also, inside of that function, you can then use the RequestResponse parameter as a Target for the “Was Request Successful” blueprint.

Hey, , do you have website?

thanks!

I have File Manager plugin. I am looking to hire someone to help install it. Anyone interested please send me quote on how much to do the install here :

Thanks

“to help install it”

What do you mean? Installing a plugin is as simple as a couple button presses in the Epic Games Launcher?

Are you trying to make something with it? Or are you trying to install it in a source build of the engine?

Also, the support email address is support@.com, the website is https://.com/

Looking forward to the 4.16 updates. :slight_smile:

Ehm, aren’t the 4.16 plugin updates already available on the marketplace? :stuck_out_tongue:

Oh, sorry! They are. I was just expecting the launcher to tell me that they were available and it did not. Manually installing now. Sorry for the trouble.

No problem, haha :stuck_out_tongue:

@

Just had a thought and was wondering if you have looked at SpatialOS at all?

Hm no, never seen it, but looks cool.

It seems that what they are doing is basically causing you to connect to a different server if you walk ‘out-of-bounds’ of the current server. So what many MMO’s are doing basically (WoW causes you to connect to a different server as well if you walked into a different zone).

I wonder how they deal with the areas where the zones meet though, since the Unreal Engine 4 client-server code doesn’t allow you to be connected to several servers, right? So you can’t see players right in front of you if you are starting at a different zone.

Although, maybe they use their own client-server code, which would mean that you can’t use the networking functionality of the Unreal Engine 4 then.

Well, the only way to figure out how well it works is by trying it yourself I suppose.

Also, I don’t think this is useful for your project unless you’re building a MMO, and if you’re building a MMO, you might want to create the server infrastructure from scratch instead (so you could use the Unreal Engine 4’s networking functionality for example).

This is just a first impression though, the only way to get in-depth knowledge about it is by giving it a try I suppose.

Thanks for taking a look.

I have been following it for some time and have built the Unreal sample projects. They are just now in the process of developing a UE4 integration.

SpatialOS is a distributed operating system operating in the cloud and won’t use any specific server. It won’t use any of UE4’s networking at all. Their system is scalable out of the box and utilizes “Workers” to represent NPCs, PCs, and so forth. It appears to have the potential to permit niche MMORPGS such as we are working on.

Unfortunately, we’ve gone as far as we can go with UE4’s dedicated server. It will never, in my opinion, be suitable for a massively multiplayer game (Is there any other kind?")

The major hurdle facing us atm is the fact that all of the code we have will have to be reworked to use SpatialOS networking. Another significant problem is that SpatialOS was developed with Unity in mind and it does not appear that the developers have fully understood the Unreal game creation methodology as yet.

Hm, if you’re creating your own MMO you would probably be best off finding someone that’s experienced in network programming, but if SpatialOS works well, that might be a valid option as well.

One thing though, this: “distributed operating system operating in the cloud” seems a bit sketchy/bullshitty to me. From what I know, they just have their own network protocol running on their own servers, which are connected to a coordinating server that makes the servers aware of each other and able to send data to each other. I don’t think they have their own operating system, lol, and the “in the cloud” part is a bit dubious when talking about servers, since servers are always “in the cloud”. Don’t know if these words came from them or not, if it did, I would get a bit more cynical about what other claims they make.

Anyway, making the multi-server infrastructure yourself isn’t that hard, I did it for my demo game as well (there’s one main server which all the game servers are connected to, then when players get matchmade, the main server picks a random game server and sends the IP and port to the clients so they connect to that server, the main server also sends data to the game server so it knows to bind the clients together, and it also knows what to expect, like how many players etc).

The hardest part is the realtime networking part, which is what the Unreal Engine 4 network functionality solves for you. I don’t know if SpatialOS makes this easier to do as well, if they do, it might be a very good option for a realtime MMO.

If they don’t have a solution for realtime networking, you might as well either try to get the Unreal Engine 4 networking functionality to work in a multi-server configuration, or just program the entire network functionality from scratch.

Another thing I find a bit dubious is that they are not clear and up-front with their pricing, which usually doesn’t mean anything good.

Anyway, lots of options, why couldn’t you get the Unreal Engine 4 servers to work though? Just create a socket server as a main/coordinator server (with the LE Socket Connection plugin for example), then connect every Unreal server with the main server, then on the main server figure out where the client is on login and then find out what Unreal server handles that region, then make the client connect to that Unreal server. Then, when ever a client walks off that region, make the Unreal server let the main server know, and make the main server connect the client to a different Unreal server. Seems like quite a basic task for a network programmer. The only problem is the seems / loading screens which will happen when a client connects to a different Unreal server, which is a bit ugly, but not unheard of (the Elder Scrolls Online has this ugliness as well).

-edit-

Seemed like I missed this part. The ‘workers’ SpatialOS was talking about seems to just be servers that are connected as clients/bots. For example, in my demo game I had bots that players could play against, instead of executing the bot AI on the main or game server (which would overload the server, it’s bruteforcing minmaxing AI), I created different servers that would handle the AI, and then I let those servers be connected to the main and game servers as a client/bot.

If you go with the Unreal Engine servers, the AI will just run on the servers, which is fine, since AI like that is very basic (for example, every 5 seconds, just check if a player is nearby, then cause the bot to run towards the player until it is close enough, then cause the bot to attack the player). You could potentially make ‘workers’ as well with the Unreal Engine servers, you’ll basically just have to create a different client game/app which will take care of the AI, then just let this client connect to the Unreal Engine servers and you’ll have the same functionality and separation as the SpatialOS ‘workers’ have.

Cool, thanks for all the info. :slight_smile: I have practically no experience in network programming, but will investigate the scenarios you have mentioned. Thanks again!

We’d like to have Open World, no loading screens. Right now, our prototype (One of the better vids:https://www.youtube.com/watch?v=sr57TyqOIwE) works on dedicated servers and the player has to change severs (zone) to enter our prototype dungeon.

We actually have the basic elements in place and working, however, Unreal’s dedicated server can’t handle more than 100 ish players (from the MMO Kit thread, which we have but don’t use. We plan to tease out its chat server).

Improbable has stated that their pricing will permit FTP games, but as you said, it remains to be seen whether it will actually be affordable for a niche online game.

Only a 100 ish players? Even when you disable physics calculations on the server (which other solutions, like SpatialOS, probably also don’t calculate)?