Announcement

Collapse
No announcement yet.

[Fix Incoming] Seriously damaging change to Online Subsystems in 4.20

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    #31
    Stephen Ellis You're in luck.

    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:
    Code:
    virtual FName GetType() const override
    {
        return TEXT("UWorks");
    }
    It wasn't even a pure virtual function. There wasn't any indication whatsoever to make me check this. I found this mostly by mistake. Really ****ing smooth change by the Epic guys.

    Comment


      #32
      vlad.serbanescu11

      Sorry it caused you pain. We always have "reasons". I'll share this one.

      It was a mistake made by an integration engineer moving code from one branch to another and it was the path of least resistance "temporarily" to keep multiple projects working that didn't have all the code for FUniqueNetId and so were failing to compile "can't instantiate abstract class". So it was set non virtual and forgotten about.

      Apologies. It was never an intentional design decision. Lots going on around here

      Comment


        #33
        Yeah, the silent failures really bit me, I'd much rather be forced to change my code so that it works.

        Unfortunately as noted this doesn't work at all as it is. The tests are not testing the real usage of it.

        The problem is that FUniqueNetIdRepl::MakeReplicationData is using FMemoryWriter, and FUniqueNetIdRepl::NetSerialize is using FBitReader.

        When writing the Type with FMemoryWriter it goes down this path:

        Code:
        virtual FArchive& FMemoryArchive::operator<<( class FName& N ) override
        Which basically does:
        Code:
        FString StringName = N.ToString();
        *this << StringName;
        When reading with FBitReader it goes down:

        Code:
        virtual FArchive& FNetBitReader::operator<<( class FName& N ) override
        Which basically does:
        Code:
        uint8 bHardcoded = InName.GetComparisonIndex() <= MAX_NETWORKED_HARDCODED_NAME;
        Ar.SerializeBits(&bHardcoded, 1);
        if (bHardcoded)
        {
              // send by hardcoded index
              checkSlow(InName.GetNumber() <= 0); // hardcoded names should never have a Number
              uint32 NameIndex = uint32(InName.GetComparisonIndex());
              Ar.SerializeInt(NameIndex, MAX_NETWORKED_HARDCODED_NAME + 1);
        }
        else
        {
             // send by string
             FString OutString = InName.GetPlainNameString();
             int32 OutNumber = InName.GetNumber();
             Ar << OutString << OutNumber;
        }
        Which causes all kinds of problems...

        Comment


          #34
          That path has been fixed in 4.21 ^

          Comment

          Working...
          X