What could cause lag in my 2d online game? It using sockets and graphics2d. Graphics2d is in JPanel. It everytime repaints all clients after one client changes his coordinates. So if i run server and client on my computer i have no lag while moving, but if my friend connects from another computer and he moves, i see him lagging, and myself not, also my friend sees us both lagging.