Can anyone help me clear up my knowledge.
My code to decode the packet header (2022) is as follows
data = sock.recv(1464)
Packet = binascii.hexlify(data).decode()
for x in range(0,len(Packet)//2):
array.append(Packet[x*2:x*2+2])
packetFormat = TC.uint16(array[1]+array[0])
gameMajorVersion = TC.uint8(array[2])
gameMinorVersion = TC.uint8(array[3])
packetVersion = TC.uint8(array[4])
packetId = TC.uint8(array[5])
sessionUID = TC.uint64(array[13]+array[12]+array[11]+array[10]+array[9]+array[8]+array[7]+array[6])
sessionTime = TC.float32(array[17]+array[16]+array[15]+array[14])
frameIdentifier = TC.uint32(array[21]+array[20]+array[19]+array[18])
playerCarIndex = TC.uint8(array[22])
secondaryPlayerCarIndex = TC.uint8(array[23])
print(packetFormat)
print(gameMajorVersion)
print(gameMinorVersion)
print(packetVersion)
print(packetId)
print(sessionUID)
print(sessionTime)
print(frameIdentifier)
print(playerCarIndex)
print(secondaryPlayerCarIndex)
However the way the UDP specification is laid out makes me think that there is a better, more compact and easier way to lay it out.
If no one minds can you show me how I could be doing the packet header, using the lay out straight from the specification. I wont be changing my 2022 version as it works fine, but it will help me make my 2023 version be cleaner.
Edit:
I have looked myself but I cannot seem to find anything that works.