Jump to content

  • Log In with Google      Sign In   
  • Create Account


lerno

Member Since 10 May 2004
Offline Last Active Oct 13 2013 08:22 AM
-----

#5081009 UDP protocol to minimize latency?

Posted by lerno on 27 July 2013 - 02:16 PM

This is sort of a follow-up to this question: http://www.gamedev.net/topic/645872-responsive-mobile-multiplayer-udp-or-tcp/

 

Experimental results

 

After a lot of testing I managed to determine that the bad 3G latency times I initially got for UDP on my phone was due to the phone saving power.

 

In particular, I was seeing roundtrips of 2000 ms for UDP over 3G when sending 1 message every 2 seconds. When I instead sent a new message within 50 ms of receiving the return message, that number would dive to a steady 80 ms, with occasional hiccups of 400 ms.

 

TCP got around 120-200 ms with the same setup, but when it encountered packet loss, the roundtrip would hit 2000-4000 ms!

 

This verifies that there are indeed serious stuttering with TCP that would be extremely hard to cover with animations.

 

Looking for a good reliable UDP protocol

 

I've been looking at various existing libraries. Most of them are way too high level - I prefer to write all the serialization myself thank you.

 

But even for products like ENet, it looks like the strategy is to push a TCP-like reliable layer on top of UDP and I don't think I want that.

 

What about something like thie?

 

I remember reading about one of those early Lucasart space combat games (X-wing vs Tie-fighter?), that they used an extremely simple scheme - basically sending the packet n together with packet n + 1, so that only on two consequent packet losses would there actually be a packet loss.

 

Our particular game doesn't have much action. In fact, as I've described in the other posting, it's about 80 packets sent per player total.

 

In order to keep the phone awake though, one would have to send pings, and send pings often.

 

Assuming we send pings every 100 ms we could imagine simply piggy bagging un-ack:ed messages until they're acked, it could look something like this:

 

1. Client sends action request with message n

2. Client sends ping with message n + 1, and adds message n

3. Client sends ping with message n + 2, and adds ping n + 1, message n

4. Client receives pong from server, ack-ing up to n + 1

5. Client sends ping with message n + 3, and adds ping n + 2

 

etc.

 

We could then prune old pings from the resends, so we only send resend actions, and vice versa for the server obviously.

 

This looks like it could be much faster in recovering from latency than any resend mechanism that relies on requesting missing packets, like TCP does.

 

The biggest worry I have is that I'd move from TCP with very conservative bandwidth-requirements to something which constantly bombards the server with packets.




#4959947 The case against non-topdown strategy games?

Posted by lerno on 17 July 2012 - 04:12 AM

I was thinking of having a novel perspective for the world map in our upcoming strategy/MMO, with the perspective ending up very close to this:

1033224423-00.gif

From prototyping, the tiles would end up twice as wide as they were high. Then I read this article which mentioned Civ 4 opting for a 3D top-down style map because the isometric map of Civ 2 was considered more difficult for the user to determine distances.

I realized the same problem would apply to our game if we stuck to this perspective.

Now question is: how serious is this problem? I expect the current perspective will be more atmospheric, but if it's too hard to understand we should scrap it as soon as possible. Has anyone done a more thorough analysis of this? Perhaps someone could guide me to some other articles?

Is top down the best (and only) choice here?


PARTNERS