* * *

Author Topic: Good protocol for communication in the game?  (Read 418 times)

kmk68

  • Newbie
  • Posts: 2
Good protocol for communication in the game?
« on: November 06, 2017, 11:17:20 am »
400/5000
... and one more question:

I have a FPC game server. Console program. View and communication
with server only from external program. Many queries about the answer
the size of several hundred bytes. Transmitted data of the type of the condition
and the state of the objects.

What protocol to use? Right now I'm using Synapse and websocket. It works,
But I do not know what the performance is ... are there better methods?

Best regards,
Kajetan

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 648
    • Burdjia
Re: Good protocol for communication in the game?
« Reply #1 on: November 06, 2017, 12:37:22 pm »
There's no "game network protocol".  I mean, it depends on the game.  It is not the same for action games, simulation, turn based strategy...  Each one has different needs.

If the one you're using works, then work on it.  You can trace the net traffic and see if there are parts that can be optimized, specially the most common messages.

Also a "prediction algorithm" will help a lot to speed up things as it allows to reduce the frequency and number of messages needed.

Also, if you're interested on games, then you should join the Pascal Game Development community.

Leledumbo

  • Hero Member
  • *****
  • Posts: 7718
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Good protocol for communication in the game?
« Reply #2 on: November 06, 2017, 03:55:31 pm »
Real time games usually use UDP, because it doesn't matter if you miss a status update that can be updated in the next millisecond. Compression may also add benefit if your data size is somewhat "big", you need to experiment to decide whether this applies to you or not.

User137

  • Hero Member
  • *****
  • Posts: 1732
    • Nxpascal home
Re: Good protocol for communication in the game?
« Reply #3 on: November 07, 2017, 03:06:51 pm »
Many queries about the answer
the size of several hundred bytes. Transmitted data of the type of the condition
and the state of the objects.
That is still small packet, but i hope you are using packed records? Should also optimize int types for fitting size.

Depends on the game you are making, but default way should be TCP. Packet loss can be a real nuisance to deal with if using UDP. The TCP protocol should do what you don't need to do then, keeping backup of packets in memory to resend them. You can also use 2 ports simultaneously; 1 for TCP for the structurally critical data such as text messages or events and fast data with UDP. And that is also why your protocol implementation should be threaded from beginning.
« Last Edit: November 07, 2017, 03:08:29 pm by User137 »

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus