Jump to content
  • Advertisement
Sign in to follow this  
brwarner

Multiplayer ENET Runs Extremely Slow

This topic is 3004 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
You really need to tell us more:

- The characteristics of the Internet connections of the computers involved. Alone saying "connected by Internet" doesn't mean much because there are really crappy Internet connections.

- How large is the data you're sending every frame? (I.e. how many bytes?)

In spite of this, I'd spontaneously say: Yes it sounds weird with 1500 ms ping with ENet, but without the above information one cannot be more precise.

Btw, ensure the ENet bandwidth limiter isn't active.

Share this post


Link to post
Share on other sites
Every frame (30 fps) the server sends about 13 bytes to the client while the client sends between 0 and 5 bytes to the server.

By internet (sorry I wasn't specific) I meant that instead of using "localhost" I used by external IP address, so only one computer is involved.

The ping ends up being more like 0.7 seconds, but still really noticeable and unplayable. I deactivated the bandwidth limitations on the client but it still has this delay.

Share this post


Link to post
Share on other sites
Wait nevermind, I'm an idiot....
I wrote microseconds instead of milliseconds so it was actually running at 30 000 frames per second. Fixed and now it runs fine (still needs tuning though).

Thanks anyway

[Edited by - brwarner on July 4, 2010 10:36:57 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!