def main(): # Create the game instance gcli = GameClient.GameClient() if PSTAT: from pandac.PandaModules import PStatClient PStatClient.connect() run()
def _pstatsToggle(self): print("HI") if self._pstatProc: # TODO: Fix this. It does not terminate the pstats process. print("Terminating pstats pid=%s"%(self._pstatProc.pid)) PStatClient.disconnect() self._pstatProc.terminate() time.sleep(2) #self._pstatProc.kill() #self._pstatProc.send_signal(signal.SIGTERM) #os.kill( self._pstatProc.pid , signal.SIGTERM) else: print("Starting pstats server") self._pstatProc = subprocess.Popen("pstats", shell=True) print(" pstats proc: pid=%s"%(self._pstatProc.pid)) time.sleep(1) print("Connecting to pstats server") PStatClient.connect()
from otp.avatar import Avatar from otp.avatar import AvatarDNA from direct.task import Task from pandac.PandaModules import ClockObject from direct.showbase.MessengerGlobal import * import sys from pandac.PandaModules import PStatClient from direct.showbase import ShowBase from ChatManagerGlobal import * # # globals # connected = 0 pStats = PStatClient.getGlobalPstats() startTime = 0.0 startFrameCount = 0 globalClock = ClockObject.getGlobalClock() # # viewpoint list # vpl = ((Point3(-10.5, 20.3, 5.6), VBase3(-153., -14., 0.)), (Point3(-45., -0.3, -0.8), VBase3(-90., -4., 0.)), (Point3(-74.4, -46.4, 6.5), VBase3(-58., -5.8, 0.)), (Point3(127.7, -74., 5.), VBase3(60.5, -4.6, 0.)), (Point3(66.3, 62.7,
def load(self, task): PStatClient.connect() self.bug_text.setText("loading Display...") #showFrame() yield Task.cont yield Task.cont self._loadDisplay() self.bug_text.setText("loading physics...") #showFrame() yield Task.cont yield Task.cont self._loadPhysics() self.bug_text.setText("loading sky...") #showFrame() yield Task.cont yield Task.cont self._loadSky() #Definitely need to make sure this loads before terrain self.bug_text.setText("loading terrain...") #showFrame() yield Task.cont yield Task.cont self._loadTerrain() yield Task.cont yield Task.cont while taskMgr.hasTaskNamed("preloadTask"): #loggin.info("waiting") yield Task.cont logging.info("terrain preloaded") #self.bug_text.setText("loading fog...") #showFrame() #self._loadFog() self.bug_text.setText("loading player...") #showFrame() yield Task.cont yield Task.cont self._loadPlayer() self.bug_text.setText("loading water...") #showFrame() yield Task.cont yield Task.cont self._loadWater() self.bug_text.setText("loading filters...") #showFrame() yield Task.cont yield Task.cont self._loadFilters() self.bug_text.setText("loading gui controls...") #showFrame() yield Task.cont yield Task.cont self._loadGui() self.bug_text.setText("loading miscellanous...") #showFrame() yield Task.cont yield Task.cont self.physics.setup(self.terrain, self.ralph) taskMgr.add(self.move, "moveTask") # Game state variables self.prevtime = 0 self.isMoving = False self.firstmove = 1 disableMouse() self.bug_text.setText("") #showFrame() yield Task.cont yield Task.cont self.splash.destroy() self.splash = None yield Task.done
from voxplanet.config import Config as VoxConfig from voxplanet.params import Params as VoxParams from panda3d.core import VBase4 from pandac.PandaModules import loadPrcFileData, PStatClient, AmbientLight from modules.objects.blocks import CoordBlock from config import Config loadPrcFileData("", "window-title {0}".format(Config().name_game)) loadPrcFileData("editor-startup", "show-frame-rate-meter #t") loadPrcFileData("want-pstats", "1") loadPrcFileData("task-timer-verbose", "1") loadPrcFileData("pstats-tasks", "1") loadPrcFileData("", "support-threads #t") # loadPrcFileData("", "threading-model cull/draw") PStatClient.connect() class Main: """Main class for game """ def __init__(self): self.gui = GUI(self) self.cmd_handler = Command_Handler(self) self.textures = TextureCollection(self) signal.signal(signal.SIGINT, self.signal_stop) signal.signal(signal.SIGTERM, self.signal_stop) def signal_stop(self, signum, frame):
from voxplanet.config import Config as VoxConfig from voxplanet.params import Params as VoxParams from panda3d.core import VBase4 from pandac.PandaModules import loadPrcFileData, PStatClient, AmbientLight from modules.objects.blocks import CoordBlock from config import Config loadPrcFileData("", "window-title {0}".format(Config().name_game)) loadPrcFileData("editor-startup", "show-frame-rate-meter #t") loadPrcFileData("want-pstats", "1") loadPrcFileData("task-timer-verbose", "1") loadPrcFileData("pstats-tasks", "1") loadPrcFileData("", "support-threads #t") #loadPrcFileData("", "threading-model cull/draw") PStatClient.connect() class Main(): """Main class for game """ def __init__(self): self.gui = GUI(self) self.cmd_handler = Command_Handler(self) self.textures = TextureCollection(self) signal.signal(signal.SIGINT, self.signal_stop) signal.signal(signal.SIGTERM, self.signal_stop) def signal_stop(self, signum, frame):
def load(self, task): PStatClient.connect() self.bug_text.setText("loading Display...") #showFrame() yield Task.cont yield Task.cont self._loadDisplay() self.bug_text.setText("loading physics...") #showFrame() yield Task.cont yield Task.cont self._loadPhysics() self.bug_text.setText("loading sky...") #showFrame() yield Task.cont yield Task.cont self._loadSky() # Definitely need to make sure this loads before terrain self.bug_text.setText("loading terrain...") #showFrame() yield Task.cont yield Task.cont self._loadTerrain() yield Task.cont yield Task.cont while taskMgr.hasTaskNamed("preloadTask"): #logging.info( "waiting") yield Task.cont logging.info( "terrain preloaded") #self.bug_text.setText("loading fog...") #showFrame() #self._loadFog() self.bug_text.setText("loading player...") #showFrame() yield Task.cont yield Task.cont self._loadPlayer() self.bug_text.setText("loading water...") #showFrame() yield Task.cont yield Task.cont self._loadWater() self.bug_text.setText("loading filters...") #showFrame() yield Task.cont yield Task.cont self._loadFilters() self.bug_text.setText("loading gui controls...") #showFrame() yield Task.cont yield Task.cont self._loadGui() self.bug_text.setText("loading miscellanious...") #showFrame() yield Task.cont yield Task.cont self.physics.setup(self.terrain, self.ralph) taskMgr.add(self.move, "moveTask") # Game state variables self.prevtime = 0 self.isMoving = False self.firstmove = 1 disableMouse() self.bug_text.setText("") #showFrame() yield Task.cont yield Task.cont self.splash.destroy() self.splash = None yield Task.done