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"

TypeHash invalid with a custom online subsystem

Since version 4.20, the client/server projects are returning

LogNet: Warning: Error with encoded type hash

I have a custom Online subsystem

 class ONLINESUBSYSTEMKADEO_API FOnlineSubsystemKadeo :
     public FOnlineSubsystemNull

The problem is that we cannot provide a hash type with the subsystem "Kadeo"

In NetSerialize function

 bool FUniqueNetIdRepl::NetSerialize(FArchive& Ar, UPackageMap* Map, bool& bOutSuccess)
                     uint8 TypeHash = GetTypeHashFromEncoding(EncodingFlags);
                     if (TypeHash == 0)
                         // If no type was encoded, assume default
                         TypeHash = UOnlineEngineInterface::Get()->GetReplicationHashForSubsystem(UOnlineEngineInterface::Get()->GetDefaultOnlineSubsystemName());

With custom online subsystem, it return 0 since the subsystem cannot be registered in FOnlineSubsystemUtils in the private function CreateNameHashes()

     void CreateNameHashes()
         int32 HashId = 1;
 #define CREATE_HASH(MacroName) \
 { \
  uint8 Hash = static_cast<uint8>(HashId); \
  SubsystemNameToHash.Add(MacroName, Hash); \
  HashToSubsystemName.Add(Hash, MacroName); \
  HashId++; \
         // Shouldn't need these as they are mocking interfaces for existing platforms

         ensure(SubsystemNameToHash.Num() == (HashId - 1));
         ensure(HashToSubsystemName.Num() == (HashId - 1));

How can I register my own online subsystem ?

Product Version: UE 4.20
more ▼

asked Aug 07 '18 at 08:16 AM in C++ Programming

avatar image

714 49 56 128

avatar image vlad.serbanescu11 Aug 20 '18 at 08:10 PM

I'm having the same issue. This is a common sense "feature".

By hard-coding this, the programmer responsible essentially created a circular dependency between the subsystem utilities and the subsystems themselves. 0/10 wouldn't even consider hiring them.

avatar image BlackFangTech Aug 21 '18 at 12:22 PM

Absolutely terrible work by whoever did this at Epic. Really hope this will be fixed in 4.21, or better yet, the next patch for 4.20.

avatar image Pantong51 Aug 21 '18 at 01:46 PM

Noticed this as well. Has there been any update?

avatar image Darkkitten Aug 21 '18 at 03:28 PM

For the love of pete please fix this ASAP..

avatar image mightyenigma Aug 22 '18 at 08:21 PM

Has anyone filled out a Bug Report about this yet?

avatar image domzorg Aug 23 '18 at 10:48 AM

I did not filled any bug reports for this.
I stay in 4.19.2 version ;-)

avatar image vlad.serbanescu11 Nov 22 '18 at 11:06 AM

For anyone reading this, I found the problem and posted it in the thread and I'll paste the text below as well.

Found the fix for the hash issue. Instead of adding a hash, given the "fix" implemented by Epic in 4.20.3, we now need to override the following function in FUniqueNetIdUWorks, inherited from FUniqueNetId:

 virtual FName GetType() const override
     return TEXT("UWorks");

It wasn't even a pure virtual method. There wasn't any indication whatsoever to make me check this. I found this mostly by mistake.

avatar image LDOGLONDON Nov 30 '18 at 05:56 PM

So I've done what vlad.serbanescu11 has suggested and when the server is getting the hash for the subsystem. It's still only checking the official 20 subsystems.

note: I am not deriving from any of the official subsystems, but mine is basically just a copy of the steam subsystem. Also I created my own OnlineSusbytemNames.h called OnlineSubsystemCustomNames.h which includes OnlineSusbytemNames.h and defines my custom OSS. So I've already done the GetType() thing, it seems like I need to hash my OSS name and add it to SubsystemNameToHash but I have no idea how to do that. Has anybody solved this?

avatar image LDOGLONDON Nov 30 '18 at 06:47 PM

I just realized I'm on 4.20.2 so maybe that's the problem

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort oldest

Apologies for breaking your custom online subsystem implementations.   Two features that improved UniqueId overall came together to break the code in question.

1) UniqueId compression - up until now, in the interest of simplicity, we were simplify passing a string across the network.  This was grossly inefficient, but for small player counts it wasn't on our radar.   For Epic's unique id scheme, a guid, it was 43 bytes to replicate.   We found that we could pack this into nibbles and save a ton of space.  The code now serializes at 18 bytes, which is significant savings in FNBR where we replicate 100 user ids to everyone (10k replications x 43 bytes). Additionally for cross play we replicate other platform unique ids (10k x 64bit number in string format).  These weren't as big a savings, but since they were straight up integers, we could pack them the same way.

2) UniqueId type - again for crossplay, we needed to better understand what type of UniqueId we were dealing with without having to cross reference other systems.   Replicating the type without losing savings from 1 is the reason for the "hash/index" value that is causing you trouble.  5 bits of the packet were used to have room for 32 online subsystems.  Of course this means we need to know ahead of time all the values.   This is clearly not conducive to custom implementations.

We are going to fix this.    We will use one of the bits to signify a custom Online Subsystem, and pack the name of your system into the packet.  We thought about some way to deterministically register all known online subsystems, but this won't work given that not all will register in all scenarios (not all platforms register all subsystems).   The simplest thing to do is sacrifice a little bit of the compression savings for simplicity and convenience.

We are looking to get an implementation in ASAP and have it available with the one of the next 4.20 hotfix releases.

Apologies for the delay in a response, we do not often get a lot of visibility into specific forum issues.   I hope this addresses the concerns, the online team does care about the pains of other developers.

more ▼

answered Aug 24 '18 at 07:29 PM

avatar image

Crzyhomer STAFF
1.3k 35 26 103

avatar image domzorg Aug 25 '18 at 06:01 AM

thank you.

avatar image Swanton007 Sep 26 '18 at 12:20 AM

Any updates with this? Our project uses Uworks, and we are getting the same TypeHash error on 4.20.3. Is there anything that needs to be done to get custom OSS to work on 4.20.3?

avatar image Vormulac Sep 29 '18 at 03:29 PM

I'm very curious about this too. I'm building a new prototype and my list of TODOs that are precursors to steam integration is shrinking rapidly.

avatar image vlad.serbanescu11 Nov 21 '18 at 06:30 AM

Has anyone actually got the fix from 4.20.3 working? I'm on 4.21 and I can't get any external subsystem to work at all. Same stupid hash issue.

avatar image domzorg Mar 28 '19 at 05:40 PM

Switch to version 4.21.2 and it finally works.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
more ▼

answered Aug 24 '18 at 12:40 PM

avatar image

820 60 97 140

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Thank you for taking the time to write the detailed explanation and looking into fixing this! Now it makes sense.

more ▼

answered Aug 24 '18 at 09:06 PM

avatar image

14 2 5 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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