I can’t seem to figure this one out… I’m using the panda threading ability to over come some IO problems for my preloading, but for some reason I still get the huge lag that comes from loading my main big model… Is there any other way to maybe some how lower its pressure on my game? I tried using the threadPriority variable, but I’m a little lost on the whole “TP_low, TP_normal, TP_high, or TP_urgent” passing… it wants a int number so not really sure to pass a high 4 or a low 0, either way it didn’t seem to help when I did it… but then again I didn’t test the time just the human feel.
############################PreLoad Data#########################################
def PreLoad(self):
taskMgr.setupTaskChain('PreLoadThread', numThreads = 1)
taskMgr.add(self.PreLoadData, "PreLoading", taskChain = 'PreLoadThread')
def PreLoadData(self, task):
print "Starting preload"
if self2.LastLocation:
LoadEnvironment().PreLoad(self2.LastLocation)
Thread.considerYield()
#SP effects
for Item in ['Misc/Misc/Smoke/Smoke2/Smoke2.bam']:# 'Misc/Misc/Explosion/Explosion1/Explosion1.bam', 'Misc/Misc/Smoke/Smoke1/Smoke1.bam', ]:
try:
Smoke = loader.loadModel(''.join(map(str, ("MainMenu/Game/BlockWar/", Item))))
Smoke.prepareScene(base.win.getGsg())
Smoke.removeNode()
except:
print traceback.format_exception(*sys.exc_info())
Thread.considerYield()
#Sounds
for Item in ['Knife/gunfire/Knife_HitConc1.ogg', 'Pistol/gunfire/pistol_fire.ogg', 'Mrifle/gunfire/rifle_fire_1.ogg', 'hunting_rifle/gunfire/hunting_rifle_fire_1.ogg',
'PulseRifle/gunfire/shockrifle_shoot.ogg', 'RocketLauncher/gunfire/rocket_launcher.ogg', 'MiniGun/gunfire/minigun_fire.ogg']:
try:
Sound = loader.loadSfx(''.join(map(str, ("MainMenu/Game/BlockWar/Music/Sounds/", Item))))
except:
print traceback.format_exception(*sys.exc_info())
Thread.considerYield()
#Models
for Item in ["Scrolls/Scroll.bam"]:
try:
Model = loader.loadModel(''.join(map(str, ("MainMenu/Game/BlockWar/Misc/Items/", Item))))
Model.prepareScene(base.win.getGsg())
Model.removeNode()
except:
print traceback.format_exception(*sys.exc_info())
Thread.considerYield()
for Item in ["Knife/Knife.bam", "Mrifle/Mrifle.bam", "Pistol/Pistol.bam", "Sniper/Sniper.bam", "bullit.bam"]: # "MiniWeapon/MiniWeapon.bam", "BFG/BFG.bam", "PulseRifle/PulseRifle.bam", "RocketLauncher/RocketLauncher.bam", "ShotWeapon/ShotWeapon.bam"
try:
Weapon = loader.loadModel(''.join(map(str, ("MainMenu/Game/BlockWar/Misc/Items/Weapons/", Item))))
Weapon.prepareScene(base.win.getGsg())
Weapon.removeNode()
except:
print traceback.format_exception(*sys.exc_info())
Thread.considerYield()
print "Done preloading"