I am trying to make an RTS game. I am using a UDP peer to peer network. I have made the logging in process and all works well. The problem is my game only runs at about 2 frames per second if i am lucky. Now i get 60 fps single player so I know it is the networking that is slowing it down.
I would post the code but it is quite big and hard to understand. So i will explain the process that it uses in the hope that someone could suggest a better way.
Basically the only information that is transmitted is the positions of the clicks and a few other variables. a buffer 105 in length. Now this info has to be swapped between players once per turn/cycle.
The network part works as follows. Each player has one thread to receive on and does the sending from the main game loop. When it is time to swap data each player sits in a loop, whilst in the loop they send requests to each other player, if a player receives a request they send a reply to the person that game them the reply. Both requests and replies contain all the game data to be transferred. Once a player has replies from all the other players they proceed one turn. If a player receives a request from a player 1 turn ahead they will proceed one turn if they have all the data.
I suspect the problem may be to do with players spamming out request too fast but am not sure. All the messages are getting through.
If someone could explain the proper way of doing this I would be very grateful.
Thanks in advance for any help and sorry for the long question.
And if anyone has any simple questions then feel free to ask hear as I will be checking back and can help with the easy stuff.
<-- Great game