bonjour2015 Posted September 27, 2014 Share Posted September 27, 2014 HI, guys.I want to save the screen as an image file like jpg file (of course the file is in memroy) and upload the image data to the http server when I run my html5 app so I can share the screenplay with others.How can I do that in the Phaser framework?Thx. Link to comment Share on other sites More sharing options...
lewster32 Posted September 27, 2014 Share Posted September 27, 2014 You can get the Phaser canvas data with game.canvas.toDataURL() if using the canvas renderer - you'll probably have to do this in the render function to ensure you capture everything for that frame. However if you intend to use this to live share the gameplay as it happens, this will be very, very inefficient. It'd be much better in that case to send over the positions and such of objects, or even better, just the player's input, which is how many netplay engines work - though this will require some quite strict enforcement of things like repeatable random number generation etc. Failing that, there are ways of sharing video feeds over WebRTC but I'll leave the research on that one to you! Link to comment Share on other sites More sharing options...
bonjour2015 Posted September 27, 2014 Author Share Posted September 27, 2014 You can get the Phaser canvas data with game.canvas.toDataURL() if using the canvas renderer - you'll probably have to do this in the render function to ensure you capture everything for that frame. However if you intend to use this to live share the gameplay as it happens, this will be very, very inefficient. It'd be much better in that case to send over the positions and such of objects, or even better, just the player's input, which is how many netplay engines work - though this will require some quite strict enforcement of things like repeatable random number generation etc. Failing that, there are ways of sharing video feeds over WebRTC but I'll leave the research on that one to you! thanks for your reply. It is a great help to me. Link to comment Share on other sites More sharing options...
Recommended Posts