William Clarkson has shared his solution and source code for scaling games in Phaser 3!

Article by Scott Westover. Posted on 9th Mar 2020.   @swestover06

image

William Clarkson has released an excellent tutorial on how you can scale games in Phaser 3. Being able to scale your games to any device or window size is crucial if you want to reach the most consumers today. In addition to showing you how you can scale your Phaser 3 games, William has released the source code for his custom class for free! You can also watch a video version of the tutorial here: YouTube.

image

From the tutorial: "As game developers, one of the challenges we have faced since the invention of the smartphone is how to scale the game so it will fit on whatever device the player has. Scaling games in Phaser 3 is no exception.

Using a dynamic canvas size means we don’t know the size of the game when we start. The alignment grid works because instead of placing an object at a static point we place it at a percentage of the canvas size.

There are a few occasions where I’ve had to tweak placements or sizes for certain devices, but I’ve been using this method in my professional work for almost 2 years now, and I’ve found it has done 99% of the work for me."

Read More