#base.setSleep(1 / base.config.GetFloat('server-ticks', 30)) from p3recastnavigation import RNNavMeshManager nmMgr = RNNavMeshManager.get_global_ptr() nmMgr.set_root_node_path(render) nmMgr.get_reference_node_path().reparentTo(render) nmMgr.start_default_update() nmMgr.get_reference_node_path_debug().reparentTo(render) base.nmMgr = nmMgr from direct.distributed.ClockDelta import globalClockDelta __builtins__.globalClockDelta = globalClockDelta from src.coginvasion.ai.CogInvasionAIRepository import CogInvasionAIRepository as CIAIR base.air = CIAIR(config.GetInt('air-base-channel', 401000000), config.GetInt('air-stateserver', 10000))\ # We deal with attacks on the server side as well from src.coginvasion.attack.AttackManagerAI import AttackManagerAI base.air.attackMgr = AttackManagerAI() host = args.astron_ip port = 7033 if ':' in host: host, port = args.astron_ip.split(':', 1) port = int(port) base.air.connect(host, port) try: base.run() except SystemExit: raise
def __aiWaitForPlayer(task): if ModGlobals.LocalAvatarID in base.air.doId2do.keys(): print("Player generated on server") makeBattle() return task.done return task.cont taskMgr.add(__aiWaitForPlayer, "aiWaitForPlayer") def __handleAIConnected(): base.air.sendAIHello() base.acceptOnce('createReady', __handleAIReady) from src.mod.distributed.ModAIRepository import ModAIRepository base.air = ModAIRepository(ModGlobals.DCFileNames, 'AI') base.air.connect(['http://127.0.0.1:7032'], __handleAIConnected) # ================================================================================= import time sv_min_frametime = ConfigVariableDouble("sv_min_frametime", 1 / 120.0).getValue() while True: try: #frameStart = globalClock.getRealTime() base.taskMgr.step() #frameEnd = globalClock.getRealTime() #secElapsed = (frameEnd - frameStart) # How many seconds do we have to sleep?
base.setSleep(0.01) if ':' in args.astron_ip: hostname, tcpPort = args.astron_ip.split(':') else: hostname = args.astron_ip tcpPort = 7190 self.acceptOnce('airConnected', self.connectSuccess) self.connect(hostname, int(tcpPort)) def connectSuccess(self): """ Successfully connected to the Message Director. Now to generate the LoginManager """ print('Connected Successfully!') # Generate our 'dummy' object... rootObj = RootObjectUD(self) rootObj.generateWithRequiredAndId(self.GameGlobalsId, 0, 0) # Claim this object's ownership... self.setAI(self.GameGlobalsId, self.baseChannel) # And then generate the LoginManager itself. loginManager = LoginManagerUD(self) loginManager = self.generateGlobalObject(LOGIN_MANAGER_DO_ID, 'LoginManager') base = ShowBase() base.air = RalphUDRepostiory(args) base.run()
localconfig += 'air-stateserver %s\n' % args.stateserver if args.astron_ip: localconfig += 'air-connect %s\n' % args.astron_ip if args.eventlogger_ip: localconfig += 'eventlog-host %s\n' % args.eventlogger_ip loadPrcFileData('Command-line', localconfig) class game: name = 'coginvasion' process = 'server' __builtins__.game = game from panda3d.core import * loadPrcFileData('', 'window-type none') loadPrcFileData('', 'audio-library-name none') from direct.showbase.ShowBase import ShowBase base = ShowBase() base.setSleep(0.04) from lib.coginvasion.ai.CogInvasionAIRepository import CogInvasionAIRepository as CIAIR base.air = CIAIR(config.GetInt('air-base-channel', 401000000), config.GetInt('air-stateserver', 10000)) host = args.astron_ip port = 7033 if ':' in host: host, port = args.astron_ip.split(':', 1) port = int(port) base.air.connect(host, port) try: base.run() except SystemExit: raise
# Allow some time for other processes. base.setSleep(0.01) if ':' in args.astron_ip: hostname, tcpPort = args.astron_ip.split(':') else: hostname = args.astron_ip tcpPort = 7190 self.acceptOnce('airConnected', self.connectSuccess) self.connect(hostname, int(tcpPort)) def connectSuccess(self): """ Successfully connected to the Message Director. Now to generate our World! """ print 'Connected Successfully!' self.world = WorldAI(self) self.world.setName(self.worldName) self.world.generateWithRequiredAndId(self.districtId, self.GameGlobalsId, ZONE_ID_WORLDS) self.setAI(self.districtId, self.baseChannel) self.timeManager = TimeManagerAI(self) self.timeManager.generateWithRequired(ZONE_ID_MANAGERS) def getAvatarIdFromSender(self): return self.getMsgSender() & 0xFFFFFFFFL base = ShowBase() base.air = RalphAIRepository(args) base.run()
# Allow some time for other processes. base.setSleep(0.01) if ':' in args.astron_ip: hostname, tcpPort = args.astron_ip.split(':') else: hostname = args.astron_ip tcpPort = 7190 self.acceptOnce('airConnected', self.connectSuccess) self.connect(hostname, int(tcpPort)) def connectSuccess(self): """ Successfully connected to the Message Director. Now to generate the LoginManager """ print 'Connected Successfully!' # Generate our 'dummy' object... rootObj = RootObjectUD(self) rootObj.generateWithRequiredAndId(self.GameGlobalsId, 0, 0) # Claim this object's ownership... self.setAI(self.GameGlobalsId, self.baseChannel) # And then generate the LoginManager itself. loginManager = LoginManagerUD(self) loginManager = self.generateGlobalObject(LOGIN_MANAGER_DO_ID, 'LoginManager') base = ShowBase() base.air = RalphUDRepostiory(args) base.run()