2
0

ServerRepository.py 795 B

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