Damian Pastorini Posted September 8, 2018 Share Posted September 8, 2018 Hi everyone, My name is Damian, I'm new in Phaser. I was working with a code sample that has the following: <script> const WEBGL_RENDERER = true; const CANVAS_RENDERER = true; </script> <script type="text/javascript" src="./client.js"></script> I'm really not sure for what are the const's, I'm working in a "2d-titled" game and nothing changes if I comment both. Any recommendations or clue about if I should keep them and why? Thanks! Link to comment Share on other sites More sharing options...
Pave Posted September 9, 2018 Share Posted September 9, 2018 WebGL just increases performance of your game. Canvas rendering is the slower option. I have never seen setting this constants manually. I always set them in the "config" variable. var config = { type: Phaser.AUTO, width: 800, height: 600, scene: { preload: preload, create: create, update: update } }; var game = new Phaser.Game(config); The type "Phaser.AUTO" automatically tries to use WebGL, but if the browser doesn't support it it'll fall back to Canvas rendering. If you set the correct type in the config variable i think you can delete the two lines, but maybe a phaser expert knows more than I. Damian Pastorini 1 Link to comment Share on other sites More sharing options...
Milton Posted September 9, 2018 Share Posted September 9, 2018 10 hours ago, Damian Pastorini said: Any recommendations or clue about if I should keep them and why? You only need them if you rebuild Phaser itself. You could shrink the filesize by using only 1 (or even no) renderer. Damian Pastorini 1 Link to comment Share on other sites More sharing options...
Damian Pastorini Posted September 9, 2018 Author Share Posted September 9, 2018 Well... I'm using Parcel but I think it's for rebuild Phaser itself but to rebuild the code I use that implements Phaser. I'll share with you the game-base once it's relative working (is a Colyseus + MySQL + Phaser 3 implementation for a MMORPG), hopefully I will get some feedback as good as yours Thanks both! Link to comment Share on other sites More sharing options...
Recommended Posts