x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Unrecognized type 'FSocket'

Hello everyone, looks like I need your help once again =)

I'm not really sure if I'm doing thing in the right way, so here is what I'm trying to achieve;

I'm making an online game, where users must login first, so I'll be abe to show em their statistics, bought items and so on. For this I have made so called "QueryServer" which is working with database, and managing UE4 dedicated serrvers, by launching instances for each game session.

So, simplified "login screen" -> "game session" process looks like so:

  1. 1) User is launched game client

  2. User enter his/her credentials

  3. Game client connecting to the "QueryServer"

  4. If OK, sending credentials to the "QueryServer" (SSL)

  5. The "QueryServer" processes the credentials and generating clientToken

  6. If OK, the "QueryServer" returns the clientToken, info about bought items, characters stats, etc. to the game client

  7. User gets to the next stage, where he sees his character, bought items, etc.

  8. User presses the "Play button

  9. The QueryServer building teams (Actually there is separated "TeamBuilder" server) and launching an UE4 dedicated server instance (actually there is always few more instances than needed)

  10. Users/Clients which will parcipiate in the game session (teams) will get a responce from the QueryServer, which contain information about UE4 dedicated server IP, port, etc.

  11. game starts...

I have wrote some nice code to communicate with the QueryServer, and it's works like a charm. But when broke the code in methods, and added these to my BlueprintLibrary class, the compiler sad this: "Unrecognized type 'FSocket' - type must be a UCLASS, USTRUCT or UENUM". Is there any way to use methods with FSocket* type in blueprints?

If no, what is the best place to define a "Global" variable, in C++ project, so i can store the connection there? I mean a place, so i can define the variable once, and it will be defined until user close the game client...

Thank you for reading :)

Product Version: UE 4.10 Preview
Tags:
more ▼

asked Oct 25 '15 at 01:05 PM in C++ Programming

avatar image

Naivrat
50 8 9 14

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

FSocket is non-UObject class and reflection system does not support those, so you can't use it with UPROPERTY() or UFUNCTION() (only in function arguments and return value, in function you can use anything you want). So either you need to create UObject wrapper for FSocket (USocket?) or or deal with FSocket diffrently just in the way that UHT won't see it.

It's not recommended to use global variables, but in C++ it's very simple, you just dealere one outside the class. UE4 it self got some global variables for main components (like GEngine for main UEngine pointer or GbIsEditor) and as you notice they have "G" prefix in name. you can also use static variables in classes (same as static function), they also work like global variable, if you really need global varable use it this way

more ▼

answered Oct 25 '15 at 04:52 PM

avatar image

Shadowriver
35.2k 921 166 1098

avatar image Naivrat Oct 25 '15 at 05:14 PM

Thank you for the clear answer. Yes, I know, that global variables are evil. Maybe there is another solution, but I was unable to find one.

The thing i'm trying to do is: When game client starts or maybe at GameMode constructor, connect to my QueryServer and store the connection, so i can reuse it at any moment. Sure using reconnect logic. The point, is to create one single connection and reuse it, instead of creating 1 connection per request/response. The problem, is that I cannot find a good place for it :(

avatar image Naivrat Oct 25 '15 at 05:43 PM

Just another question, maybe I should just make new OnlineSubSystemModule? as the blueprints have already "Create Session", "Is Logged In", etc.. Is there some manual for creating custom modules like online sub system?

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question