ThePixelPony
ThePixelPony

Reputation: 741

Should small games use UDP or TCP if only a few packets are critical?

In a small game, which I am working on, most packets are not critical, but a few are.

Assuming that there are 30 packets sent every second (in total to 20 players from the server) and only 1 or 2 critical packets every few minutes, is it worth implementing a custom response system that sends acknowledgements of critical packets only, one of which is 1024 bytes, or is it better to just use TCP for everything for a smoother game overall?

The TCP structure.

The UDP structure.

The first image shows the structure of a TCP packet, whilst the second shows the structure of a UDP packet.

Upvotes: 0

Views: 417

Answers (1)

Nachiket Kate
Nachiket Kate

Reputation: 8571

According to me,

First of all know what TCP offers over UDP

  1. Flow control
  2. Order
  3. Security and Reliability i.e. established connection

If above things are not important or doesnt matter for you (If you are handling these in your code) then use udp else tcp is best option.

You will get very less performance/network improvement with UDP in small scale usage. TCP is always better.

Upvotes: 3

Related Questions