rosancoderian Posted July 8, 2018 Share Posted July 8, 2018 can panda.js run in headless mode? or is there any way to remove draw update and browser only code? Quote Link to comment Share on other sites More sharing options...
enpu Posted July 9, 2018 Share Posted July 9, 2018 This should be possible with few changes on the engine. I will work on this asap and get back to you with an example. Quote Link to comment Share on other sites More sharing options...
enpu Posted July 10, 2018 Share Posted July 10, 2018 Support for headless mode has now been added to latest dev version. Here is small example on running Panda Engine on headless mode with node: server.js global.game = require('./src/engine/core.js'); game.config = { system: { frameRate: 10 } }; game.module( 'game.main' ) .body(function() { game.createScene('Main', { init: function() { console.log('Main scene started'); var world = new game.Physics(); this.body = new game.Body(); var shape = new game.Rectangle(100); this.body.addShape(shape); this.body.addTo(world); }, update: function() { console.log(this.body.position.y); } }); }); game.start(); Output: $ node server.js Main scene started 0 2.45 7.3500000000000005 14.700000000000001 24.5 36.75 51.45 Let me know if you have any issues. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.