I have recently made a 2d game in java and need help with making a network protocol that works. I am currently using DataOutputStream
and DataInputStream
with Socket
s and ServerSocket
. The Joining is working but the communication between the client and the server is not working. The way I want to have it work and the way i have it set up is so the server does the running and updating and the client receives the position info and data and renders the game and sends back control inputs for the player on the server.
Process:
server: starts
client: starts and sends username to the server
server: replies with a UID witch is used to identify the
client and is assigned to the player that is the client
client: sends inputs to server and server receives them
updates the player and sends the data and position info
to the client
client: reconstructs the data to a player and renders it
(repeat last 2 steps)
This is what I have currently for the reading and writing functions
What I am looking for is suggestions of things I could do or Ideas to try. Thanks