Files
panda3d/samples/networking/03-distributed-node/ServerRepository.py
Fireclaw 3d8f824081 Add Distributed Network samples
1: Simple client-server connection
2: Client-server connection with timeManager
3: Create distributed objects, sending and receiving messages
4: Distributed model file
5: Simple text chat
6: Simple smooth moving actor
2021-10-28 09:54:17 +02:00

21 lines
795 B
Python

# all imports needed by the server
from direct.distributed.ServerRepository import ServerRepository
from panda3d.core import ConfigVariableInt
# the main server class
class GameServerRepository(ServerRepository):
"""The server repository class"""
def __init__(self):
"""initialise the server class"""
# get the port number from the configuration file
# if it doesn't exist, we use 4400 as the default
tcpPort = ConfigVariableInt('server-port', 4400).getValue()
# list of all needed .dc files
dcFileNames = ['../direct.dc', 'sample.dc']
# initialise a threaded server on this machine with
# the port number and the dc filenames
ServerRepository.__init__(self, tcpPort, dcFileNames=dcFileNames, threadedNet=True)