After 2 years of good behavior my Phaser 3 game has suddenly changed.
As soon as new Phaser.game()
runs, GPU usage jumps to nearly 100% (even though idle)
and the computer is burdened so that typing in devtools (or elsewhere) is ridiculously unresponsive.
This occurs on multiple (identical) computers
I do not think it is related to any recent code change
but I now init the game in a Promise chain, after loading level design files.
I doubt this is the problem but here is that code
Promise.all( currentRound.levels.map( name=>
fetch( `./levels/${name}.json` )
.then( res => res.json() )
))
.then( dbs=> dbs.forEach( db=>{
console.log("SCENELIST", db);
let cfg = { key: db.scene.name, active:false, visible:true, db:db };
let next = null;
switch ( db.scene.type.toLowerCase()){
case "cut" : next = new CutScene( cfg ); break;
case "chase" : next = new ChaseScene( cfg ); break;
case "choose" : next = new ChooseScene( cfg ); break;
default : next = new BaseScene( cfg ); break;
}
sceneList.push( next );
console.log("SCENELIST", sceneList);
}))
.then ( ()=>
game = new Phaser.Game( {
type: Phaser.AUTO,
backgroundColor: 0xFF77AA,// 0x27176b, //rooftop may 16= 0x9aabe3,//0x034047,// 0x3254e7,
width: 9000,
height:800,
scale: {
parent: 'gamescreen',
mode: Phaser.Scale.FILL,
width: 1920,
height: 1080
},
parent: 'gamescreen',
dom: {
createContainer: false
},
physics: {
default: 'arcade',
arcade: {
gravity: { y:1300 },
debug: dbg.seePhysics
}
},
scene: sceneList,
plugins: {
global: [
{ key: 'SceneWatcher', plugin: PhaserSceneWatcherPlugin, start: true, mapping: 'sceneWatcher' }
]
},
callbacks: {
postBoot: function (game) { game.plugins.get('SceneWatcher').watchAll(); }
}
}) )
;