The game im developing is currently is using ServerSocket and Socket to provide the multiplayer. It laggs alot when it's not run localy, so im wondering if I should remake the multiplayer structure to send both through TCP (ServerSocket, Socket) and UDP (DatagramSocket). Currently as mentioned im only using TCP and it's only sending around 60 packets a second (30 recieve and 30 sent) when not ran localy.
Information that is sent between server and client:
Movement, trading, ItemUsage, EnvironmentDetails and more stuff.
So my questions are:
Would it make a huge difference if I both used TCP and UDP instead of only TCP?
If I switched to both TCP and UDP what should I send in each protocol?
Thanks in advance!
Edit:
Client:
Instancing: this.out = new ObjectOutputStream(new BufferedOutputStream(this.requestSocket.getOutputStream()));
this.in = new ObjectInputStream(new BufferedInputStream(this.requestSocket.getInputStream()));
Sending:
this.out.writeObject(temp.toString());
this.out.flush();
Temp is a JSONObject
Server:
Instancing: this.out = new ObjectOutputStream(new BufferedOutputStream(c.getOutputStream()));
this.out.flush();
this.in = new ObjectInputStream(new BufferedInputStream(c.getInputStream()));
Sending: this.out.writeObject(temp.toString());
this.out.flush();
Temp is a JSONObject