The position server accepts IPv4 packets using protocol 254 (experimental). The protocol is designed to be simple and lightweight, allowing real-time position updates for sprite movement.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Magic (0xB0B0) | X Position (first half) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | X Position (second half) | Y Position (first half) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Y Position (second half) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Total size breakdown: Magic: 16 bits (2 bytes) - 0xB0B0 X Position: 32 bits (4 bytes) - little-endian float Y Position: 32 bits (4 bytes) - little-endian float
0xB0B0
echo 'b0b00000c8410000c841' | xxd -r -p | sudo socat - ip-sendto:164.90.208.47:254
python3 -c "from scapy.all import *; send(IP(dst='164.90.208.47',proto=254)/Raw(load=b'\\xB0\\xB0' + struct.pack('<ff', 50.0, 50.0)))"
from scapy.all import *
import struct
import time
def send_position(x, y, dst_ip="164.90.208.47"):
"""Send a position update to the server"""
payload = b'\\xB0\\xB0' + struct.pack('<ff', float(x), float(y))
packet = IP(dst=dst_ip, proto=254)/Raw(load=payload)
send(packet, verbose=0)
print(f"Sent position: x={x}, y={y}")
def move_diagonal():
"""Simple diagonal movement pattern
Moves from (0,0) to (100,100) and back continuously"""
x = 0
while True:
# Move from (0,0) to (100,100) and back
x = (x + 1) % 100
send_position(x, x)
time.sleep(0.05) # 50ms between updates
if __name__ == "__main__":
print("Starting diagonal movement...")
try:
move_diagonal()
except KeyboardInterrupt:
print("\\nStopping movement")
Position update for x=50.0, y=50.0:
B0 B0 00 00 48 42 00 00 48 42
Where:
B0B0
: Magic bytes00004842
: 50.0 in IEEE 754 (little-endian)00004842
: 50.0 in IEEE 754 (little-endian)