Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Network system for 1v1 game  (Read 3074 times)

0 Members and 1 Guest are viewing this topic.

MrOnlineCoder

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Network system for 1v1 game
« on: February 18, 2017, 10:53:15 am »
Hello. I am making a game with multiplayer over network support. There are 2 players with: position, rotation and shooting moment. My questions are:
1.What should I choose: TCP or UDP?
2.Should I do client-server or peer-to-peer communication?
3.What server should do (checking shooting intersection, end of game)?
Regards,
MrOnlineCoder

Turbine

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Network system for 1v1 game
« Reply #1 on: February 18, 2017, 06:14:16 pm »
TCP, client-server. As UDP would require both people to be port forwarded, not just the server. Unless you manage a UDP hole punch.

BroManSalaam

  • Guest
Re: Network system for 1v1 game
« Reply #2 on: February 20, 2017, 02:18:15 am »
1. I would suggest using UDP because you usually don't need all of the checks and reliability that TCP guarantees, which makes your game and network go faster.

2. having a server would provide better security and stability between the two players. You would need to have the two players connected to the server remember. One player in the game could not be the server because your actions would occur instantly, because it would take time for you to send the info to the other player and back.

3. Yes, *the server should make the decisions in the game* and then send that info to the players. This helps prevent cheaters.

Here's a link to a great quick beginners tutorial on these subjects

http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/IntroductionToMultiplayerGameProgramming