For example, should I be looking into threading each type of manager so it runs independantly?
I'm quite busy ATM, so the short answer to this is: NOOOOO! :wink:
Don't let another thread than your main thread manipulate your game entities (at least not as long as it affects jPCT related stuff). It may happen at any time, even when jPCT is rendering them and that will cause all kinds of wierdness which are a pain to debug. Trust me...been there, done that...
Don't manipulate the Camera, the World, an Object3D etc. from inside another thread. Don't do it. Never! jPCT has a kind of locking implemented (has to be enable explicitly) to make it pseudo-threadsave, but that dates back to the times where i thought that i might be a good idea. It isn't...
Edit: Here's a short code snippet from Paradroidz' main loop. Looks similar to your approach. That doesn't mean that it's the only way to go, but it works for me.
if (!gameState.showsSomeOverlay()) {
if (data.isAlive()) {
player.checkInvincible(storeTicks);
player.reEnergize(level, storeTicks);
}
level.updateShadowVolume();
eManager.enterCollisionMode();
player.enterCollisionMode();
level.processDoors(storeTicks);
level.processEnergyPads(storeTicks);
level.processDisruptors(storeTicks);
SimpleVector playerPos=player.getTranslation();
player.processProjectiles(storeTicks);
map.disableCollisionListeners();
if (data.isAlive() && !gameState.hasState(GameState.FINISHED)) {
move(storeTicks);
}
eManager.setPlayerPosition(playerPos);
eManager.calculateVisiblity(storeTicks);
eManager.moveEnemies(storeTicks);
map.enableCollisionListeners();
if (data.isAlive() && !gameState.hasState(GameState.FINISHED)) {
eManager.fireAtWill(storeTicks);
fire(storeTicks);
transfer();
level.setArrow(eManager.getClosestEnemyPosition(playerPos, false), storeTicks);
} else {
eManager.moveBulletsOnly(storeTicks);
}
eManager.leaveCollisionMode();
player.leaveCollisionMode();
player.processClouds(storeTicks);
player.synchronize();
level.processExplosions(storeTicks);
level.processBlastRings(storeTicks);
level.processParticles(storeTicks);
processCamera(storeTicks);
}