Using TCP and UDP at same time in game?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

User avatar
Zenith
Posts: 55
Joined: 09 Oct 2017, 09:57

Using TCP and UDP at same time in game?

Postby Zenith » 24 Jan 2018, 14:07

Hi,

My game is quite heavy as all calculations are done on server and for a 1v1 match I need to push updates of full game state to both players every 1 second.

This game state involves moving of lots of units from one pos to other. I want to send it by UDP.

Also I have other updates like units getting killed and new units being spawned , which needs to be sent by TCP.

1. Can I be able to use both TCP and UDP and get better performance. Currently everything is TCP.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Using TCP and UDP at same time in game?

Postby Lapo » 24 Jan 2018, 14:28

Yes, you can use UDP for all unreliable messages and limit TCP to only those messages that must have guaranteed delivery.
It's a common approach used in many games.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Zenith
Posts: 55
Joined: 09 Oct 2017, 09:57

Re: Using TCP and UDP at same time in game?

Postby Zenith » 24 Jan 2018, 16:06

Lapo wrote:Yes, you can use UDP for all unreliable messages and limit TCP to only those messages that must have guaranteed delivery.
It's a common approach used in many games.

Cheers


Any way how to achieve it?
Can I know what part has relevant documentation?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Using TCP and UDP at same time in game?

Postby Lapo » 25 Jan 2018, 14:40

Hi,
by default all messages SFS2X sends are sent via TCP.
You can override the transport (TCP vs UDP) in your Extension calls.

Here's the relevant doc:
http://docs2x.smartfoxserver.com/Advanc ... p-protocol

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 65 guests