TCP Friends: making online games

TCP Friends is a software I made some time ago in Game Maker; it allows some players to connect each other to start an online match.

The program is a good starting point to make online games, you can use it as it is (by downloading and editing the GMStudio project).

TCP Friends is not meant to make MMORPG, but only matches for a limited time period. In fact, the software doesn’t rely on a server active 24 hours a day. So the players, to start a game, must somehow exchange their IP addresses. It’s good, for example, for some friends that exchange their IPs through a chat software (hence the name).

If you like, you can extend it. At this time, only TCP sockets are supported.

How it works

  1. A player creates a game. The player will be the number 1. His instance of TCP Friends will take care to coordinate other players during the setup of the match.
  2. The player 1 tells his IP and port to other players, so they can join the game.
  3. The player 1 starts the game.

A unique feature of this software is that there aren’t one server and more clients. Instead, every player is a server for all the players with bigger numbers. In this way, there isn’t a centralised server, but everyone is connected to everyone. The advantage: the ping is halved (because every player can send packets directly to all other players).

To send a message to everyone, you can use the send_broadcast script. To receive messages, you can use the Networking event of the ob_controller object.

Download link

 Download tcpfriends_src