Original Post
Here is my architecture design which runs very smoothly when connecting by localhost, but up to 1.5 seconds of lag when going through the internet, I am trying to find out why.
Server Loop:
Process all packets in queue
-Read the packet into a string, each character is a key that is down on the client
If it has been 1/30 seconds since last update
-Update objects (player changes position based on keys down)
-Send XY position of objects to client (in unreliable packet)
Client Loop:
Process all packets in queue
-Read raw XY coordinates into local variables
If it has been 1/30 seconds since last update
-Send a string of all keys down to server (in unreliable packet)
Render Scene
I know its not the most efficient setup, as its just a mock-up version at the moment, but it seems extraordinarily slow considering there is only one object and only one client. Any ideas?
EDIT: I'm using enet by the way
Server Loop:
Process all packets in queue
-Read the packet into a string, each character is a key that is down on the client
If it has been 1/30 seconds since last update
-Update objects (player changes position based on keys down)
-Send XY position of objects to client (in unreliable packet)
Client Loop:
Process all packets in queue
-Read raw XY coordinates into local variables
If it has been 1/30 seconds since last update
-Send a string of all keys down to server (in unreliable packet)
Render Scene
I know its not the most efficient setup, as its just a mock-up version at the moment, but it seems extraordinarily slow considering there is only one object and only one client. Any ideas?
EDIT: I'm using enet by the way