Hey Guys,
What are the current ways to work with an other server? Lets say I want to send a global announcement on all servers or print that player X joined server 1 in server 2.
MySQL with Delay every X seconds or even socket?
Connection between multiple servers
Re: Connection between multiple servers
Socket would be the way to go.
I'm currently working on a CCP - Custom Communication Port custom package. It will be the main dependency for MOTDPlayer package, but it suits your case perfectly.
With it, you would be able to do something like this (code on server #2):
API for external apps (those who are connecting to the SRCDS - including other SRCDS's, too) has yet to be designed.
Either wait for CCP or make something with sockets on your own - for the sake of simply sending an announcement across servers, it should be not that difficult.
I'm currently working on a CCP - Custom Communication Port custom package. It will be the main dependency for MOTDPlayer package, but it suits your case perfectly.
With it, you would be able to do something like this (code on server #2):
Syntax: Select all
import json
from messages import SayText2
from ccp import RequestBasedCommunicator
@RequestBasedCommunicator('my_plugin')
def my_plugin_communicator(data):
dict_ = json.loads(data)
if dict_['action'] == "ANNOUNCE_NEW_PLAYER"
SayText2(
"Player {} has joined Server 1".format(dict_['player'])).send()
return "OK"
return "ERROR"
API for external apps (those who are connecting to the SRCDS - including other SRCDS's, too) has yet to be designed.
Either wait for CCP or make something with sockets on your own - for the sake of simply sending an announcement across servers, it should be not that difficult.

My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.

Re: Connection between multiple servers
You could use a database, but that isn't optimal and not what a database is designed for.
Peer to peer also isn't optimal, because every server will have to keep a connection open to every other server, which is wasteful.
Best thing to do would be to have a centralized server to which all your servers connect & to design your own protocol to communicate between game server and your central server. One of the most useful advantages over using a plain db is that you can shove heavy calculations or i/o bound operations to this server, keeping your game server lag-free. Another advantage is that you also tighten the gaping security hole an open database connection on the game server is (for larger communities especially).
I like to use websockets and then communicate using JSON encoded strings, JSON & websockets (especially with modern libraries) take a lot of low-level work out of regular sockets and are supported virtually everywhere.
Personally I have this implemented using Django + Daphne on a web server and websocket-client with SourcePython on the game server.
Peer to peer also isn't optimal, because every server will have to keep a connection open to every other server, which is wasteful.
Best thing to do would be to have a centralized server to which all your servers connect & to design your own protocol to communicate between game server and your central server. One of the most useful advantages over using a plain db is that you can shove heavy calculations or i/o bound operations to this server, keeping your game server lag-free. Another advantage is that you also tighten the gaping security hole an open database connection on the game server is (for larger communities especially).
I like to use websockets and then communicate using JSON encoded strings, JSON & websockets (especially with modern libraries) take a lot of low-level work out of regular sockets and are supported virtually everywhere.
Personally I have this implemented using Django + Daphne on a web server and websocket-client with SourcePython on the game server.
Re: Connection between multiple servers
Thank you for your responses, but im personally waiting for @iPlayer to finish CCP which sounds very interesting.
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 47 guests