Announcement

Collapse
No announcement yet.

Is "uint32 bValue : 1;" in header file used to specify the number of replicated bits?

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

    Is "uint32 bValue : 1;" in header file used to specify the number of replicated bits?

    I've seen some declarations in header files such as such these as in GameMode.h:

    PHP Code:
    UPROPERTY()
    uint32 bUseSeamlessTravel 1;

    UPROPERTY()
    uint32 bPauseable 1;

    UPROPERTY()
    uint32 bStartPlayersAsSpectators 1
    Notice the : 1. I noticed that the : 1 is only used for boolean values so I think its related to the number of relevant bits. Does anyone know if this is used to optimize replication? Is there documentation on this? Thanks.
    Last edited by Zhi Kang Shao; 11-27-2014, 06:29 AM.
    Journeyman's Minimap - Available on Marketplace - Forum topic - Video

    #2
    +1. Saw this same thing in ShooterGame Player Start.

    PHP Code:
    /** Which team can start at this point */
    UPROPERTY(EditInstanceOnlyCategory=Team)
    int32 SpawnTeam;

    /** Whether players can start at this point */
    UPROPERTY(EditInstanceOnlyCategory=Team)
    uint32 bNotForPlayers:1;

    /** Whether bots can start at this point */
    UPROPERTY(EditInstanceOnlyCategory=Team)
    uint32 bNotForBots:1
    Support my RTS Game (Agora) on Patreon!
    Unreal Nexus - Create Share and Experience!
    Unreal Engine 4 World-Wide User Map

    [PLUGIN] Aws Gamelift Client Plugin
    [TOOL] Create your own binary release of UE4 from GitHub source
    My UE4 Tutorials and Misc Tools

    Lead Programmer at YetiTech Studios
    Your Friendly Neighborhood
    Satheesh PV (a.k.a RyanJon2040) | Twitter, Instagram, Facebook, LinkedIn, YouTube, Google+

    Comment


      #3
      That represent bitfield storage. It's a memory optimisation basically specifying to use just one bit to represent the underlying value. Make no mistake, it doesn't mean that just 1 bit of memory will be occupied, rather the data will be shared. In your case you have 3 uint32 so it would be 12 bytes. But since they use bitfields only 4 bytes will be allocated and 3 bits used. check this tutorial for further info http://www.tutorialspoint.com/cprogr...bit_fields.htm

      Comment


        #4
        Originally posted by pinosh View Post
        That represent bitfield storage. It's a memory optimisation basically specifying to use just one bit to represent the underlying value. Make no mistake, it doesn't mean that just 1 bit of memory will be occupied, rather the data will be shared. In your case you have 3 uint32 so it would be 12 bytes. But since they use bitfields only 4 bytes will be allocated and 3 bits used. check this tutorial for further info http://www.tutorialspoint.com/cprogr...bit_fields.htm
        Cool! I didn't know it was such a core feature to C. Thanks for the link.
        Journeyman's Minimap - Available on Marketplace - Forum topic - Video

        Comment

        Working...
        X