Announcement

Collapse
No announcement yet.

Byte Vs. Integer

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

    #16
    Originally posted by Simple2012 View Post
    32 bit integer is 4 bytes.
    4 bytes
    if you have a 1 kb line, you can transfer 250 integers per second.
    Let me give you a hint, today none has a 1 kb line.
    http://www.internetsociety.org/map/g...ad-speed-fixed
    https://www.statista.com/statistics/...ed-by-country/

    On 144th place we have "Niger" (I never even heard of em), they have 0.6/0.2 MB
    That is 600000/200000 b/s. i.e. you can download 150000 integers/s or
    Dude, those are averages.
    According to that map, Germany has 28.8 Mb/s. That doesn't mean that everyone has that speed. It means that there's a few people that are at 100Mb/s and a shitload that are at lower speeds.
    Especially in rural areas in Germany, you will generally get a value between 2Mb/s and 16Mb/s.

    You should also consider mobile usage. A throttled mobile phone will have a speed somewhere between 32Kb/s and 386kb/s.
    However, that's only in theory, as the way throttling is done makes the connection useless even when you aren't breaking the speed boundaries, as the provider just makes your connection drop a percentage of your packets. So let's disregard it.
    Even unthrottled, you will hugely impact how the game is played. An LTE connection might be capable of 100Mb/s, but if you actually use the full bandwidth here I can guarantee you that no one will play the game, as the average data limit would be burned through in mere seconds. Even a difference between 512kb/s and 2mb/s will be felt by a player at the end of the month, depending on how long sessions in the game are. Data limits tend to be in a ballpark between 100MB and 10GB currently, at least in countries that have data limits.

    But remember, people aren't just connecting to the internet to play one game. It's nice if your player has a 2Mb/s connection and your game only uses 1.5Mb/s, but what happens if their connection goes unstable for a momentum and drops to 1Mb/s? Or what if their email program is synchronizing in the background and using 0.1Mb/s? And then they add a voice chat program and suddenly you are over the limit.

    It makes quite a difference when your game is, for example, an RTS and uses either 64 B/s or 256 B/s to update the status of a single unit. That's either 512 b/s or 2kb/s.
    Get 1024 units moving and you are suddenly at either 512 kb/s or 2mb/s.
    (I have no idea what the real ballparks are here, so I'm just focusing on the possible size differences of optimized vs unoptimized integers. These numbers feel plausible for multiple ticks per second, though.)

    Comment


      #17
      Originally posted by vb4 View Post
      Dude, those are averages.
      According to that map, Germany has 28.8 Mb/s. That doesn't mean that everyone has that speed. It means that there's a few people that are at 100Mb/s and a shitload that are at lower speeds.
      Especially in rural areas in Germany, you will generally get a value between 2Mb/s and 16Mb/s.

      You should also consider mobile usage. A throttled mobile phone will have a speed somewhere between 32Kb/s and 386kb/s.
      However, that's only in theory, as the way throttling is done makes the connection useless even when you aren't breaking the speed boundaries, as the provider just makes your connection drop a percentage of your packets. So let's disregard it.
      Even unthrottled, you will hugely impact how the game is played. An LTE connection might be capable of 100Mb/s, but if you actually use the full bandwidth here I can guarantee you that no one will play the game, as the average data limit would be burned through in mere seconds. Even a difference between 512kb/s and 2mb/s will be felt by a player at the end of the month, depending on how long sessions in the game are. Data limits tend to be in a ballpark between 100MB and 10GB currently, at least in countries that have data limits.

      But remember, people aren't just connecting to the internet to play one game. It's nice if your player has a 2Mb/s connection and your game only uses 1.5Mb/s, but what happens if their connection goes unstable for a momentum and drops to 1Mb/s? Or what if their email program is synchronizing in the background and using 0.1Mb/s? And then they add a voice chat program and suddenly you are over the limit.

      It makes quite a difference when your game is, for example, an RTS and uses either 64 B/s or 256 B/s to update the status of a single unit. That's either 512 b/s or 2kb/s.
      Get 1024 units moving and you are suddenly at either 512 kb/s or 2mb/s.
      (I have no idea what the real ballparks are here, so I'm just focusing on the possible size differences of optimized vs unoptimized integers. These numbers feel plausible for multiple ticks per second, though.)
      Yes those are averages indeed, the example also shows the 144th place of average internet speeds, then you should also remember, there are more users with lower speeds than users with high speed in those countries.
      I would "almost" agree with you when it comes to mobile games. But I still stick to my reasoning. It is more worth spending time optimising what you send, rather than how you send it. For example, you might not need to send an update of the a persons HP every frame in a mobile game, you could instead of updating the movement every frame, you can increase the movement speed and update it every other frame instead.

      Of course, the way I explained it is very simple and a real implementation is more challenging, but I hope I got my point across.
      In other words, focus on what actually matters instead of on minor details that doesn't have any major impact. Prioritise your time.

      Comment


        #18
        I stumbled upon this old thread. But i think the question is still relevant and the answer may not be obvious for coding beginners:
        Byte is almost certainly slower to process than integer. So if you think about making a property on an actor a byte or a integer, always go with the integer. Only use byte in arrays or structures, were you perform operations on large sets of data. Only in this instance you will actually save memory and also can improve performance by using SIMD instructions.

        For networking you also don't save any bandwidth as you should quantize values befor sending them. So you pack your integer into a byte on network serialization if you know it never exceeds 255.

        If you work in blueprints only, this is all not relevant to you. If you need to optimize for performance or memory usage the first step would be to translate the piece of code, which needs to optimizations to C++ anyway.

        Comment

        Working...
        X