Thread: That random data inside a packet

Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1 That random data inside a packet 
    Registered Member
    Join Date
    Dec 2013
    Posts
    419
    Thanks given
    127
    Thanks received
    85
    Rep Power
    349
    Hey guys,

    I haven't posted anything useful in a while (this thread is probably useless too) but I thought I'd answer a question that a lot of people might not already know!

    Take the following example packet:

    Code:
    out.write(opcode)
    out.write(0)
    out.write(player.x)
    out.write(player.y)
    out.write(0)
    out.write(0)
    out.write(someclass.var)

    Notice the random 0's in that packet? In the client, these can sometimes be random values that we think make no sense. That's because they do not make sense and are called Reserved Data (my theory anyway, I've seen it done before).

    Reserved data are like placeholders. It allows the client developers to send additional data without having to modify the structure of the packet and for easy coding on the server end.
    We have seen this already, just try comparing an old client with a newer one, you might see that what was a random var suddenly has a meaningful value to it! (a good example is the login protocol, I think...)

    Now on the server side, we can stop identifying unknown packets as:

    Code:
    int idfkwhatthis = in.read();
    And instead, give it a more meaningful name such as:

    Code:
    int clientReservedPacketData = in.read();
    Another thing about packets and their data that people don't know about is endians and reading data using bitshifts etc.

    For those who don't know what an endian is, read: https://en.wikipedia.org/wiki/Endianness - it will explain it better than I will

    Also on that topic, you might see packets that look like this:

    Code:
    out.write(opcode)
    out.write(player.x >> 8 | y) // or some bs like this
    This is used for compression over a network. Instead of sending 2 bytes/ints/whatever you can just send the 1 type which is quicker and uses less data (meaning a much faster upload/download!).

    Hope this made sense to you guys
    Reply With Quote  
     

  2. #2  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Holy fuck that bitshift explanation
    Reply With Quote  
     

  3. Thankful users:


  4. #3  
    Registered Member
    Join Date
    Dec 2013
    Posts
    419
    Thanks given
    127
    Thanks received
    85
    Rep Power
    349
    Quote Originally Posted by Jason View Post
    Holy fuck that bitshift explanation
    It's just one reason it's used.
    Reply With Quote  
     

  5. #4  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    I really don't think RS sends random bytes/values. They all have a purpose. At least all of the variables in the packets I've identified have seemed to have one purpose or another, it may not be that obvious but there's an explanation behind everything.


    Everything except OSRS player updating.
    Attached image
    Reply With Quote  
     

  6. #5  
    pride, love, happiness
    .alycia's Avatar
    Join Date
    Jun 2010
    Age
    28
    Posts
    4,106
    Thanks given
    1,714
    Thanks received
    2,062
    Rep Power
    5000
    Quote Originally Posted by Kris View Post
    I really don't think RS sends random bytes/values. They all have a purpose. At least all of the variables in the packets I've identified have seemed to have one purpose or another, it may not be that obvious but there's an explanation behind everything.


    Everything except OSRS player updating.
    OSRS player updating is similar to RS3's in that its more efficient and uses less client memory (AFAIK)
    Reply With Quote  
     

  7. #6  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Quote Originally Posted by chaflie View Post
    OSRS player updating is similar to RS3's in that its more efficient and uses less client memory (AFAIK)
    It's not what I meant. While they did update to RS3, they've also done some changes to it. Nothing in player updating is regional anymore, all locations and whatnot are sent as full locations, bitpacked. However after doing all these changes, they never cleaned their code up. For starters, on login, OSRS currently sends 4605 (+6 bits) bytes of nothing but plain zeroes. This is just the start though, there are more similar examples within the updating itself, however none as significant as this latter.
    Attached image
    Reply With Quote  
     

  8. Thankful user:


  9. #7  
    pride, love, happiness
    .alycia's Avatar
    Join Date
    Jun 2010
    Age
    28
    Posts
    4,106
    Thanks given
    1,714
    Thanks received
    2,062
    Rep Power
    5000
    Quote Originally Posted by Kris View Post
    It's not what I meant. While they did update to RS3, they've also done some changes to it. Nothing in player updating is regional anymore, all locations and whatnot are sent as full locations, bitpacked. However after doing all these changes, they never cleaned their code up. For starters, on login, OSRS currently sends 4605 (+6 bits) bytes of nothing but plain zeroes. This is just the start though, there are more similar examples within the updating itself, however none as significant as this latter.
    "requires engine work"

    Thanks for the information, all I knew was they tried to change it to be more efficient
    Reply With Quote  
     

  10. #8  
    Zaros Developer

    Nomac's Avatar
    Join Date
    Feb 2011
    Age
    29
    Posts
    1,068
    Thanks given
    318
    Thanks received
    200
    Rep Power
    1092
    Quote Originally Posted by Kiissmyswagb View Post
    It's just one reason it's used.
    You do realize no packet is over what.. 17 bytes? Aside from player updating and stuff obv. How in the hell is that going to impact network speed. That isn't a reason at all, it's called hashing.
    Attached image


    Reply With Quote  
     

  11. Thankful user:


  12. #9  
    Registered Member
    hc747's Avatar
    Join Date
    Dec 2013
    Age
    26
    Posts
    1,474
    Thanks given
    3,312
    Thanks received
    691
    Rep Power
    1098
    Quote Originally Posted by Nomac View Post
    You do realize no packet is over what.. 17 bytes? Aside from player updating and stuff obv. How in the hell is that going to impact network speed. That isn't a reason at all, it's called hashing.
    No, it's called multiplexing, lol.
    Reply With Quote  
     

  13. #10  
    Zaros Developer

    Nomac's Avatar
    Join Date
    Feb 2011
    Age
    29
    Posts
    1,068
    Thanks given
    318
    Thanks received
    200
    Rep Power
    1092
    Quote Originally Posted by hc747 View Post
    No, it's called multiplexing, lol.
    It's the same damn thing in sense.
    Attached image


    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Why is it that 667 data is rare, unlike 602 data?
    By Zakawer2 in forum RS2 Client
    Replies: 28
    Last Post: 03-11-2016, 07:35 PM
  2. Replies: 0
    Last Post: 01-25-2013, 05:40 PM
  3. Replies: 3
    Last Post: 06-17-2009, 01:02 PM
  4. Some 525 MapData and a packet data dump
    By ZachHaley in forum Downloads
    Replies: 2
    Last Post: 01-12-2009, 01:08 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •