Jump to content

Help! Massive lag with Object Streams / how does big games handle data transfer?

- - - - -

  • Please log in to reply
1 reply to this topic

#1
Master Kenth

Master Kenth

    Newbie

  • Members
  • Pip
  • 4 posts
So I have this 2 player game with a TCP connection between. Then I have an ObjectInputStream/ObjectOutputStream between them to handle data and sends/recieves every 33ms (~30fps). They transfer well but I often change objects, so I get serialization problems. To solve this i reset the outputstream which *works*, but creates a massive delay if I reset the stream every tick. Instead I can reset it every 20 tick or so which removes the latency but creates an seemlingly laggy player on the screen, since it only gets its position each ~0.5s :crying:

So how do I solve this? or rather, how does big games that handle alot of data do (example, CS, LoL etc..)? I only send custom objects with different variables, since every image already exists on both ends.

tl;dr: ObjectOutputStream.reset() with fast tick creates network lag, slow tick creates delay.

#2
Master Kenth

Master Kenth

    Newbie

  • Members
  • Pip
  • 4 posts
nvm solved it. Problems was not resetting the stream, but using the exact same object pointer the same time + synchronization etc.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users