<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Phaser World]]></title><description><![CDATA[Phaser World]]></description><link>https://phaser.world</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1725557015486/3ba581e2-4b83-4369-ae7a-de0ca711cc1a.png</url><title>Phaser World</title><link>https://phaser.world</link></image><generator>RSS for Node</generator><lastBuildDate>Sat, 16 May 2026 23:59:50 GMT</lastBuildDate><atom:link href="https://phaser.world/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Phaser World Issue 216]]></title><description><![CDATA[Greetings everyone! We’re back with another round of news from the wider Phaser community. This issue we have got the release of Phaser v3.88.1, three games, and two advanced tutorials. Plenty to keep you busy 😄
There’s no Dev Log this week because ...]]></description><link>https://phaser.world/phaser-world-issue-216</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-216</guid><category><![CDATA[Game Development]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[WebGL]]></category><category><![CDATA[canvas]]></category><category><![CDATA[phaser]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Thu, 13 Feb 2025 18:27:56 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739469646103/91e65588-1afc-4e1f-ad93-d2683fc4e7d6.png" alt class="image--center mx-auto" /></p>
<p>Greetings everyone! We’re back with another round of news from the wider Phaser community. This issue we have got the release of Phaser v3.88.1, three games, and two advanced tutorials. Plenty to keep you busy 😄</p>
<p>There’s no Dev Log this week because we’ve several very significant projects all nearing completion together, so we’ve just not had time to write about them. Dev Logs shall commence regular service in the next issue. Until then, please dig into a smaller but no less tasty treat of an issue …</p>
<h2 id="heading-phaser-v3881-released">🥳 Phaser v3.88.1 Released</h2>
<p><a target="_blank" href="https://github.com/phaserjs/phaser/releases/tag/v3.88.1"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739469696527/02b3c44c-4a1f-41a5-a689-56eda5777322.png" alt class="image--center mx-auto" /></a></p>
<p>We are excited to announce the release of Phaser v3.88.1, codenamed 'Minami'. This latest version of our open-source HTML5 game framework brings lots of important fixes and improvements that we know our community will benefit from.</p>
<p>Our mobile and web audio systems have received vital updates. We've improved audio unlocking on mouse-enabled devices, and implemented crucial fixes for iOS 17.5.1+ and iOS 18+ to prevent audio interruption during focus changes in Safari.</p>
<p>We've merged a community PR that adds a handy new Transform.getWorldPoint method that lets you accurately retrieve world coordinates for game objects, even within nested hierarchies. Plus Dynamic Textures have had their rendering quality substantially improved by ensuring even-numbered dimensions.</p>
<p>For our physics-focused developers, we've enhanced Arcade Physics collision handling, particularly for circle-to-circle and circle-to-rectangle collisions. We've also fixed a critical issue with Matter.js physics that could cause browser crashes when handling large delta values in background tabs.</p>
<p>The update includes many more improvements, from better tilemap handling to enhanced tween management and DOM element scaling fixes. We've worked hard to ensure these changes maintain backward compatibility while improving your game development workflow. As always, please see the full Change Log for details.</p>
<p>Phaser v3.88.1 is available now via npm and GitHub and in the Phaser Sandbox. We've also updated all of our framework templates too. We encourage all developers to upgrade to this latest version to take advantage of these improvements. As always, we're grateful for our community's continued support and feedback that helps make Phaser better with each release.</p>
<p><a target="_blank" href="https://github.com/phaserjs/phaser/releases/tag/v3.88.1">Download from GitHub</a></p>
<h2 id="heading-memory-game-with-phaser-and-react">🧠 Memory Game with Phaser and React</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/02/memory-game-with-phaser-and-react"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739469906850/24335d4c-5abd-4077-9558-57af6c710973.jpeg" alt class="image--center mx-auto" /></a></p>
<p>If you're interested in game development with JavaScript, why not try building a memory game using Phaser and React? This tutorial walks you through the entire process, showing you how to integrate these two technologies to create an interactive card-matching game.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/02/memory-game-with-phaser-and-react">Read the Tutorial</a></p>
<h2 id="heading-magical-cat-rescue">😽 Magical Cat Rescue</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/02/magical-cat-rescue"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739469992415/eaea720f-4672-49a4-af31-551c0c886106.jpeg" alt class="image--center mx-auto" /></a></p>
<p>If you love puzzle games and adorable cats, Magical Cat Rescue is a game you don’t want to miss! Built using Phaser, this delightful adventure challenges players to solve puzzles and rescue lost cats in a magical world.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/02/magical-cat-rescue">Play Magical Cat Rescue</a></p>
<h2 id="heading-continuous-collision-detection-in-phaser">🧠 Continuous Collision Detection in Phaser</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/02/continuous-collision-detection-in-phaser"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739470138841/4f828867-2b48-4a8e-ba67-30a3c581a95d.png" alt class="image--center mx-auto" /></a></p>
<p>This tutorial is part of an ongoing series and provides an in-depth look at:</p>
<p>Handling high-speed object collisions with line segments Detecting vertex collisions for more precise interactions Preventing the notorious tunneling effect caused by fast motion Implementing mathematical techniques to achieve accurate physics.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/02/continuous-collision-detection-in-phaser">Read Tutorial</a></p>
<h2 id="heading-brew-perfect">☕ Brew Perfect</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/02/brew-perfect"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739470220615/afa42bad-1903-45dc-8d45-97055babbf8b.png" alt class="image--center mx-auto" /></a></p>
<p>Love coffee and casual games? Then Brew Perfect is your next caffeine fix! Created by PlayGood Games in partnership with Chemex Coffeemakers, this engaging browser game lets players experience the art of brewing the perfect cup of coffee.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/02/brew-perfect">Play Brew Perfect</a></p>
<h2 id="heading-the-legend-of-three-heroes">⚔️ 风尘三侠传 The Legend of Three Heroes</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/02/the-legend-of-three-heroes"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739470316069/0c50840e-9f1e-4a52-a56b-69f0975b32a8.png" alt class="image--center mx-auto" /></a></p>
<p>As game developers, we often come across titles that pique our interest, even if they're beyond our linguistic reach. One such game is 风尘三侠传 (The Legend of Three Heroes), developed and published by Dai Jin. Released a year ago, this Phaser created game is available exclusively in Chinese on Steam.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/02/the-legend-of-three-heroes">Read about Legend of the Three Heroes</a></p>
<hr />
<h1 id="heading-phaser-youtube-channel">Phaser YouTube Channel</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739470957866/b83ed30c-9dc8-4af9-9b39-8bc61fa7b493.png" alt class="image--center mx-auto" /></p>
<p>New readers may not be aware that Phaser has its own <a target="_blank" href="https://www.youtube.com/@PhaserYouTube">YouTube channel</a>! We’ve been posting a steady collection of updates, recaps, and game showcases there for a while now, and it’s growing nicely. Our aim is to start trying some short-form tutorials and see how those go down, but if you’ve any other ideas, please let us know in our Discord. Here are some of the latest videos:</p>
<p><a target="_blank" href="https://www.youtube.com/@PhaserYouTube"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739471049499/92f80dc9-c5fb-4073-94e1-3d2f99368e25.png" alt class="image--center mx-auto" /></a></p>
<p>Subscribe to us at <a target="_blank" href="https://www.youtube.com/@PhaserYouTube">https://www.youtube.com/@PhaserYouTube</a></p>
<hr />
<h1 id="heading-share-your-content-with-18000-readers">Share your content with 18,000+ readers</h1>
<p>Have you created a game, tutorial, code snippet, video, or anything you feel our readers would like?</p>
<p>Please <a target="_blank" href="mailto:content@phaser.io">send it to us</a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739470760880/d68a4b09-09b1-4e96-8e2e-7fca58b6dcbd.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 215]]></title><description><![CDATA[Oh boy, we have a good one for you this week! A new beta release of Phaser 4 that introduces some groundbreaking GPU tech for rendering millions of sprites, plus a comprehensive guide on Shader development, cool new games, and a massive team develope...]]></description><link>https://phaser.world/phaser-world-issue-215</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-215</guid><category><![CDATA[Game Development]]></category><category><![CDATA[WebGL]]></category><category><![CDATA[canvas]]></category><category><![CDATA[phaser]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Wed, 05 Feb 2025 00:22:17 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738712472189/02ddf3e3-aa03-4ddb-b0e0-e281bc1a594d.png" alt class="image--center mx-auto" /></p>
<p>Oh boy, we have a good one for you this week! A new beta release of Phaser 4 that introduces some groundbreaking GPU tech for rendering <em>millions</em> of sprites, plus a comprehensive guide on Shader development, cool new games, and a massive team developer log.</p>
<h2 id="heading-1-million-animated-sprites-yes-please">🤯 1 Million+ Animated Sprites? Yes, please!</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/phaser-v4-beta-5-released"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738711938408/eb2e15e5-ecdf-458f-bf3e-317130ff1d16.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Here's something a little special - the final part of our new renderer just landed and <strong>Sprite GPU Layers</strong> are now available in Phaser v4 Beta 5. What can they do? For a start, they can easily handle rendering <em>1 million+</em> background sprites!</p>
<p>SpriteGPULayer is a new game object designed for ultra-high performance in background layers. Leverage the power of the GPU to render a hundred times faster than conventional sprites. And use tween-like animations to add life to "static" backgrounds. This allows for behaviors like animated characters, crowds of moving people, trees swaying in the wind, fading smoke rising from chimneys, raindrops falling, and many more.</p>
<p>We just published an article all about them, which includes <strong>4 demos</strong> to play with.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/phaser-v4-beta-5-released">Read about Sprite GPU Layers</a></p>
<h2 id="heading-phaser-4-shader-guide-now-available">📕 Phaser 4 Shader Guide now Available</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/phaser-4-shader-guide"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738712122714/0517969a-3d1d-4060-8443-14e8ac6f0663.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Phaser 4 updates the WebGL rendering system to become more powerful and reliable than ever before. This guide explains the core concepts and how to use shaders in the new system.</p>
<p>We're excited to announce the release of our detailed guide on creating shaders in Phaser 4! This comprehensive resource walks you through everything you need to know about working with Phaser's new WebGL rendering system, "Phaser Beam"</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/phaser-4-shader-guide">Read more about the Shader Guide</a></p>
<h2 id="heading-word-rummy">🔠 Word Rummy</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/word-rummy"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738712242745/d543e343-f3ae-4f12-8042-5cd86e8fe525.png" alt class="image--center mx-auto" /></a></p>
<p>Word enthusiasts, get ready for a fresh take on letter-tile gaming! Stone Fruit Studios has just launched Word Rummy, an engaging new word game available exclusively as a Discord Activity. This clever mashup of beloved classics like Wordle, Scrabble, and Bananagrams brings strategic word-building directly to your Discord server.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/word-rummy">Play Word Rummy</a></p>
<h2 id="heading-full-stack-snake-tutorial">🐍 Full Stack Snake Tutorial</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/full-stack-snake-tutorial"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738712322350/1507b903-c0f5-4214-b55a-3ebaa0079ade.jpeg" alt class="image--center mx-auto" /></a></p>
<p>In this episode of the 12-Minute AI Game Development Challenge, we’ll build a full-stack Snake game with Cursor IDE, Supabase, and Phaser.js — all in just 12 minutes and with just prompts (NO coding) Watch and learn how to use AI to build and develop games with Cursor.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/full-stack-snake-tutorial">View the Video</a></p>
<h2 id="heading-hammer-time">🔨 Hammer Time</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/hammer-time"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738712385567/68ff24a7-7ac4-49e7-92f8-6000dfb456b4.png" alt class="image--center mx-auto" /></a></p>
<p>In a standout entry from the 16th Pirate Software Game Jam, developer drewhjava brings us Hammer Time, an intense survival game where you play as a trusty hammer that is both your lifeline and your greatest weapon. Created in just 16 days under the theme "You are the weapon," this game stands out among the jam's 1,772 submissions with its unique combat mechanics and strategic gameplay.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/hammer-time">Play Hammer Time</a></p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738712515371/80ead5a1-3c37-490d-bd82-d031028ff708.png" alt class="image--center mx-auto" /></p>
<p>Things are getting hot in here! This is what the Phaser Studio team was up to last week…</p>
<h2 id="heading-rich-cto-amp-founder">👨‍💻 Rich - CTO &amp; Founder</h2>
<p>Part of my job includes talking to new potential customers. In addition to finding out about their companies, it also allows them to ask what features Phaser and Phaser Editor have. A reoccurring question, which was posed yet again today, is: How are you going to integrate AI into your products?</p>
<p>And it's a perfectly valid thing to ask of a software vendor now. Of course, there's no need to have it within Phaser itself. I'm not sure how that would even be possible anyway. But within Editor? That's a different matter. Developers are becoming so used to having co-pilot and Cursor-like interfaces at their fingertips that it's becoming almost painful when they're not present, and purchase decisions are now based upon it. Code-level assistants are one thing. This would be relatively easy for us to add if we wanted to. Because Phaser has always been open-source, the models are full of a decade of learning material. They don't always appreciate the nuances of just <em>how</em> the API fully interacts - but, given enough prompting and patience, they can all muster-up a decent quality Phaser game in next to no time.</p>
<p>That doesn't mean we should stop learning to code and let the tools take over, far from it. Yet it would be idiotic to bury my head in the sand and pretend this seismic shift isn't taking place because it is. And it's happening right now. So, what are we going to do about it? The short answer is: I'm not entirely sure yet, but it's something as a team we need to focus on very closely and carefully in the coming months. Right now, though, we've got the massive Phaser v4.0 release to focus on, the lesser, but no less important v3.88 release, and of course, Phaser Launcher and Phaser Editor updated to reflect all of this innovation.</p>
<p>Make no mistake, Phaser 4 is a superb release, and I cannot wait for it to be released this month. We've spent over a year working full-time on the brand-new renderer, and it shows. It's a giant leap forward in terms of performance and features - look at the Sprite GPU Layers we released in this issue for proof. Having that live, along with the other projects all coming to completion, will be truly exciting for us and the community.</p>
<p>In the meantime, I will keep talking to customers, listening to their needs and trying to find ways to make their lives easier. And if that means integrating AI into our products, so be it. It's not something I'm going to rush into. It's something that needs to be done right and done well. And that's going to take time. But it's also going to be worth it. Because the future of development will be very different from now. And we need to be ready for it. Thankfully, with all the tech we've been developing and releasing over the past year, we're in a perfect position to do just that.</p>
<h2 id="heading-francisco-phaser-launcher">👨‍💻 Francisco - Phaser Launcher</h2>
<p>Welcome everyone to another week!</p>
<p>We're getting closer and closer to the first release of our Phaser Launcher. As you may know, "Phaser Launcher" is just our project name and not the final name of the software. Our team has been brainstorming potential names, and we've come up with some interesting ones:</p>
<ul>
<li><p>Phaser Launcher</p>
</li>
<li><p>Phaser Editor Lite</p>
</li>
<li><p>Phaser Taco Blast Processing</p>
</li>
<li><p>Zero (this one is really solid!) We haven't made a final decision yet, but we hope you'll like the name we will choose.</p>
</li>
</ul>
<p>The Launcher is designed to be a tool that helps developers create games with Phaser, as well as an entry point for those who want to step into the world of game development. With that in mind, we've added the Phaser by Examples book to the launcher. We've even dedicated a section on the landing page to make it easier for you to access the book.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738712709375/a9202c08-33f3-4015-ad85-9b59fe3c6aeb.gif" alt class="image--center mx-auto" /></p>
<p>The Launcher features a Game Viewer, a component that allows you to preview your game’s progress. However, we encountered a small issue: to see any updates, you had to close and reopen the window manually.</p>
<p>After diving deep into how Tauri’s window management works, I discovered that I could inject code into the game server, allowing it to emit an event that requests an update for this component. Thanks to this, we now have a much faster update process—without needing to close the window!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738712739387/aa25ed43-b8c4-43a0-9626-51a778be0cba.gif" alt class="image--center mx-auto" /></p>
<p>Thanks for reading about the Launcher’s progress—stay tuned! 🚀</p>
<h2 id="heading-arian-phaser-editor">👨‍💻 Arian - Phaser Editor</h2>
<p>Hello!</p>
<p>These have been some hard work on the Box2D tools for Phaser Editor. Here is a summary of some of the most important features we have made progress on.</p>
<p><strong>Body bounds</strong></p>
<p>Since Box2D is not part of Phaser, I have had to implement some utilities to delimit the area that a body encompasses. This is used to determine when the user clicks on a body and also to highlight the object when it is selected.</p>
<p><strong>New shapes</strong></p>
<p>I have added two new shapes: Offset box and Circle.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738712813707/b9659634-ccea-4dd0-9613-0bf4421cdb0f.png" alt class="image--center mx-auto" /></p>
<p><strong>Box2D glue-code generation</strong></p>
<p>In a game, to create scenes with Box2D support, you have to write some code related to setting up the world, advancing the simulation, updating the sprites, displaying debug information, etc... All this code is now generated by the editor. You just have to activate the parameter Generate Box2D World Code. This means that the editor is now able to automatically generate all the code needed to get your Box2D scenes ready to run. Along with this parameter I have added others to further detail some optional aspects of the scene, such as implementing the "update" method and generating debug code.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738712843756/a69e9ed6-6f6b-4f89-b7df-e6182fbccb53.png" alt class="image--center mx-auto" /></p>
<p><strong>World parameters</strong></p>
<p>If you enable the code generation of the Box2D world, then the editor shows you the world parameters:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738712866427/317c7fca-52e4-4b3a-a474-85f962f9f0d1.png" alt class="image--center mx-auto" /></p>
<p><strong>Auto import</strong></p>
<p>All Box2D construction is made by calling the Box2D API functions. The editor will generate the "import" statements of all the functions. For now, it will look at the "PhaserBox2D.js" file in the project and will use it as the source of the API.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738712888007/47ba1991-a5fc-4a4e-a94e-82c1c8f8a9f2.png" alt class="image--center mx-auto" /></p>
<p><strong>Prefabs</strong></p>
<p>I started working with adapting the editor's prefab system to the Box2D particularities. In the next scene, all of the elements are made of prefabs that contains a Box2D body:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738712954040/9efdfd2f-f1b8-455f-bc79-04afa70423d5.png" alt class="image--center mx-auto" /></p>
<p>There is a lot to do with the prefab system, since I should implement a new way to configure the nested prefabs by setting the parameters via constructor arguments instead of object properties (as it is now).</p>
<p>Finally, here I let you with a small video of a demo I'm making, inspired on Angry Birds. In the next weeks we are going to make a release of the editor with an early version of the Box2D tooling. This version is not going to be feature-complete, but you will be powerful enough to make an Angry Birds-like game, all with in-scene visual tools.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738712972814/5a78834d-73b7-43cd-9c1d-fa0e1079e48f.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-can-discord-activities">👨‍💻 Can - Discord Activities</h2>
<p>I wrapped up work on the guide and the template itself, providing a clear step-by-step approach. Dealing with all the details is not a straightforward experience, we wanted to make the process as simple as possible. You have to go through steps like app creation, setting your development environment, payout settings, dealing with proxies, verifying your app, creating your store, testing, debugging via the Discord app itself, bot settings, getting into production, and many more! If you get stuck on any part through it, or any part we can improve with the guide &amp; repo - share with us in #discord-activites on Phaser Discord.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738713114069/3f034fd9-f8e7-4989-be2d-924e571513aa.gif" alt class="image--center mx-auto" /></p>
<p>Now, I'm switching to Phaser Launcher to join forces with my great teammate, Francisco. I'll be focusing on the deployment part of the app for the moment being.</p>
<p>Till the next one, keep sharpening your pixels!</p>
<hr />
<h1 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738713168452/b8e03334-2c85-40b5-9dba-111f97bd080c.png" alt class="image--center mx-auto" /></p>
<p>3rd February, 2025 - Ben Richards</p>
<p>We've released <a target="_blank" href="https://phaser.io/news/2025/01/phaser-v4-beta-5-released">Phaser 4 Beta 5</a>, and it's a big one. This release introduces <code>SpriteGPULayer</code>, a game object which uses WebGL to render lively backgrounds a hundred times faster than anything else in Phaser. I've had this in the works for some time, and it's great to finally have it out!</p>
<p>As if that wasn't enough, I released the first draft of the Beam Shader Guide, to help you write your own shaders and filters. It's available for logged-in Phaser members at <a target="_blank" href="https://phaser.io/tutorials/phaser-4-shader-guide">https://phaser.io/tutorials/phaser-4-shader-guide</a>.</p>
<p>I also made changes to internal texture orientation, and fixed lots of bugs.</p>
<h2 id="heading-spritegpulayer">SpriteGPULayer</h2>
<p>SpriteGPULayer is a new game object designed for ultra-high performance in background layers. Leverage the power of the GPU to render a hundred times faster than conventional sprites. And use tween-like animations to add life to "static" backgrounds. This allows for behaviors like animated characters, crowds of moving people, trees swaying in the wind, fading smoke rising from chimneys, raindrops falling, and many more.</p>
<p>This means you can get over 1 million sprites running on modern devices. That's a lot! A 4K display only has 8.3M pixels, and a more common resolution of 1280x720 has less than 1M pixels - one pixel per sprite. That quickly dissolves into meaningless noise if you try to push the limits. I know, I've done it.</p>
<blockquote>
<p>You can actually get more than a million sprites. The maximum buffer size seems to be around 8 million, but if you run out, just make a second SpriteGPULayer. High-end machines can handle it.</p>
</blockquote>
<p>The SpriteGPULayer is designed for high efficiency backgrounds. The expected use case is for developers to create static background or foreground layers containing high detail and limited animation. This is common in video game worlds, so we think it's going to be very useful.</p>
<p>The <a target="_blank" href="https://phaser.io/sandbox/X4nXSf53">"Big Forest" demo</a> shows just how much you can do with this technology. It consists of 1.4 million sprites, set up with parallax and cyclic animation. Grass and trees sway, clouds drift by, grains of pollen glint in the light, and plenty more. But this is overkill: the scene is <em>a thousand screens across</em>. It would take you 60 minutes to scroll from one side of the game world to another. 1.4 million sprites is a lot, and every grain of pollen in the entire world is being recalculated every frame. It still runs smoothly.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738713308509/79d638eb-4a0c-4dfa-bc86-473487837478.jpeg" alt class="image--center mx-auto" /></p>
<p>(The Big Forest demo also uses basic procedural generation to place parallax ground layers, alter the weather, grow trees etc. if you like that sort of thing.)</p>
<p>My advice for SpriteGPULayer is to use it efficiently. Don't render a thousand screens of off-screen content - that wastes device power. Consider splitting the scene up into smaller regions which can render efficiently, and use multiple SpriteGPULayers to handle foreground, background, and far background parallax elements. Use it to shift computation off the CPU, to free up processing power for other tasks like physics and AI.</p>
<h3 id="heading-how-it-works">How It Works</h3>
<p>SpriteGPULayer is designed to fix a major performance bottleneck: the CPU-GPU update cycle.</p>
<p>Most Phaser game objects are calculated in the CPU, packed into buffers, and sent to the GPU to render. The problem is, CPU computation is very limited in JavaScript. We're limited to a single thread, so we have to do every calculation one after the other. Then when we're done, we have to send the data to the GPU, a process which takes more time while we just wait. This all adds up to a lot of time per frame, limiting how much we can render.</p>
<blockquote>
<p>These problems have solutions. JavaScript has access to WebWorkers, and GPU updates are far more efficient with APIs like WebGPU. Unfortunately, WebWorkers have too much overhead for our current architecture, and WebGPU is not yet optimized enough to meet our performance needs.</p>
</blockquote>
<p>What if we didn't have to use the CPU?</p>
<p>SpriteGPULayer packs data into buffers and sends them to the GPU <em>at construction time</em>. The data doesn't need to be updated. All the computations which are normally done on the CPU are instead handled by a vertex shader on the GPU. Because shaders are highly parallelized, all the work that takes a long time gets split up and run at the same time. This means we can run orders of magnitude more rendering work, and never run out of time.</p>
<blockquote>
<p>You can update SpriteGPULayer data at runtime. It's just as efficient as ordinary Phaser objects. But because SpriteGPULayer can use so many more sprites, you may find that updates take so long the game stutters. The object has some optimizations for quickly updating contiguous regions of buffer memory, but even so, you should be cautious with updates to large layers.</p>
</blockquote>
<p>Parallel GPU shader operations are so efficient that they will never be a bottleneck. The actual bottleneck is fill rate: how many pixels are drawn to the screen. The GPU has to handle every pixel on every sprite on the screen, even if it's behind another sprite. (Pixels not on the screen are not calculated.) Don't draw too many overlapping sprites, or performance will drop.</p>
<p>This all comes at a cost. If we don't update the data, we can't change it in response to input, physics, or other "dynamic" systems. A highly detailed background that doesn't move is pretty boring, even if it has parallax.</p>
<p>So I implemented an animation system. In fact, SpriteGPULayer supports two kinds of animation: frames and properties.</p>
<p>Frame animation is the ordinary kind of animation you see on sprites. A series of frames are displayed in sequence. SpriteGPULayer supports basic frame playback: it cycles frames at a fixed interval.</p>
<p>Property animation is more like tweens. You set the base value of properties like <code>x</code>, <code>y</code>, <code>alpha</code>, or <code>tintBlend</code>. You can also set values like amplitude, duration, delay, and animation type. The SpriteGPULayer vertex shader uses these values to calculate the vertex positions at a given moment in time, without recording state or computing multiple steps. THis is enough to support a great variety of lifelike animations.</p>
<p>I added animations which correspond to most tweens in Phaser. Because <code>Elastic</code> requires more parameters, it had to be left out. The <code>Stepped</code> tween supports extra parameters, but we skip them for the same reason. Also check out the unique animation type, <code>Gravity</code>, which simulates objects falling - perfect for effects like fountains, explosions, etc. You don't have to use Gravity just for the Y position; you could apply it to other properties to simulate some process which accelerates or decelerates over time.</p>
<p>There are a <em>lot</em> of technical details in how this fits together, but I don't want to be here all week, so I'll just skim the surface.</p>
<p>WebGL has some hard limits on how much data we can use per vertex. We assume that we have access to 16 vertex attributes. An attribute is a vector of 4 32-bit floating-point numbers, so in practice we can use 16x4=64 numbers to describe a sprite. As you saw above, we define a property with base, amplitude, duration, delay, animation type, and a 'yoyo' flag to control how animation repeats. That's 6 numbers per property, so we could have up to 10 properties in our program. We have (let's see...) 14.</p>
<p>Obviously we're doing something clever to exceed the hardware limitations.</p>
<p>Many properties aren't animated. For example, we have per-vertex color tint, just like regular Sprites; but we don't animate it. Animating 4 8-bit color channels inside a 32-bit value is pretty complicated! Instead we have a single animated <code>tintBlend</code> property which controls how much tint every vertex receives. This is enough to give decent control of colors.</p>
<p>And many properties are packed together, using the 32-bit number space to store more data than intended. For example, when you use the Gravity animation, we replace the animation amplitude with velocity and acceleration. How do we fit two numbers into a single number? Well, we make some precision trade-offs. We round down the velocity to an integer value, which is almost always good enough. Then we store acceleration as a fraction. There's a global gravity value for the whole layer, and this fraction multiplies that to get an individual gravity value for the sprite. Then we just add the integer and the fraction together to get a single number, which we store. On the GPU, we reverse the process to turn one number back into two. This might not be super efficient, but it's fast enough and gives us all the functionality we need! While there are limits on floating-point number precision, you've still got 23 bits to split between velocity and acceleration.</p>
<p>I haven't even mentioned how we use texture data to store frame animations. We really squeezed every drop of functionality out of this system. I'm pretty proud of the result, and I hope it helps you make better games.</p>
<h2 id="heading-shader-guide">Shader Guide</h2>
<p>The <a target="_blank" href="https://phaser.io/tutorials/phaser-4-shader-guide">Shader Guide draft</a> tells you all about shaders and filters in Phaser 4. Log into the Phaser site and give it a look! This is a very powerful system for managing shader code. It also gives solid examples to get you writing your own shaders. We've already seen developers creating cool experiments, so I guess it works!</p>
<h2 id="heading-texture-orientation">Texture Orientation</h2>
<p>After examining various factors around external renderer compatibility, it became clear that we were handling textures wrong. GL texture coordinates start in the bottom-left, unlike the top-left of web standard image formats. We previously handled this with some options inside the render system, storing images in top-left format and doing a "final flip" to present the frame to the player. But when using the <code>Extern</code> object to add renders from ThreeJS and other engines, it was no longer quite good enough.</p>
<p>So I flipped texture representation. Now all our texture systems are bottom-left oriented.</p>
<p>This should not change anything for the user. Only if you're handling texture coordinates within the render system do you need to invert your Y axis.</p>
<p>However, for users of <strong>compressed textures</strong> such as PVR or KTX files, you must invert your texture coordinates for them to work properly in Phaser 4. This is a simple option in the software used to create these files. If you are using assets created for other systems, they are probably oriented this way already, because it is the default. We don't want you to have to create non-standard textures just for Phaser!</p>
<p>A summary of steps for creating high quality compressed textures for Phaser 4:</p>
<ul>
<li><p>Generate a texture atlas in TexturePacker, and save it as PNG.</p>
</li>
<li><p>Use ImageMagick to lighten the image for hardware compression on the Web: <code>magick input.png -set colorspace RGB -colorspace sRGB output.png</code></p>
</li>
<li><p>Use TexturePacker or PVRTexTool to save the lightened image as the following texture formats, in a PVR or KTX container, <em>ensuring that the Y axis is flipped</em>:</p>
<ul>
<li><p>ASTC sRGB UNorm 4x4 (or another sample level - don't select a "signed" variant!)</p>
</li>
<li><p>ETC2 sRGBA</p>
</li>
<li><p>PVRTC v1</p>
</li>
<li><p>S3TC DXT5 sRGB (also known as BC3)</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-fixes-and-tweaks">Fixes and Tweaks</h2>
<p>In Beta 5, I fixed DynamicTexture. It broke after we removed some theoretically dead code in Camera.</p>
<p>After the Beta 5 release, I added destroy handling for filters, including a setting to preserve filter controllers for reuse (not recommended, but possible if you know what you're doing). I also removed more dead code, this time from places where it was interfering with nested transforms, helping apply filters to objects inside Containers. The last thing I did was add filter support to Layer, which slipped through the cracks because it's the only game object that's not a GameObject. This is why code duplication is bad, kids! It's not just extra package size; it's a maintenance issue.</p>
<h2 id="heading-next-week">Next Week</h2>
<p>I've got a pile of bugs and tweaks to work through to get Phaser 4 ready to roll. But we're close! We had an absolutely titanic week last week, and beta feedback continues to be excellent. Thanks to all the people who are helping us create the best Phaser there's ever been.</p>
<hr />
<h1 id="heading-share-your-content-with-18000-readers">Share your content with 18,000+ readers</h1>
<p>Have you created a game, tutorial, code snippet, video, or anything you feel our readers would like?</p>
<p>Please <a target="_blank" href="mailto:content@phaser.io">send it to us</a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738713366378/a17b3093-ad02-4bfc-ad5e-b449c09a45df.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 214]]></title><description><![CDATA[We’ve a feature-packed issue to round out the month of January. Let’s go …
🚀 Phaser v4 Beta 4 Released

The fourth beta release of Phaser 4 delivers essential fixes to the Arcade Physics and sees multiple improvements in the rendering engine with a ...]]></description><link>https://phaser.world/phaser-world-issue-214</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-214</guid><category><![CDATA[Game Development]]></category><category><![CDATA[WebGL]]></category><category><![CDATA[canvas]]></category><category><![CDATA[phaser]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Mon, 27 Jan 2025 18:19:38 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737997883194/1b6c202c-f5ff-451f-8ef5-5c2face32816.png" alt class="image--center mx-auto" /></p>
<p>We’ve a feature-packed issue to round out the month of January. Let’s go …</p>
<h2 id="heading-phaser-v4-beta-4-released">🚀 Phaser v4 Beta 4 Released</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/phaser-v4-beta-4-released"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737997936788/8af8b742-d73f-440e-b74e-570117e8c2e9.jpeg" alt class="image--center mx-auto" /></a></p>
<p>The fourth beta release of Phaser 4 delivers essential fixes to the Arcade Physics and sees multiple improvements in the rendering engine with a streamlined RenderSteps initialization process and corrected Layer implementation.</p>
<p>We're on the final path to the full Phaser 4 release. We've identified a couple more issues that need resolving, but aside from this it's mostly tidying up and lots and lots of testing left. If you find anything broken, please tell us in Discord or open an issue on GitHub. As it stands, we will have the final version out during February 2025.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/phaser-v4-beta-4-released">Read More</a></p>
<h2 id="heading-multiplayer-connect-four-game-with-phaser">📺 Multiplayer Connect Four Game with Phaser</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/multiplayer-connect-four-game-with-phaser"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737998105355/965e80ed-e767-4b4a-9179-ee302d92333f.png" alt class="image--center mx-auto" /></a></p>
<p>Scott writes: “Welcome to another exciting tutorial where we combine coding and fun. Today, we’ll learn how to build a real-time multiplayer Connect Four game using the powerful Phaser 3 framework and Playroom Kit.”</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/multiplayer-connect-four-game-with-phaser">Watch Tutorial</a></p>
<h2 id="heading-memoriki">🐸 Memoriki</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/memoriki"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737998193380/0545b7a0-20c2-469a-83f4-99ca9b170e6e.png" alt class="image--center mx-auto" /></a></p>
<p>Evgenii Starostin emailed to tell us all about their new game for kids, Memoriki. The concept is simple: Tap the matching pairs to remove them from the board and try to clear it before the timer runs out. With each successful round, you reveal a little bit more of a cute animal, such as a frog or octopus. And, of course, with each round, more pairs are added, making it harder to finish on time!</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/memoriki">Play Memoriki</a></p>
<h2 id="heading-smooth-pixel-art-cameras-in-phaser">🎥 Smooth Pixel Art Cameras in Phaser</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/smooth-pixel-art-cameras-in-phaser"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737998289581/02299be7-e578-4254-af8a-0c66c2da7949.png" alt class="image--center mx-auto" /></a></p>
<p>Josh Morony has been making Phaser content for years and is currently working on a really interesting-looking bushcraft survival game. In a recent video dev log he explains how he managed to achieve perfectly smooth camera scrolling, while still maintaining the pixel art effect he wanted for his game.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/smooth-pixel-art-cameras-in-phaser">Watch the video</a></p>
<h2 id="heading-the-wildfires">🔥 The Wildfires</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/the-wildfires"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737998377103/035988d7-3490-4890-8c54-34b06204c775.jpeg" alt class="image--center mx-auto" /></a></p>
<p>A new indie game puts players in the cockpit of firefighting aircraft, challenging them to protect communities from advancing wildfires. Developed in Phaser by the Home Team Game Dev team, with Victor Debone as lead developer, The Wildfires offers an engaging mix of resource management and aerial firefighting action.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/the-wildfires">Play The Wildfires</a></p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737998461345/0e4178ff-47df-482e-9d49-1884f2b884c7.png" alt class="image--center mx-auto" /></p>
<p>Another week, another team Dev Log!</p>
<h2 id="heading-rich-cto-amp-founder">🧑‍💻 Rich - CTO &amp; Founder</h2>
<p>Right now, the Studio feels like a kitchen with multiple dishes in the oven, all about to finish baking at the same time. Phaser v3.88 is shaping up to be a nice bookend to the v3 legacy, a version that has served us well for many years but has served its time. Phaser v4 is also in the final stages of prep and we released another new beta version this week for you to use.</p>
<p>Ben also wrote a truly massive Phaser 4 Shader Guide. This is still in draft mode and needs some proofreading and technical checking. Still, it will otherwise act as an invaluable resource for anyone who wants to make the most of the powerful new filter system inside of Phaser Beam. Our aim is to have this ready for you all next week.</p>
<p>Phaser Editor (as you’ll see below) is having a bunch of great Box2D tools added to it, so you can visually lay out Box2D bodies and shapes and then experiment with them directly in the Editor.</p>
<p>We’re also very close to the release of Phaser Launcher. You can see a sneak peek of this in Francisco’s dev log this issue. I’m really looking forward to this as it addresses a massive and constantly reoccurring theme we hear time and time again: “I’ve downloaded Phaser, now what?”. Typically you have to tell them to go away and install VSCode some variation of LiveServer and then grab a template to start from, plus have the docs open, maybe a tutorial or book and to just ‘figure it out’ themselves. And that’s just to get started with Phaser dev.</p>
<p>We’ve encountered this problem <em>so many times</em> in our Discord that we decided to do something about it. How many times, exactly? Well, during Q3 2024, we exported all of the text from our Discord server and then pushed it through some custom scripts to analyze it. And we were shocked at how many beginners didn’t have an IDE or server or clue what to do. Hundreds upon hundreds of them over the past few years. When you factor in that those who come to our Discord asking for help are a tiny % of those trying to get started and failing at the first step, that’s a massive signal that shouldn’t be ignored and cannot be solved via documentation alone.</p>
<p>Phaser Launcher is our solution for beginners to be able to start coding without having to worry about setting up <em>anything</em>, plus have all the resources they need at their fingertips. Once they’re proficient, they can level up to VS Code and/or Phaser Editor, but beginners, too, should be afforded an easy path to web game dev, and Launcher will provide that.</p>
<p>Aside from all these projects, most of my development time has been spent working flat-out on the Responsive Game Plugin. This has evolved through several internal iterations but is starting to take shape and will hopefully address another one of the frequently asked topics we see in our Discord: How to create a mobile/desktop responsive game! More details on this next week.</p>
<h2 id="heading-zeke-phaser-v388">🧑‍💻 Zeke - Phaser v3.88</h2>
<p>Happy Chinese New Year of the Snake (if you’re celebrating). I will be skipping the coming week’s dev log due to being away for the week to celebrate Chinese New Year with my family.</p>
<p>On to the dev log =) Last week, I focused my attention on resolving as many GitHub issues as possible before Phaser 3.88 release.</p>
<p>Rather than a long list of single resolved issues, I’ve grouped together the issues into categories:</p>
<h3 id="heading-physics-bodies">Physics bodies</h3>
<p>Both arcade and matter physics had slightly different issues when setting its body size. Matter physics bodies now has a proper getter / setter function to scale its game object attached physics body.</p>
<p>With arcade physics, adding an existing DOM element to the physics world initially uses the <code>getBoundingClientRect()</code> native browser function to accurately calculate the size of the DOM element (including padding and border). While this works fine if the goal is to create a precise user interface, it doesn’t quite work so well when it comes to physics bodies. To resolve this, the clientWidth and clientHeight is used instead to return only the element's content box.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737998760135/8373efcf-985e-4f3c-b126-82a15bb5d6ea.jpeg" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Left: Using clientWidth and clientHeight to generate the physics bounding box</p>
</li>
<li><p>Right: Using <code>getBoundingClientRect()</code> to generate the physics bounding box</p>
</li>
</ul>
<h3 id="heading-tweens">Tweens</h3>
<p>Adding a <code>persist: true</code> to a Tween configuration object does not guarantee a Tween would not be destroyed after it completes. This has been fixed and all Tweens with <code>persist</code> set to <code>true</code> can be replayed infinitely.</p>
<h3 id="heading-text-letter-spacing">Text letter spacing</h3>
<p>Adding custom letter spacing when a text game object had wrapping enabled showed text going beyond the width of the set boundary. I reworked the letter spacing calculation to take into account the wrap width so it works correctly.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737998773571/b1643768-9597-431e-b42a-be2ab367c763.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Top-left: Without letter spacing</p>
</li>
<li><p>Bottom-left: With reduced letter spacing</p>
</li>
<li><p>Top-right: With added letter spacing</p>
</li>
<li><p>Bottom-right: Word wrap after letter spacing calculation correction</p>
</li>
</ul>
<h3 id="heading-tilemaps">Tilemaps</h3>
<h4 id="heading-tiledimagecollection">TiledImageCollection</h4>
<p>TiledImageCollection has been improved to take into account different sized images in a collection. Also improved are the positioning of the rendered images and debug rendering of tiles to correctly show which tiles are being occupied by each tile image.</p>
<p>Layout done in Tiled Map Editor</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737998792113/c8a6c06f-67a7-4476-9793-55dafed25400.png" alt class="image--center mx-auto" /></p>
<p>Tiled Image Collection in Tiled Map Editor</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737998805480/77c0d7b7-8ba9-47e4-896f-fe87922f5d5b.png" alt class="image--center mx-auto" /></p>
<p>Result in Phaser 3 with RenderDebug enabled</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737998817149/69d41a9d-8908-4bec-b4da-3deb8f8fca5b.png" alt class="image--center mx-auto" /></p>
<h4 id="heading-hexagonal-maps-hexsidelength">Hexagonal maps <code>hexSideLength</code></h4>
<p>Final issue addressed is the positioning of tiles in hexagonal maps. Previously, for each tile you had to manually set the <code>hexSideLength</code> value and force each tile to update by calling <code>updatePixelXY()</code>. Missing this key step would cause tiles to be placed incorrectly as in the screenshot below:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737998833061/175f6a46-9cb8-4643-8b38-adf6615c6efc.png" alt class="image--center mx-auto" /></p>
<p>After some tweaking, each tile automatically inherits the <code>hexSideLength</code> property from the loaded map data file and correctly calculates its own position:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737998845772/4fd01d75-e41b-42b3-93c2-ebea854cb80a.png" alt class="image--center mx-auto" /></p>
<p>That’s all the major updates for the past week. Catch up in 2 weeks time! Have a good week ahead.</p>
<h2 id="heading-can-discord-activities-tutorials">🧑‍💻 Can - Discord Activities Tutorials</h2>
<p>This week felt like a martial arts match with Discord and server connections. Integrating monetization in a sandboxed environment while preparing for production brought hurdles like port management, proxy issues, permissions in a test/production mode, and the difficulty of debugging in a sandboxed environment for production. Logging proved essential in navigating these challenges.</p>
<h3 id="heading-key-takeaways">Key Takeaways:</h3>
<ul>
<li><p>Sandbox isn't perfect: Testing real-world conditions earlier is crucial.</p>
</li>
<li><p>Logging is essential: Detailed logs made troubleshooting manageable. Despite using Discord's developer edition, you might not get all the response that you will need! You need to think alternative ways to manage.</p>
</li>
<li><p>Automation saves time: Automated scripts for testing ports and URLs were invaluable. Tools are our biggest friends!</p>
</li>
</ul>
<p>The core monetization flow is now functional, which soon to be released!</p>
<h3 id="heading-next-steps">Next Steps</h3>
<p>The next step is making sure it works for everyone and polishing the app further. A tough week, but progress feels rewarding!</p>
<p>Till next week, keep your pixels pristine and your sanity intact everyone!</p>
<h2 id="heading-francisco-phaser-launcher">🧑‍💻 Francisco - Phaser Launcher</h2>
<p>Hello everyone,</p>
<p>This week, I've been focused on adapting Phaser Launcher to the new design. There isn't much to say about this task since the adaptation process is quite repetitive for each component.</p>
<p>After laying the groundwork last week by installing new packages such as Tailwind and other animation libraries, the focus now is on reviewing each component individually.</p>
<p>The process involves:</p>
<p>Analyzing the new design compared to the existing one. Discussing how the new design interacts with the current implementation. Integrating the new design into the application. Verifying that everything works as expected. Although it may seem like a straightforward process, ensuring a smooth transition while maintaining functionality requires attention to detail.</p>
<p>Here is a sneak peek of Phaser Launcher in action!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737999023606/2fc3436f-4872-419c-98e1-f97d80a4f837.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-arian-phaser-editor">🧑‍💻 Arian - Phaser Editor</h2>
<p>Hello!</p>
<p>I've already broken the ice with Box2D! This week I've made significant progress with implementing the Box2D tools for Phaser Editor. This is a particularly difficult task, since Box2D's API is independent of Phaser and has a very different style. The editor's scene editor is very closely tied to how Phaser has designed the interface and object hierarchy, so we've had to make some adaptations to incorporate the Box2D API.</p>
<p>In order to incorporate the Box2D API into the editor, you have to affect several aspects of the scene editor, such as code generation, serialization, and object modification tools, such as Translate, Rotate, Resize, etc... However, after several days of mulling over the Box2D API, reviewing other editors such as Unity, Cocos, and Godot, I've got a clearer idea of ​​how we can implement it in Phaser Editor.</p>
<p>Object Hierarchy</p>
<p>In the editor you can attach a physical body to any Phaser game object, but you can also place separate bodies in the scene. You can add shapes to each body. So far, I've only implemented a box-shaped shape. Unlike the other scene elements, Box2D elements are simulated. We don't use Box2D itself in the editor, so we can use a model that is more in line with the editor's internal interfaces.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737999151144/a45ab3ff-68cc-4a63-a107-b76467dbc833.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737999172763/3315e98d-ac87-4d93-a189-7608a295a109.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737999182414/8a685116-6686-419f-9938-a1aafc31466a.png" alt class="image--center mx-auto" /></p>
<p><strong>Code Generation</strong></p>
<p>Phaser Editor uses a JSON format to represent scenes in the editor, from which it generates JavaScript code that will be part of your game. With Box2D it's no different, the editor generates the code to create the bodies, shapes, and other elements of the Box2D API. Here's an example of how to generate a body with a shape that is attached to a "platform" game object:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737999230066/032f4bc4-401b-4a2c-aee8-1b56e09dd5d8.png" alt class="image--center mx-auto" /></p>
<p>As you can see, it's not a small amount of code, but it's readable and understandable once you get to know the Box2D API a bit more. Of course, this is all in an early stage of development and can change.</p>
<p>A huge challenge for code generation is adapting the Box2D API to Phaser Editor prefabs. Phaser objects are based on properties that can be changed at any time, and this is essential for the editor's prefab system. In the Box2D API, this is not so much the case, and rather the objects are configured initially. This different form of API will require more work in the code generation of the prefabs. This is something I'm still thinking about, but in the end we'll get a much more flexible system.</p>
<p>There's still a lot to do, but the hardest part is over, which is having a clear idea of ​​what we want to do and how we're going to do it. Here is a quick screenshot of the tool in action. See you soon!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737999245253/0ad310a9-0951-41a9-9e6c-8c2d0a36db0c.gif" alt class="image--center mx-auto" /></p>
<hr />
<h1 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737999290296/a5bfdf79-a3f1-4978-962a-532d198c721c.png" alt class="image--center mx-auto" /></p>
<p>27th January, 2025 - Ben Richards</p>
<p>Last week the release of <a target="_blank" href="https://phaser.io/news/2025/01/phaser-v4-beta-4-released">Phaser 4 beta 4</a>, and several bug fixes.</p>
<p>I fixed an issue where padding in internal filters would cause the framebuffer to be oversized. This was ultimately due to a mistake while handling rectangle data. You can represent a rectangle in one of two ways. Use the top left corner and the bottom right corner; or use the top left corner and the width and height. When the top left corner is 0x0, which is the default situation, these representations are the same. But when the corner changes, the representations start to describe different sizes. I was using the wrong representation. I've improved documentation to prevent this from happening again.</p>
<p>I fixed an issue where <code>TilemapLayer</code> and <code>TileSprite</code> would interfere if they were together in a scene. This was due to an oversight in the shared shader that these game objects use: it failed to recognize a change in settings, so it kept using a single version of the shader. This was only suitable for one of the two object types, so the other would break. I fixed it to recognize changes and use the correct shader variant for each object.</p>
<p>The following updates were made after the release of beta 4.</p>
<p>I added smart handling of round pixels. The <code>roundPixels</code> option snaps vertices to integer values, ensuring that texture filtering does not apply unwanted sub-pixel blending to pixel art. We've put in a lot of effort to get this as accurate as possible, including vertex bias and the <code>smoothPixelArt</code> game option. However, it only makes sense for axis-aligned, unscaled graphics. When an object is rotated or scaled, its vertices do not naturally align with integer values. Forcibly rounding the coordinates causes the object to warp and flicker by a single pixel, which is very noticeable.</p>
<p>So I added logic to check whether an object would be axis-aligned and unscaled, and only activate <code>roundPixels</code> if it met the criteria. This was not quite as straightforward as checking rotation and scale! An object can have a "parent transform" which alters its transformation matrix. For example, a transformed camera, or <code>Container</code>, can combine their transforms with that of the object. My final check looks at the values of the transformation matrix itself, which should be in the identity state:</p>
<pre><code class="lang-javascript"><span class="hljs-number">1</span> <span class="hljs-number">0</span>
<span class="hljs-number">0</span> <span class="hljs-number">1</span>
</code></pre>
<p>That matrix looks very simple if you're used to 4x4 matrices used in 3D graphics! And it is. We actually use a 3x3 matrix for 2D work, but the other parts are relevant only to translation.</p>
<p>Finally, I added support for the <code>resolution</code> property on <code>TextureSource</code>. This property exists in Phaser 3 but is not connected to anything. In Phaser 4 it is now connected to the <code>resolution</code> property of <code>TextStyle</code>, so when you increase text resolution it simply increases sharpness instead of increasing the size of the text.</p>
<p>Coming soon: <strong>The Phaser 4 Shader Guide!</strong> This is currently already over 4000 words and in draft review. It will cover all the important steps, rules, and suggestions for making powerful shaders and filters in Phaser 4. More details about this next week.</p>
<hr />
<h1 id="heading-share-your-content-with-18000-readers">Share your content with 18,000+ readers</h1>
<p>Have you created a game, tutorial, code snippet, video, or anything you feel our readers would like?</p>
<p>Please <a target="_blank" href="mailto:content@phaser.io">send it to us</a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737999484878/2456144b-1f89-44cb-b2e5-0a467b62f3fe.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 213]]></title><description><![CDATA[Welcome to the latest issue of Phaser World. We’ve some great community tutorials and games in this issue. It’s always inspiring to see developers achieve their dream of releasing their game on Steam (even in beta form), and we’ve another banger this...]]></description><link>https://phaser.world/phaser-world-issue-213</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-213</guid><category><![CDATA[Game Development]]></category><category><![CDATA[WebGL]]></category><category><![CDATA[canvas]]></category><category><![CDATA[phaser]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Tue, 21 Jan 2025 16:38:06 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737475354374/b0330803-53dc-4142-8b90-dc8479016358.png" alt class="image--center mx-auto" /></p>
<p>Welcome to the latest issue of Phaser World. We’ve some great community tutorials and games in this issue. It’s always inspiring to see developers achieve their dream of releasing their game on Steam (even in beta form), and we’ve another banger this week in the shape of Veliri, the awesome work of a solo dev.</p>
<h2 id="heading-create-tripeaks-solitaire-with-phaser">♥️ Create TriPeaks Solitaire with Phaser</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/create-tripeaks-solitaire-with-phaser"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737475434499/c01dffe3-e814-482d-aba5-2553a56a28dc.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Discover how to build a TriPeaks Solitaire game using Phaser JS, the powerful HTML5 game framework. This step-by-step tutorial guides you through the process of creating a fully functional card game, complete with smooth animations and interactive features.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/create-tripeaks-solitaire-with-phaser">Watch Tutorial</a></p>
<h2 id="heading-himegotchi">👸 Himegotchi</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/himegotchi"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737475496819/1578ccfd-2bc6-40fa-8197-d994215577cf.png" alt class="image--center mx-auto" /></a></p>
<p>You are a rich, ferocious dragon, and you have just kidnapped the most beautiful princess in the kingdom; what a great position to be in as a dragon.</p>
<p>The princess is a feisty one and has a lot of demands, keep her happy and don't let the princess escape!</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/himegotchi">Play Game</a></p>
<h2 id="heading-tile-based-platformer-tutorial">🧱 Tile Based Platformer Tutorial</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/tile-based-platformer-tutorial"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737475558730/e91f8d10-48bb-4089-a124-889c1881d7dd.png" alt class="image--center mx-auto" /></a></p>
<p>Emanuele Feronato is back with a new tutorial all about building a tile-based platformer with slopes and no physics engine in Phaser.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/tile-based-platformer-tutorial">Read Tutorial</a></p>
<h2 id="heading-ai-for-texture-generation-in-phaser">🤖 AI for Texture Generation in Phaser</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/ai-for-texture-generation-in-phaser-3"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737475673983/bbd84627-47cd-497e-bc11-6a7a8600c4ed.jpeg" alt class="image--center mx-auto" /></a></p>
<p>A recent article on Restack.io explores the integration of AI-driven texture generation within Phaser games. The piece delves into how AI can dynamically adjust game difficulty, generate procedural content, and enhance non-player character behaviors.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/ai-for-texture-generation-in-phaser-3">Read Tutorial</a></p>
<h2 id="heading-veliri-planet-of-machines">🚀 Veliri: Planet of Machines</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/veliri-planet-of-machines"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737475762999/b7bd84db-8e18-4dc4-9fe6-48d0ff807dc4.jpeg" alt class="image--center mx-auto" /></a></p>
<p>TrashPony's new game Veliri offers players a unique blend of economic simulation and sci-fi warfare in an ever-evolving online world. Set on a distant planet, players take control of synthetic war machines competing for resources and influence across a dynamic battlefield.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/veliri-planet-of-machines">Play Game</a></p>
<h2 id="heading-phaser-box2d">📺 Phaser Box2D</h2>
<p>In case you missed the announcement, our new video covers what’s possible with the new Phaser Box2D release:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=EkWihSNLuwI">https://www.youtube.com/watch?v=EkWihSNLuwI</a></div>
<p> </p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737475950847/f9c90065-dd99-498d-b1b5-075b04b6d814.png" alt class="image--center mx-auto" /></p>
<p>A brief Dev Log this week as most of the team had Monday off and forgot to write their entries! Normal service will resume next issue 😅</p>
<h2 id="heading-rich-cto-amp-founder">🧑‍💻 Rich - CTO &amp; Founder</h2>
<p>Zeke and I have been cracking through the Phaser issues on GitHub, preparing the v3.88 release. We’ve closed loads of them, and it’s shaping up to be a nice little ‘farewell’ version before we join Ben in completing Phaser v4. We will continue to resolve issues in v3 going forward as long as they aren’t rendering-related, which is what v4 is for, so it won’t be the final release of version 3 ever, but we really do want people to move to Phaser 4, which is why we’ve kept the API as in-sync as we possibly could.</p>
<p>I started the week by tidying up the Phaser Discord. Various old, zombie-like channels have been removed, some others have been renamed, and I have tidied up the channel categories a lot. Also, I ditched the emojis at the front of the channel names. It makes it look a bit less colorful, but it also makes it much easier to read on the Discord mobile app.</p>
<p>If you’re not part of the Phaser Discord, <a target="_blank" href="https://discord.gg/phaser">please join here</a>!</p>
<p>I’ve also been busy working on the new <em>Responsive Layout Template</em>. This is a comprehensive Phaser template with a set of powerful additional functions that make it significantly easier to work across varying mobile resolutions. It supports full-screen displays, the ability to pin the UI into the corner of the screen, as well as a ‘base game size’ which you can, well.. ‘base’ everything on.</p>
<p>We’ve seen this question come up so many times in our Discord and from our customers that we figured it made sense to create an official response to it. There are lots of different ways to solve it, too, so I had to pick one that felt flexible enough to cater for the most common game types. It was also somewhat depressing to see that even with the Screen Orientation API that browsers provide, there is no consistency between them. And, as always, iOS makes the API next to useless by reporting incorrect dimensions during the event and not implementing the rotation locking part of the API. Such is life.</p>
<p>This template should be ready within the next few weeks and free to all subscribers.</p>
<h2 id="heading-francisco-phaser-launcher">🧑‍💻 Francisco - Phaser Launcher</h2>
<p>Hello everyone,</p>
<p>This week, we received a new design for the Phaser Launcher, and I've been working on analyzing the code for the new design and preparing our application so it can integrate the new design without needing a complete rewrite.</p>
<p>Additionally, as we move closer to wrapping up the software to prepare for version 1, I’ve added a split panel to the editor, something that allows users to dynamically resize the panels, which is common in this type of software.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737476262052/e7383142-fbab-4f67-a5a8-cdf87b202aef.gif" alt class="image--center mx-auto" /></p>
<p>I’ve also been thinking about the first template we’ll provide in version 1. We believe this structure is quite user-friendly for the initial release (though it might change in future versions).</p>
<p>The structure is as follows:</p>
<pre><code class="lang-javascript">-assets
|   |-src
|   |   |-scenes/
|   |   |    |-Main.js
|   |-main.js
-index.html
-project.zero
</code></pre>
<p>In the <strong>assets</strong> folder, you’ll store all your assets, and this folder will be read by the browser media. Inside <strong>src</strong>, you’ll find your game’s code, and within <strong>src/scenes</strong>, you’ll have your scenes. In <strong>src</strong>, there’s a file named <strong>main.js</strong>, which will serve as the entry point for your game’s configuration. As you might have noticed, there’s also a file named <a target="_blank" href="http://project.zero">project.zero</a>. This file is meant to be a metadata file used by our editor. We might also include a file for your game’s icons, but that’s still under discussion with the team.</p>
<hr />
<h1 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737476016689/e23f8426-454d-40e2-8dcd-85576e64857a.png" alt class="image--center mx-auto" /></p>
<p>17th January 2024, Ben Richards</p>
<p>This week: Bugfixes! I've been working through issues with Phaser 4 beta, eliminating some interesting problems.</p>
<h2 id="heading-bugfix-1-filter-camera-size">Bugfix 1: Filter Camera Size</h2>
<p>The inimitable Rex Rainbow identified an issue with filters. When an object was placed at a non-integer position, sometimes its camera was 1 pixel too large on the X and/or Y axis. This was visible as a flicker as filters turned on and off: undesirable!</p>
<p>This turned out to be due to the <code>getBounds()</code> method. I was relying on this to generate a rectangle describing the object, and fit the camera to that size.</p>
<p>Why not simply use the object's width and height? Well, not all objects have width and height. For example, <code>ParticleEmitter</code> does not. It has a <code>getBounds()</code> method, however, which measures the region in which particles exist. For this reason, I initially chose to use <code>getBounds()</code> for camera focusing.</p>
<p>However, <code>getBounds()</code> isn't quite correct for this task. It's supposed to be used for axis-aligned bounding boxes, a non-rotated rectangle which contains the entire object. To measure game objects, I was setting their transforms back to default, getting the bounds, and re-transforming them back into place. In retrospect, this was a sign that it was a poor fit.</p>
<p>The bug itself came from floating point calculations. A sprite which should be 64x64 was sometimes measured as 64x64.000000003 (or some large number of 0s), and this was rounded up to 64x65. This can happen when the position is not comfortably aligned with integers.</p>
<p>I experimented with more temporary transformations, attempting to zero out the position as well. But this didn't work for all game objects - again considering ParticleEmitter, moving the emitter doesn't move the particles, so the bounds don't move. But with a sprite, the bounds <em>do</em> move when the position changes. This means that different objects behave differently - and that makes everything unpredictable. We can't produce confident results like this.</p>
<p>So I changed my approach completely. I started using width and height instead.</p>
<p>Didn't I just explain why those are no good? Yes. But everything is a compromise, and here I was able to find a workable trade-off. Width and height are no good for game objects like ParticleEmitter - but they are perfect for ordinary sprites, with no floating point errors.</p>
<p>For objects that cannot use width and height, we use a fallback: the "external context". This was already implemented for objects that have no <code>getBounds()</code> method. The external context is just the camera in which the external filters are rendered, often the base game screen itself.</p>
<p>This has two consequences.</p>
<p>First: objects without width and height now have no practical difference between internal and external filters, as they use the same context.</p>
<p>Second: some objects which used <code>getBounds()</code> to get a precise internal context will now use the fallback, losing that precise internal context. ParticleEmitter is affected. We don't think this will have a major impact. In fact, it may improve visual consistency, as these are usually dynamic objects which change size rapidly, and many filters take effect in steps based on the size of the context. The external context is generally of fixed size, so these filters will behave consistently.</p>
<p>The update also removes several function calls from the filter camera focus method. This simplifies and improves performance in the function. Performance isn't important here: filters initiate one or more draw calls, which are vastly more expensive than a single function of this kind. But the simplification is always good.</p>
<h2 id="heading-bugfix-2-camera-zoom-reversion">Bugfix 2: Camera Zoom Reversion</h2>
<p>The equally inimitable Samme identified an issue with scaling filtered objects. When an object scaled on a single axis, the filter render process rendered it inaccurately. It cut off the sides on one axis, and opened margins on the other axis.</p>
<p>At first, I had no idea what was happening. I thought I might have overlooked something in the filter camera zoom settings, or made a mistake in multiplying matrices in the correct order. Some of my tweaks fixed one axis, but for no apparent reason, and the other axis continued being wrong.</p>
<p>Once I started looking at the raw matrix data, however, I noticed something. The transform matrix for the filter camera was symmetrical.</p>
<p>That didn't seem right. If I scaled an object by 2x1, I shouldn't see a matrix like this:</p>
<pre><code class="lang-javascript"><span class="hljs-number">1.5</span> <span class="hljs-number">0.0</span>
<span class="hljs-number">0.0</span> <span class="hljs-number">1.5</span>
</code></pre>
<p>Where does 1.5 come from? Those positions in the matrix are supposed to be scale factors (when there's no rotation or skew). When scaling by 2x1, I should see 2 and 1 in those slots.</p>
<p>Then I remembered an old commit. Years ago, camera zoom was a single value - but then it got split up into X and Y components. The single value still exists, but it's not a permanent value; <code>Camera.zoom</code> just returns the <em>average</em> of the X and Y components.</p>
<p>And the average of 2 and 1 is 1.5.</p>
<p>Obviously, the camera was using <code>zoom</code> somewhere, not <code>zoomX</code> and <code>zoomY</code> as intended. And indeed, it was right there.</p>
<p>When we merged the new Beam renderer into Phaser a couple of months ago, we accidentally introduced a regression in the Camera code. One specific function started using <code>zoom</code> again. This meant that <em>all</em> cameras could no longer scale on X and Y axes. Fortunately, this is rare, which is why we hadn't caught it yet.</p>
<p>So I fixed the regression, and everything worked again.</p>
<h2 id="heading-next-week">Next Week</h2>
<p>I've got a few more bugs to squash. Then it's time to write the Renderer Guide.</p>
<p>Living in Aotearoa New Zealand, I'm currently enjoying summer. But the holidays are over, and I'm picking up steam again. Phaser 4 is almost ready - and that gives us the foundations for a whole lot of cool new stuff!</p>
<hr />
<h1 id="heading-share-your-content-with-18000-readers">Share your content with 18,000+ readers</h1>
<p>Have you created a game, tutorial, code snippet, video, or anything you feel our readers would like?<br />Then please <a target="_blank" href="mailto:content@phaser.io">send it to us</a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737476072536/4f5dcc4d-9c89-410c-a692-b23fa92ed326.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 212]]></title><description><![CDATA[Happy New Year! It’s not too late to say that, right? This is our first issue of 2025, and we’ve got some great games and tutorials lined up for you, as well as a chunky Dev Log. Dig in …
🤯 Unity-like coroutines in Phaser

SBC Games has published a ...]]></description><link>https://phaser.world/phaser-world-issue-212</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-212</guid><category><![CDATA[Game Development]]></category><category><![CDATA[WebGL]]></category><category><![CDATA[canvas]]></category><category><![CDATA[phaser]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Mon, 13 Jan 2025 17:12:07 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736783771296/2ff38fb1-b3d6-4b13-80c6-7a5659688520.png" alt class="image--center mx-auto" /></p>
<p>Happy New Year! It’s not too late to say that, right? This is our first issue of 2025, and we’ve got some great games and tutorials lined up for you, as well as a chunky Dev Log. Dig in …</p>
<h2 id="heading-unity-like-coroutines-in-phaser">🤯 Unity-like coroutines in Phaser</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/unity-like-coroutines-in-phaser"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736783917493/3eedf5af-a9be-4387-8619-81bc79c345d0.png" alt class="image--center mx-auto" /></a></p>
<p>SBC Games has published a great new tutorial that will be of special interest to those who straddle the Unity / Phaser developer line: "If you are familiar with Unity, you may be used to work with coroutines. These are special methods whose execution can be suspended at specific points and resumed after a condition is met. They are handy for executing a sequence of steps.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/unity-like-coroutines-in-phaser">Read More</a></p>
<h2 id="heading-2048-match-balls">🎮 2048 Match Balls</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/2048-match-balls"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736783970341/e7c36fee-0974-4e30-878e-ac8cc12e652b.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Imagine a world where numbered balls collide and merge, each combination bringing you closer to the magical 2048. This isn't just another matching game – it's a strategic puzzle that tests your aim and planning skills.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/2048-match-balls">Play Game</a></p>
<h2 id="heading-onchain-game-jam">⛓️ Onchain Game Jam</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/onchain-game-jam"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736784631358/5ba70ac1-4844-4b84-83d8-604b4dbe04f1.jpeg" alt class="image--center mx-auto" /></a></p>
<p>The Onchain Game Jam by Bario Entertainment System umbrella is designed to bring talented indie game developers into the onchain gaming economy.</p>
<p>This jam bridges the gap between traditional game developers and decentralized gaming, encouraging creators to explore onchain possibilities while staying true to the creativity and freedom that indie games embody.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/onchain-game-jam">Read More</a></p>
<h2 id="heading-infinite-jumper-tutorial">📺 Infinite Jumper Tutorial</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/metroid-infinite-jumper-phaser-tutorial"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736784745401/33d3b309-6cd9-49ab-8b4d-bf0f3964add3.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Scott Westover is back with a brand new YouTube series: "Today, we’re diving into Phaser Editor v4 to create something really exciting: a retro-inspired infinite jumper game! Think of the classic pixel-art vibes of games like Metroid and Super Metroid—but now, you're building it yourself.</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/metroid-infinite-jumper-phaser-tutorial">Read More</a></p>
<h2 id="heading-bubble-town-quest">🎮 Bubble Town Quest</h2>
<p><a target="_blank" href="https://phaser.io/news/2025/01/bubble-town-quest"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736784814586/2109a70b-30af-46b5-9f04-b30022dfe18d.jpeg" alt class="image--center mx-auto" /></a></p>
<p>It was another idyllic day in Borb Bay. Birds chirped, Borbs laughed and played. Suddenly, a shadow fell over the town. It was a spaceship from outerspace. The Lumps had arrived! And Borb Bay would never be the same again. But who was behind the insidious invasion? It is up to you to find out. Only YOU can banish the Lumps and save Borb Bay from catastrophe!</p>
<p><a target="_blank" href="https://phaser.io/news/2025/01/bubble-town-quest">Play Game</a></p>
<hr />
<h1 id="heading-phaser-studio-developer-logs"><strong>Phaser Studio Developer Logs</strong></h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736784867497/c22a411e-4da1-45b5-b3dc-34e9df512e7b.png" alt class="image--center mx-auto" /></p>
<p>The whole team is back working again, which means we have a nice big Dev Log for this issue!</p>
<h2 id="heading-rich-cto-amp-founder"><strong>🧑‍💻 Rich - CTO &amp; Founder</strong></h2>
<p>This week has been its usual mixed bag of contents! Mostly, I’ve been working on Phaser v3.88, which has been a nice change of pace for me. An interesting side-effect of v3 being so well established is that the issues that come in now are quite esoteric in nature. Some require intense debugging to emulate, others only trip under particular conditions. It makes each one of them more of a challenge but equally more rewarding to close. Hopefully we should only need another week or two of dev before releasing. As with most v3 updates, these primarily address issues rather than dropping big feature bombs.</p>
<p>I also updated the Phaser API docs, so they contain all the current versions, which are available via a drop-down list. This makes navigating specific versions possible.</p>
<p>I’ve also been working on updating Phaser Box2D. There has been one new release, which fixes a minor issue but mostly continues the path of merging upstream changes into the core. This is an interesting process because the official box2d repo is a live, breathing, experimental bed of work. Ideas are tested, sometimes kept, sometimes dropped, and often mixed into the same commit as bug fixes and benchmark tweaks. Atomic, box2d commits are most certainly not, and unpicking those commits is often a real challenge. Still, that’s the price you pay when you hook onto an existing library of any kind. You have to match their style and processes, or you just cause a world of pain for yourself later on if you deviate too far.</p>
<p>Once v3.88 is out, the next objective is the release of Phaser v4.0.0 and Phaser Launcher, as well as building out the future roadmap. 2024 was a massive year for us. We shipped an incredible amount of products. We know what we want to achieve this year, and right now, all tasks revolve around making that happen.</p>
<h2 id="heading-francisco-phaser-launcher">🧑‍💻 Francisco - Phaser Launcher</h2>
<p>Happy New Year, everyone!</p>
<p>This week, a bunch of stuff happened in Phaser Studio and Phaser Launcher.</p>
<p>In Phaser Launcher, I’ve been focused on improving the editor workflow, making sure everything works as smoothly as possible to get ready for the V1 release. I fixed a few annoying issues with folder creation—one of those "small but important" kind of fixes.</p>
<p>I also made a game! I followed the awesome guide by Emanuele Feronato: "Quick HTML5 prototype of ‘Vampire Survivors’ built with Phaser (like the original game).” The process was super fun, and it really highlighted how smooth creating a game feels now with the editor. The results look great too, which is always a nice bonus.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736785030195/758c6440-5b82-4312-875b-d47314580e34.gif" alt class="image--center mx-auto" /></p>
<p>We’ve also been talking about adding new channels to the launcher, such as the channel for the tool Richard created to generate images using artificial intelligence and the Phaser Explorer to make browsing Phaser’s documentation much easier.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736785076962/8740764c-4ef2-4b11-b699-fe47c4ed7cc9.png" alt class="image--center mx-auto" /></p>
<p>(don’t worry, it won’t look a thing like this when released! Simon is busy crafting the UI right now)</p>
<p>On top of that, I’ve been dealing with some Tauri V2 permission issues. During internal testing, Richard noticed that it wasn’t possible to create files or folders on a different drive from the system drive. To solve this, Can, Richard, and I discussed the issue, and the solution turned out to be simpler than it seemed.</p>
<p>Tauri V2 provides fs:scope, which helps us grant access to specific folders. So, the configuration now allows reading and writing on different drives. This means everything should work smoothly for V1.</p>
<p><strong>Possible Future for the Tool</strong></p>
<p>This week, I’ve also been exploring new Rust tools for creating builds. I’d like to incorporate this into the launcher so that when users hit "Play," a new build can be generated automatically. We might even be able to use TypeScript in the tool.</p>
<p>Additionally, I’d like to add more helpful features to the tool. For example, when you right-click on a .png file, it could automatically generate and copy the import code for that file, or even handle the import process automatically. Another idea is to make the scene generator fully automated as well, so when you create a scene, it’s imported right away. These features could save users a lot of time and streamline the workflow even further.</p>
<p>That’s it for this week! Catch you all next time with more updates on Phaser Launcher.</p>
<h2 id="heading-zeke-phaser-v388">🧑‍💻 Zeke - Phaser v3.88</h2>
<p>A very happy new year =)</p>
<p>After some good time off at the end of 2024 of rest, relaxation and refreshing, I’m back on board to tackle a string of GitHub issues.</p>
<p>Two things I’m thankful for as I begin my year:</p>
<ol>
<li><p>Being part of an amazing team</p>
</li>
<li><p>You: being part of an amazing community</p>
</li>
</ol>
<p>Why #2? Because a passionate community helps everyone grow and improve (our team included). Here’s how you help us become better:</p>
<ol>
<li><p>Reporting issues on GitHub whenever you discover bugs or problems that don’t seem to have a solution. This helps us dig in further into our codebase to see where things can be improved.</p>
</li>
<li><p>Reporting issues on GitHub AND suggesting solutions. This saves a tonne of time for the team and benefits the entire community. Our resource stays focused on testing your solutions then quickly pushing it to our master branch repository.</p>
</li>
</ol>
<p>Here is a list of GitHub issues I was looking at last week:</p>
<ul>
<li><p>#6996: Wrong math variables used in the crop component for trimmed frames. Thanks @CrispMind for reporting this and suggesting a solution that we could immediately publish to fix this issue.</p>
</li>
<li><p>#6992: The calculation for <code>widthInPixels</code> and <code>heightInPixels</code> causes incorrect layout and rendering in hexagonal tile maps. Thanks @ptantiku for the heads up and providing a solution that can be published quickly after some testing.</p>
</li>
<li><p>#6979: <code>Interpolate.ColorWithColor</code> always returns a ColorObject with an undefined <code>color</code> value. After some digging, it was discovered that not only the <code>color</code> value was undefined, but the alpha value was missing too. Thanks @XWILKINX for bringing this to our attention.</p>
</li>
<li><p>#6972: Setting <code>ignoreDestroy</code> to <code>true</code> on game objects causes the game to freeze when leaving a scene. Thanks @samme for quickly pointing out the cause of this issue that happens in the <code>DisplayList#shutdown()</code> function. I made a minor code change in the while loop to ensure the <code>Displaylist</code> is cleared even if the game object is not destroyed. If you are thinking of moving a complex game object between scenes, this could be a possible solution. Thanks @Stever1388 for bringing this to our attention.</p>
</li>
<li><p>#6967: The <code>ArcadeColliderType</code> is missing the <code>StaticBody</code> type. Strangely enough, all other occurrences where the Arcade Physics <code>Body</code> or <code>StaticBody</code> type is required, this is the only place where <code>StaticBody</code> is missing. Thanks @yongzheng7 for bringing this to our attention.</p>
</li>
<li><p>#6893: NodeJS: scene ready before plugins loaded. There are cases where our community members run Phaser on NodeJS. Phaser typically runs on the browser and uses the HTML Canvas APIs. The challenge with NodeJS being server-side is it lacks native rendering context and this can cause some things to break. In this case, plugins aren’t booted up because it depends on completing a scene’s boot sequence in the browser. After discovering where the plugin boot happens, it was a simple fix to automatically boot the plugin whenever <code>headless</code> mode (server-side or non browser-based) is set in the game config file. Thanks @hubertgrzeskowiak for reporting this issue.</p>
</li>
</ul>
<p>So what’s next?</p>
<ul>
<li>Tackling more GitHub issues (keep them coming so we can continue improving Phaser and making it a better)</li>
</ul>
<p>That’s it for the week. Hope you have a good week ahead.</p>
<h2 id="heading-can-discord-activities">🧑‍💻 Can - Discord Activities</h2>
<p>Happy New Year/Mutlu Yıllar, everyone!🌟</p>
<p>After having a blast year with the team &amp; community, 2025 is here - refreshed the body and soul with bigger plans! I'm very excited to see where the journey goes.</p>
<p><strong>Discord Monetization Guide</strong></p>
<p>Last week, I kicked off the year by diving into the Discord monetization guide. If you haven't yet explored how to create Discord Games with Phaser, check out our <a target="_blank" href="https://phaser.io/tutorials/creating-discord-games-with-phaser">tutorial</a>.</p>
<p>This guide is one of the few resources out there focused on monetization within Discord games. We aim to show how to use the SDK effectively and implement monetization strategies(technical one!) in your projects.</p>
<p>You’ll find:</p>
<ul>
<li><p>An overview of Discord monetization options and how they work.</p>
</li>
<li><p>Practical code examples for different scenarios.</p>
</li>
<li><p>A step-by-step guide to implementing a one-time purchase feature that grants a badge reward on your Discord server.</p>
</li>
</ul>
<p>We believe this guide will be handy for developers looking to make the most of their games on Discord.</p>
<p>As usual, keep your pixels sharp everyone!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736785369629/3ad2a296-46f7-40ec-9981-73b74f846ff4.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-arian-phaser-editor">🧑‍💻 Arian - Phaser Editor</h2>
<p>Hello friends!</p>
<p>This past week I've been working mainly on Box2D. To be precise, most of the time looking at examples, reading the documentation, and doing little experiments.</p>
<p>One of these experiments is a "Box2D editor" inside Phaser Editor. Take a look at how it looks:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736785428438/eea649a6-b85d-419c-aea9-9ab860ce27aa.png" alt class="image--center mx-auto" /></p>
<p>Well... the truth is that this is not a new tool of the editor, but regular shapes which I then convert into Box2D bodies in the game code itself. Although this is a "trick", it has allowed us to get an idea of ​​how we can implement our final tool. For example, so far we know that we will have to make a project template for Box2D and a new option to create a scene with Box2D support.</p>
<p>In this past year, we have seen many advances in the editor. Without a doubt it has been one of the most prolific years of the editor, which has been in development for 9 years now. This was to be expected, since we are now a team that has valuable experience in the field of video game development. Starting with the creator of Phaser himself... who better to contribute ideas and lead the development of the editor?</p>
<p>These are some of the features we added to the editor in 2024:</p>
<ul>
<li><p>A massive improvement of the script nodes presentation and installation workflow.</p>
</li>
<li><p>Improved numerical input fields, that you can change with the arrow keys and the mouse wheel.</p>
</li>
<li><p>A welcome page.</p>
</li>
<li><p>Game object shader effects support.</p>
</li>
<li><p>An in-scene particle emitter tool, with in-line preview.</p>
</li>
<li><p>A new -amazing- logo.</p>
</li>
<li><p>An improved "new project" workflow, that includes installing dependencies and starting the development HTTP server.</p>
</li>
<li><p>Integration with the Phaser website authentication.</p>
</li>
<li><p>A certified installer of the editor for macOS and Windows.</p>
</li>
<li><p>A new Video game object.</p>
</li>
<li><p>A Chat window integrated into the editor to contact the Phaser Studio support team.</p>
</li>
<li><p>Improve assets workflow: from dropping files and folders to importing the assets.</p>
</li>
<li><p>Adopt Monaco editor as the built-in code editor.</p>
</li>
<li><p>Migrate to JavaScript ES modules in all project templates.</p>
</li>
<li><p>In-scene preview of sprite animations.</p>
</li>
<li><p>New Settings UI: including Keyboard shortcuts, external editor and external browser configuration.</p>
</li>
<li><p>A complete built-in tilemap editor.</p>
</li>
<li><p>Compressed textures.</p>
</li>
</ul>
<p>If 2024 was a wonderful year for the editor, wait until 2025! For this year we plan to incorporate such important tools as:</p>
<ul>
<li><p>Tween-based animation editor.</p>
</li>
<li><p>Layout manager for responsive games.</p>
</li>
<li><p>Assets and template marketplace.</p>
</li>
<li><p>Box2D physics editor.</p>
</li>
<li><p>Publishing outputs.</p>
</li>
<li><p>Support for many other game objects: Mesh, Plane, Geom, Shapes, Masks, Path.</p>
</li>
<li><p>Game UI.</p>
</li>
</ul>
<p>Will we be able to implement all this this year? I think so, to a large extent!</p>
<p>Happy new 2025!</p>
<hr />
<h1 id="heading-tales-from-the-pixel-mines"><strong>Tales from the Pixel Mines</strong></h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736785570064/022023f9-2264-4101-816b-227f300ae9f0.png" alt class="image--center mx-auto" /></p>
<p>13th January 2024, Ben Richards</p>
<p>Happy New Year! We've got plenty of awesome things in the works for 2025. Here's just a sampling.</p>
<h3 id="heading-phaser-4">Phaser 4</h3>
<p>We're polishing up Phaser 4 for release as we speak. The public beta has found a few bugs in the advanced filter padding logic, which I'm in the process of fixing. This is honestly great news; everything else seems to be working, and working better than ever. The new Beam renderer is a big improvement for speed, reliability, and flexibility of WebGL rendering.</p>
<h3 id="heading-dont-stop-shading">Don't Stop Shading</h3>
<p>Shaders are a vital part of game development. We understand that, and we're coming up with multiple ways to get awesome shaders into the hands of developers.</p>
<p><strong>Rendering Guide</strong></p>
<p>I've been discussing the internals of the renderer on Discord for much of the past week. It's clear we need a guide, not just to writing shaders for Phaser, but for the whole Phaser Beam rendering pipeline. So my next task is to write that guide, covering all the key parts of Beam:</p>
<ul>
<li><p>RenderNodes</p>
</li>
<li><p>DrawingContext</p>
</li>
<li><p>Batch Rendering</p>
</li>
<li><p>WebGL State Management</p>
</li>
<li><p>Basic Sprites</p>
</li>
<li><p>Nested Rendering</p>
</li>
<li><p>Filters</p>
</li>
<li><p>Shaders</p>
</li>
</ul>
<p><strong>Shader Library</strong></p>
<p>There are infinitely many possible shaders. We can't fit them all into Phaser. So we're planning the next best thing: a shader library for sharing shader and filter plugins.</p>
<p>We removed a lot of filters from Phaser 4, as they were too specialized to be useful to most developers. I've always planned to bring them back as plugins. This keeps the Phaser library small, but preserves the ability for developers to use shaders and filters freely.</p>
<h3 id="heading-new-frontiers">New Frontiers</h3>
<p>Right now, we're focused on making Phaser 4 the best 2D compositing system we can. But development doesn't stop there.</p>
<p>Rich has said that 3D is on the cards. We don't know what shape this is going to take yet, but we want to do it seriously. This is why we removed the Mesh and Plane objects that were in Phaser 3. They're useful, but they would be <em>more</em> useful as part of a true 3D system. Games in the 21st century rely on a lot of technologies, from lighting to animation, and I'd like to take the time to get it right.</p>
<p>Before that happens, though, we've been discussing smaller projects to push us in the right direction. See how I called Phaser 4 a "2D compositing system"? That's a very specific approach to rendering. Phaser's core strength is putting sprites on the screen, building up a scene layer by layer. That's very flexible, but it has tradeoffs in CPU time computing transforms, and bandwidth sending buffers to the GPU.</p>
<p>What if you didn't have to do that? Well, then you'd be able to render 100 times faster, handling literally millions of sprites. The cost is, you're no longer able to control the sprites you're rendering. Can you keep a secret? Listen: You don't need to control backgrounds. They stay in one place. Can you keep another secret? That's not true - <em>backgrounds can move</em>.</p>
<p>But hush - it's a secret. We think you'll be happy when you see what we've been cooking.</p>
<h3 id="heading-into-the-future">Into the Future</h3>
<p>We've got big plans, and it all starts with Phaser 4. The beta is ongoing, so check it out if you haven't already. It's both a huge change, and a tiny change. Unless you work with masks, FX, shaders, or other parts of the render system directly, it should just work. We worked hard to make it as compatible as possible - and where we couldn't, we made it better instead.</p>
<p>From there, the wild ride continues. We hope you'll be there with us in 2025.</p>
<hr />
<h1 id="heading-share-your-content-with-18000-readers">Share your content with 18,000+ readers</h1>
<p>Created a game, tutorial, code snippet, video, or anything you feel Phaser World readers would like? Then please <a target="_blank" href="mailto:content@phaser.io">send it to us</a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736785813566/1f0d313b-215d-49a1-8fb2-ebc806011ab0.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 211]]></title><description><![CDATA[In this issue, we have the free version of Phaser Box2D and new versions of Phaser v4 and Phaser Editor.
⭐ Phaser Box2D Released as open-source
A free, high-performance, industry-standard 2D physics engine built on Box2D v3.

We’re happy to announce ...]]></description><link>https://phaser.world/phaser-world-issue-211</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-211</guid><category><![CDATA[Game Development]]></category><category><![CDATA[WebGL]]></category><category><![CDATA[canvas]]></category><category><![CDATA[phaser]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Fri, 27 Dec 2024 17:05:08 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735311126420/3ecdd8fb-6a0c-4bc1-b7f8-dbf62885b304.png" alt class="image--center mx-auto" /></p>
<p>In this issue, we have the free version of Phaser Box2D and new versions of Phaser v4 and Phaser Editor.</p>
<h2 id="heading-phaser-box2d-released-as-open-source">⭐ Phaser Box2D Released as open-source</h2>
<p><em>A free, high-performance, industry-standard 2D physics engine built on Box2D v3.</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735311248631/1aa1213d-6588-4b45-824b-94faeae91bd4.png" alt class="image--center mx-auto" /></p>
<p>We’re happy to announce that Phaser Box2D is now available completely for free and has been released as open-source.</p>
<p>The Phaser Studio team is thrilled to announce the release of Phaser Box2D, the ultimate 2D physics engine for creating realistic, physics-driven games for your browser. Whether you’re building fast-paced shooters, intricate puzzle games, or sprawling RPGs, Phaser Box2D is here to take your creations to the next level.</p>
<p>Phaser Box2D is powered by the latest version of Box2D, a cutting-edge physics engine designed for accuracy and performance. We’ve painstakingly converted the Box2D v3.0 API, written in C, to modern JavaScript, making Phaser Box2D the only v3 port available for the web. We’ve optimized it specifically for browsers, so it’s fast, powerful, and ridiculously easy to integrate with all modern web stacks.</p>
<p>It's also open source and released under the MIT license, so you're free to use Phaser Box2D in your games and applications. Phaser Pro and Enterprise customers can also benefit from priority technical support from the team that created it.</p>
<p>No one likes laggy physics or buggy collisions, and with Phaser Box2D, you won’t have to deal with either. Thanks to a fancy new Soft Step Rigid Body Solver, your physics will stay stable and smooth—even with fast-moving objects or crazy stacks of bodies. Plus, its island-based sleep management keeps things efficient by letting inactive objects and your processor take a break.</p>
<p>Have you ever had a bullet magically phase through a wall? Not with Continuous Collision Detection (CCD). Whether it’s high-speed objects, tricky AI behaviors, or complex aiming mechanics, Phaser Box2D makes sure everything behaves exactly how you expect.</p>
<p>We’ve kept it simple. Phaser Box2D works right out of the box as an ES Module. It’s also tiny — just 65KB when zipped — so it’s perfect for web games and playable ads. And for those of you who’ve used Box2D before, good news: we kept the original C API function names, so you’ll feel right at home. The added benefit of this approach is that if Box2D is new to you, you can rely on its rich 18-year history to learn it faster because tools like ChatGPT and Cursor understand its C API well.</p>
<p>It’s also packed with features you’ll love:</p>
<ul>
<li><p><strong>Shapes, Shapes, and More Shapes</strong>: From circles to chains to rounded polygons, create the environments and characters of your dreams.</p>
</li>
<li><p><strong>Composite Bodies</strong>: Combine shapes for vehicles, ragdolls, or even funky robots with multiple collision parts.</p>
</li>
<li><p><strong>Versatile Joints</strong>: Build swinging doors, working pistons, or even car suspensions—if you can dream it, you can make it.</p>
</li>
<li><p><strong>Smooth Physics</strong>: Speculative collisions and continuous motion handling keep everything looking and feeling real.</p>
</li>
</ul>
<p>We’ve also included over 50 examples to get you up and running in no time. From mini-games to single-feature demos, you’ll have everything you need to get inspired and start building.</p>
<p>Phaser Box2D is here to help you create incredible, physics-driven games that wow your players. Whether you’re an indie creator or a pro studio, this is the tool to bring your ideas to life.</p>
<p>Ready to get started? Let’s make some magic together!</p>
<p><a target="_blank" href="https://phaser.io/box2d">Download Phaser Box2D</a></p>
<h2 id="heading-project-x-light-years">🚀 Project X: Light Years</h2>
<p><em>Classic Shooter Gameplay Reimagined with Cutting-Edge Visuals and Design</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/project-x-light-years"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735311954866/f03a9782-6bc5-4909-94bb-6f54784f3694.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Project X: Light Years is an exciting reimagining of the classic Amiga shooter, brought to life by MK Games and Team17. Fans of the original Project X will find themselves immersed in a modernized experience that pays homage to the roots of the genre while introducing new twists for today's gamers.</p>
<p>Scheduled for release on Steam, this game offers a fresh perspective on the beloved side-scrolling space shooter format. In partnership with Team17 this is an official entry in the Project X series. Engage in space combat as you navigate through visually stunning environments and swarms of enemies, and upgrade your arsenal to become the ultimate space fighter.</p>
<p>A demo version and gameplay videos are available on Steam.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/project-x-light-years">Play Project X</a></p>
<h2 id="heading-phaser-editor-481-released">⭐ Phaser Editor 4.8.1 Released</h2>
<p><em>Enhancing Your Workflow with Compressed Textures, Asset Management, and more</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/phaser-editor-481-released"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735312282310/3fc4716a-1dcc-47ad-999a-38903932b0b6.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Phaser Editor 4.8.1 launches with powerful compressed texture support, enabling seamless integration into scene and animation editors. The streamlined workflow pairs compressed textures with standard image files as fallbacks, while introducing robust blend mode controls for game objects and enhanced Glow FX capabilities with fine-tuned quality and distance parameters.</p>
<p>The update increases workflow efficiency through further improvements: a dynamic asset pack visibility system for superior asset management, quick OS terminal access via the Files view, and an improved file deletion system that utilizes the recycle bin in the Desktop edition. This polished release also squashes key bugs, addressing sprite animation preview glitches, Outline view navigation issues, and scene editor grid rendering at high zoom levels.</p>
<p>Subscribers can download this version immediately.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/phaser-editor-481-released">Read more about this release</a></p>
<h2 id="heading-phaser-raycaster-plugin">🔦 Phaser Raycaster Plugin</h2>
<p><em>The latest update of this raycasting plugin is now available</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/phaser-raycaster"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735312416113/54474e41-f71f-4a71-bc90-3f7d12e0c8eb.png" alt class="image--center mx-auto" /></a></p>
<p>Phaser Raycaster is a Phaser 3 plugin, released by Wiserim, which provides raycasting for geometric Game Objects, Sprites, Arcade Physics, and Matter Physics bodies.</p>
<p>It has been in development for a while, but the new v0.10.11 release has just been made available, with updated documentation and examples to be found on CodePen.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/phaser-raycaster">Read more about Phaser Raycaster</a></p>
<h2 id="heading-phaser-v4-beta-3-released">⭐ Phaser v4 Beta 3 Released</h2>
<p><em>The final release of the year introduces the new Filters Component and more fixes.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/phaser-v4-beta-3-released"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735312517810/3c1e1754-4d34-46c8-9414-eb39ad23ff47.jpeg" alt class="image--center mx-auto" /></a></p>
<p>We're very happy to announce that Phaser v4 Beta 3 is now available on GitHub and npm. This represents all development work over the past month and takes us another step closer to the final release in Q1 2025.</p>
<p>The biggest change in this version came about thanks to the community feedback in the Phaser Discord. In short, we decided to rework the way RenderFilters work:</p>
<p>Previously, the RenderFilters object wrapped game objects to apply Filters. This worked well in several ways, but because it replaced the existing game object, it made object references less reliable.</p>
<p>The decision was made to change Filters to a component on game objects. This is similar to the old FX system, but it is now built into the base GameObject, so it can be used everywhere. Filters are not FX (they're better).</p>
<p>For those who have been using Phaser 4 beta 1 or 2, this will change the way you use filters. The core principles are the same, however: filters are still divided into internal and external lists.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/phaser-v4-beta-3-released">Read more about Phaser v4 Beta 3</a> and be sure to read the Dev Log this issue too</p>
<h2 id="heading-build-a-retro-style-2d-game">📺 Build a Retro Style 2D Game</h2>
<p><em>Learn Game Development with Phaser 3!</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/build-a-retro-style-2d-game"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735312636533/21294f7e-a53a-43ea-960f-2625163ca09f.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Jeremy Morgan has released a new tutorial on his site, How to Make Games, and also published it on YouTube: "Have you ever wanted to create your own video game but didn’t know where to start? In this video, we’re diving into game development with Phaser 3, a powerful and beginner-friendly JavaScript framework. Whether you're a total newbie or just curious about coding games, this is the perfect place to start!</p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/build-a-retro-style-2d-game">Watch the video on YouTube</a></p>
<hr />
<h1 id="heading-phaser-studio-developer-logs"><strong>Phaser Studio Developer Logs</strong></h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735312827366/8618664a-ea57-4662-a0f3-ba6736c66421.png" alt class="image--center mx-auto" /></p>
<p>The Phaser Studio team is all off enjoying their holidays at the moment, but both Arian and Ben left developer logs before they went - so here’s a slightly reduced Dev Log for you all.</p>
<h2 id="heading-rich-cto-amp-founder"><strong>🧑‍💻 Rich - CTO &amp; Founder</strong></h2>
<p>This is the final issue of Phaser World for 2024, and I’m taking a week off from writing, returning in early January 2025. Approaching the end of a year always makes me think back to what has been accomplished in the previous 12 months. I find that a little retrospection helps to focus the lens on what should be achieved in the coming year.</p>
<p>Suffice it to say that 2024 has been an <em>epic</em> year.</p>
<p>When you consider that Phaser Studio was only formed in December 2023 and consists of just 8 full-time staff (and a selection of lovely contractors), the fact we’ve managed to output so much is a testament to the determination and hard work of all those involved. I was planning on making a list of everything we released as a team this year, but the length of it was getting silly, so instead, here are some highlights:</p>
<ul>
<li><p>Constant Phaser Editor updates. From v3.66 to v4.8.1 with almost a release a month.</p>
</li>
<li><p>Constant Phaser updates. From v3.80 up to Beta 3 of v4.0.0.</p>
</li>
<li><p>The creation of a brand new state-of-the-art renderer for Phaser 4 from scratch.</p>
</li>
<li><p>Over 50 Phaser Templates for React, Vue, Rollup and many, many more.</p>
</li>
<li><p>The release of the Create Phaser Game CLI app.</p>
</li>
<li><p>Complete documentation overhaul with hundreds of pages of new content written.</p>
</li>
<li><p>A huge free book published! And lots of new tutorials covering Discord, Ionic, and Box2D.</p>
</li>
<li><p>Phaser Compressor, Phaser Explorer, Phaser Playable Ads, and Phaser Sandbox released.</p>
</li>
<li><p>A stunning new website 😀 and a growing new YouTube channel.</p>
</li>
<li><p>50 issues of this newsletter and 200 articles posted to the Phaser website (most of which I wrote!)</p>
</li>
</ul>
<p>And this isn’t even everything. It is, however, a good representation of the diverse types of tasks any modern software company needs to undertake. Yes, of course, you need to write code, but if you don’t pay attention to the whole ecosystem around it, all of that hard work can often be in vain.</p>
<p>And if you do pay attention, the rewards are worth it.</p>
<p>The Phaser Templates we published? Our analytics show they’ve been used over 76,000 times in the past couple of months. Right now, someone is building a Phaser game every minute of every day.</p>
<p>Or the website? After the relaunch at the start of October, we’ve seen a dramatic uptick in registrations and time spent on the site. This week, we passed 27,000 registered users, which is an incredible amount of people if you stop to think about it for a moment. As for page views, we’ll close the year with over 7 million of those. You guys are reading <em>a lot</em>!</p>
<p>Interest in building games for the web is truly stronger than it has been in a long while.</p>
<p>I would attribute this to a couple of factors. The first is that you can now play web games pretty much anywhere. Everything is a games platform. From Discord Activities, Telegram, WeChat, YouTube Playables, Reddit, and even LinkedIn. Big tech is waking up to the appeal of games to keep people on their sites or apps. And game devs are waking up to the notion of taking their games, or little slices of them, to the places where gamers dwell. Of course, where there is a captive audience, there is a need to build for them, and Phaser is optimally positioned right in the center of this perfect storm.</p>
<p>The other factor that shouldn’t be ignored is the rise of AI.</p>
<p>How we write code has changed forever. Our first port of call is now a Copilot, Cursor, or LLM, which we’re using to supplement our skills and knowledge at a faster pace than ever previously possible. For skilled developers, AI is an enhancement tool like no other. Yet, we’re also seeing the opposite end of the spectrum. Developers are coming to the Phaser Discord and showing us games they’ve made entirely with the help of ChatGPT. Because OpenAI, Anthropic, and the rest have ingested and trained upon all of the Phaser documentation and API, it’s tightly embedded into their vector stores, making it relatively easy for them to guide beginners through the process of game creation in a way that was previously unthinkable.</p>
<p>Of course, this also extends into game assets, too. The creation of sprites, characters, title screens, logos and other game elements is now commonly handled by AI tools. We had originally planned to create an Asset Marketplace for Phaser developers so they could easily buy graphics and sounds to use in their games. In all honesty, this now seems like a pointless endeavor. Based on progress in this space alone in the past year, it’s only a matter of time before the type of developer who would have previously purchased assets from a store will generate them instead. This tidal shift is inevitable. It’s not going to replace game artists of course, there will always be a place for those skills, but in projects where it’s a solo dev, or small non-art team, they’re the perfect candidates for these tools.</p>
<p>Quite how this fits with Phaser we’re not entirely yet sure. But as I mentioned at the start, you have to keep an eye on the whole ecosystem to understand what direction to take. And like it or not, AI is now a key part of game development.</p>
<p>At the most basic level, it means we ought to consider how to provide Phaser documentation in a way that makes it easy for LLMs to digest and parse rather than writing it for humans first. And I can’t help but wonder how long it will be before we need to start designing our APIs in a similar manner. Classes, function names, and parameters tailored specifically for AI so that it can generate the most optimal and error-free code possible. It’s all food for thought as we round out the year.</p>
<p>Of course, the immediate technical priority of Phaser Studio in 2025 will be to get Phaser v4 released and used. And this is being built for humans 😅 I just wonder if I’ll be saying the same in a year’s time.</p>
<p>All that leaves me to say is thank you for joining us on this exciting journey, whether this is your first issue or you’ve been on this crazy ride since the very start. 2025 will be another epic year for Phaser Studio, and I hope it is for you, too.</p>
<h2 id="heading-arian-phaser-editor"><strong>🧑‍💻</strong> Arian - Phaser Editor</h2>
<p>Hello friends,</p>
<p>In the last few days we have been working on a new release of the editor. It is ready and will soon be announced on our channels. The key thing about this new version is that it incorporates support for compressed textures. This is a feature that many of you will not use, but for some cases the possibility of using these textures is of great importance. In addition, for the release we have reviewed the list of issues on GitHub and have implemented some of the community requests.</p>
<p>Some of these issues are: Send to the recycle bin instead of deleting a file. Add a parameter to the JavaScript compiler so that it does not generate the field declarations. Add the quality and distance properties to the FX Glow object, and the blendMode property to all Game Objects.</p>
<p>We also implemented a new command to open the operating system terminal in the folder selected in the Files view. This complements the "Locate File" command, which opens the system file explorer.</p>
<p>Something interesting we did, and which was also a community request, is adding the visible parameter to the Asset Pack editor. As you know, all the editor tools that work with assets use asset packs as a manifest for the assets available in the project. With the new parameter you can "hide" an asset pack from the view of the other editor tools, which allows you to filter them out and focus only on the ones you are working on in cases where you have a large amount of assets. It can also help you simulate a kind of skin system, where you can activate one skin or another and get better feedback when designing your levels.</p>
<p>During this week we have been working on the editor documentation. It is mainly an update task: features that are no longer there or have evolved, old screenshots, links to Phaser documentation, and also style. Thanks to the VS Code Copilot extension, I can now write in slightly improved English. Perhaps this is all we'll be doing regarding the editor for the rest of the year, as many of us on the team will soon be going on vacation, and el 2025 viene echando candela.</p>
<hr />
<h1 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735313103098/f0104f39-5d72-4254-98c7-369d6603591c.png" alt class="image--center mx-auto" /></p>
<p>20th December 2024, Ben Richards</p>
<p>In the past couple of weeks, I've changed the way Filters work. This affects more than just Filters, though; it adds a whole new way to manage rendering. I've also fixed some issues with Filter padding.</p>
<h2 id="heading-render-steps">Render Steps</h2>
<p>The RenderSteps system allows us to add steps to rendering, in addition to the <code>renderWebGL</code> method.</p>
<p>RenderSteps is available on all GameObjects. The basic idea is simple: we want to run a series of functions, so we can override or defer rendering. For example, if an object has filters, we want to render the object to another framebuffer, so we want to run extra code around the normal render.</p>
<p>This isn't as simple as running each function in sequence. In the filters example, we want to set up framebuffers, run the normal render, then run the filters. While we could break up the filter logic into two sequential functions, this is difficult to manage. It's easier to use one function, which can start the next step when it reaches the correct point.</p>
<p>So we add a parameter to these step functions: the current step. In most cases, we're running <code>renderWebGL</code> and it doesn't need to start another step so it doesn't care about this parameter. But when we do care, such as when rendering filters, we can use the current step to find the <em>next</em> step in the list of steps, and run that at the appropriate time.</p>
<p>This lets us "wrap" the render function in another function. By wrapping the function, we can override behavior without wrapping the entire game object, which can cause issues.</p>
<p>RenderSteps are currently only used to add Filters, but they can be used for any system that needs to run during the rendering process. Debug graphics are one possibility.</p>
<h2 id="heading-goodbye-renderfilters-hello-filters-component">Goodbye RenderFilters, Hello Filters Component</h2>
<p>Previously, the RenderFilters object wrapped game objects to apply Filters. This worked well in several ways, but because it replaced the existing game object, it made object references less reliable.</p>
<p>The decision was made to change Filters to a component on game objects. This is similar to the old FX system, but it is now built into the base GameObject, so it can be used everywhere. Filters are not FX (they're better).</p>
<p>For those who have been using Phaser 4 beta 1 or 2, this will change the way you use filters. The core principles are the same, however: filters are still divided into internal and external lists.</p>
<p>The new way to use filters is thus:</p>
<pre><code class="lang-js"><span class="hljs-comment">// Set up filter systems.</span>
gameObject.enableFilters();

<span class="hljs-comment">// Create filter controllers.</span>
<span class="hljs-keyword">const</span> blur = gameObject.filters.internal.addBlur();
</code></pre>
<p>When you run <code>enableFilters()</code>, Phaser creates an internal camera to handle the object's filters, and adds a RenderStep function.</p>
<p>By default, when there are no active filters to render, the RenderStep skips straight to <code>renderWebGL</code>. If you want the object to render to a framebuffer without rendering a filter, you can set <code>gameObject.filtersForceComposite = true</code>. This can be useful when you want to composite alpha, e.g. when you have several objects in a Container or Layer and you don't want to see them through each other, you can leave their alpha at 1, set <code>filtersForceComposite</code>, and reduce the alpha of <code>gameObject.filterCamera</code>.</p>
<p>Filters run <code>focusFilters</code> every time they render by default. This differs from <code>RenderFilters.focus</code>, which didn't run every time. This method ensures that the <code>filterCamera</code> is always locked onto the object. Some objects don't have enough properties to accurately lock on to, so the system will guess, and fall back to the screen resolution. You can run <code>gameObject.focusFiltersOverride</code> to manually set the camera target.</p>
<p>In general, this runs much like FX did - but with more control and better compatibility.</p>
<h2 id="heading-filter-padding-fixes">Filter Padding Fixes</h2>
<p>I fixed some issues with filter padding. This padding is used to give filters extra space to work in, e.g. when an object is blurred it should extend outside the usual boundaries of the object and not be abruptly cut off.</p>
<p>I hadn't fully tested this system when I first implemented it, and it turns out there were some issues. When objects were rotated or scaled, the padding was applied in the wrong direction. This was not immediately obvious. Only when the padding changed, growing or shrinking, was it clear that it was pointing the wrong way.</p>
<p>What was happening: I had combined the internal and external padding to describe the position of the internal quad within the external context. But this meant that the external padding was transformed with the object, when it should have remained with the external context. I removed it to a step after the transform was calculated, and the issue was resolved.</p>
<p>This sounds like an obvious problem and an obvious fix. And I'm sure it was, to some minds! Alas, mine was recovering from illness, and there were more than a few moving parts involved, so it took me a moment to figure it out.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735313144697/0346633a-5ed8-406e-a244-a8efdae18fa0.png" alt class="image--center mx-auto" /></p>
<p>That's what it's <em>supposed</em> to look like, by the way. This might be helpful in visualizing what exactly filter padding does. (The diagram was made in Phaser itself, by the way. It's not just a game engine; it's a data visualization system!)</p>
<h2 id="heading-a-question-about-texture-coordinates">A Question About Texture Coordinates</h2>
<p>As you may know, WebGL measures the Y axis starting from 0 at the <em>bottom</em> of a texture. Most software measures from the <em>top</em>. So Phaser does everything on the assumption that Y = 0 is at the <em>top</em> to keep things simple.</p>
<p>But it occurs to me that this might not actually keep things simple. These coordinates only really surface inside shaders, and most shaders are written with a <em>bottom</em> start. This means shaders written elsewhere have to be adapted for Phaser.</p>
<p>What do you think? Should we swap to use the conventional, bottom-first Y axis?</p>
<h2 id="heading-next-week-er-year">Next Week, er, Year</h2>
<p>Next week I'm celebrating the holidays with family, and recuperating from a busy year. I've had a great time with Phaser Studio so far - I just have to remember to take time off every so often!</p>
<p>In the new year, we'll be putting the finishing touches on Phaser 4. The main area for public testing is the new shader system; I want to write a guide for using it, to make sure it makes sense to everybody else.</p>
<p>In the meantime, have a happy holiday, whichever is best for you. Meri Kirihimete from me to you!</p>
<hr />
<h1 id="heading-share-your-content-with-18000-readers">Share your content with 18,000+ readers</h1>
<p>Created a game, tutorial, code snippet, video, or anything you feel Phaser World readers would like? Then please <a target="_blank" href="mailto:content@phaser.io"><strong>send it to us</strong></a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735313350394/7cf1a5a7-0ca1-4de8-b6df-637e25dec5d5.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 210]]></title><description><![CDATA[After months of hard work and Dev Log entries, we’re delighted to announce that Phaser Box2D is now available. This issue of Phaser World will be specially dedicated to exploring what it offers. However, we also have two tutorials and two great new g...]]></description><link>https://phaser.world/phaser-world-issue-210</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-210</guid><category><![CDATA[box2d]]></category><category><![CDATA[WebGL]]></category><category><![CDATA[Game Development]]></category><category><![CDATA[canvas]]></category><category><![CDATA[phaser]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Tue, 17 Dec 2024 17:08:59 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734449433852/2cc96ba3-6ee6-479d-9f0e-607587df6eb4.png" alt class="image--center mx-auto" /></p>
<p>After months of hard work and Dev Log entries, we’re delighted to announce that Phaser Box2D is now available. This issue of Phaser World will be specially dedicated to exploring what it offers. However, we also have two tutorials and two great new games at the end! Regular newsletter service will commence in the next issue. For now, let’s fling some dynamic bodies around.</p>
<h2 id="heading-phaser-box2d-is-now-available">🚀 Phaser Box2D is now available</h2>
<p><em>Create immersive, physics-rich 2D worlds</em></p>
<p><a target="_blank" href="https://phaser.io/box2d"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734450618243/621cf5a3-5fbe-4de4-85f8-ecc867ae23ee.png" alt class="image--center mx-auto" /></a></p>
<p>The Phaser Studio team is thrilled to announce the release of <a target="_blank" href="https://phaser.io/box2d"><strong>Phaser Box2D</strong></a>, the ultimate 2D physics engine for creating realistic, physics-driven games for your browser. Whether you’re building fast-paced shooters, intricate puzzle games, or sprawling RPGs, Phaser Box2D is here to take your creations to the next level.</p>
<h3 id="heading-what-makes-phaser-box2d-so-awesome">What Makes Phaser Box2D So Awesome?</h3>
<p>Phaser Box2D is powered by the latest version of <strong>Box2D</strong>, a cutting-edge physics engine designed for accuracy and performance. We’ve painstakingly converted the Box2D v3.0 API, written in C, to modern JavaScript, making Phaser Box2D the only v3 port available for the web. We’ve optimized it specifically for browsers, so it’s fast, powerful, and ridiculously easy to integrate with all modern web stacks.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734452457160/5c1d8504-b23e-4780-baeb-7c35ec635c8b.png" alt class="image--center mx-auto" /></p>
<h4 id="heading-performance-that-speaks-for-itself"><strong>Performance That Speaks for Itself</strong></h4>
<p>No one likes laggy physics or buggy collisions, and with Phaser Box2D, you won’t have to deal with either. Thanks to a fancy new <strong>Soft Step Rigid Body Solver</strong>, your physics will stay stable and smooth—even with fast-moving objects or crazy stacks of bodies. Plus, its <strong>island-based sleep management</strong> keeps things efficient by letting inactive objects and your processor take a break.</p>
<h4 id="heading-pinpoint-accuracy"><strong>Pinpoint Accuracy</strong></h4>
<p>Have you ever had a bullet magically phase through a wall? Not with <strong>Continuous Collision Detection (CCD)</strong>. Whether it’s high-speed objects, tricky AI behaviors, or complex aiming mechanics, Phaser Box2D makes sure everything behaves exactly how you expect.</p>
<h4 id="heading-easy-integration"><strong>Easy Integration</strong></h4>
<p>We’ve kept it simple. Phaser Box2D works right out of the box as an ES Module. It’s also tiny — just <strong>65KB</strong> when zipped — so it’s perfect for web games and playable ads. And for those of you who’ve used Box2D before, good news: we kept the original C API function names, so you’ll feel right at home. The added benefit of this approach is that if Box2D is new to you, you can rely on its rich 18-year history to learn it faster because tools like ChatGPT and Cursor understand its C API well.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734452480132/781c04dd-99a4-466e-ac18-cbb7873471e8.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-packed-with-features-youll-love">Packed with Features You’ll Love</h3>
<ul>
<li><p><strong>Shapes, Shapes, and More Shapes</strong>: From circles to chains to capsules (a new Box2D v3 feature), create the environments and characters your game needs.</p>
</li>
<li><p><strong>Composite Bodies</strong>: Combine shapes for vehicles, ragdolls, or funky robots with multiple collision parts.</p>
</li>
<li><p><strong>Versatile Joints</strong>: Build swinging doors, working pistons, or even car suspensions — you can access Revolute, Distance, Prismatic, Wheel, and Weld joint types.</p>
</li>
<li><p><strong>With Versatile Interactions</strong>: Combine the joints in interesting ways, with limits, motors, springs, and friction available.</p>
</li>
<li><p><strong>Smooth Physics</strong>: Speculative collisions and continuous motion handling keep everything looking and feeling real.</p>
</li>
</ul>
<h3 id="heading-hands-on-fun-with-50-examples">Hands-On Fun with 50+ Examples</h3>
<p>We’ve included over <strong>50 examples</strong> to get you up and running in no time. From mini-games to single-feature demos, you’ll have everything you need to get inspired and start building.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734451275789/c9ea7397-b7da-4a57-8cd2-aaccd581eb81.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-made-for-phaser-open-to-everyone">Made for Phaser, Open to Everyone</h3>
<p>Of course, Phaser Box2D works beautifully with the Phaser game framework (thanks to our handy plugin), but you don’t have to use Phaser. It plays nicely with any web game framework or application, making it a great choice no matter what you’re building with.</p>
<p>Even the Phaser integration is entirely optional. We have been careful not to deeply tie the two together, instead opting to provide a thin layer of helper functions between the two. This makes it easy for you to roll your own fully custom integration without needing to unpick lots of legacy code. Or you can use the handy functions we created! Either is OK with us.</p>
<h3 id="heading-lets-build-something-amazing">Let’s Build Something Amazing</h3>
<p>Phaser Box2D is here to help you create incredible, physics-driven games that wow your players. Whether you’re an indie creator or a pro studio, this is the tool to bring your ideas to life.</p>
<p>Ready to get started? Let’s make some magic together!</p>
<p>We offer three licenses: one for those looking to integrate Phaser Box2D into their tools and systems, one for commercial use, and one for indie solo developers.</p>
<p>Find all the pricing details on the <a target="_blank" href="https://phaser.io/box2d">Phaser Box2D website</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734452639164/13f1333d-d780-4830-959a-be2cf5786c09.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-whats-included">What’s Included?</h2>
<p>When you purchase Phaser Box2D, you will receive the following:</p>
<ul>
<li><p><strong>A Comprehensive Getting Started Guide</strong>. This covers two sample projects, one using Phaser and one without, and guides you through some Box2D terminology and how to approach it.</p>
</li>
<li><p><strong>Over 50 Box2D Examples</strong>. The complete source code and assets to many examples, including stress tests, mini-games, joint and shape demos, and more. We will keep adding to the examples in the coming months. They are provided with a web-based interface and launcher script so you can quickly run them locally.</p>
</li>
<li><p><strong>API Documentation</strong>. We have written our own API documentation, which is included in the download. The docs cover all of the core functions you may need to use and the correct data types required for our JavaScript version.</p>
</li>
<li><p><strong>Vite Project template</strong>. To help you get started fast, we’ve also compiled a Vite project template that shows how to use Phaser and Box2D together. It supports development hot-reload and production build commands.</p>
</li>
<li><p><strong>30 Advanced Tutorials</strong>. We’ve also published 30 detailed tutorials covering all aspects of Box2D, from querying the World to efficiently destroying bodies to advanced topics such as buoyancy and sticky projectiles. Feel free to <a target="_blank" href="https://phaser.io/tutorials/box2d-tutorials/">browse the tutorials</a> on our website.</p>
</li>
</ul>
<h2 id="heading-faqs">FAQs</h2>
<p><strong>Q. Box2D is open source. Why does this cost money?</strong></p>
<p><strong>A.</strong> Phaser Studio invested months of full-time work into carefully porting, optimizing and testing this library specifically for web games. We believe it represents one of the most stable and feature-packed physics libraries available for the web and, as such, has commercial value to those earning from publishing web games and playables.</p>
<p>The Phaser Studio team also offers continuous updates and support, custom documentation, tutorials, and examples, ensuring Phaser Box2D remains reliable and up-to-date. We understand that the pricing isn’t suitable for everyone. Some developers' web games are purely a hobby. In those cases, we’d suggest a free alternative like the <a target="_blank" href="https://github.com/phaserjs/rapier-connector">Rapier Physics</a> integration we put together.</p>
<p><strong>Q. Does it only work with Phaser, or can I use Pixi, etc?</strong></p>
<p><strong>A.</strong> Despite its title, Phaser Box2D is compatible with any web-based tech stack or framework, including Pixi, React, Vue, and more. It is provided as an ESM compatible Module and is not deeply integrated with Phaser itself. There is no Phaser code or Game Objects within the plugin at all.</p>
<p>Of course, as Phaser Studio, we include many helpful functions that ease the use of Box2D with Phaser itself. These are included with the purchase. However, using Phaser isn't a requirement.</p>
<p><strong>Q. How complicated is it to use?</strong></p>
<p><strong>A.</strong> Complexity is, of course, subjective. However, we feel it would be remiss to say that this is perfect for complete beginners. You are expected to have a solid grasp of JavaScript and, ideally, previous experience with physics systems.</p>
<p>We provide tutorials, API Documentation, and examples from which to learn. Plus, you can ask us questions in our Discord. Even so, Box2D does have a certain level of complexity, and if you are unsure if it's right for you, we would recommend you read some of our <a target="_blank" href="https://phaser.io/tutorials/box2d-tutorials/">public tutorials</a> first to get an understanding of how it works.</p>
<p>You can find more FAQs on the Phaser Box2D page.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734453485561/11a0f552-02ab-450f-a9c1-67595505f6fa.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-a-quick-phaser-example">A Quick Phaser Example</h2>
<p>In this example, we will create a simple physics Scene with a static ground platform on which we drop two dynamic bodies. The full code is as follows (minus the import statements, to save space in this newsletter)</p>
<pre><code class="lang-js"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Phaser</span>.<span class="hljs-title">Scene</span> </span>{

    <span class="hljs-keyword">constructor</span> () {
        <span class="hljs-built_in">super</span>();
    }

    create () {

        SetWorldScale(<span class="hljs-number">40</span>);

        <span class="hljs-keyword">const</span> debug = <span class="hljs-built_in">this</span>.add.graphics();
        <span class="hljs-keyword">const</span> world = CreateWorld({ <span class="hljs-attr">worldDef</span>: b2DefaultWorldDef() });
        <span class="hljs-keyword">const</span> worldId = world.worldId;

        CreateBoxPolygon({
            worldId,
            <span class="hljs-attr">type</span>: DYNAMIC,
            <span class="hljs-attr">position</span>: pxmVec2(<span class="hljs-number">630</span>, <span class="hljs-number">64</span>),
            <span class="hljs-attr">size</span>: <span class="hljs-number">1</span>,
            <span class="hljs-attr">density</span>: <span class="hljs-number">1.0</span>,
            <span class="hljs-attr">friction</span>: <span class="hljs-number">0.2</span>,
            <span class="hljs-attr">color</span>: b2HexColor.b2_colorGold
        });

        CreateCircle({
            worldId,
            <span class="hljs-attr">type</span>: DYNAMIC,
            <span class="hljs-attr">position</span>: pxmVec2(<span class="hljs-number">690</span>, <span class="hljs-number">0</span>),
            <span class="hljs-attr">radius</span>: <span class="hljs-number">1</span>,
            <span class="hljs-attr">density</span>: <span class="hljs-number">1.0</span>,
            <span class="hljs-attr">friction</span>: <span class="hljs-number">0.5</span>,
            <span class="hljs-attr">color</span>: b2HexColor.b2_colorRed
        });

        <span class="hljs-keyword">const</span> groundBodyDef = b2DefaultBodyDef();

        groundBodyDef.rotation = RotFromRad(<span class="hljs-number">-0.06</span>);

        CreateBoxPolygon({
            worldId,
            <span class="hljs-attr">type</span>: STATIC,
            <span class="hljs-attr">bodyDef</span>: groundBodyDef,
            <span class="hljs-attr">position</span>: pxmVec2(<span class="hljs-number">640</span>, <span class="hljs-number">-600</span>),
            <span class="hljs-attr">size</span>: <span class="hljs-keyword">new</span> b2Vec2(<span class="hljs-number">20</span>, <span class="hljs-number">1</span>),
            <span class="hljs-attr">density</span>: <span class="hljs-number">1.0</span>,
            <span class="hljs-attr">friction</span>: <span class="hljs-number">0.5</span>,
            <span class="hljs-attr">color</span>: b2HexColor.b2_colorLawnGreen
        });

        <span class="hljs-built_in">this</span>.world = world;
        <span class="hljs-built_in">this</span>.debug = debug;

        <span class="hljs-built_in">this</span>.worldDraw = <span class="hljs-keyword">new</span> PhaserDebugDraw(debug, <span class="hljs-number">1280</span>, <span class="hljs-number">720</span>, GetWorldScale());
    }

    update (time, delta) {

        <span class="hljs-keyword">const</span> worldId = <span class="hljs-built_in">this</span>.world.worldId;

        WorldStep({ worldId, <span class="hljs-attr">deltaTime</span>: delta });

        <span class="hljs-built_in">this</span>.debug.clear();

        b2World_Draw(worldId, <span class="hljs-built_in">this</span>.worldDraw);
    }
}

<span class="hljs-keyword">const</span> config = {
    <span class="hljs-attr">type</span>: Phaser.AUTO,
    <span class="hljs-attr">width</span>: <span class="hljs-number">1280</span>,
    <span class="hljs-attr">height</span>: <span class="hljs-number">720</span>,
    <span class="hljs-attr">scene</span>: Example
};

<span class="hljs-keyword">const</span> game = <span class="hljs-keyword">new</span> Phaser.Game(config);
</code></pre>
<p>This code should be very familiar to you if you've experience with Phaser. We’re using a Phaser Graphics Game Object to render our world. This is perfect for quick tests and debugging. You can, of course, hook bodies to sprites too!</p>
<p>We’ll show some more examples in the next issue.</p>
<p>We’re extremely happy with how this product has turned out. It was a lot of hard work, a lot of debugging and tweaking, but ultimately, we felt it was about time there was an industry-standard physics library available for web games, and we’re thrilled to have created exactly that. It’s fast, stable and powerful.</p>
<p>That’s enough Box2D talk; let’s conclude this issue with some tutorials and games from the Phaser community.</p>
<h2 id="heading-full-breakout-tutorial">⚽ Full Breakout Tutorial</h2>
<p><em>Breaking Down Breakout: Learn Essential Game Physics While Building a Timeless Classic.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/full-breakout-tutorial"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734454374980/d966e3c7-85a4-42eb-9ca6-447d6f6aeb14.png" alt class="image--center mx-auto" /></a></p>
<p>Learn how to create a classic Brick Breaker (Breakout) game using Phaser JS! This tutorial covers everything from setting up the game configuration to implementing paddle and ball physics, creating colorful brick rows, and adding sound effects for an engaging experience. Watch how to handle game states like losing lives, game over, and victory, all explained with clear, easy-to-follow code. Perfect for beginners and those looking to expand their Phaser.js skills.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/full-breakout-tutorial">Watch the video</a></p>
<h2 id="heading-daily-dungeon">⚔️ Daily Dungeon</h2>
<p><em>Your Daily Dose of Puzzle-Packed Adventure: A New Labyrinth of Challenges Every 24 Hours.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/daily-dungeon"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734454481646/8783440c-0c3f-4465-842f-b36aa90809f4.png" alt class="image--center mx-auto" /></a></p>
<p>As the name suggests, Daily Dungeon is a quick-fire dungeon romp. The controls are simple. Move with the arrows, collect keys to open doors, and solve the puzzles. The difference is in the title: Every day, you get a different dungeon to explore!</p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/daily-dungeon">Play Daily Dungeon</a></p>
<h2 id="heading-steps">🧠 Steps</h2>
<p><em>Game 3 of the 101 Game Challenge is out.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/steps"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734454550586/0a213b43-941a-486c-b35c-d9278a034d33.png" alt class="image--center mx-auto" /></a></p>
<p>Emanuele Feronato is back with game 3 in his 101 game series. Each game is available both to play, and also download the source code, or buy an extended version of it. So you can simply enjoy it, or learn from it, too.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/steps">Read about Steps</a></p>
<h2 id="heading-dangle-drop">⭐ Dangle Drop</h2>
<p><em>Orchestrating the Perfect Chain Reaction: A Symphony of Falling Dots.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/dangle-drop"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734454622792/37ba568c-d656-4464-a4a3-c54ffc620a0e.png" alt class="image--center mx-auto" /></a></p>
<p>Dangle Drop is an engaging gravity-based puzzle game set against a calming night sky, challenging players to clear puzzles by eliminating all the white dots on the screen. The gameplay revolves around clicking strategically on various types of dots to create chain reactions, causing the white dots to fall away. Each puzzle offers a unique setup, and players must carefully consider their moves to succeed.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/dangle-drop">Play Dangle Drop</a></p>
<h2 id="heading-state-of-web-game-dev-2024-survey">🖊️ State of Web Game Dev 2024 Survey</h2>
<p>The survey should take no more than 20 minutes. The result will be used to evaluate the state of Web Game Development in 2024. The survey takes place between December 4th and 20th 2024, and we plan on sharing the results publicly in January 2025. Make sure to visit <a target="_blank" href="http://gamedevjs.com/survey/2024">gamedevjs.com/survey/2024</a> for more details.</p>
<p><a target="_blank" href="http://gamedevjs.com/survey/2024">Please take part in this survey!</a></p>
<hr />
<h1 id="heading-share-your-content-with-18000-readers">Share your content with 18,000+ readers</h1>
<p>Created a game, tutorial, code snippet, video, or anything you feel Phaser World readers would like? Then please <a target="_blank" href="mailto:content@phaser.io">send it to us</a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734455085044/a12cdbfa-dbfd-41db-8f23-4e1b9aec06e5.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 209]]></title><description><![CDATA[A nice big chunky issue again! This time we’ve our brand-new Discord Activity Launcher available, two great new tutorials, two great new games and a Dev Logs section to enjoy!
🚀 Discord Activity Launcher Released
From Project Setup to Live Testing i...]]></description><link>https://phaser.world/phaser-world-issue-209</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-209</guid><category><![CDATA[WebGL]]></category><category><![CDATA[canvas]]></category><category><![CDATA[phaser]]></category><category><![CDATA[Game Development]]></category><category><![CDATA[AI]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Mon, 09 Dec 2024 18:43:25 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733763661229/82c1e5c6-8b30-4c60-be9c-045a8663d0da.png" alt class="image--center mx-auto" /></p>
<p>A nice big chunky issue again! This time we’ve our brand-new Discord Activity Launcher available, two great new tutorials, two great new games and a Dev Logs section to enjoy!</p>
<h2 id="heading-discord-activity-launcher-released">🚀 Discord Activity Launcher Released</h2>
<p><em>From Project Setup to Live Testing in Minutes with our free new tool!</em></p>
<p><a target="_blank" href="https://phaser.io/tutorials/discord-activity-launcher-quick-guide"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733763893955/3efc950d-2fec-4d6d-88bd-44f0290e1732.png" alt class="image--center mx-auto" /></a></p>
<p>Creating games for Discord just got significantly easier. Our new Discord Activity Launcher eliminates the traditional setup hurdles, offering a streamlined workflow for both newcomers and experienced developers working with Phaser.</p>
<p>The launcher automatically handles everything from initial project creation to proxy URL generation. Choose between single-player and multiplayer templates, and let the tool configure your development environment, install dependencies, and set up cloud tunneling - all through an intuitive interface.</p>
<p>For existing projects, the launcher serves as a quick way to generate proxy URLs, making testing on Discord seamless. It even integrates directly with the Discord Developer Portal, copying your proxy URL to clipboard and directing you to the right page when your APP_ID is configured.</p>
<p>Available for both Windows and macOS (including Apple Silicon support), the Discord Activity Launcher represents our commitment to making Discord game development more accessible.</p>
<p>Ready to start? Check out our comprehensive tutorial to learn how to use the Discord Activity Launcher and begin creating your own Discord games with Phaser.</p>
<p><a target="_blank" href="https://phaser.io/tutorials/discord-activity-launcher-quick-guide">Download the Discord Activity Launcher</a></p>
<h2 id="heading-game-title-screen-generator-beta">🎨 Game Title Screen Generator Beta</h2>
<p><em>Test out our new AI art tool that helps create game title screens</em></p>
<p><a target="_blank" href="https://gorf.io/titlescreen/"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733765498285/251f92ff-a390-48b5-a92f-e20754f3995c.jpeg" alt class="image--center mx-auto" /></a></p>
<p>We’ve released a beta version of our new AI art tool, which has been built specifically to help you create title screens for your games or projects. It leans heavily into the retro 16-bit aesthetic, having been trained with a special dataset, and we’re really pleased with the results. Read about the development of this in this week’s Dev Log.</p>
<p>This is a time-limited beta release. If you’re reading this in the distant future, we may have already removed the service. Otherwise, feel free to have a play and share your favorite creations!</p>
<p><a target="_blank" href="https://gorf.io/titlescreen/">Phaser Title Screen Generator</a></p>
<h2 id="heading-state-of-web-game-dev-2024-survey">🖊️ State of Web Game Dev 2024 Survey</h2>
<p>The survey should take no more than 20 minutes. The result will be used to evaluate the state of Web Game Development in 2024. The survey takes place between December 4th and 20th 2024, and we plan on sharing the results publicly in January 2025. Make sure to visit <a target="_blank" href="http://gamedevjs.com/survey/2024">gamedevjs.com/survey/2024</a> for more details.</p>
<p><a target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLSfg0sCatdSryJoNVNoo8rLJTKlECtnRo2kOYfT6TpKXKRzDFQ/viewform">Please take part in this survey!</a></p>
<h2 id="heading-create-a-whack-a-mole-style-game">🧠 Create a Whack-a-mole Style Game</h2>
<p><em>Learn how to use Phaser Editor to create this fun monster-bashing game!</em></p>
<p><a target="_blank" href="https://www.youtube.com/watch?v=BVCGpUjBsy4"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733764026968/a2f72420-799f-478f-be25-05f2e2d24fb0.png" alt class="image--center mx-auto" /></a></p>
<p>Scott Westover brings us this great new tutorial on YouTube: "Hey everyone! Today, we’re diving into Phaser Editor v4 to create a fun, monster-themed Whack-a-Mole game!</p>
<p>Phaser Editor makes it super easy to build HTML5 games thanks to its powerful, visual editor that helps us create engaging Phaser games with just a bit of code. In this tutorial, I’ll walk you through each step of creating a simple Whack-a-Mole-style game where you’ll learn a ton.</p>
<p><a target="_blank" href="https://www.youtube.com/watch?v=BVCGpUjBsy4">Watch on YouTube</a></p>
<h2 id="heading-egg-hunt-mania">🎮 Egg Hunt Mania</h2>
<p><em>Scrambling for success in this fast-paced egg-catching challenge</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/egg-hunt-mania"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733764135190/f7f42199-48e5-4d75-ad8e-49a788d5b7b6.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Egg Hunt Mania turns the simple act of catching eggs into a surprisingly intense arcade experience. Players must deftly maneuver their basket to catch eggs rolling down from overhead chickens, all while managing their basket capacity and making crucial timing decisions about when to sell their collected eggs.</p>
<p>The game's core mechanic shines in its deceptive complexity. What starts as a straightforward egg-catching exercise quickly evolves into a challenging balancing act. The tension builds naturally as your basket fills up, forcing you to make split-second decisions: continue catching more eggs to maximize your selling price, or make a dash to the store before your precious cargo ends up as a mess on the floor?</p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/egg-hunt-mania">Play Egg Hunt Mania</a></p>
<h2 id="heading-create-a-game-like-vampire-survivors">🧠 Create a game like Vampire Survivors</h2>
<p><em>Build a quick prototype of Vampire Survivors with Phaser</em></p>
<p><a target="_blank" href="https://www.emanueleferonato.com/2024/11/29/quick-html5-prototype-of-vampire-survivors-built-with-phaser-like-the-original-game/"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733764288494/84fb7f62-8987-4860-a9ef-568d4bd7651d.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Emanuele Feronato is back with the start of a new tutorial series sure to interest a lot of you: "I bet you’re all familiar with Vampire Survivors, the bullet hell roguelike that spawned a new genre of video games and hundreds of imitators.</p>
<p>Did you also know that it was originally built with Phaser? Probably, if you follow the fortunes of this fabulous framework.</p>
<p>So why not write a script of a handful of lines capable of running a prototype of Vampire Survivors?</p>
<p><a target="_blank" href="https://www.emanueleferonato.com/2024/11/29/quick-html5-prototype-of-vampire-survivors-built-with-phaser-like-the-original-game/">Read the Tutorial</a></p>
<h2 id="heading-lottie-arcade">🎮 Lottie Arcade</h2>
<p><em>Where Retro Meets Modern Web Technology</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/lottie-arcade"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733764391071/573e673c-00ee-444a-86ee-e451d5eb692b.png" alt class="image--center mx-auto" /></a></p>
<p>The team at Lottie, known for their web animation technology, has turned their talents to classic gaming with Lottie Arcade. Built during an internal hackathon, this collection of games brings beloved arcade classics to the modern web.</p>
<p>The arcade features three carefully crafted titles that capture the essence of retro gaming. Command Earth's last defenses in Space Invaders, where waves of alien forces descend with increasing intensity. Test your reflexes in Flappy Bird, perfectly timing each tap to navigate through an endless maze of pipes. For speed demons, Highway Rush offers an intense arcade racing experience as you weave through traffic at breakneck speeds.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/12/lottie-arcade">Play Lottie Arcade</a></p>
<hr />
<h1 id="heading-phaser-studio-developer-logs"><strong>Phaser Studio Developer Logs</strong></h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733764540765/711ed29e-9920-4c6a-9f25-616020a4b4ff.png" alt class="image--center mx-auto" /></p>
<p>Here is what the Phaser Studio team has been up to this week:</p>
<h2 id="heading-rich-cto-amp-founder">🧑‍💻 Rich - CTO &amp; Founder</h2>
<p>Here in the UK, and I assume elsewhere in the world, there is a TV show called “I’m a Celebrity, Get Me Out of Here”. My wife and daughter love it. I can’t stand it. So I figured: What fun little evening project could I work on while this is on TV and they are otherwise engaged? Plus, I don’t have to endure watching people swim in beetles (poor beetles 🪳)</p>
<p>The answer came in the form of learning all about AI art generation. This has been a hot-topic for a while. We’re all no doubt familiar with Stable Diffusion’s ‘sausage-finger’ images combined with its inability to even render simple text. But I figured that things don’t really sit still for long. What was next to useless just a year ago, may be a lot more advanced now. And I wasn’t wrong. Some cursory reading on the subject led me to a new alternative model called Flux, created by Black Forest Labs. The results from this were quite staggering. It could do text! It could do fingers! It could do “display a solid red square on a white background” - such power! 🙂</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733767364351/50135b61-4cd1-40c9-b54a-4114debbe13a.jpeg" alt class="image--center mx-auto" /></p>
<p>But could it do pixel art? The short answer: No. Not really. It clearly has no actual concept of what pixel art even is. I was about to give up when I started reading about fine-tuning and creating your own LoRA (Low-Rank Adaptation). A LoRA works by modifying the fine-tuning process. It freezes the original model weights and then applies a separate set of weights, which are blended with the original parameters. In short, you don’t retrain the entire model - because only a handful of tech giants in the world can actually afford to do that - instead, you fine-tune it by training on a specific set of data and using those weights to influence what gets output at the end.</p>
<p>Now, this was fascinating. I found a bunch of online sites that offered LoRA training services for very reasonable prices. All you had to do was prepare your dataset, click a button, wait several hours, and out came a safe tensor file on the other end. So I did what I suspect a lot of noobs do. I threw in a whole batch of images, hit “train” and expected it to understand what I wanted 😅 of course, that’s not how AI works at all.</p>
<p>My initial test images were just a grab bag of retro game screenshots. When I asked the tuned model for an image, expecting to get some pixel-art beauty back again, it didn’t have a clue what to do and gave back rubbish. My weights were having no impact, or worse, ruining the base model. But on TV, contestants were still trying to drink blended cockroach smoothies, so I figured there had to be a reason for my training failure and dug deeper.</p>
<p>When you build your dataset, you have two components: the source image and a textual description of what is in that image. The quality of the description is fundamental. For example, have a look at the following image:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733767819858/a7946240-7a8a-41b2-99ee-bcf2194895f2.png" alt class="image--center mx-auto" /></p>
<p>If you had to type in a description of this, you may write something like “a hand above a planet's surface.” I mean, sure, that <em>is</em> what you can see here. But the training needs much, much more detail. For example, it actually needs something more along the lines of this:</p>
<p><code>The image is a digital artwork, likely from a video game or old-school computer game, featuring a stylized, sci-fi scene. The central focus is a human hand reaching out from the bottom of the image, with fingers extended. The hand is rendered in a detailed, realistic manner with a slightly exaggerated texture, giving it a slightly cartoonish appearance. The hand is a light tan color with visible veins and creases, indicating a detailed shading and lighting effect.</code></p>
<p>Notice how precise we’re being about the placement of the hand. The shading, the color, the style. All of these things matter. This is how the LLM ‘learns’ what it is seeing. You cannot expect it to invoke any real ‘human sense’. There’s no actual ‘intelligence’ going on here. Just a huge vector cloud of related terms and weights.</p>
<p>Prompt an AI to create an image, and it isn’t like asking it to scan a database. If you ask for an “apple,” it doesn’t go and see what apple images it has stored and return one. Instead, AI image generation works more like the model has learned the "essence" of what makes an apple look like an apple. During training, it analyzed millions of images and their descriptions, learning patterns like "apples are typically round, have a stem, can be red or green, and often have a distinctive shape."</p>
<p>When you ask it to create an apple, the AI starts with random noise - imagine TV static or random dots. Then, through diffusion, it gradually refines this noise, using what it learned about apple-like patterns to transform the chaos into something that matches its understanding of "apple-ness." The LoRA is liking giving this understanding additional specialized training in a particular style or subject. When you apply a LoRA to an AI model, you're essentially tweaking its understanding of certain visual concepts.</p>
<p>Once I understood that, I understood the challenge a little deeper. The descriptions had to be excellent, and the source imagery had to be clean. Anything extra in the source imagery would be incorrectly perceived as being part of the image. Plus, for pixel art, you had to ensure all of the source images were properly scaled-up and all the same dimensions to avoid them falling into different training buckets.</p>
<p>Thankfully, Celebrity is quite a long show, so over several nights, I cleaned the source files, carefully resized them, and meticulously detailed them. I set the new training running and went to bed. The next day I got to see the fruits of my labor.</p>
<p>This hard work, combined with a massively powerful base model, resulted in some incredible images. They truly captured what a retro game title screen should look like to me. All bold faux-3D lettering, vibrant colors, and hard outline pixel art. That, when down-sampled and palette quantized, retained that sharp, crisp look.</p>
<p>I felt I was onto something enough to build a basic web interface to it all. This was some simple Bootstrap styles and a bunch of Node JavaScript. I threw it on a cheap VPS, and now it’s available for testing and playing with at:</p>
<p><a target="_blank" href="https://gorf.io/titlescreen/">https://gorf.io/titlescreen/</a></p>
<p>I posted about it to BlueSky and the Phaser Discord, and it was fun to see what was generated. In the past couple of days, over 1000 title screens have been made! A few of my favorites are below:</p>
<p><a target="_blank" href="https://gorf.io/titlescreen/"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733769329113/4e5951ad-9b8b-4763-be62-eb21b85ea125.png" alt class="image--center mx-auto" /></a></p>
<p>Feel free to play with the service. I won’t keep it online for that long, so if you make something you like, please save it!</p>
<p>This work has been interesting, taught me a lot, and is a feature that will manifest in Phaser Launcher upon release. You’ll be able to enter your game name, ask it to create a title screen, and have it add it directly to your project for you.</p>
<p>Who knows what else we could train it to do in the future? 🙂</p>
<h2 id="heading-zeke-phaser-box2d">🧑‍💻 Zeke - Phaser Box2D</h2>
<p>I started the week adding 3 more Box2D examples:</p>
<ol>
<li><p>Static vs. dynamic vs. kinematic bodies</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733764728631/487f145a-a35a-42c5-b71d-bdce9dda33d3.gif" alt class="image--center mx-auto" /></p>
</li>
<li><p>Multiple physics body shapes</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733764741123/9ef52dfb-23a7-49ae-8142-39f20390928a.gif" alt class="image--center mx-auto" /></p>
</li>
<li><p>Different types of linear movement</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733764754331/b5af21be-ee8c-479b-ad11-812667917dcd.gif" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>The remainder of the week was spent working on publishing the first draft of our Box2D documentation on Phaser’s Hashnode Documentation site. I’m happy to announce that it’s up although there is still room for tidying up and tweaking to make everything cohesive and readable.</p>
<p>Until next week, happy game dev-ing!</p>
<h2 id="heading-francisco-phaser-launcher">🧑‍💻 Francisco - Phaser Launcher</h2>
<p>Hi everyone,</p>
<p>This week, I’ve been working on user authentication for our new tool. The idea is to implement something similar to what Arian does in Phaser Editor, with a functional OAuth flow tailored to our application.</p>
<p>To achieve this, I needed to spin up a temporary server directly from the app, which I implemented using Rust. This server handles the authentication flow, including receiving the callback from the OAuth provider. Once authentication is complete, the server shuts down automatically to avoid staying in a listening state.</p>
<p>Ensuring the server closed properly was the most time-consuming part. Adjusting timings, handling errors, and making sure no orphan processes were left behind required several iterations, but I got it working in the end. Now we have a fully functional authentication flow, although it’s currently running as a separate project.</p>
<p><strong>Next steps</strong></p>
<p>Full integration: The next step is to merge this functionality with the main tool. This includes building a component to continuously validate with the server whether the user is logged in. Refinements: While the flow is functional, I want to make sure it’s robust against potential network errors or unexpected configurations. It’s been an intense week, but the result is worth it. We now have a solid foundation for authentication and are one step closer to a fully functional tool.</p>
<h2 id="heading-can-discord-activity-launcher">🧑‍💻 Can - Discord Activity Launcher</h2>
<p>After enduring intense power cuts in my country, I'm thrilled to announce that the first version of our <a target="_blank" href="https://phaser.io/tutorials/discord-activity-launcher-quick-guide">Discord Activity Tool</a> &amp; tutorial is finally complete—hooray!🎉</p>
<p><strong>What I've Accomplished This Week</strong></p>
<ul>
<li><p>UI Restructuring &amp; Polishing: Completely revamped the user interface for better usability and aesthetics.</p>
</li>
<li><p>Fixed Typos: Cleaned up all those pesky text errors.</p>
</li>
<li><p>Updated App Info &amp; Mac Icons: Ensured all metadata and visuals are up-to-date and looks good.</p>
</li>
<li><p>Disabled Window Resizing: Locked down the app's dimensions for a better, controlled experience.</p>
</li>
<li><p>Improved Cloudflared Check: The app now skips the installation if Cloudflared is already installed and avoids redundancy.</p>
</li>
<li><p>Better Background Design: Thank you, Richard!</p>
</li>
</ul>
<p><strong>Tauri in Production</strong></p>
<p>I discovered something unexpected about Tauri: even if you hardcode CSS colors in your app, Tauri will adjust the app's colors based on your system's theme mode (e.g., light/dark mode). While this can be neat in some scenarios, it wasn't what we wanted. Thankfully, it's an easy fix with a simple Tauri config tweak.</p>
<p><strong>First Impressions of Tauri</strong></p>
<ul>
<li><p>Effortless Builds: Minimal hassle, excellent performance, and the lightweight build size is a dream for a web app.</p>
</li>
<li><p>Rust Experience: Although I'm not well-versed in Rust, implementing bug fixes and plugins wasn't as challenging as I feared.</p>
</li>
<li><p>Upgrading from v1 to v2: The upgrade process was straightforward, though the documentation still needs refinement. Some details are missing, and following v1 docs can sometimes mislead—but also guide!</p>
</li>
</ul>
<p>Got feedback or ideas? Drop by our Discord's #discord-activities channel and share your thoughts or showcase your own projects!</p>
<p>May the pixels be ever in your favor! (Or, if you're feeling nostalgic: "May the force be with you!")</p>
<h2 id="heading-arian-phaser-editor">Arian - Phaser Editor</h2>
<p>Hello friends</p>
<p>Last week I have dedicated almost entirely to a new feature of the editor: compressed textures.</p>
<p>Phaser has supported compressed textures for a while now, and now you can use it via Phaser Editor as well, you just have to define the textures in an asset pack.</p>
<p>The process is similar to other assets or images, you must first define them in an asset pack to then be able to use it in the scene editor.</p>
<p>Compressed textures have a peculiarity, and that is that the editor needs an image (PNG, JPG, etc...) as a reference, and you must also define its counterpart with the different compressed texture formats, since browsers can vary in the support of these formats. So, first you select the reference image, and import it as a "texture":</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733765018842/8ae1f708-6d32-409b-a141-cb428bd95360.png" alt class="image--center mx-auto" /></p>
<p>Then, in the asset pack editor, you can define versions of that image in the different compressed texture formats supported by Phaser:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733765027528/2f6997e3-0214-402b-b3dc-58e488bc798a.png" alt class="image--center mx-auto" /></p>
<p>The process for importing a compressed texture atlas is very similar. The editor needs an atlas of reference images, and then you define all the versions in the different formats.</p>
<p>This feature is now ready. We are working on various issues and features requested by the community. We should have a new release before the end of the year.</p>
<p>Cheers!</p>
<hr />
<h1 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733764497552/f3520f6c-9cc9-42a2-8263-42d29e21440e.png" alt class="image--center mx-auto" /></p>
<p>9th December, 2024 by Ben Richards</p>
<p>I'm back in action. The last couple of weeks were a writeoff, thanks to a second bout of COVID-19. Very unpleasant; do not recommend. The main symptoms took me out for a couple of days, and left me barely able to code for another week.</p>
<p>This is why I mask up in public places. I don't want to infect anybody else, because I don't like being sick and I assume other people feel the same way.</p>
<p>So there's not much to report, sadly. I'm still working on Phaser 4 beta 3. The main objective is still to get Filters working as a component, much like FX in Phaser 3. This entails some rewrites of the transform logic, because filters previously had a separate RenderFilters object to hold all their transforms, but a component just has the single GameObject to work with. Overall, however, this approach is simpler and requires fewer moving parts. I'm confident that this is a better approach.</p>
<p>I reckon there will be plenty to share next week.</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 208]]></title><description><![CDATA[Welcome to Issue 208 and two new product releases, Studio Developer logs and of course a Cyber Monday special offer. Read on …
🔥 Cyber Monday - 30% Off!
Get 30% off our annual subscriptions for a limited time.
Use the code CYBER30 during checkout to...]]></description><link>https://phaser.world/phaser-world-issue-208</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-208</guid><category><![CDATA[WebGL]]></category><category><![CDATA[canvas]]></category><category><![CDATA[phaser]]></category><category><![CDATA[Game Development]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Mon, 02 Dec 2024 16:10:55 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733152769337/c3fe3eb7-9b4c-4d35-905b-867fa81b9a9c.png" alt class="image--center mx-auto" /></p>
<p>Welcome to Issue 208 and two new product releases, Studio Developer logs and of course a Cyber Monday special offer. Read on …</p>
<h2 id="heading-cyber-monday-30-off"><strong>🔥 Cyber Monday - 30% Off!</strong></h2>
<p>Get 30% off our annual subscriptions for a limited time.</p>
<p>Use the code CYBER30 <a target="_blank" href="https://phaser.io/pricing">during checkout</a> to get 30% off.</p>
<p>This code expires on December 6th, 2024.</p>
<h2 id="heading-phaser-editor-v471-released">🚀 Phaser Editor v4.7.1 Released</h2>
<p><em>Settings panels, keyboard shortcuts, support for JetBrains IDEs, font files, and more!</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/phaser-editor-v470-released"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733152970453/18f863f8-5596-4f34-adf0-7b1b54fa681e.png" alt class="image--center mx-auto" /></a></p>
<p>We are pleased to announce the release of Phaser Editor 4.7.0. This version introduces the long-awaited built-in web font loader. This new feature allows you to load web fonts directly from the editor asset pack editor, making it easier to use custom fonts in your scenes. This new feature was possible thanks to the latest Phaser version (3.87), which introduced the new FontFile API.</p>
<p>In addition to the font loader, we built a brand-new UI system that allows you to configure most Phaser Editor settings.</p>
<p>Today (Monday 2nd) we also published the 4.7.1 point release, which has a small fix for adding Tilemaps into Layers.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/phaser-editor-v470-released">Read more about Phaser Editor 4.7.0</a></p>
<h2 id="heading-arena-survivors">🎮 Arena Survivors</h2>
<p><em>Visit interesting places and destroy everything in this bullet hell game.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/arena-survivors"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733153138446/28d0a1d7-add6-4130-ada3-dd1219db4ff6.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Arena Survivors, developed by 2kblater, builds upon the addictive auto-shooter mechanics popularized by Vampire Survivors while carving out its own unique identity. This rogue-like RPG drops players into dynamic arenas where survival depends on quick thinking and strategic character building.</p>
<p>Like its inspiration, Arena Survivors excels in creating that "just one more run" feeling. The game sets itself apart through its diverse enemy roster – from mythological beasts to surprisingly deadly farm animals. Boss encounters and special events keep players on their toes, requiring quick adaptation of tactics and loadouts. The procedurally generated levels ensure no two runs feel identical.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/arena-survivors">Play Arena Survivors</a></p>
<h2 id="heading-creat-game-cli-update">🌮 Creat Game CLI Update</h2>
<p><em>This new version adds multiplayer, Discord Activities and physics templates.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/create-game-cli-update"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733153353041/b8a66018-5d1c-458a-8a7f-129b62acc8a8.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Today we released version 1.2.7 of our Create Game CLI app. This release introduces a new 'Middleware' section that offers you the ability to download and install the following new templates:</p>
<p>Rune Multiplayer Tic-Tac-Toe Example Discord Activities (Single Player) Discord Activities (Multiplayer) Rapier Physics Connector To use the tool, simply issue the command:</p>
<p><code>npm create @phaserjs/game@latest</code></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/create-game-cli-update">Read more about the CLI Tool Update</a></p>
<h2 id="heading-game-file-hosting">💾 Game File Hosting</h2>
<p><em>Free, easy drag-and-drop game file hosting for all Phaser users!</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/game-file-hosting-available"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733153634764/436b160e-2c72-4123-a1af-862bb17fc3e8.jpeg" alt class="image--center mx-auto" /></a></p>
<p>We're super excited to announce that our Game File Hosting Service is now available for everyone. Register an account on the Phaser site, and you'll have immediate access to our new file hosting service.</p>
<p>Because of the way browser security works, it's often quite complex to simply put a file somewhere and get a URL that you can use in your games. Direct linking to files, such as those stored in Imgur or GitHub, is nearly always blocked via restrictive CORs policies. And if you want to test something quickly, using our Phaser Sandbox is perfect for that — but again, how do you access your files from within it?</p>
<p>Previously, you'd need to run your own server and manage your security settings manually to achieve this. Now, you can use our free drag-and-drop file hosting service!</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/game-file-hosting-available">Read More about Game File Hosting</a></p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733153805673/ab155b05-5a95-4342-9bc5-8aeea4d53c60.png" alt class="image--center mx-auto" /></p>
<p>Here is what the Phaser Studio team has been up to this week:</p>
<h2 id="heading-rich-cto-amp-founder">🧑‍💻 Rich - CTO &amp; Founder</h2>
<p>This week was strange. Obviously, with Thanksgiving, several of the team members were away for two days. Plus, Ben contracted Covid, which knocked him out for the entire week. As a result, sadly, there are no <em>Tales from the Pixel Mines in</em> this issue! So we were much lighter-staffed than usual for most of the week. Even so, we published a new CLI create game tool version and a lovely Quality of Life release for Phaser Editor.</p>
<p>Internally, the design and build for the Box2D pages are now entirely done! This is super exciting. :) The library is solid, the documentation is done, the examples are coming together, and we’ve got lots of tutorials, too. All in all, it’s a compelling bundle of a package, and, touch wood, it should be on sale this week.</p>
<p>Once Box2D is out, my focus will shift to Phaser v4. Now that Ben is well again, the pace will ramp up this week, and we’ll push towards a new beta release. We’ve also got the Game Publishing service to go live, hundreds of new examples to upload, and new Discord Activities tutorials! It’s going to be a busy final month of the year 🙂</p>
<h2 id="heading-francisco-phaser-launcher">🧑‍💻 Francisco - Phaser Launcher</h2>
<p>¡Hola a todos!</p>
<p><strong>Phaser Template Installer</strong></p>
<p>This week, we updated our Phaser Template Installer with the release of version 1.2.7, which brings three new templates and some important adjustments. One of the existing templates, <strong>Rapier</strong>, has been moved to a new section called <strong>Middleware</strong>, where you’ll find templates related to tools and extensions for Phaser. Some of these templates are contributions from third parties that we’ve carefully reviewed to ensure their quality and usefulness.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733155290899/3b6cd93c-5f25-42f8-8b5b-2bbb2f360731.png" alt class="image--center mx-auto" /></p>
<p><strong>Phaser Launcher</strong></p>
<p>Regarding Phaser Launcher, I’ve been working on the component responsible for displaying the game. This component has a rather unique behavior: it needs to open with the DevTools window enabled right from the start and allow users to toggle it open or closed at will.</p>
<p>At first, this turned out to be quite challenging, especially on Windows and macOS. The main issue was the iframe used to load the game—it captured all events, making it impossible to open the DevTools window. This limitation caused a lot of frustration as I experimented with different approaches to find a solution that wouldn’t break other functionality.</p>
<p>After what felt like hundreds of tests, I finally found the right approach: taking complete control of the component by injecting code directly into the game’s index.html. This allowed me to capture all generated events, making it possible to open and close the DevTools window smoothly, even with the iframe in place.</p>
<p>The exciting part about this solution is that it opens the door to injecting additional scripts dynamically into the game. This gives us a lot of flexibility to introduce new tools or features in the future.</p>
<p>That’s all for now — stay tuned for more updates!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733155312114/6d87ed39-4aa1-47b4-ac0c-ea63d930ef6e.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-zeke-box2d">🧑‍💻 Zeke - Box2D</h2>
<p>This week, I focused on completing the Tiny Wings demo and started working on our Box2D Javascript documentation. Pete has done an amazing job porting the entire C library to Javascript and the demo’s the team has made are just beautiful to watch.</p>
<p>Here’s a gif showing the final step in the Tiny Wing’s demo featuring endless terrain generation.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733155351923/22caf620-7ea4-4981-8d99-df0d7ece54fe.gif" alt class="image--center mx-auto" /></p>
<p>As for Box2D documentation, I worked on reviewing existing code examples to ensure it works as intended. This also involves creating fully working examples of each tutorial so you can see how all the code is put together to make it work.</p>
<p>Here’s an example of a one-way platform:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733155374555/7ad6dcfe-4eae-45bb-baeb-031a102707b5.gif" alt class="image--center mx-auto" /></p>
<p>This documentation will continue for the near future so expect to see more examples posted.</p>
<p>Have a good week ahead!</p>
<h2 id="heading-pete-box2d">🧑‍💻 Pete - Box2D</h2>
<p>It's a wrap! ... nearly! For my last week on Phaser Box2D I helped convert the entire contents of the iForce2D website from talking about Box2D v2.X in C++ to relevance for Phaser Box2D v3 in JavaScript.</p>
<p>Together Zeke and I went through the material several times, and hopefully <em>I</em> didn't miss too many of the old-style references for Zeke to clean up before it all goes live. Looking back at what this Phaser team has achieved is incredibly rewarding: a complete, fast, JS conversion of the newest version of the leading 2D physics engine.</p>
<p>With a fully documented API, tons of examples, and an entire website worth of tutorials. We truly "stand on the shoulders of giants" because none of this would have been possible without the amazing work done by Erin in creating Box2D v3 and Chris in writing such a wonderful tutorial resource.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733155581110/0a0ba095-0dcd-47f8-be07-fc45dc6c4043.png" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 207]]></title><description><![CDATA[In this issue, we introduce a free file hosting service, showcase two great games, dive into Phaser Editor tutorials, and have a massive dev log from the team. Let’s go …
🔥 Black Friday - 30% Off!
Get 30% off our monthly or annual subscriptions for ...]]></description><link>https://phaser.world/phaser-world-issue-207</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-207</guid><category><![CDATA[WebGL]]></category><category><![CDATA[canvas]]></category><category><![CDATA[phaser]]></category><category><![CDATA[Game Development]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Mon, 25 Nov 2024 14:56:37 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732538264719/355ddaab-548d-4560-9377-2746e7dfbd15.png" alt class="image--center mx-auto" /></p>
<p>In this issue, we introduce a free file hosting service, showcase two great games, dive into Phaser Editor tutorials, and have a massive dev log from the team. Let’s go …</p>
<h2 id="heading-black-friday-30-off">🔥 Black Friday - 30% Off!</h2>
<p>Get 30% off our monthly or annual subscriptions for a limited time.</p>
<p>Use the code <strong>BF30</strong> during checkout to get 30% off.</p>
<p><a target="_blank" href="https://phaser.io/pricing">Click here to see the Pricing page</a>.</p>
<p>This code expires on December 1st 2024.</p>
<p>The discount applies to first-time customers and is for the first payment only. For the largest discount, use it on an annual payment.</p>
<h2 id="heading-game-file-hosting">💾 Game File Hosting</h2>
<p><em>Free, easy drag-and-drop game file hosting for all Phaser users!</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/game-file-hosting-available"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732538584426/1debe783-7eff-4149-b0ca-152a8835b0db.jpeg" alt class="image--center mx-auto" /></a></p>
<p>We're super excited to announce that our <strong>Game File Hosting Service</strong> is now available for everyone. Register an account on the Phaser site, and you'll have immediate access to our new file hosting service.</p>
<p>Because of the way browser security works, it's often quite complex to simply put a file somewhere and get a URL that you can use in your games. Direct linking to files, such as those stored in Imgur or GitHub, is nearly always blocked via restrictive CORs policies. And if you want to test something quickly, using our Phaser Sandbox is perfect for that — but again, how do you access your files from within it?</p>
<p>Previously, you'd need to run your own server and manage your security settings manually to achieve this. Now, you can use our free drag-and-drop file hosting service!</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/game-file-hosting-available">Read More about Game File Hosting</a></p>
<h2 id="heading-reddit-games-and-puzzles-hackathon">🧩 Reddit Games and Puzzles Hackathon</h2>
<p><em>Create a new word or puzzle game and win a share of $116,000 prize money.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/reddit-games-and-puzzles-hackathon"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732539439000/3fbe80ec-25a2-4878-b2c2-1d1fc46bcd3f.jpeg" alt class="image--center mx-auto" /></a></p>
<p>The Reddit Games and Puzzles Challenge kicked off today and gives Phaser developers a great chance at winning a slice of the $116,000 prize money on offer. The challenge? To create a word or puzzle game using Reddit's Developer Platform.</p>
<p>They are looking for apps that "leverage interactive posts", making this an exciting opportunity for developers to showcase their creativity and skills.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/reddit-games-and-puzzles-hackathon">Read more about the Reddit Hackathon</a></p>
<h2 id="heading-the-crazy-hyper-dungeon-chronicles">🎮 The Crazy Hyper-Dungeon Chronicles</h2>
<p><em>A fresh take on roguelite crawlers where procedural dungeons meet witty chaos.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/the-crazy-hyper-dungeon-chronicles"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732539567082/1ed53420-b896-4b0b-a727-292f8ec1761d.png" alt class="image--center mx-auto" /></a></p>
<p>In an era saturated with dungeon crawlers, The Crazy Hyper-Dungeon Chronicles stands out by refusing to take itself too seriously. This upcoming pixel-art RPG, slated for 2025, brings a refreshing blend of classic dungeon-crawling mechanics and modern roguelite elements, all wrapped in a layer of eccentric humor.</p>
<p>With 50 planned levels, multiple heroes, and three combat styles, The Crazy Hyper-Dungeon Chronicles promises substantial content. But its true appeal lies in how it balances accessibility with depth – easy to pick up, yet offering enough complexity to keep veterans engaged.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732539697086/ce0216f0-a00b-401a-bfed-1ed5139ab181.png" alt class="image--center mx-auto" /></p>
<p>Whether you're following in the footsteps of the legendary Lando Lore or simply trying to keep King Dandelion entertained enough to avoid war, this quirky dungeon crawler looks set to carve out its own unique niche in the genre.</p>
<p>Everyone at Phaser Studio wishes the developers all the best for their full release. In the meantime, download the entertaining demo version from Steam and be sure to add it to your wishlist!</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/the-crazy-hyper-dungeon-chronicles">Read more about the Steam demo</a></p>
<h2 id="heading-phaser-editor-script-nodes-tutorial">🧠 Phaser Editor Script Nodes Tutorial</h2>
<p><em>Learn how to manage custom code and modular development in Phaser Editor.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/phaser-editor-script-nodes-tutorial"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732539777137/47d5a0f8-e1db-489e-9369-69be73668747.png" alt class="image--center mx-auto" /></a></p>
<p>Scott Westover has published a new YouTube tutorial that goes in dept into one of the most powerful features of Phaser Editor v4 - Script Nodes. This tool opens up a whole new way to manage custom code, making game development faster and more flexible.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/phaser-editor-script-nodes-tutorial">Watch the Tutorial</a></p>
<h2 id="heading-murder">🎮 Murder</h2>
<p><em>Creep up behind the king and take him out quietly in this 100M+ played game.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/murder"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732539925909/9de4986e-7c11-42bb-adba-4f75b50ca905.png" alt class="image--center mx-auto" /></a></p>
<p>One of the things about Phaser being open-source is that anyone can come along, freely take the library and release a game without ever telling us. We absolutely love it when they do tell us! Yet there is, of course, no obligation to do so. Which means that we'll often come across a game that may have been released years ago, that we have never played before. And that is the case here, with Murder!</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/murder">Play Murder</a></p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732540013104/53deefb2-f91a-4556-b905-24e8c8162e1a.png" alt class="image--center mx-auto" /></p>
<p>Here is what the Phaser Studio team has been up to this week:</p>
<h2 id="heading-rich-cto-amp-founder">👨‍💻 Rich - CTO &amp; Founder</h2>
<p>As usual, my week was a mixed bag of delights! On the Box2D front, I configured JSDoc and have it generating all of the documentation we’ve created for the v3 functions. We had to write it all ourselves, and there are hundreds of functions! But now this is done, it’s easy to scan through in HTML form.</p>
<p>However, we also realized that you need tutorials as well as function documentation. So we’ve attacked this on two fronts. The first is to create our own, and the second is that we agreed with Chris Campbell of iForce2D to license and repurpose his excellent Box2D tutorials. His are all for v2, and all code is in C, so we have a bunch of work to update them - but once complete, this will be a solid bundle: A modern, compact library, a whole bunch of examples to learn from (including both Phaser and ‘pure’ examples), a large set of tutorials and finally generated documentation. It’s been a lot of work to get the product to this point, involving weeks of hard graft from the team - and ultimately, this is why it can’t be a free release. I’m well aware we’re going to get criticized for this. I’m also well aware of how much it cost us to produce.</p>
<p>In other news, Ilija has completed the Phaser Beam logo! There are light and dark versions, and I absolutely love it. It’s everything I wanted it to be and more. Here is an exclusive peek at it:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732541529587/fc119e30-95a9-46b4-9e91-dcda31056c27.png" alt class="image--center mx-auto" /></p>
<p>Totally awesome 🤩</p>
<h2 id="heading-pete-box2d">👨‍💻 Pete - Box2D</h2>
<p>The week has been busy on several different fronts...</p>
<p><strong>Code Optimization</strong></p>
<p>We've achieved package size reductions by identifying and removing unused SIMD-related functions. Additionally, we've improved performance by optimizing even more heavily-used functions that were creating temporary <code>b2Vec2</code> objects – inline mathematics operations now reduce garbage collection overhead and provide minor performance gains.</p>
<p>While maintaining close alignment with the official Box2D implementation, we made a decision to improve user experience: mouse joints now automatically wake sleeping objects upon attachment. We're tracking recent official patches regarding sleep/wake states and will evaluate their integration soon.</p>
<p><strong>Code Quality</strong></p>
<p>An ESLint pass has helped us clean up both the library and examples. During this process, I addressed nearly all of my outstanding TODO items, leaving only one complex design question for further discussion.</p>
<p>We've resolved display issues on high DPI screens, benefiting Mac users who were experiencing scaling problems with the debug drawing in the examples. The core library doesn’t include any drawing functions at all, but it’s always helpful to see what is going on in the examples, so there is both a canvas debugger and a Phaser one.</p>
<p><strong>New Examples and Features</strong></p>
<p>This week's new demonstrations include:</p>
<ul>
<li><p>A dynamic jar simulation featuring capsule-shaped pills stirred by a rotating paddle</p>
</li>
<li><p>A side-scrolling car driving demo with an extensive chain-based terrain</p>
</li>
<li><p>Physics-driven explosion effects triggered by mouse input</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732540736647/48537596-6e10-4a51-9d47-890ab5d1b4d4.gif" alt class="image--center mx-auto" /></p>
<p>We've also refined existing examples and extracted the Earcut Constrained Delauney Triangulation code into a standalone helper file, temporarily housed in the Examples folder pending a permanent location decision.</p>
<p><strong>Documentation and Tutorials</strong></p>
<p>Additional help is available following the creation of first-draft tutorials covering 13 example projects. Pending initial feedback, we might extend this effort to most remaining examples.</p>
<p><strong>Performance Testing</strong></p>
<p>Our new stress test example dynamically maintains 58fps (±1) by adding or removing physics objects as needed. This benchmark helps us understand performance across different hardware configurations:</p>
<ul>
<li><p>Powerful but aging Windows desktop: ~2,300 objects</p>
</li>
<li><p>Mid-range systems: ~1,900 objects</p>
</li>
<li><p>High-end hardware (iMac M3): 6,000+ objects</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732540949980/a693c73e-b831-49d1-8a60-64de1efee133.gif" alt class="image--center mx-auto" /></p>
<p>This test dumps thousands of objects into one giant heap, so isn’t representative of an actual game, as it’s dealing with literally thousands of contact resolutions per frame. If you were to island the objects, so groups of them could achieve going to sleep, you can expect dramatically larger numbers. Even so, ‘stress’ is the important part of this test here: Huge piles of objects that never start overlapping or ‘squishing’.</p>
<p><strong>Ongoing Development</strong></p>
<p>We're actively following Erin's improvements to the official Box2D v3, carefully evaluating and incorporating the most critical updates into our JavaScript implementation. We've secured an agreement with Chris from iForce2D to adapt his excellent Box2D v2 educational content for Phaser Box2D. This adaptation work has just begun and promises to provide comprehensive, practical guidance for our implementation.</p>
<h2 id="heading-francisco-phaser-launcher">👨‍💻 Francisco - Phaser Launcher</h2>
<p>Hi everyone,</p>
<p>This week, I’ve been exploring how to add drag-and-drop functionality to our small editor.</p>
<p>Initially, I ran into several challenges. My first approach was to use Tauri’s events to handle file drops. However, this method didn’t emit any events to the client, which caused issues when trying to display what was happening on the front end of the application.</p>
<p>The solution turned out to be simpler than expected. In the end, I disabled Tauri’s drag-and-drop events and leveraged HTML5’s DataTransfer API instead. This allowed me to copy files to the user’s selected path seamlessly.</p>
<p>Step by step, our application is growing and gaining potential. I’m excited to see where this journey takes us!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732541064033/f34836c5-0760-40b2-bf82-a1d7b5cf08fc.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-arian-phaser-editor">👨‍💻 Arian - Phaser Editor</h2>
<p>Hello friends.</p>
<p>This week we finally completed the UI for the editor settings. Basically, we finished the tab for redefining command key bindings. This is something that many of you have been asking for for a while, and it's finally done. Here's a picture:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732541171150/be81bc69-30b6-4c60-9905-3f207bf3dcfd.png" alt class="image--center mx-auto" /></p>
<p>During the week, a few of us on the team were tasked with implementing small examples for the new Box2D JavaScript library they're cooking up in Phaser. This was quite stressful for me, as I had very little knowledge of how these kinds of physics libraries work. The first day I spent most of my time reading the Box2D documentation and even learning some physics concepts. Physics was never my strong suit in school. But finally on the second day I was able to complete two examples. Here are some pictures.</p>
<p>Spiderman movement example:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732541181796/8679fe20-4716-4dc8-a410-cd20af6aed09.gif" alt class="image--center mx-auto" /></p>
<p>Retro volleyball gameplay:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732541188673/461f2bf2-c0af-4566-93c9-82a96cc9be40.gif" alt class="image--center mx-auto" /></p>
<p>Next week we're adding support for web fonts to Phaser Editor, and we'll start working on publishing a release. See you!</p>
<h2 id="heading-zeke-box2d">👨‍💻 Zeke - Box2D</h2>
<p>Another week, another Box2D game demo completed and another in progress. Inspiration can come from anywhere, and this week’s demo is inspired by <a target="_blank" href="https://benjames171.itch.io">BenJames171’s</a> Escape Pod game. Although it’s no longer available to play, here’s a screenshot:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732545387870/7ce70483-e1ae-4528-9e4a-d9de7f8e0124.jpeg" alt class="image--center mx-auto" /></p>
<blockquote>
<p>The aim of the game is to reach your homeworld in an escape pod fired from a base on the other side of various planetary systems. The escape pod works as a projectile so you only control angle and power when firing off; you need to find the right trajectory that makes use of the other planets gravity along the way.</p>
</blockquote>
<p><strong>Demo 1</strong></p>
<p>And here are the steps taken to create a basic implementation of planetary gravity in Phaser’s Box2D plugin.</p>
<ol>
<li><p>Create a Box2D circular sensor zone and have objects touching the area drawn towards the centre. The planet itself is a solid circle body so the objects are able to <em>land</em> on it.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732545410005/1e109aba-f214-4761-975f-57a5174a8e70.gif" alt class="image--center mx-auto" /></p>
</li>
<li><p>Add an aiming mechanism that controls the angle and power</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732545424663/acf2179d-0347-4f3e-ba5e-d4eebbeb06ac.gif" alt class="image--center mx-auto" /></p>
</li>
<li><p>Add collision detection for the planets</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732545467134/0e267e03-4cf3-494b-adbc-e42c0d66ba26.gif" alt class="image--center mx-auto" /></p>
</li>
<li><p>Add ending animation for the final planet</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732545477145/e319f97d-de15-4b35-92bb-ed8853ec8422.gif" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>Just place the start and end positions, adjust the size, positions and gravity strength of each planet and you can easily create multiple levels.</p>
<p><strong>Demo 2</strong></p>
<p>This next demo is inspired by <a target="_blank" href="https://www.andreasilliger.com/">Andreas Illiger’s Tiny Wings</a>.</p>
<blockquote>
<p>The goal of the game is to control a bird while using hills in order to gain speed and fly as far as possible.</p>
</blockquote>
<p>Although the demo is incomplete at this point, the basic mechanics are already in place.</p>
<ol>
<li><p>The first step is to draw procedurally generated hills using a cosine function and enable physics bodies on the curve.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732545494499/c5f77278-b969-4db9-a318-79aac60198fe.gif" alt class="image--center mx-auto" /></p>
</li>
<li><p>Next to add input controls to enable the ability to <em>dive</em>.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732545508016/5288cfb8-0f11-45db-9623-9bdd4e5179af.gif" alt class="image--center mx-auto" /></p>
</li>
<li><p>Camera pan and zoom effects are added to follow the player.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732545518769/1988d061-f719-4bab-8b3c-ebafb7b976e6.gif" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>The last step in this demo that will be worked on next week is to add continuous terrain generation to make this demo an endless journey for the player. Of course, more features could be added but this is a good enough starting point if you’re interested in creating games with a similar mechanic.</p>
<p>Although we’ve already got a tonne of ideas for 2D physics demos on our plate, feel free to get in touch with the dev team on Discord if you have ideas or suggestions you’d like to see implemented.</p>
<p>Have a good week ahead!</p>
<hr />
<h1 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732541279889/cd02863d-caa2-4b47-b9b8-839260d6b15a.png" alt class="image--center mx-auto" /></p>
<p><em>November 23rd 2024, Ben Richards</em></p>
<p>This week: Beta feedback!</p>
<p>Last week, we released Phaser 4.0.0 beta 1. As a beta test, we're trying to find problems, both in the code and in the way it gets used. With the help of the community, we're succeeding at both!</p>
<h2 id="heading-bug-fixes">Bug Fixes</h2>
<p>Beta 2 was quickly released with several fixes.</p>
<ul>
<li><p><code>roundPixels</code> quality enhancement</p>
</li>
<li><p>Fixes to DynamicTexture and Mask</p>
</li>
<li><p>Fixes to shader compilation on diverse systems</p>
</li>
<li><p>Fix Extern</p>
</li>
<li><p>Separate TileSprite dimension defaults</p>
</li>
<li><p>BaseFilterShader now accesses loaded shader cache keys correctly.</p>
</li>
</ul>
<h3 id="heading-roundpixels-quality-enhancement">RoundPixels Quality Enhancement</h3>
<p>The <code>roundPixels</code> setting, available in the game config and on individual cameras, causes the vertices of sprites to snap to integer values. This helps keeping pixel art crisp by avoiding antialiasing.</p>
<blockquote>
<p>For the best pixel art results, use the new <code>smoothPixelArt</code> config option for antialiased, unfiltered texels, or the existing <code>pixelArt</code> option for aliased texels.</p>
</blockquote>
<p>We've taken a few approaches to this setting in the past. They all have trade-offs and weak points. Phaser v3 has used a couple of techniques, including vertex shader rounding and CPU-side vertex rounding. CPU-side rounding got good results, but because the CPU runs one linear computation thread, it's slower. It also touches lots of regions of code, and such complexity is usually fragile.</p>
<p>So vertex shader rounding is probably the best choice. Unfortunately, there are a few problems which aren't immediately obvious.</p>
<p>The first problem: there's no <code>round</code> function in the OpenGL ES Shading Language 1.0 specification. All we have is <code>floor</code>, which will change 1.999 to 1.0. This is easy to hack: <code>floor(value + 0.5)</code> is pretty much the same.</p>
<p>The second problem: no it's not. Under almost all circumstances, <code>floor(value + 0.5)</code> returns the expected value. However, what happens when <code>value == 0.5</code>? You might think that <code>0.5 + 0.5 == 1.0</code>, i.e. <code>value</code> is rounded up. Unfortunately, that's not always true. The GPU handles floating-point numbers with limited precision. In fact, the precision can be quite low, especially if the shader is set to <code>mediump</code> precision. Given different values, e.g. 1.5 versus 1000.5, we might round either up or down, without any way to predict it.</p>
<p>This might seem like a very unlikely problem. How often is a sprite placed at precisely 0.5 pixels? And what's the worst that could happen?</p>
<p>Unfortunately, it's very common, and quite visible. A sprite's position is, by default, midway between its corners. If its dimensions are odd, e.g. 27x53, "midway" means its corners are 13.5x26.5 pixels away. Their fractional component is precisely 0.5 - the problem value. And because we can't predict which way this value rounds, the corners may be up to 1 pixel off.</p>
<p>This means that the sprite may be slightly distorted, skipping or duplicating some pixels. Which is bad!</p>
<p>After some experimentation, we settled on a simple fix: adding bias. By adding a tiny quantity to the value, we can tip it into the precision range where 0.5 always rounds up - the desirable outcome. The former hack becomes <code>floor(value + 0.5001)</code>. This is just as fast, but it produces perfect results in this very common use case.</p>
<blockquote>
<p>Could this cause distortions in other scenarios? Probably, but they're far less likely. Consider that it's very easy to get 0.5, just by loading a texture with an odd dimension and positioning it at an integer. But it's very unlikely to get within the precision range of 0.5001 unless you're moving objects incredibly slowly.</p>
<p>Further, the position is calculated in "window space": it's always rounded to the nearest pixel on the screen. This limits any distortion to a single pixel. Even if you zoom in 1,000,000,000 times, you'll never see more than a pixel of distortion.</p>
<p>The value actually being rounded is computed on the CPU. JavaScript uses 64-bit floating point numbers, which have a great deal of precision, but some calculations use 32-bit buffers so the precision is not that high. Just avoid values in the quadrillions and everything will be fine.</p>
</blockquote>
<h3 id="heading-fixes-to-dynamictexture-and-mask">Fixes to DynamicTexture and Mask</h3>
<p>When we merged development of the Beam renderer with the latest Phaser code base, we inadvertently invalidated the way we create DynamicTextures. The base Texture naming rules were tightened, invalidating our original strategy. The Mask filter uses a DynamicTexture, so it stopped working too.</p>
<p>The fix was to standardize DynamicTexture naming to use UUIDv4 strings.</p>
<h3 id="heading-fixes-to-shader-compilation-on-diverse-systems">Fixes to Shader Compilation on Diverse Systems</h3>
<p>Here's the truth about shaders: they work differently on different devices. In fact, sometimes something that works fine on one machine is an error on another: not due to different capabilities, but simply due to the way the shader compiler works. This can even differ between browsers on the same machine.</p>
<p>You can see where this is going. Shaders that worked fine on my machine failed to work on other devices. This is why community testing is good.</p>
<p>The most egregious example was a case where one vertex attribute was not used by a shader. On most systems, the attribute was still exposed; it just did nothing. On one Linux system, however, the attribute was removed by the shader, because it did nothing. So our code crashed when it tried to access it.</p>
<p>I've made changes to prevent these issues. Things seem to be working better.</p>
<h3 id="heading-fix-extern">Fix Extern</h3>
<p>The Extern game object allows you to use other renderers within the Phaser render process. For example, you can use ThreeJS to render 3D graphics.</p>
<p>Our Extern handling retained a reference to removed code, which prevented it from working. This is fixed in beta 2.</p>
<p>Incidentally, with a bit of knowledge of the render system, you can now integrate external renders with Phaser systems like filters. The <code>Extern.render</code> method receives the current <code>DrawingContext</code>, which you can use.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> view = <span class="hljs-built_in">this</span>.add.extern();
view.render = <span class="hljs-function">(<span class="hljs-params">renderer, drawingContext, calcMatrix</span>) =&gt;</span> {
    <span class="hljs-comment">// ... Set up extern renderer.</span>

    <span class="hljs-comment">// Force update the current framebuffer.</span>
    renderer.glWrapper.updateBindingsFramebuffer({
        <span class="hljs-attr">bindings</span>: {
            <span class="hljs-attr">framebuffer</span>: drawingContext.framebuffer
        }
    }, <span class="hljs-literal">true</span>);

    <span class="hljs-comment">// ... Other rendering.</span>
};
</code></pre>
<p>This might break things in external renderers, but that's no longer my department!</p>
<h3 id="heading-separate-tilesprite-dimension-defaults">Separate TileSprite Dimension Defaults</h3>
<p>If TileSprite received width or height 0, it would default both dimensions to those of the sprite texture. We changed it so that <em>only</em> the dimension that is 0 will default; if the other is valid, it won't be changed.</p>
<h3 id="heading-basefiltershader-shader-cache-keys">BaseFilterShader Shader Cache Keys</h3>
<p>Fixed an internal bug with cache access.</p>
<h2 id="heading-upcoming-changes">Upcoming Changes</h2>
<p>The main change is the <code>RenderFilters</code> object. After much discussion, we've decided this is going to become a component on GameObjects instead. It will retain all existing functionality; it's just where it sits in a game that will change.</p>
<p><code>RenderFilters</code> is a wrapper around a GameObject. This made sense when thinking about rendering processes. The child GameObject is not rendered to the game; it's passed through filters, and those are what eventually renders out.</p>
<p>Unfortunately, this means that the wrapper has to duplicate a lot of information from the child. And after discussing use cases with expert user rex, we concluded that the duplication was too complex. If the child wants to manage its own properties, as is often the case, it would have to check if it was inside a wrapper, and do more complex work that isn't its own fault.</p>
<p>Phaser Beam works on the principle of "context agnostic rendering": objects should render the same in different contexts. This makes it flexible and fixes many bugs and incompatibilities from previous versions. So we don't want to bring in more context awareness.</p>
<p>The best solution is to turn <code>RenderFilters</code> into a component on a GameObject. This means that the GameObject remains in the same context, and doesn't need to care about filters at all. There's no data duplication. It's much neater.</p>
<p>However, the Filters component is still a wrapper! It just wraps the render method of the object, rather than the entire object. This preserves the intent of the render process. It does make invoking the render method a bit more complex, but I'm working on keeping that invisible right now. In fact, this work should make it possible to fully control the render process of any object from the outside, which is cool.</p>
<p>Big thanks to rex for talking through the use cases with me.</p>
<h2 id="heading-next-week">Next Week</h2>
<p>I'll be finishing up the new Filters component, and we should see a beta 3 release very soon. Then it's more testing and fixing.</p>
<p>Thanks for checking this out. We couldn't get Phaser this solid without your help.</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 206]]></title><description><![CDATA[Another week, another packed newsletter. Plus, Phaser is now on Bluesky. If you’re also on there, please give us a follow!
🌟 Phaser v3.87 and v4.0.0 Beta 1 Released
Set renderer to warpspeed. Two brand-new releases of Phaser just landed.

Phaser Stu...]]></description><link>https://phaser.world/phaser-world-issue-206</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-206</guid><category><![CDATA[WebGL]]></category><category><![CDATA[phaser]]></category><category><![CDATA[canvas]]></category><category><![CDATA[Game Development]]></category><category><![CDATA[Startups]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Mon, 18 Nov 2024 16:05:01 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731942956136/85dcb44e-26ce-44a4-a53c-6876a9ee596a.png" alt class="image--center mx-auto" /></p>
<p>Another week, another packed newsletter. Plus, Phaser is now on <strong>Bluesky</strong>. If you’re also on there, please <a target="_blank" href="https://bsky.app/profile/phaser.io">give us a follow</a>!</p>
<h2 id="heading-phaser-v387-and-v400-beta-1-released">🌟 Phaser v3.87 and v4.0.0 Beta 1 Released</h2>
<p><em>Set renderer to warpspeed. Two brand-new releases of Phaser just landed.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/phaser-v387-and-v400-released"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731943038405/61769c2f-bfb7-489a-8c53-4ad303370eb3.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Phaser Studio is very happy to announce the immediate availability of both Phaser v3.87 and v4.0.0 Beta 1. The v3.87 release closes off a couple of high-ticket issues and drops in a compelling new feature: the ability to load web fonts via the Phaser Loader. No more messing around with CSS hacks or cumbersome third-party web font loaders.</p>
<p><a target="_blank" href="https://phaser.io/download/release/v3.87.0">Download v3.87 here</a> (available on both GitHub and npm)</p>
<p>However, we didn't stop there! Today also saw the release of Phaser v4.0.0 Beta 1. We have been working on our brand-new WebGL renderer all year, with 5 Technical Preview releases throughout that time frame. Eager readers will have been following the development progress, week by week, in our Phaser World newsletter. Finally, after months of hard work, we have merged the renderer into the core of Phaser and published the first beta release.</p>
<p>You can download v4.0.0 Beta 1 from GitHub and npm under the beta tag.</p>
<p><a target="_blank" href="https://github.com/phaserjs/phaser/releases/tag/v4.0.0-beta.1">https://github.com/phaserjs/phaser/releases/tag/v4.0.0-beta.1</a></p>
<p>It's also already available in our Phaser Sandbox. <a target="_blank" href="https://phaser.io/sandbox/U448ifCH">Here's an example</a> of how to use the new Bloom parallel filter!</p>
<p>We have also created a phaser4 channel in our Discord. So please join in there to get the latest details and answers to questions.</p>
<p>We aim to release new betas at a high frequency. There’s no limit to how high the number could go. We’ll keep pumping them out until it feels stable and ready to hit main.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/phaser-v387-and-v400-released">Read more about the releases here</a></p>
<h2 id="heading-curvelicious">🎮 Curvelicious</h2>
<p><em>A Fast-Paced Multiplayer Twist on Classic Snake Games.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/curvelicious"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731943594527/4623c3af-ab91-4e20-bf85-3bb760a862d4.png" alt class="image--center mx-auto" /></a></p>
<p>If you're craving high-octane local multiplayer action with a touch of nostalgia, Curvelicious is here to deliver. Taking cues from classic snake and curve games, this new title from developer Filip Strelec reinvents the formula, infusing it with intense multiplayer excitement and strategic gameplay that’s perfect for game nights with friends.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=4ry3KUWY2Es">https://www.youtube.com/watch?v=4ry3KUWY2Es</a></div>
<p> </p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/curvelicious">Read about Curvelicious on Steam</a></p>
<h2 id="heading-creating-pacman-with-phaser-3">Creating Pacman with Phaser 3</h2>
<p><em>This six-part YouTube series covers the recreation of the dot-munching classic.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/creating-pacman-with-phaser-3"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731943796629/52dc5c61-cf47-4124-91e2-a08b255e1720.png" alt class="image--center mx-auto" /></a></p>
<p>Simple Coding Tutorials on YouTube has been publishing a series of tutorials over the past few months, all about re-creating the classic game Pacman in Phaser 3. They are currently up to part 6, and you can follow-along at each stage of the development.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/creating-pacman-with-phaser-3">Read more about this tutorial</a></p>
<h2 id="heading-mobilefuse-hiring-phaser-developer">😊 MobileFuse hiring Phaser Developer</h2>
<p><em>Experience with Phaser and HTML/CSS? Join a powerful creative team.</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731943877600/88145d46-07ec-4c46-8354-d309d29b84be.png" alt class="image--center mx-auto" /></p>
<p>MobileFuse (<a target="_blank" href="http://www.mobilefuse.com">www.mobilefuse.com</a>) is a leading mobile advertising network. We are currently looking to hire an outstanding Freelance Creative Developer to support our growth. We are looking for candidates who have a desire to learn new skills and improve existing ones. The perfect candidates will pay attention to details and take great pride in their work.</p>
<p>You will be joining a team of designers who are the leaders in our industry. Take advantage of this opportunity to use your talents and creativity to design and develop captivating ads for mobile devices. Our world revolves around cutting-edge technology and finding the best talent possible. If you believe you match these qualifications, then we can’t wait to speak with you!</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/mobilefuse-hiring-phaser-developer">Read the full job posting</a></p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731943950943/39172c54-0c11-4964-b95b-9708e15f57b1.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-rich-cto-amp-founder">🧑‍💻 Rich - CTO &amp; Founder</h2>
<p>This week I’ve been working across all projects, as per usual. Although I did find time to create the Phaser v3.87 release and put a couple of nice enhancements in there. But the most exciting release was v4.0.0 Beta 1. You can read all about that elsewhere this issue, but we’re going to be really pushing the releases out at a fast pace.</p>
<p>We’re also very nearly finished with Box2D. This week, the whole team will sit down and play with it in depth, after which we will open it up to a handful of key community members. Beyond that, it’s release time! Our aim was always by the end of November, and I don’t think we’ll be too far off that.</p>
<p>I’m mostly just going to let the guys talk about what they’ve been up to this week. You’ll find my name in nearly all of their sections, because that is what being a CTO is really about: driving everything forward.</p>
<h2 id="heading-arian-phaser-editor">🧑‍💻 Arian - Phaser Editor</h2>
<p>Hi friends</p>
<p>This week we started a new iteration on the editor. We will be working on a UI for the editor settings (including keyboard shortcuts and compressed texture support). This week we have made progress on the settings UI. This is a task that seems simple, but the editor has different configuration files with different scopes and this requires a bit of work to formalize a UI.</p>
<p>So far, there are several ways to configure the editor:</p>
<p>1) Using the flags of the server executable, as in <code>PhaserEditor -opt1 -opt2</code>.</p>
<p>2) Writing a <code>flags.txt</code> file, which can be present in the editor installation folder, the user configuration folder <code>(~/.phasereditor2d)</code>, or the project folder.</p>
<p>3) Writing to the <code>phasereditor2d.config.json</code> file that is located in the project folder.</p>
<p>4) Some of the settings, like Phaser renderer, is written in the <code>localStorage</code> of the web browser.</p>
<p>5) And finally, writing to the <code>settings.json</code> file that is located in the user configuration folder (which is currently used to configure the editor proxy).</p>
<p>That is, there is a whole amalgam of configuration files in different places.</p>
<p>The problem is that we need two types of configurations: global, and project-wide. Global settings affect each project, such as the proxy, browser, code editor, and project-wide settings only affect a particular project, such as the type of Phaser renderer to use in the editor.</p>
<p>So, for this new UI, all global settings will be written to the ~/phasereditor2d/settings.json file, and all project-wide settings will be written to the phasereditor2d.config.json file that appears in the root of each project. However, the other configuration files will still be supported, but will have a lower priority when determining the value of a configuration parameter.</p>
<p>All configuration writing is done on the editor server, so it takes a bit of work to set up new communication APIs between the client and the server.</p>
<p>Another complexity regarding configurations is that the editor uses an architecture based on plugins and extensions, which can be installed even by the same user. Therefore, the configuration UI must be extensible.</p>
<p>Almost all of this is ready. Here are some screenshots.</p>
<p>UI to configure external apps (the browser and the code editor):</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731944248919/1fa78dc5-2f42-41d3-bd86-1f8c6e9fec69.png" alt class="image--center mx-auto" /></p>
<p>UI to configure Phaser scenes:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731944276090/90ec220f-8496-4cc6-916d-6dadbfb0eb7a.png" alt class="image--center mx-auto" /></p>
<p>By the way, in the UI to configure external applications, we included some shortcuts to auto-configure options that are quite common for Phaser users, such as Google Chrome, Firefox, VS Code, JetBrains Webstorm, and JetBrains Rider:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731944310460/d2271603-b4d4-4058-8bc8-477d00c497f3.png" alt class="image--center mx-auto" /></p>
<p>Next week we will complete this UI and start implementing the UI to change the key combinations of the commands available in the editor.</p>
<p>Keep in touch!</p>
<h2 id="heading-francisco-phaser-launcher">🧑‍💻 Francisco - Phaser Launcher</h2>
<p>¡Hola a todos!</p>
<p>This week, I worked on integrating an internal server for the editor, aiming to serve projects in real time. Initially, I started with tiny-http, a lightweight server for Rust. While I managed to implement it and get it running (starting and stopping worked just fine), I realized that adding MIME support required manual setup, which was a bit tedious.</p>
<p>That's when Richard recommended trying Actix and shared a link with me. After giving it a shot, everything fell into place. With Actix, the server became much easier to manage and could automatically switch ports if the one we wanted was already in use. I also added an autoreload feature, which refreshes the served content whenever files are updated, making it incredibly practical for real-time development.</p>
<p>While the functionality to open the browser directly from the editor with a right-click is implemented, what really excites me is how robust the server is now and how it enables a much more efficient workflow. I'm very satisfied with the outcome.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731944407751/1d49d210-8681-4060-913e-50118ac8b6ac.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-pete-box2d">🧑‍💻 Pete - Box2D</h2>
<p>We're moving towards release with a number of QoL improvements across the board.</p>
<p>Rich managed to get eslint working, so the beginning of the week was cleaning up the many (MANY) warnings and errors that were raised. Most of them were basic tidying-up, but a couple of potentially nasty bugs were averted, too.</p>
<p>The type definitions have been added for every JS class (99% of them simply replace C 'structs' but there are one or two new ones which were needed for the translated library to work).</p>
<p>Several assertions have been enhanced to generate very specific messages. These will show up when a few particularly 'likely' mistakes are made. They're a form of last resort assistance when we've been unable to design things differently to avoid the mistakes in the first place!</p>
<p>All of the original uses of <code>b2Assert</code> (in C it's a macro which vanishes in release builds) have been replaced with <code>console.assert</code> and we have a 'release build' equivalent when you use <code>npm run build</code>. This is separate from the <code>b2Validation</code> flag which enables all of the asserts and adds in some heavy-duty internal box2d verification.</p>
<p>I found the bug that made the top-down car driving example drive poorly, it now drives excellently! It's very interesting to see the difference between a car simulation with four wheels exerting forces compared with the usual single box with faked physics rules. It feels so much more dynamic and on edge...</p>
<p>Some new examples have been added or completed:</p>
<p><strong>Top Drive</strong> has been finished</p>
<p><strong>Spatial Grid Partitioning</strong> shows a large number of bodies with gravitational attraction, two seconds after a 'big bang' I enable gravity and watch everything fly together in larger and larger clumps. It uses a grid to divide the space into smaller squares, and uses those to optimise the gravitational calculations. The motivation for this one is to show the speed that we gain by using <code>b2World_GetBodyEvents</code> instead of calling <code>b2Body_GetTransform</code> on every body in the system.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731944699566/b5c53606-e84d-4600-adcb-15fe31cbdffc.png" alt class="image--center mx-auto" /></p>
<p><strong>Constrained Delauney Triangulation</strong> shows some convex or otherwise complex shapes being triangularised so that box2d can handle them (the usual limit is 8 points per polygon). I used the letters 'P','H','A','S','E','R' as the shapes to test with.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731944744813/2917b50d-3ab5-425d-9edc-602358c74282.png" alt class="image--center mx-auto" /></p>
<p><strong>Trajectory Bombs</strong> is a small game example. Aim your catapult to launch a bomb at a building to knock it down. You might recognise the inspiration for this one 🙂</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731944769861/b3a293d5-4394-4e21-92cc-0392843dca3c.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-zeke-box2d">🧑‍💻 Zeke - Box2D</h2>
<p>Thanks to Richard’s work on Phaser’s Box2D integration, we’re now able to create examples with proper graphic assets. I spent the week testing the integration and came up with this box stacking game example:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731944931008/1cef439b-4eb7-4e62-b24d-fe0eb6161291.gif" alt class="image--center mx-auto" /></p>
<p>A game with simple mechanics, just tap / click on the screen to drop a moving box. The goal is to stack as many boxes as possible to achieve a high score.</p>
<p>With Phaser finally back in the centre, it only took a few lines of code to add random box graphics. Also, with integration working, Box2D physics bodies were easily resized to match the sprite.</p>
<p>Besides the Box2D elements, another camera was added to the scene with zooming features that enables you to see the entire box stack.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731944954043/415b8f84-0af4-4a22-88f8-4fb486831ffa.png" alt class="image--center mx-auto" /></p>
<p>Do check out the example. So far my highest score is 22. Pretty sure you’ll be able to top that easily.</p>
<p>Until next week, enjoy the demo!</p>
<h2 id="heading-can-discord-activity-launcher">🧑‍💻 Can - Discord Activity Launcher</h2>
<p>Another week, another adventure in Phaser Studio land. Let's dive into what's been happening behind the <em>scenes</em> (pun intended!).</p>
<p>After some brainstorming about our new design flow, it became clear: we needed something easier to manage the sections. That's when I thought, "Hey, we Phaser devs love our Scene Managers, don't we?" So why not create one for Tauri? I know web devs throwing tomatoes at me, why not use router or any other modern frontend framework to go with? Well, I like to experiment things, and find a decent workarounds of it. It fits for the app's needs, so why not! Also, I do love vanilla solutions.</p>
<p>You can see the example code to grasp an idea how it works!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731945088017/1992b0c9-8f23-4fbf-9d44-90d6334a15bf.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731945098778/18aefd20-5385-45da-b46d-41ded8abb25b.png" alt class="image--center mx-auto" /></p>
<p>Besides that, I've added traditional app's menu on the top, more space for tutorials, about and any other section is not necessary for the page.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731945107405/5a9187d4-f80f-4994-a4ae-7ac43f8aa6f3.png" alt class="image--center mx-auto" /></p>
<p>Next up, I'm fine-tuning transitions between "scenes" in the tool and polishing up some UI elements. Its mainly working with div elements. Managing the scenes through them.</p>
<p>Until next week, keep coding, keep creating everyone.</p>
<hr />
<h1 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731945135684/74b32fd7-e593-4392-9b3a-6e0636f082c2.png" alt class="image--center mx-auto" /></p>
<p><em>November 15th 2024, Ben Richards</em></p>
<p>This week: Phaser 4 beta 1!</p>
<p>Rich and I have done a lot of work finalizing the build, and it's ready for beta. We expect to find plenty of issues and release plenty of beta builds. But this is a huge milestone, and I can hardly believe we got here.</p>
<p>Let's recap. Phaser 4 introduces the Beam renderer. I've spent most of the last year working on Beam. Originally, I was trying to fix an issue where masks didn't work with certain FX. Things accelerated from there, and I rewrote the entire renderer. We don't even have masks or FX any more! (They're both Filters now, and more powerful than ever.)</p>
<h2 id="heading-drawingcontext">DrawingContext</h2>
<p>Beam uses a system of <code>DrawingContext</code> objects to ensure that different parts of the rendering system can't interfere with each other. A DrawingContext is basically a collection of WebGL settings. We apply these settings just before the actual draw command, ensuring that settings are always exactly what we need. We don't leave anything to chance.</p>
<p>This approach gives us the confidence to treat more game objects in exactly the same way. Phaser 3 had several restrictions, such as "no blend modes on <code>Shader</code> game objects" or "no FX on objects drawn to a <code>DynamicTexture</code>". Phaser 4 lifts most of these restrictions - objects don't care where they are in the render process, they just draw using the same rules every time.</p>
<blockquote>
<p>Exception: lighting within framebuffers. Because normal map lighting is computed in "window space", relative to the pixels of the framebuffer where drawing is occurring, framebuffers which don't precisely match the game canvas and camera angle may compute lighting improperly. For now, framebuffer lighting is technically unsupported even if it works, although I'd like to develop a solution one day.</p>
</blockquote>
<h2 id="heading-performance-enhancements">Performance Enhancements</h2>
<p>By standardizing the render process, Beam has also become more efficient. We've switched from using 6 vertices per quad, to 4 vertices. Why did we use 6 in the first place? Well, the whole point of a 2D game engine is to render textures: rectangular images we call "quads". But WebGL doesn't know what quads are; it has to work with triangles. Two triangles together make a quad, but they also have 6 corners ("vertices"). Beam uses a couple of tricks (indexed rendering) to re-use 2 vertices, so while there are technically still 6, we only have to deal with 4. If a game is bottlenecked by vertices, this optimization can give you 50% more performance.</p>
<p>Note that performance depends on lots of things working together. You're rarely going to see full 50% improvements, because other bottlenecks come into play. The three bottlenecks to consider are:</p>
<ol>
<li><p>GPU sync</p>
</li>
<li><p>Vertex load</p>
</li>
<li><p>Fill rate</p>
</li>
</ol>
<p>GPU sync is the primary bottleneck. We upload vertex data to the GPU, which takes time. Lots of time. About a hundred times longer than it takes the GPU to actually draw that data! That's why going from 6 to 4 vertices is a huge boost.</p>
<p>Vertex load is the computation of vertices on the GPU. This is rarely an issue. Any modern GPU can push so many vertices that you just don't need them all. You don't have enough pixels on screen to resolve all of them at once.</p>
<p>Fill rate is the computation of each pixel, also on the GPU. This is also rarely an issue, but complex shaders or intense overdraw can eventually drag the frame rate down. Overdraw is what it sounds like: you draw things "over" each other, wasting the effort spent on the lower layers. Try to avoid too much layering if at all possible.</p>
<h2 id="heading-filters">Filters</h2>
<p>The existing Mask and FX systems were combined into Filters. I've written a lot about these recently, so in summary: Filters are post-processing effects. You can apply them to a camera, or via a <code>RenderFilters</code> wrapper to an individual game object (such as a Container or Layer, if you need to combine several objects).</p>
<p>I've fallen in love with Filters. How else can you get cool effects like this?</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731945240228/23d64539-8edc-4727-b5c1-97e6089da608.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-tidy-up">Tidy-Up</h2>
<p>This week, we've been working on finalizing the build. Rich and I have both deleted old code that was no longer necessary. In my case, I cleared out 18,000 lines of code. I was keeping it around for reference, but now that Beam is ready for beta, we don't need it any more.</p>
<p>And we ran TypeScript over the code. While Phaser isn't a TypeScript project yet (watch the skies), we do have tools for generating type definitions (<code>phaser.d.ts</code>).</p>
<p>This is a good thing, because apparently I'd made quite a mess during development. The code worked, but the documentation attached to it was sometimes a tiny bit... bad. Copy-paste errors left the wrong names on properties. Iterative design left old names in forgotten corners of the code. Thankfully, the project picked them all up, and I spent a couple of days tightening things up. I changed a few call signatures on internal systems, defined a few complex types for config parameters, and eventually it all worked.</p>
<p>What is TypeScript? It's a compiled superset of JavaScript. You write files with type annotation, and the compiler turns them into ordinary JS. Or it tells you that you messed up and you need to fix something - which is the kind of thing a good coder loves to hear.</p>
<p>TypeScript is a boon to any large JavaScript project. Its ability to identify mistakes and loopholes in complex code saves a lot of time. I'd encourage anyone starting a new project to use TypeScript from the start. These days, it's more supported than ever: VSCode has plenty of integration, Deno runs TS files without even asking you to compile anything, and I'm sure there are plenty more cases.</p>
<p>Anyway, I'm pretty happy that this tidy-up went so fast. That's what let us get the beta out the door so quickly.</p>
<h2 id="heading-next-week">Next Week</h2>
<p>The future is uncertain, but I see two things awaiting me: testing, and bug fixes. They're really the same thing. It's not a challenging divination.</p>
<p>We've got a huge pile of examples, covering hundreds of applications of Phaser. If I can get them all working, that gives us enormous confidence in the beta. There will definitely be examples which don't work due to changes in the render system; fixing these helps me build a sense for the practicalities of migration from v3 to v4.</p>
<p>Once this is all done, we'll be able to massively improve our release cadence. The foundation of Beam has been a long time coming, but it's a solid foundation from which we can do amazing things.</p>
<hr />
<h2 id="heading-share-your-content-with-18000-readers">Share your content with 18,000+ readers</h2>
<p>Created a game, tutorial, code snippet, video, or anything you feel Phaser World readers would like? Then please <a target="_blank" href="mailto:content@phaser.io">send it to us</a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731945352165/403d90c2-2437-4201-9793-383904e2094a.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 205]]></title><description><![CDATA[Welcome to another packed issue of Phaser World. There’s a new release of Phaser Editor available, lots of progress being made on Box2D and the Phaser Beam renderer enters the final stages before integration. Busy, busy, busy! Enjoy …
🌟 Phaser Edito...]]></description><link>https://phaser.world/phaser-world-issue-205</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-205</guid><category><![CDATA[WebGL]]></category><category><![CDATA[Game Development]]></category><category><![CDATA[phaser]]></category><category><![CDATA[canvas]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Mon, 11 Nov 2024 15:15:36 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731334912732/b99af55a-39af-49e6-a8b5-0ca90a991335.png" alt class="image--center mx-auto" /></p>
<p>Welcome to another packed issue of Phaser World. There’s a new release of Phaser Editor available, lots of progress being made on Box2D and the Phaser Beam renderer enters the final stages before integration. Busy, busy, busy! Enjoy …</p>
<h2 id="heading-phaser-editor-v460-released">🌟 Phaser Editor v4.6.0 Released</h2>
<p><em>This brand-new version includes a powerful built-in Tilemap Editor.</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731335323335/ca82dee4-23b0-4587-aa9f-48e582433454.png" alt class="image--center mx-auto" /></p>
<p>Available for immediate download is Phaser Editor v4.6.0. This introduces a long-awaited and powerful feature: A built-in Tilemap Editor. The new Tilemap tools are directly integrated into the Scene Editor, allowing you to combine Tilemap Layers together with Game Object layers simply and effectively.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/phaser-editor-v460-released">Watch a video and read more here</a></p>
<h2 id="heading-president-47">🎮 President 47</h2>
<p><em>Regardless of who you vote(d) for, you can't beat a good bullet-hell action game!</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731335508453/87414287-85cd-453c-88a8-6d11ea13f784.jpeg" alt class="image--center mx-auto" /></p>
<p>President 47 from 2kblater Games is a wry take on recent Whitehouse events. But most of all, it's an action-packed bullet-hell in the Vampire Survivors school of blasting and is available on Steam.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/president-47">Watch the game trailer</a> (if you can stomach any more politics right now)</p>
<h2 id="heading-101-games-challenge">😰 101 Games Challenge</h2>
<p><em>The challenge continues with game two, Bolaz, available to play and download.</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731335759696/a0339248-c145-471e-81dd-2bbc389f2154.png" alt class="image--center mx-auto" /></p>
<p>Emanuele Feronato has set himself an ambitious task: To create 101 games as a solo developer. There are some rules around the games. Such as: all games must be actual playable games, not just prototypes. AI is not allowed to be used to create short-cuts and, most importantly for Phaser developers: the source code and project files for each game must be made available.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/101-games-challenge">Check out Game 2: Bolaz</a></p>
<h2 id="heading-mobilefuse-hiring-phaser-developer">😊 MobileFuse hiring Phaser Developer</h2>
<p><em>Experience with Phaser and HTML/CSS? Join a powerful creative team.</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731335033228/26933bd0-4d7e-4202-be3e-435ab1d29fd1.png" alt class="image--center mx-auto" /></p>
<p>MobileFuse (<a target="_blank" href="http://www.mobilefuse.com">www.mobilefuse.com</a>) is a leading mobile advertising network. We are currently looking to hire an outstanding Freelance Creative Developer to support our growth. We are looking for candidates who have a desire to learn new skills and improve existing ones. The perfect candidates will pay attention to details and take great pride in their work.</p>
<p>You will be joining a team of designers who are the leaders in our industry. Take advantage of this opportunity to use your talents and creativity to design and develop captivating ads for mobile devices. Our world revolves around cutting-edge technology and finding the best talent possible. If you believe you match these qualifications, then we can’t wait to speak with you!</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/mobilefuse-hiring-phaser-developer">Read the full job posting</a></p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731335109927/1d28f8db-5dab-4862-90fb-7ec801fbb3e5.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-rich-cto-amp-founder">🧑‍💻 Rich - CTO &amp; Founder</h2>
<p>Hi everyone. Last week was quite intense, to say the least! From a company point of view, one of the most exciting things that happened was that we hired our permanent CEO. This also means that our interim CEO, Brian, departed for pastures new (and non-techy) - he has been invaluable to me over the past 6 months, and I’ve loved working with him. Yet, in order to move forward, we knew we needed a permanent CEO. After lots of interviews and talks, this process is now complete, and I look forward to him introducing himself next week.</p>
<p>On the coding front, I worked on the Box2D project. While Pete and Zeke kicked the tires from all angles to make sure nothing fell off, my task was to code a Phaser interface to the API. Unlike with Arcade or Matter, this interface is a much more ‘light touch’ approach. It wraps common things you’ll need to do, such as create a physics body from a Sprite, or pair a body with a Sprite and have them remain in sync as the physics world steps. These are available as functions you import:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> block = <span class="hljs-built_in">this</span>.add.sprite(<span class="hljs-number">640</span>, <span class="hljs-number">90</span>, <span class="hljs-string">'block'</span>);

<span class="hljs-keyword">const</span> world = CreateWorld({ <span class="hljs-attr">worldDef</span>: b2DefaultWorldDef() });

<span class="hljs-keyword">const</span> worldId = world.worldId;

<span class="hljs-keyword">const</span> box = SpriteToBox(worldId, block, {
    <span class="hljs-attr">restitution</span>: <span class="hljs-number">0.7</span>,
    <span class="hljs-attr">friction</span>: <span class="hljs-number">0.1</span>
});

AddSpriteToWorld(worldId, block, box);
</code></pre>
<p>Above, we create a basic Phaser Sprite, a Box2D world, and a body from this Sprite. The two are linked, so the sprite renders as the body updates. Repeat that for hundreds of bodies, and voila:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731337708556/c37dba66-7be7-424e-8863-2ddaa26345d9.png" alt class="image--center mx-auto" /></p>
<p>However, it’s all open and optional. If you don’t want to use the wrapper, you don’t need to. You can just look at the code for it and implement your own approach. Perhaps you may want to create your own extended Sprite class that has a Box2D body as part of it? It’s entirely up to you. We’re not going to force you down a ‘plugin only’ route.</p>
<p>Another task I completed was porting the debug renderer to Phaser Graphics, so you can now render all the examples via a single Graphics instance, such as these tic-tac-like capsules:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731337823208/12850fdd-3a46-47de-9fa7-59f7b42a6b4a.png" alt class="image--center mx-auto" /></p>
<p>You’d rarely want to use this ‘in game’, but for debugging it’s invaluable.</p>
<p>With the documentation in place and the examples pool growing by the week, we’re very close to release now. The aim was always by the end of November, and currently, it feels like we can achieve that.</p>
<h2 id="heading-pete-box2d">🧑‍💻 Pete - Box2D</h2>
<p>Now that the implementation has (nearly) stabilised, we've rolled out a Phaser Box2D API. Following our earlier approach, we used the C original as our guide, and I'm pleased to say that the full original API is available. We've kept all the original function names and stuck as close as possible to the original parameters. For the few features that don't quite fit our JS version, we've added wrapper functions that give friendly console warnings.</p>
<p>The great thing about keeping so close to the original is that you can use the official Box2D documentation to learn about the engine and its physics simulation.</p>
<p>On the documentation front, we've added JSDoc comment headers to all 358 functions, complete with a quick summary, detailed description, and annotated parameters and returns. I'll be documenting the types today, and then we'll do several review passes to ensure everything's spot-on.</p>
<p>In the examples section, we've added a tiny Platform Character demo featuring a single (fixed rotation) capsule that responds to keyboard inputs for movement and jumping.</p>
<p>Building on that, we've created "Run and Gun" – a basic scrolling platformer where you can shoot at the mouse position. Right now, it uses a static box for each tile, which gives us that familiar 'tile corner hop' when crossing boundaries. I'd like to work on a helper class for creating edge chains or possibly a grouping algorithm to smooth this out by combining adjacent platforms. Since the mouse aiming was a bit tricky to get right, I've wrapped up some handy coordinate conversions as <code>ConvertWorldToScreen</code> and <code>ConvertScreenToWorld</code>.</p>
<p>We've also added an interesting new example called Joint Smasher. It demonstrates breakable joints with 400 boxes arranged in a square grid using Weld Joints, which get repeatedly dropped onto a heavy vertical pole. The joints get progressively weaker with each drop, leading to some pretty cool fragmentation effects, though it is quite bouncy. For a more rigid version, we'd want to group all shapes into a single body.</p>
<p>To make life easier, I've added a <code>CreateChain</code> helper function that lets you quickly create a series of linked objects in a line – perfect for chains, ropes, or bridges. What used to be a bit fiddly is now nicely straightforward.</p>
<p>And, of course, the week included our usual round of bug fixes, code polishing, and general preparation work to get everything launch-ready!</p>
<h2 id="heading-arian-phaser-editor">🧑‍💻 Arian - Phaser Editor</h2>
<p>Hello friends</p>
<p>What a week! We have finally <a target="_blank" href="https://phaser.io/news/2024/11/phaser-editor-v460-released">released Phaser Editor v4.6.0</a>, a version that brings a built-in tilemap editor. We have been talking about it for the last four weeks. In the last few days we finished <a target="_blank" href="https://docs.phaser.io/phaser-editor/scene-editor/game-objects/editable-tilemap-object">writing the documentation</a> and we have made a new project template with an example of the new tilemap editor. I recommend you to take a look at it, it appears right in the examples section in the project page of the editor:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731336156014/b303284e-f425-432e-9c91-b9e5edd30a31.png" alt class="image--center mx-auto" /></p>
<p>Now comes one of the most exciting parts, what will be our next project?</p>
<h2 id="heading-zeke-box-2d">🧑‍💻 Zeke - Box 2D</h2>
<p>Worked on two Box2D examples and one game demos this week. After creating the asteroids demo last week, I thought it would be good to break down the full game into smaller, easier to understand components. Here are the demos:</p>
<p><strong>Ship movement</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731336340339/ddea058f-a6fa-4b39-83e5-be81a085feba.gif" alt class="image--center mx-auto" /></p>
<p>Creating ship movement with Box2D would be the first step in creating a similar top down shooter.</p>
<p><strong>Collision filtering</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731336348390/03063f01-b95a-4d00-833d-967a9558986b.gif" alt class="image--center mx-auto" /></p>
<p>Filtering collisions is necessary to ensure the right physics bodies are allowed to collide and respond. For example, you wouldn’t want to be able to shoot and hit your ship with your own bullets. Or maybe you do? In the asteroids example last week, asteroids can only collide with bullets and the player ship, while the ship could not collide with the bullets fired.</p>
<p><strong>Suika Watermelon game demo</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731336547084/0cad8aeb-2bc8-45ae-bf77-d60407f3959b.gif" alt class="image--center mx-auto" /></p>
<p>Do a quick Google search for "Suika" and you’ll be able to play the original full game on the web. In the game demo, you’ll see how to create a basic playable version of the game with Box2D.</p>
<h2 id="heading-francisco-phaser-launcher">🧑‍💻 Francisco - Phaser Launcher</h2>
<p>¡Hola a todos!</p>
<p>This week, I've been focused on enhancing the Phaser Launcher, particularly in the landing section, which serves as the user's entry point to the app. Additionally, I worked on the functionality for importing and creating new projects.</p>
<p>While handling these tasks, I realized that a complete workflow was starting to come together, closing an exciting loop in the development of this tool. So, I decided to take the next step by setting up a simple server and launching a single project through it. The tool is shaping up really well, and we are excited about its potential!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731336597359/c51b3248-db71-40f2-b69a-f8d825e2a444.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-can-discord-activities-tool">🧑‍💻 Can - Discord Activities Tool</h2>
<p>This week, I continued refining the Discord Activity tool, focusing heavily on enhancing user experience. One major task that consumed much of my time was dealing with Apple’s code signing and notarization process. Thankfully, working with Tauri made it significantly smoother compared to other development tools. Tauri’s streamlined workflow provided a much-needed boost in navigating Apple’s often complex requirements.</p>
<p>After thorough testing and analysis with Rich, we decided that the current UI needed a change for improved user experience. This led to exploring and implementing a new interface design that better meets user expectations.</p>
<p>On top of these significant updates, I added a few small but impactful features, such as the ability to open the project folder automatically after successful creation. These enhancements aim to make the tool more intuitive and user-friendly.</p>
<p>That’s all for this week’s progress. Keep your pixels sharp, everyone!</p>
<hr />
<h1 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731335171342/be7e8354-6d19-4b0d-b0d4-71e9b7b1c6dd.png" alt class="image--center mx-auto" /></p>
<p><em>November 8th 2024, Ben Richards</em></p>
<p>This week, I've hit a big milestone: full implementation. That means I've implemented everything on our roadmap for the new Beam renderer. It doesn't mean it's <em>finished</em>, as there's a lot to test and tidy up. We'll probably find things we've overlooked, or awkward features that need a little streamlining. But it's another big step forward!</p>
<p>The last pieces of the puzzle involved the last work on Filters, and a new implementation of the <code>Shader</code> game object. It also involves changes to the GLSL file loader.</p>
<h2 id="heading-full-implementation">Full Implementation</h2>
<p>Beam is a complete rewrite of Phaser's WebGL render system. This makes it more robust and efficient, but it also means that everything that renders has to be rewritten. That in turn gives us opportunities to rethink everything. And that all took a while.</p>
<p>We took care to ensure that things work the same wherever possible. We view the Phaser API as an asset, and stability is important. The Technical Preview program helped users test compatibility, and we're pleased that very sophisticated games can still work with zero changes.</p>
<p>However, anything that touches the render system will need updates. The Filter, and Shader systems in particular are quite different. Filters take the place of FX and Masks. <code>DynamicTexture</code> and <code>RenderTexture</code> objects have simplified their command sets, and require you to call <code>render()</code> before they draw anything.</p>
<p>Further, we've chosen to omit some items from Beam. Several filters have been removed, as we believe they are easy to implement as a flexible combination of other filters. The <code>Mesh</code> game object and its subclass <code>Plane</code> have been removed, as we intend to rethink our approach to 3D rendering. <code>BitmapMask</code> is removed, and <code>GeometryMask</code> no longer has any function in WebGL, but does still work in the Canvas renderer. FX and Masks are gone from game objects, and are now surfaced in the Filter system, available through cameras or the <code>RenderFilters</code> game object container.</p>
<p>The Pipeline concept has been retired. Beam uses a collection of types including <code>DrawingContext</code> to track drawing requirements, <code>ProgramManager</code> to provide shader programs, and <code>RenderNode</code> as a superclass for various discrete rendering tasks.</p>
<p>This should all give you a picture of where you should expect changes, and where you should expect things to just work as normal.</p>
<h2 id="heading-filters">Filters</h2>
<h3 id="heading-bloom-filter-and-parallelfilters">Bloom Filter and ParallelFilters</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731336758030/7fed908c-9a08-48b8-8bd3-9d0e7a349dd9.png" alt class="image--center mx-auto" /></p>
<p>Last week, I talked about the Bloom filter, and what choices we faced when creating it.</p>
<p>Well, this week I decided that <em>you</em> should make the choices. So I removed the Bloom filter. It's replaced by a special filter called <code>ParallelFilters</code>. This surfaces the branching logic I discussed last week, splitting the render path into two lists of filters, then blending them together again at the end.</p>
<p>Here's how I made the above full-screen bloom effect:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> parallelFilters = <span class="hljs-built_in">this</span>.cameras.main.filters.internal.addParallelFilters();
parallelFilters.top.addThreshold(<span class="hljs-number">0.5</span>, <span class="hljs-number">1</span>);
parallelFilters.top.addBlur();
parallelFilters.blend.blendMode = Phaser.BlendModes.ADD;
</code></pre>
<p>That's it! As you can see, it's a really simple effect, but you can tune it yourself. Tweak the threshold to control highlights, lower or raise the blend amount, use a different blend mode, control the blur using the same parameters as the Blur filter, or even add other filters to further take control of the effect.</p>
<h3 id="heading-blend-filters-to-blend-filter">Blend Filters to Blend Filter</h3>
<p>I made an internal change to the Blend filter. My first pass used a dedicated shader for each blend mode. But I quickly realized that this was just inflating package size with a lot of boilerplate.</p>
<p>So I switched to a single shader. This has all the blend modes defined as separate functions. How do we tell which one to use? Simple: we use the shader additions system. When we run the shader, we update its additions to include <code>'#define BLEND ' + blendModeName</code>. The system is smart enough to know if this changes, and compiles a new shader program only when necessary.</p>
<p>Shader additions are super useful, once you get familiar with their use. You don't have to write an entire shader for every new function - you just add code into an existing framework.</p>
<h2 id="heading-glsl-file-loading">GLSL File Loading</h2>
<p>In Phaser 3, GLSL code is loaded as a single program, with vertex and fragment shader code. But because our handling of GLSL shader code is so much more flexible in Beam, we needed to rethink our file loading strategy.</p>
<p>I've changed the GLSL loader to a simpler text system. It no longer treats files as vertex or fragment shaders. And it no longer parses "bundle" files consisting of several shaders. Instead, it loads a single file, which can be a complete vertex or fragment shader, or a snippet of code for use in a shader addition.</p>
<p>This makes it easier to develop GLSL code for flexible use. Bundle files weren't in any recognized syntax, so you wouldn't get warnings about mistakes in your code. I've been careful to make systems which use valid GLSL for Beam, so your editor doesn't have to cope with any special syntax. (The <code>#pragma phaserTemplate()</code> syntax is valid GLSL, even if it doesn't do anything.)</p>
<h2 id="heading-shader-game-object">Shader Game Object</h2>
<p>What's a Shader? It's a slightly confusing name, but here's what it does: it applies a shader program to a quad. That's all.</p>
<p>Well, we have to define a few more rules before we can make everything simple. Here's what we settled on.</p>
<ul>
<li><p>A Shader has default vertex and fragment shaders. You can override or apply additions to either. We expect that you'll only need fragment code.</p>
</li>
<li><p>A Shader game object is a quad. Its transforms behave just like a Sprite, and it uses the same code behind the scenes.</p>
</li>
<li><p>You can use a Shader anywhere you'd use a Sprite. You can apply filters to it, or set blend modes (previously impossible). The only thing you can't do is set alpha or tint, because those are actually shader inputs and your shader needs to control them itself.</p>
</li>
<li><p>Shader's vertex shader receives two attributes: position and texture coordinates. Texture coordinates are made available in the fragment shader as <code>outTexCoord</code>. We expect this to be the primary driver of generative shader textures.</p>
</li>
<li><p>Texture coordinates default to describing a rectangle from [0, 0] to [1, 1], but each vertex can be set manually.</p>
</li>
</ul>
<p>These rules mean that you can use a Shader just like a texture. The freedom to change texture coordinates means you can use frames from a texture atlas, or scroll around a generative texture space.</p>
<p>The API of Shader has changed, but remains as compatible as possible.</p>
<ul>
<li><p><code>scene.add.shader(key, x, y, width, height, textures, textureData)</code> (Phaser 3)</p>
</li>
<li><p><code>scene.add.shader(config, x, y, width, height, textures)</code> (Phaser Beam)</p>
</li>
</ul>
<p>I've removed <code>TextureData</code>, as it only changed some texture settings you can edit yourself.</p>
<p>The main change is going from <code>key</code> to <code>config</code>. The <code>key</code> string fetched a GLSLFile from the Shader Cache, which as you'll recall, was a fully compiled shader. The <code>config</code> object lets you define which parts to combine into your own shader. You can reuse additions and entire shaders in different configs.</p>
<p>But if you don't need that power, I've left a backwards compatible option. If <code>config</code> is a string, instead of a configuration object, it assumes it's the key for a fragment shader, and creates a config automatically. This is usually what you want: just load your own fragment shader and use that.</p>
<p>We encourage you to switch to the <code>config</code> object when Beam is released, as this provides a convenient place to define shader uniform handling. This is necessary for any form of animation or interaction in the shader.</p>
<p>Phaser 3 handled several uniforms automatically. These correspond to uniforms once used by <a target="_blank" href="https://www.shadertoy.com">Shadertoy</a>. However, Shadertoy has changed its interface, so these are no longer valid, and I've removed them in Beam. This also means Shader is no longer calculating mouse input for all your shaders that don't use it. We will create examples to demonstrate how to achieve common tasks, such as using time to animate shaders, or use a pointer in a shader. It's usually just a boilerplate line or two in your uniform handling.</p>
<p>But enough technical stuff. How about some examples?</p>
<h3 id="heading-random-noise">Random Noise</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731336784769/26348edc-b673-49d2-9c3b-e9b4bce7359a.png" alt class="image--center mx-auto" /></p>
<p>Random noise has many uses, so here are a few different kinds. These varieties use a single Shader config, modified with different additions to create different shader effects.</p>
<h3 id="heading-gradient-noise">Gradient Noise</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731336800386/811696e2-aed9-4e73-be50-5f74215a851d.gif" alt class="image--center mx-auto" /></p>
<p>Random noise is cool, but it has no structure or continuity, so it's not useful for many applications. Enter Perlin noise, a way to use random noise to construct smoother textures. There are several improvements on this technique, such as Gradient and Simplex noise. This example has a Shader rendering such structured noise, using <code>renderToTexture</code> to make it available to other objects, and plugging that texture into a Displacement filter on a background sprite. You could actually combine the Sprite, Shader, and Filter together into a single shader to be more efficient, but this is a quick way to experiment with effects.</p>
<h3 id="heading-clouds-and-holograms">Clouds and Holograms</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731336820641/1e3f924d-8a57-4e5a-8fba-d9861e77fafa.png" alt class="image--center mx-auto" /></p>
<p>This is a quick hologram effect, and a not-so-quick cloud effect. It uses the same gradient noise as the last example, but I adjust the perspective, take multiple samples, and combine them to make something that looks volumetric. (It's not really, but it looks pretty close, no?)</p>
<p>Oh, the Phaser logo here is taken straight from a texture atlas. That was previously impossible. But with texture coordinate control, we have greater powers.</p>
<h2 id="heading-next-week">Next Week</h2>
<p>Well, looks like it's time to test and trim! We don't have any more additions planned for the initial Beam release. That means I need to go back and pull out all the old systems that were left in Phaser while I developed Beam (the lessons of the past are always valuable).</p>
<p>We also need to update all the Phaser examples, and make sure they still work, or that the fixes are well-documented. That's going to take a while.</p>
<p>But soon we'll be done, and Beam will be ready for alpha. When? I can't say! But as soon as possible.</p>
<p>Until next week, be excellent to one another.</p>
<hr />
<h2 id="heading-share-your-content-with-18000-readers">Share your content with 18,000+ readers</h2>
<p>Created a game, tutorial, code snippet, video, or anything you feel Phaser World readers would like? Then please <a target="_blank" href="mailto:content@phaser.io">send it to us</a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1731335245748/2eec4245-7e29-45ca-a718-abb6333d1eca.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 204]]></title><description><![CDATA[Welcome to the first issue of November 2024. It has been a release-packed year and shows no signs of slowing down. This issue features a new update to the classic Phaser Debug Tool, new games, new tutorials, and not one but two job adverts! If you fe...]]></description><link>https://phaser.world/phaser-world-issue-204</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-204</guid><category><![CDATA[WebGL]]></category><category><![CDATA[canvas]]></category><category><![CDATA[Game Development]]></category><category><![CDATA[phaser]]></category><category><![CDATA[Games]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Mon, 04 Nov 2024 15:32:20 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730729805459/4e689480-2e4b-46cc-a0af-916dffc20226.png" alt class="image--center mx-auto" /></p>
<p>Welcome to the first issue of November 2024. It has been a release-packed year and shows no signs of slowing down. This issue features a new update to the classic Phaser Debug Tool, new games, new tutorials, and not one but two job adverts! If you feel like coding in Phaser as a full-time role, check those out.</p>
<h2 id="heading-phaser-debug-tool">🔥 Phaser Debug Tool</h2>
<p><em>A browser extension for real-time inspection and modification of Phaser games.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/phaser-debug-tool"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730730026960/9ab6fcb3-b949-4a8e-84e8-459e8e871f73.jpeg" alt class="image--center mx-auto" /></a></p>
<p>The Phaser Debug Tool is a Chrome and Firefox browser extension that, when invoked, checks for the existence of 'Phaser' within the page. If found, it hooks into it and provides all kinds of tools to inspect and modify the running game.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/phaser-debug-tool">Read more about the Phaser Debug Tool</a></p>
<h2 id="heading-legion">🎮 Legion</h2>
<p><em>Assemble a team of warriors and compete to be the strongest in this stunning multiplayer PvP game.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/legion"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730730193303/1d8d033e-d0dc-462b-afce-f3d792469064.png" alt class="image--center mx-auto" /></a></p>
<p>Legion is a browser-based multiplayer PvP game where players assemble and level up a team of up to 10 heroes, including Warriors, White Mages, and Black Mages, each with unique abilities. Engage in real-time battles across Practice, Casual, and Ranked modes, climbing through five seasonal leagues. Enhance your team's strength by upgrading equipment and mastering powerful spells that can heal, inflict damage, or alter terrain. The game utilizes Phaser for its engine, PreactJS for the client app, NodeJS for the server and matchmaking, and Firebase for authentication and serverless API.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/legion">Play Legion</a></p>
<h2 id="heading-halloween-memory-match-tutorial">🌟 Halloween Memory Match Tutorial</h2>
<p><em>Learn how to create a spooky memory game using Phaser Editor.</em></p>
<p><a target="_blank" href="https://www.youtube.com/watch?v=gf_3KNMRp9k"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730730586569/eb84303a-22b9-4be7-993b-d9054b787f52.jpeg" alt class="image--center mx-auto" /></a></p>
<p>It's that creepy time of the year again - and what better way to celebrate than with this stunning new Phaser Editor video tutorial by Scott Westover?</p>
<p>"Spooky season is upon us! Ready to make your very own Halloween-themed memory match game? 🎃 With Phaser Editor v4, we’ll turn your ideas into an exciting game! By using the editor to create our game visually, and with a little bit of code we can create awesome games like this."</p>
<p><a target="_blank" href="https://www.youtube.com/watch?v=gf_3KNMRp9k">Watch on YouTube</a></p>
<h2 id="heading-shapecraft-game-hackathon">🚀 Shapecraft Game Hackathon</h2>
<p><em>Join the Shapecraft Hackathon with $250k in prizes available.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/shapecraft-game-hackathon"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730730742246/2126a889-1b23-452e-87ff-77e8109c8ea6.png" alt class="image--center mx-auto" /></a></p>
<p>What if we all work together to build an interconnected game universe? A universe that is interoperable, where a player can carry their items, characters, friends list and accomplishments wherever they go. A universe that is fun, containing many independent game worlds that aren’t tied to any particular platform or genre. A universe that is neutral, where the rules are laid out transparently and no single entity has root level control. A universe that is massive, where the collective lore and depth of gameplay can rival or even surpass the largest massive multiplayer online games.</p>
<p>This is the dream of Shapecraft, a four week game jam/hackathon starting November 18th. We’re calling all of you, professional and aspiring game developers, to help bring this vision to life. There will be $250k in prizes awarded to the most inspiring projects submitted during this time period that capture this vision.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/shapecraft-game-hackathon">Read more about the Shapecraft Game Hackathon</a></p>
<h2 id="heading-mobilefuse-hiring-phaser-developer">😊 MobileFuse hiring Phaser Developer</h2>
<p><em>Experience with Phaser and HTML/CSS? Join a powerful creative team.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/mobilefuse-hiring-phaser-developer"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730730889571/c290a9a6-ec6d-42a2-b54c-ca04828db409.png" alt class="image--center mx-auto" /></a></p>
<p>MobileFuse (<a target="_blank" href="http://www.mobilefuse.com">www.mobilefuse.com</a>) is a leading mobile advertising network. We are currently looking to hire an outstanding Freelance Creative Developer to support our growth. We are looking for candidates who have a desire to learn new skills and improve existing ones. The perfect candidates will pay attention to details and take great pride in their work.</p>
<p>You will be joining a team of designers who are the leaders in our industry. Take advantage of this opportunity to use your talents and creativity to design and develop captivating ads for mobile devices. Our world revolves around cutting-edge technology and finding the best talent possible. If you believe you match these qualifications, then we can’t wait to speak with you!</p>
<p><a target="_blank" href="https://phaser.io/news/2024/11/mobilefuse-hiring-phaser-developer">Read the full job posting</a></p>
<h2 id="heading-proggenius-hiring-phaser-developer">😊 ProgGenius hiring Phaser Developer</h2>
<p>Location: Remote<br />Employment Type: Full-Time<br />Budget: 2200-2400$/mo. (PayPal)</p>
<p>We are looking for a talented Phaser Developer to join our dynamic team at <a target="_blank" href="http://surl.li/nuvgit">ProgGenius</a>. In this role, you will be responsible for creating engaging and interactive 2D games using the Phaser framework. You will collaborate with designers and other developers to bring exciting concepts to life while ensuring high performance and user experience.</p>
<p>Project Overview Sea Battle Online is a multiplayer game within Telegram, offering a remake of Sea Battle 2 adapted for the Telegram Mini App environment. The main features include turn-based naval battles with enhanced capabilities, city development and visual customization, participation in tournaments, and completion of daily quests and achievements. Monetization is through in-game purchases, while the basic functionality remains free to play.</p>
<p><a target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLSf0SdKduZ8f3qSdRe9i6TYrt4434O6AUew2W8nrvzFih_-9gg/viewform">Fill out the Application Form</a></p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730732333601/24bc0a80-847c-4cb8-8ede-421f439b24b9.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-rich-cto-amp-founder">🧑‍💻 Rich - CTO &amp; Founder</h2>
<p>The fact we’ve now hit November both terrifies and excites me! The amount of things we have accomplished this year is nothing short of staggering. The team has really been pulling out all the stops these past few months. Yet it’s also exciting because we’re now in the final stretch towards releasing our Game Publishing Service, Discord Activities Tool, Phaser Box2D, and the first alpha release of Phaser 4.</p>
<p>The <em>Game Publishing Service</em> is our lite version of itch.io. From your user account, you can set your choice of <code>phaser.games</code> sub-domain, create a new game, and then drag and drop folders/files onto it from your local system. We’ll host the game for free, and you’ll get analytics and, over time, more options to customize the layout and build up your game portfolio. Of course, we’ll also build this into our templates, Phaser Launcher, the Discord Activities Tool, and Phaser Editor. Easy 1-click game hosting to share with your friends or clients.</p>
<p>As for Box2D, this creeps ever closer to completion. Pete was on holiday this week, but Zeke carried on putting the API through its paces by creating example after example. You can read his entry in this issue to see how it has been going! We have been very careful in retaining the Box2D API as it exists in the native C version. We have not renamed all of the functions or classes, for example. They still retain their <code>b2</code> prefix and are name-spaced via the function name rather than an actual class structure. Box2D v2 was very OOP, but v3 changed all of that and it’s now almost entirely functional, but with OOP ‘emulated’ via the function naming. We kept that fully intact. The main reason is that it makes debugging easier, but another is that if you find a really nice Box2D tutorial or example written in C, you can easily use that with our port without having to worry about what ‘friendly class mapping’ we may have used because the function names are identical.</p>
<p>Someone asked on Discord if our Box2D library will be free or commercial. The answer (as I gave on Discord and previously in these Dev Logs) is that it will be commercial. This was the plan from Day 1 and we’ve never indicated otherwise. We’ll ensure there are suitable levels of pricing to make it affordable to both hobbyists and those wanting to use it for client projects. Personally, I would love for it to be free, but those who have been following along know that we’ve spent months of hard, full-time work on this, and as a result, we need to recoup some of that cost.</p>
<p>As for Phaser 4 - more on that soon! The goal is to complete Phaser Beam development and then release an alpha of effectively v3.86 with Beam replacing every single internal thing to do with rendering. It’s going to be a huge shift and I can’t wait!</p>
<hr />
<h2 id="heading-francisco-phaser-launcher">🧑‍💻 Francisco - Phaser Launcher</h2>
<p>This week, I focused on improving the Media Browser component within the text editor for Phaser.js, aiming to make file navigation and management more intuitive and functional. The Media Browser now allows smooth folder navigation using breadcrumbs, making it easier for users to locate themselves within the file structure. Additionally, I optimized file selection to allow both single and multiple selections.</p>
<p>The Media Browser is designed to open the assets folder, so having this module available to copy file paths directly into the editor will be valuable, streamlining the workflow by integrating resources directly from the Media Browser.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730731384214/bb22248c-33d3-4cf6-9680-ee95092806ac.png" alt class="image--center mx-auto" /></p>
<p>Another update is the addition of a contextual menu, which provides quick access to relevant actions for files and folders. This functionality makes the Media Browser not only more versatile but also more accessible to users, facilitating faster and more efficient file organization.</p>
<p><strong>Next Steps</strong></p>
<p>With the Media Browser shaping up, it’s time to start defining the application’s startup flow. I’m considering how best to structure folder opening and project loading for a smooth experience, including features that allow users to open a folder, load the current project, or even quickly access previous projects. The goal is to make startup intuitive and agile, catering to the needs of regular editor users.</p>
<h2 id="heading-zeke-box2d">🧑‍💻 Zeke - Box2D</h2>
<p>Finally kicked off making a Box2D game demo on Monday. It’s called… Asteroids. Yes, it’s a classic and simple enough to build over a week while figuring out what functions, shapes and UI elements are needed to make this work.</p>
<p>First step, making a basic triangle shape and making it move around. Sounds easy enough, except it’s purely Box2D in JavaScript with no helper functions. The ship itself requires 3 components: a dynamic physics body, a collision shape and a triangle shape definition in vector format. To make it move requires getting the ship’s rotation and applying a force to the ship’s centre. Here’s what it looks like:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730731602281/46f2b77d-8118-4385-9864-84eebdd13c18.gif" alt class="image--center mx-auto" /></p>
<p>Step 2: Shooting. See what my first attempt at spawning bullets from the ship looks like:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730731609867/38aea48e-4eb4-495e-adad-b5ec63d9bdf5.gif" alt class="image--center mx-auto" /></p>
<p>Unexpectedly, smoke trails were created instead that look nice if implemented properly but that’s not my intention here. So after some tweaking and applying force to each bullet, I’m happy to see shooting working.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730731617655/2dd77a85-0df3-439f-bf39-d6cf92cd3de7.gif" alt class="image--center mx-auto" /></p>
<p>Tweaking shooting a little further to add a firing rate so bullets are not spraying out like a hose:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730731624600/d7fc802b-4db7-4418-a312-f84734488bf6.gif" alt class="image--center mx-auto" /></p>
<p>Step 3: Asteroids. What’s an asteroids game without it? Using a basic circle shape, this was a fairly straightforward step. I thought it looked good until…</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730731632526/66644d51-8230-4020-962e-fb04f9c1ffbd.gif" alt class="image--center mx-auto" /></p>
<p>At least collisions are working. Maybe I should change this to bumper cars in space instead. Before splitting the asteroid, I decided to add in a world wrap feature so bullets and asteroids will reappear after exiting the edges of the world.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730731639805/cf7eecd5-45a7-4a0b-b5d8-8726edc1f6a7.gif" alt class="image--center mx-auto" /></p>
<p>Now to crack some asteroids.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730731650489/bb3ddbf5-98a6-4b66-8cf7-b63a8859abd1.gif" alt class="image--center mx-auto" /></p>
<p>After getting some feedback from the team, prettier asteroids are needed. So from a circle, it’s now a randomly generated 5 to 8 sided polygon.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730731662450/4775e96a-9ac7-4233-8bbd-24c3d6f24e40.gif" alt class="image--center mx-auto" /></p>
<p>Finally to add a simple UI to complete this demo.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730731672483/06128c78-9b77-4cd4-b8a0-49715320c779.gif" alt class="image--center mx-auto" /></p>
<p>It’s been a fun week learning more about Box2D and figuring out how to implement it in a game. The experiment has given me more ideas about what to build next. Until then, I’ll be working on creating specific physics examples to show you how to add specific physics elements like adding thrust, rotation and collision detection.</p>
<hr />
<h2 id="heading-can-discord-activities-tool">🧑‍💻 Can - Discord Activities Tool</h2>
<p>This week was about refining and testing our Discord Activity launcher. Main tasks involved bug fixes and polishing to ensure a smooth user experience. I also implemented a cloudflared check to confirm if the package is installed, which adds a helpful UX layer before it launches the project. Another improvement we've made is moving from GitHub to our CDN. Downloading a ZIP of project struggles sometimes, responses slowly - with Phaser CDN, its much much faster now!</p>
<p>On the visual side, the app logo is shaped up beautifully (Ilija kills it, yet again), and I’m excited to reveal all together soon! So far, everything is progressing as planned, and I can’t wait to share more updates as we approach launch!</p>
<hr />
<h2 id="heading-arian-phaser-editor">🧑‍💻 Arian - Phaser Editor</h2>
<p>Hello friends</p>
<p>Our tilemap editor is almost ready. We have implemented all the features we planned for the next version of the editor, which should be released this week! Right now we are working on a new project template that includes a tilemap, which you can use to get an example of how to use it. In general, nothing changes from how you have used tilemaps before. Only now you can edit it from the Scene Editor itself. One thing we worked on all week was code generation. For this new version, all map data, including tile indexes, is included as part of the scene code. For future versions, we may give the option to save the data to an external file. Here is a screenshot of the example we are working on, which is an adaptation of the <a target="_blank" href="https://ansimuz.itch.io/sunnyland-forest">Sunny Land Forest</a> demo created by <a target="_blank" href="https://ansimuz.itch.io">Ansimuz</a>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730731725457/0376ecfe-8eff-4689-9f46-60771fecf0ea.png" alt class="image--center mx-auto" /></p>
<hr />
<h1 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730731906029/240f1458-07af-48d4-9cfc-8f1d182c0d84.png" alt class="image--center mx-auto" /></p>
<p><em>November 1st 2024, Ben Richards</em></p>
<p>This week has been a mix of squashing bugs and implementing filters.</p>
<h2 id="heading-bugs">Bugs</h2>
<h3 id="heading-renderfilters-focusing">RenderFilters Focusing</h3>
<p>There were a few issues around <code>RenderFilters</code> focus. This is an important aspect to get right, because the old FX system was supposed to just work. RenderFilters requires a bit more precision due to its greater capabilities, but we want it to just work too.</p>
<p>My solution is to detect imprecise child size, and toggle a flag to put the RenderFilters into "context focus" mode. This means that it derives its size when it renders, using the current DrawingContext. The DrawingContext includes a camera which the RenderFilters can copy. This is exactly the same as the old FX system. When the RenderFilters is rendered through multiple cameras, it will resize to each in turn.</p>
<h3 id="heading-drawingcontext-release">DrawingContext Release</h3>
<p>Several issues came up with DrawingContext release. It's vital to get these correct.</p>
<p>See, when we're working with filters, we need a constant stream of framebuffers to use and discard. We get these with DrawingContext objects, provided by a pool where they're recycled. Most of the time, the whole game only ever uses a couple of extra framebuffers under this system, which is very efficient.</p>
<p>The first problem is early release. When we release a DrawingContext, it goes back to the pool, and can be re-issued to another use. But if we want to use the DrawingContext in its original form, we have a problem. Very often, it's immediately taken and drawn to for another purpose, so the original is lost by the time we come to use it. Instead, we see something unexpected drawn where we don't want it.</p>
<p>The second problem is failure to release. If we don't release a DrawingContext, we never have a chance to reuse its framebuffer. But that framebuffer still exists. And we need a framebuffer, so we make a new one. Framebuffers quickly pile up, and the WebGL context quickly runs out of memory. WebGL crashes. This is a bad time.</p>
<p>The solution is, simply, to track all the complicated uses through, and make sure we're releasing everything correctly.</p>
<p>I also added the ability to "lock" a DrawingContext, preventing it from returning to the pool until unlocked. This is useful for "diamond-shaped" logic, where a given filter result needs to be used in two separate places before being combined. It's complicated stuff, and can crash WebGL entirely if you get it wrong, but it's there if you need it. (Mostly, it's there because I need it.)</p>
<h3 id="heading-parallel-shader-compilation">Parallel Shader Compilation</h3>
<p>The parallel shader compilation extension for WebGL is not available in some browsers, mainly Firefox. A logic bug prevented some shaders from ever compiling when the extension was not available. I fixed the logic and it works fine now.</p>
<blockquote>
<p>You can enable parallel shader compilation in Beam by adding the following code to your game config: <code>skipUnreadyShaders: true</code>. This feature will skip rendering a shader until it's fully compiled, allowing your game to keep running in the meantime. It prevents stutter as shaders take several milliseconds to compile. This will result in blank renders, so it's best to pre-touch shaders and rendering options before you need them.</p>
</blockquote>
<h3 id="heading-quicktime-support">Quicktime Support</h3>
<p>I added the ability to load Quicktime <code>.mov</code> video files, which was missing.</p>
<p>This is a horror story.</p>
<p>Quicktime videos load just like any other videos. There's nothing wrong with them. But Chrome on Windows (on my machine) says it can't play them. It can play them. I checked. It's lying.</p>
<p>Because media files are so complicated, browsers have a special interface to tell you whether you can play a given file. The <code>HTMLVideoElement.canPlayType</code> function has three possible results: "no", "maybe", and "probably".</p>
<p>There is no "yes".</p>
<p>And, as we've seen, sometimes browsers lie.</p>
<p>Suddenly, a monster joins our story: HEVC, the High Efficiency Video Coding standard. This is a monster of human creation, spawned by greed and carelessness. Taken by itself, it's a beautiful thing, supporting cool features like transparency, better file sizes, and improved color handling. But the megacorporations which created it wanted to get a return on their investment, so they put licensing fees on it.</p>
<p>As a result, many organizations were unable to use HEVC. For example, the Firefox browser can't implement it, or they'd have to charge you money to pay the fees. And, as we've seen, media file support is extremely vague on the Web. So when Chrome tries to play a file with HEVC, it comes out <em>wrong</em>. (In this case, the alpha channel is missing, replaced with a black background.)</p>
<p>And HEVC isn't a file type. It's a codec. That means it can be inside a MOV or MP4 file, with no way to tell until you try to play it. My Firefox says it can "maybe" play MOV files, so it gives it a try and throws an error because it finds HEVC.</p>
<p>HEVC could be lurking in any video, waiting, biding its time. Sometimes it behaves nicely. But every so often it reveals its hidden face, and does something wrong, or just crashes your game.</p>
<p>If you can help it, don't use HEVC. Not even for the cool transparency features. The VP9 codec does transparency without these issues, as part of the WEBM container. You might still be ambushed by a video that doesn't work as expected, but as I said, this is a horror story. The story of video in the browser has no happy endings. If you're lucky, you'll survive.</p>
<h2 id="heading-filters">Filters</h2>
<h3 id="heading-color-matrix">Color Matrix</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730734027729/55520776-a8ce-45d2-85e7-b1bea1e04180.png" alt class="image--center mx-auto" /></p>
<p>Color Matrix is pretty much the same. However, the FX version concealed the fact that the color handling wasn't done by an FX Controller. It was a separate object, skinned to look like a controller. Because Filter Controllers are a bit heavier, this was no longer practical. The main difference is that you'll now call <code>colorMatrixController.colorMatrix.negative()</code> to set colors, instead of <code>colorMatrixController.negative()</code>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730734045118/91d4f20d-ceb8-4d35-89a6-7f9b0e337446.png" alt class="image--center mx-auto" /></p>
<p>Because Filters run on cameras, we can take the previous scene, and put it through a camera with the Negative color matrix. This reverses the negative to positive, and changes the unfiltered items to negative. This is the kind of cool stacking effect you can make when there are no limits on stacking filters!</p>
<p>But there's more. Notice how the background didn't turn negative. That's because it's not part of the camera! That's the <em>game</em> background, which is set outside any scene or camera, and thus is outside the realm of filters. You can also add a background to a camera, which <em>is</em> affected by filters. This is a useful distinction to know about.</p>
<h3 id="heading-barrel">Barrel</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730734063311/85153831-3e3c-47da-9be0-0b55a6ba97cb.png" alt class="image--center mx-auto" /></p>
<p>Barrel is still the same. I had an interesting time replicating the example above, though, because the order of operations is slightly different. Padding won't get the same effect. Ultimately, I used <code>box.focus(undefined, undefined, box.width + 64, box.height + 64)</code> to enlarge the scope of the camera while keeping the sprite centered. You can do a lot of different things with the controls available to filters!</p>
<h3 id="heading-blend">Blend</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730734079457/4984358b-9fe0-4830-adff-bd385224718c.png" alt class="image--center mx-auto" /></p>
<p>WebGL is infamously short on blend modes. While it has plenty of blend options, few correspond to the blend modes familiar in Photoshop or the Canvas renderer. You're left with ADD, MULTIPLY, SCREEN, and ERASE, where Canvas has dozens of familiar and useful modes.</p>
<p>While we still can't set those blend modes straight on objects, the new Blend filter will help. It gives you every blend mode from the Canvas renderer, from ADD to XOR.</p>
<p>But it's better than that. Because these are applied by shaders, you can tune and overdrive the blend. The Blend filter has a color property, which multiplies the blend texture, allowing you to tweak the behavior. And the blend amount property can go beyond the range 0-1, a setting I call "overdrive". This lets you do things that are otherwise impossible with a single blend, like apply intense colors or reverse a blend.</p>
<p>In the example below, I've used Blend in ADD mode to modify three gems, adding them to themselves. One is super bright. One is brightened just in the red channel. And one is brighter in red and <em>darker</em> in blue, turning it from cyan to orange. As you can see, overdriving a blend gives you new kinds of control you never had before!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730734102859/007ba3de-ee8a-419c-b17e-5e6d6344638c.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-bloom">Bloom</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730734112392/617b1765-7162-4ce9-b454-e0ccc4b610b8.png" alt class="image--center mx-auto" /></p>
<p>Bloom was the last filter on my agenda, and it turned out to be the hardest. It's a composite filter, using several passes to blur the input, then blending the blur with the original input. If that sounds like everything else in this log entry, you're right! I had to develop everything to support this filter.</p>
<p>And I'm not done, because I want to make Bloom look as good as possible. See, the original Bloom FX was composited in a way that made it darker in some places. Now that we have Blend shaders, we can composite it properly, making the image as bright as it was originally.</p>
<p>The question is, which Blend mode to use? ADD? SCREEN? COLOR_DODGE? I think the correct answer is to give the choice to you, and expose blend mode as a setting on the filter controller. But I still want the default to look great. I think SCREEN is probably best - it's way less garish than the alternatives in my tests.</p>
<p>If you're reading all this and getting flashbacks to the Bad Old Days of bloom 20 years ago, don't worry. You have the power to control every aspect of the filter. You can right the wrongs of the past.</p>
<h2 id="heading-next-week">Next Week</h2>
<p>I'm going to polish off this batch of filters. (That implies more batches to come. I have ideas. They won't be in this release of Beam, but there are plenty more things to empower your games.)</p>
<p>Then I'm going to work on the Shader game object. This fills a vital role in game rendering. I think of it as the counterpart to textures: a way to cover a quad with something that's not an image file. It's <em>also</em> how you get new shaders into the game.</p>
<p>Fingers crossed, we're going to hit the last few features soon, and start the laborious process of tidying everything up and making sure it works. I'm pretty confident, but I also know that complicated things attract bugs.</p>
<p>Time to fire up the bug zapper...</p>
<hr />
<h1 id="heading-share-your-content-with-18000-readers">Share your content with 18,000+ readers</h1>
<p>Created a game, tutorial, code snippet, video, or anything you feel Phaser World readers would like? Then please <a target="_blank" href="mailto:content@phaser.io">send it to us</a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730734155415/4e3fd789-a170-430d-9968-21f6f5d0bf1a.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 203]]></title><description><![CDATA[Welcome to another massive issue of Phaser World! We’ve got new videos, new tutorials, new games, and more animated gifs in the Developer Logs section than we’ve ever had before 😅
🌟 Phaser Beam Technical Preview 5
Play with new demos, download, and...]]></description><link>https://phaser.world/phaser-world-issue-203</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-203</guid><category><![CDATA[WebGL]]></category><category><![CDATA[Game Development]]></category><category><![CDATA[canvas]]></category><category><![CDATA[phaser]]></category><category><![CDATA[Physics]]></category><category><![CDATA[shader]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Tue, 29 Oct 2024 13:17:50 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730204364203/00516fba-da7c-4cb2-9153-f2a7eac6e8e1.png" alt class="image--center mx-auto" /></p>
<p>Welcome to another massive issue of Phaser World! We’ve got new videos, new tutorials, new games, and more animated gifs in the Developer Logs section than we’ve ever had before 😅</p>
<h2 id="heading-phaser-beam-technical-preview-5">🌟 Phaser Beam Technical Preview 5</h2>
<p><em>Play with new demos, download, and help test the latest release of our renderer.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/phaser-beam-technical-preview-5"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730204488403/e26f9b48-b572-462f-a10d-069901b4e180.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Welcome to Phaser Beam Technical Preview 5. This preview is an insight into upcoming advances in Phaser and its WebGL renderer.</p>
<p>This version is all about framebuffers. We've revised DynamicTexture to be easier to use and more performant. We've also removed FX and BitmapMask, combining them into the new Filters system.</p>
<p>In this article you’ll find details about everything that is new, along with 4 demos in the Phaser Sandbox and a link to download and use TP5 in your own local builds. We’re getting very close to finishing all previews of Phaser Beam. The next stage is full integration with Phaser v3.86 and then an alpha release.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/phaser-beam-technical-preview-5">Read the full article</a></p>
<h2 id="heading-build-a-game-like-teeter-up">🧠 Build a game like Teeter Up</h2>
<p><em>A tutorial series on building a game like Teeter Up using Phaser.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/build-a-game-like-teeter-up"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730204811904/1e7ff8fa-7c3c-49f0-9ce4-e9a5f4ece3f5.png" alt class="image--center mx-auto" /></a></p>
<p>Emanuele Feronato published a tutorial series on creating a game like Teeter Up in Phaser. He writes: "During the past few days I’ve been watching a few Netflix video games on my iPhone, and I particularly liked Teeter (Up).</p>
<p>It’s a simple physics game with a ball, a platform, and a hole. What could possibly go wrong?”</p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/build-a-game-like-teeter-up">Read the tutorial series</a></p>
<h2 id="heading-mahjong-at-home-aloha-edition">🎮 Mahjong at Home: Aloha Edition</h2>
<p><em>Explore the rich heritage of the Polynesian people in this beautiful casual Mahjong game.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/mahjong-at-home-aloha-edition"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730205000556/e0e10f4a-69eb-44ea-905d-25502075b23e.jpeg" alt class="image--center mx-auto" /></a></p>
<p>RavalMatic has released a new installment in their popular Mahjong at home series. This installment takes players to a Polynesian-themed environment by the sea, where they can explore the rich cultural heritage of the Polynesian peoples. Discover intriguing aspects of this vibrant culture through the immersive cabin setting, which is perfect for those interested in Polynesian history and art.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/mahjong-at-home-aloha-edition">Play Mahjong at Home: Aloha Edition</a></p>
<h2 id="heading-create-youtube-playable-games-with-phaser">🎥 Create YouTube Playable Games with Phaser</h2>
<p><em>Enjoy our new YouTube video all about making games for YouTube!</em></p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=10khjSeogr4">https://www.youtube.com/watch?v=10khjSeogr4</a></div>
<p> </p>
<p>We’ve another new video up on YouTube. Check it out above 👆</p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730205273278/c133f175-1c65-4e56-8208-ac1c78c70ef9.png" alt class="image--center mx-auto" /></p>
<p>There has been so much going on; this is another pretty big Dev Log! with lots of pretty pictures and animated gifs 😀 So, let’s get going …</p>
<h2 id="heading-pete-box2d-physics">👨‍💻 Pete - Box2D Physics</h2>
<p>This week has involved quite a lot of bug hunting, finding, and squashing (splat).</p>
<p>I started the week with the 'popcorn' bug which had been evading me on Friday last, it resolved as a combination of 5 separate 'silly' bugs (primarily typos, and two reference copies that should have been object clones).</p>
<p>On the way through I took a very close look at the new capsule implementation and found an (unrelated) issue that was allowing them to overlap. We now have fast and firm capsules which I plopped into a jar with a stirrer:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730205662427/22deeb49-aad6-4209-a7fc-8be8d2334533.webp" alt class="image--center mx-auto" /></p>
<p>After a late night bug hunt I finally found the last silly bug that was causing the 'popcorn' explosions and fixed it. Unfortunately with that fixed I was free to notice that triangles landing on other triangles didn't react properly! A problem for Tuesday...</p>
<p>Another day, another catchy bug name: the 'polygon penetration' bug. It seems that the AABB used for broadphase collision pair finding is in the wrong place when polygons switch to 'fast' moving bodies. This one was lovely and specific which made it an easy capture: an inappropriate optimisation to reduce the garbage generation... in other words I tried to make things faster and broke them instead.</p>
<p>The fix was trivial at least. I then took some time to modify various tests to push a little harder, and to use a selection of shapes rather than just one or two. This tests the engine more thoroughly and is (generally) a more realistic use-case for gaming.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730205789995/cf744a5d-9e74-4313-baf5-54f296f7198f.webp" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730205830009/6614c5e4-ab78-47f5-b9d8-201da0935230.webp" alt class="image--center mx-auto" /></p>
<p>Late on Tuesday I enabled the island 'sleeping' flag (I've been meaning to test this for a while)... and it failed. Let's save that one for Wednesday.</p>
<p>On Wednesday we started additional testing with another team member... the bugs aren't entirely gone yet, but most of the engine does its job, so it's time to get Zeke involved!</p>
<p>Either I'm getting better or the bugs are getting slower... I had an intuition about the sleeping island issue, stepped through some code deep in the solver and found a bug where a slightly unusual JS function attempted to recreate C functionality that zeroed a deep object (in C it is flat memory, but in JS it's deep). It was just the one issue this time, and a relatively simple fix means that islands sleep and wake properly. I had to check so I created this test to shower things into bins for a while, then let them sleep:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730205891455/b9288673-5173-425f-9745-3a342ee63ead.webp" alt class="image--center mx-auto" /></p>
<p><strong>Examples Revamped</strong></p>
<p>Time to make things a bit prettier!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730205914556/c81caa5b-c083-4572-afb6-38f05dd6367b.webp" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730205923873/c52bb58a-60d0-4530-bee8-819b1db730e0.webp" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730205934484/a944e446-b30d-402b-a600-84e95b28e4ae.webp" alt class="image--center mx-auto" /></p>
<p><strong>Build System Preparation</strong></p>
<p>Rich and Zeke did some obscure things and made a build system with bundler... we're definitely gearing up for the full internal testing phase.</p>
<p><strong>Another Bug</strong></p>
<p>Prismatic joints decided to act up next. They always seemed a bit dodgy to me but I couldn't put a finger on exactly what was wrong - until today when they started hopping around the screen instead of sliding up and down the lines as they're meant to. This one was tricky, and eventually, I built a C++ test bed using the original C library and mimicked it in JS. After stepping them side-by-side I found a point of divergence and was able to track that bug down to its hidey hole. Guess what... it was another reference error (reference copy instead of clone). These guys are very sneaky!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730206633195/da037c18-afc5-44dd-8cfd-a48c4b9cf9cf.gif" alt class="image--center mx-auto" /></p>
<p><strong>New Examples</strong></p>
<p>I closed out the week with a couple of new examples:</p>
<ul>
<li><p>A piston driving a wheel via a push-rod, in much the same way as a steam engine works</p>
</li>
<li><p>A chain bridge</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730205980957/b65f9472-12f8-4bbe-befc-2942a4ac88ee.webp" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730205991015/b2e84a33-5e3f-4a37-a18b-17fbb35dcfa3.webp" alt class="image--center mx-auto" /></p>
<h2 id="heading-zeke-box2d-physics">👨‍💻 Zeke - Box2D Physics</h2>
<p>On Monday, I did some final polishing for parts of the Phaser documentation site.</p>
<p>On Tuesday, I started learning Phaser’s Box2D physics engine. It’s an exciting development since Box2D gives us an industry standard physics engine to work with, and will form a really nice addition to Phaser itself.</p>
<p>The rest of the week was spent coming up with ideas and implementing some basic examples.</p>
<p>Here are a few completed examples:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730206570280/8451bd24-f439-4779-9aed-a19ef635cab0.gif" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730206581843/5cce1ef0-db2b-43a4-9710-472c1d59a51b.gif" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730206593890/2f09e730-67a9-4fcc-b6f1-1075da2d6140.gif" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730206604521/f13c0251-b0cf-4c16-9558-5f4c226fc6dd.gif" alt class="image--center mx-auto" /></p>
<p>After I’ve gotten a better grasp on Box2D, I’m planning to create more game related examples to implement in your own games.</p>
<h2 id="heading-francisco-phaser-launcher">👨‍💻 Francisco - Phaser Launcher</h2>
<p>This week, I focused on advancing the Phaser Launcher landing page and integrating features into the editor.</p>
<p>The editor now supports opening and viewing various file formats, including MP3s, videos, images, and more, directly within the editor itself. Additionally, you can modify files directly from your operating system’s native file system, with real-time updates reflected in the editor—making it highly responsive to external changes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730206777313/39da9b27-b11c-459d-9b67-cb8693800fde.gif" alt class="image--center mx-auto" /></p>
<p>I also implemented a tabbed interface, allowing multiple open tabs with a sliding feature, similar to Visual Studio Code. This makes it easier to switch between files and keep multiple resources accessible at once.</p>
<p>For the landing page, I experimented with opening multiple windows and worked on inter-window communication. Since future modules will require interaction across different windows, this is a crucial foundation for the project’s modular growth.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730206984862/4d429b4b-5c35-4523-9252-53509b0ba442.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-arian-phaser-editor">👨‍💻 Arian - Phaser Editor</h2>
<p>Hi friends.</p>
<p>The tilemap editor is going full steam ahead! I've already finished the basic tools: Stamp, Fill, Rect-Fill, Eraser, and Rect-Select. I think that next week we'll complete the features that will be part of the first version. There's still code generation to implement and some operations like deleting a tileset, and well, there are always some ideas that can come up along the way. Something very important and time consuming for me is writing the documentation. Proper documentation is essential, so I think we're still a bit short of the first version. We also need to create a project template or modify some of the existing ones. Changing the subject a bit, Scott Westover recently posted the video <a target="_blank" href="https://www.youtube.com/watch?v=upx7DST2blA&amp;t=21s">Phaser Editor v4 Beginner's Guide: Make Games Fast with Phaser 3!</a> on his YouTube channel. I recommend it!</p>
<p>Here are some images of the new tilemap editor.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730207147211/3cc98c8f-604d-4464-8e4b-1adfafe43742.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-can-discord-activities-tool">👨‍💻 Can - Discord Activities Tool</h2>
<p>This week, we focused on making the project setup even smoother, following some internal tests with the team. Before the official release, we’ve added a new feature that streamlines creating projects with our tool. Now, you can simply select your template and desired installation folder, and the tool will take care of the rest, making the whole process hassle-free!</p>
<p>Here's what it handles for you:</p>
<ul>
<li><p>Downloads and unzips the template project into the folder you selected.</p>
</li>
<li><p>Installs the necessary npm packages automatically.</p>
</li>
<li><p>Renames example.env file to .env for you.</p>
</li>
<li><p>Additionally, we've added the option to enable DevTools with the production build. This is especially helpful if something unexpected occurs that the app isn't catching on its own.</p>
</li>
</ul>
<p>We’re wrapping up our final tests with the team, and if everything goes smoothly, we’ll be ready to launch v1!</p>
<p>Until then, keep your pixels sharp, everyone!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730207220882/203e770c-6b96-4a7c-8b19-6f2f5afb88c0.png" alt class="image--center mx-auto" /></p>
<hr />
<h1 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h1>
<p><em>October 25th, Ben Richards</em></p>
<p>My big headline this week is, of course, <a target="_blank" href="https://phaser.io/news/2024/10/phaser-beam-technical-preview-5">Phaser Beam Technical Preview 5</a>. Released earlier this week, this adds support for Filters (formerly FX and BitmapMask) and DynamicTextures (and RenderTextures). I've continued to add filters to the engine, and fix some bugs along the way.</p>
<h2 id="heading-more-filters">More Filters</h2>
<h3 id="heading-threshold-filter">Threshold Filter</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730207416397/7b751fd1-c608-4052-9294-50269fa9a7a2.gif" alt class="image--center mx-auto" /></p>
<p>The Threshold filter is new in Phaser Beam. It pushes each color channel towards 0 or 1, either within a range (creating heightened contrast) or absolutely (creating black and white with no shades of gray). Here, we see it used to turn a simple particle emitter into a more cohesive and stylized effect.</p>
<p>Threshold is particularly useful when combined with a Mask. You can convert an alpha gradient into a sharp edge, and animate where on the gradient that edge appears. This leads to cool effects like burning paper and dripping liquid.</p>
<h3 id="heading-shadow-filter">Shadow Filter</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730207433493/9c59fc17-a8a3-42ad-b9d6-956fde443cb4.png" alt class="image--center mx-auto" /></p>
<p>The Shadow filter returns. In Beam, it has a bug fix. In Phaser 3, shadow alpha interpolation was not clamped, which could lead shadows to change color within their edge. The interior of shadows are now a constant color, as you can see here.</p>
<h3 id="heading-glow-filter">Glow Filter</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730207451148/a9801554-726e-4747-b2e5-28c26e81035b.png" alt class="image--center mx-auto" /></p>
<p>The Glow filter returns, with big improvements. The glow shader algorithm has been tweaked to get higher quality and better performance.</p>
<p>We've added a <code>scale</code> property, which controls the width of the glow effect. This is necessary because the <code>distance</code> property is hard-coded upon creation, built into an instance of the glow shader. The hard-coded <code>quality</code> property has also changed; default quality is now 10 instead of 0.1, which I feel makes more sense.</p>
<p>The glow shader now employs stochastic sampling. It still has even coverage, but it no longer samples in straight lines out from the target fragment. This eliminates the tendency for the shader to produce sharp lines around corners, as seen in this screenshot:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730207462684/d088adc5-5f65-4223-9bc9-263d0ab381e7.png" alt class="image--center mx-auto" /></p>
<p>Because the stochastic sampling is generally smoother, a good-looking glow can be achieved with fewer samples, improving performance.</p>
<h2 id="heading-plugin-filters">Plugin Filters</h2>
<p>The architecture for creating filters is pretty straightforward. I've developed some examples to demonstrate how to add your own filters, which should be available when Beam launches.</p>
<h3 id="heading-bump-to-normal-filter">Bump To Normal Filter</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730207496911/4f0cb4b4-2959-40ca-9e12-28f3950eabb3.png" alt class="image--center mx-auto" /></p>
<p>On the left, a stylized face in grayscale. On the right, the same face converted to a normal map.</p>
<p>This example treats the input luminance as a height map, and converts it to a normal map, perhaps useful for other textures. The example is under 70 lines, explanatory comments included, consisting of a Controller, GLSL shader source, and a RenderNode.</p>
<h3 id="heading-selective-blur-filter">Selective Blur Filter</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730207555463/4e3ed3b5-e9a2-4903-a88d-40081a20e87e.png" alt class="image--center mx-auto" /></p>
<p>This example demonstrates more complex filter techniques. It uses an extra texture to control the intensity of a blur effect, which is rendered in several applications of the shader. This uses some extra features of the filter system. The example is under 170 lines, documented and intended for use as boilerplate.</p>
<h2 id="heading-bug-fixes">Bug Fixes</h2>
<p>As expected, we were quickly informed of some bugs in Phaser Beam Technical Preview 5. I'm very grateful for these reports, as they help us discover things I never thought to test, which all makes for a better end product.</p>
<h3 id="heading-game-resizing">Game Resizing</h3>
<p>Somewhere during development, I had broken the code which resizes framebuffers when the game is resized. Fortunately, the fix was straightforward. If you want this fix in TP5, before we release the fixed Beam, add this code to a Scene (and make sure it only runs once):</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> renderer = <span class="hljs-built_in">this</span>.game.renderer;
renderer.on(Phaser.Renderer.Events.RESIZE, renderer.baseDrawingContext.resize, renderer.baseDrawingContext);
</code></pre>
<h3 id="heading-filter-draw-in-padding-area">Filter Draw in Padding Area</h3>
<p>The padding of filters is a very complicated area, and I overlooked something. The drawing technique I used meant that internal filters with padding would not draw in the padded area, which eliminated the point of padding in the first place.</p>
<p>This is because I was drawing the filter input as a quad within the padded area. Obviously, the shader couldn't run on regions outside that quad. I could always do the filter with two draws: one to draw the input to a larger quad, and another to run on the expanded quad. But that would be very inefficient.</p>
<p>Instead, I turned the problem inside-out. Rather than shrink the quad into the framebuffer, I drew the quad full-size and expanded the texture coordinates. Thus, the entire framebuffer was subject to the shader.</p>
<p>The only problem was, texture coordinates outside the texture are treated specially by WebGL. They "wrap". The texture can tile, mirror, or just repeat the edge pixels endlessly. There's no option for simply having empty texels. That meant I got effects like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730207574284/2a0e44fc-c4da-4205-9757-9d0fcc8257db.png" alt class="image--center mx-auto" /></p>
<p>So I implemented a fix. Filters support "shader additions", a system I developed for other parts of Phaser. I developed a GLSL function which returns texture samples, except when it detects out-of-bounds coordinates, then it returns transparent samples. Then I used shader additions to make it available in all the padded filters, without having to duplicate the code.</p>
<p>This is an example of work coming together to support cool new possibilities. I feel pretty happy about that.</p>
<h2 id="heading-next-week">Next Week</h2>
<p>I'm finishing up the remaining filters. Some of them might not make it, as we have better ways of achieving those effects.</p>
<p>I'm also working on a new version of the <code>Shader</code> game object. This should be as straightforward as the Filter plugins described above. The Shader, in my mind, is a system for painting with shaders instead of textures. It's a very useful part of the game maker's arsenal, especially when combined with filters and <code>DynamicTexture</code>s. There might even be some new GameObjects one day... but that's another story.</p>
<p>Beam is coming. It's faster, it's more flexible, it's shinier. We've still got a lot of work to do, but we're getting there!</p>
<hr />
<h2 id="heading-share-your-content-with-18000-readers">Share your content with 18,000+ readers</h2>
<p>Created a game, tutorial, code snippet, video, or anything you feel Phaser World readers would like? Then please <a target="_blank" href="mailto:content@phaser.io">send it to us</a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1730207656798/93732abe-5c10-4938-a979-903ab4a47972.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 202]]></title><description><![CDATA[Welcome to Issue 202 of Phaser World. As we enter the final weeks of October, we bring you new releases, new games, and yet another vast Dev Log section. An incredible amount is going on at Phaser Studio right now and we do our best to sum it all up ...]]></description><link>https://phaser.world/phaser-world-issue-202</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-202</guid><category><![CDATA[Game Development]]></category><category><![CDATA[WebGL]]></category><category><![CDATA[canvas]]></category><category><![CDATA[phaser]]></category><category><![CDATA[discord]]></category><category><![CDATA[Games]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Mon, 21 Oct 2024 10:00:41 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729425711039/71e91303-efed-4918-b018-c62aa3354616.png" alt class="image--center mx-auto" /></p>
<p>Welcome to Issue 202 of Phaser World. As we enter the final weeks of October, we bring you new releases, new games, and yet another vast Dev Log section. An incredible amount is going on at Phaser Studio right now and we do our best to sum it all up in this newsletter each week. So please read, and if you’ve any questions just ask us on <a target="_blank" href="https://discord.gg/phaser/">Discord</a> - we’re only too happy to chat.</p>
<h2 id="heading-phaser-editor-451-released">🌟 Phaser Editor 4.5.1 Released</h2>
<p><em>An important point release of Phaser Editor that solves several high-priority issues.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/phaser-editor-451-released"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729429389335/a3952835-9d38-4904-b6f0-3941739cffcb.png" alt class="image--center mx-auto" /></a></p>
<p>We are happy to announce the immediate availability of Phaser Editor 4.5.1. We felt it was important to release this update to address some priority issues.</p>
<ul>
<li><p>Fixes the 'white screen of death' issue, where the Editor would hang on a white screen after opening a project if the server was slow to start.</p>
</li>
<li><p>Fixes tilemap pixel rounding issue in the Scene Editor.</p>
</li>
<li><p>Fixes the npm install command when the proxy is configured but disabled.</p>
</li>
<li><p>Fixes the variable name generation.</p>
</li>
<li><p>We have also taken the opportunity to update the editor to the latest version of Phaser, version 3.86.</p>
</li>
</ul>
<p><a target="_blank" href="https://phaser.io/news/2024/10/phaser-editor-451-released">Download Phaser Editor 4.5.1</a></p>
<h2 id="heading-honey-snap">🎮 Honey Snap</h2>
<p><em>Guide bees to victory in this sweet, honey-filled challenge that will keep you buzzing for more.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/honey-snap"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729429447964/67705f9c-cb1b-4839-9cdd-8e0a4029eae1.png" alt class="image--center mx-auto" /></a></p>
<p>Honey Snap, besides sounding like a tasty breakfast cereal, is an addictive new game from Black Moon Design. You're presented with a grid of hexagons set into the bark of a tree. Below it are honey-filled shapes that you must drag into the grid. If you manage to complete a line in any direction, it vanishes in exchange for lots of points.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/honey-snap">Play Honey Snap</a></p>
<h2 id="heading-youtube-playables-phaser-tutorial">🎙️ YouTube Playables Phaser Tutorial</h2>
<p><em>Learn how to create YouTube Playables with our extensive new tutorial.</em></p>
<p><a target="_blank" href="https://phaser.io/tutorials/creating-youtube-playables-with-phaser"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729429566539/662eb003-0fed-4522-a308-dd28e16d7f32.png" alt class="image--center mx-auto" /></a></p>
<p>Who would have thought YouTube would become such a popular web gaming platform? That's precisely what it has done with its YouTube Playables service. After a successful beta period, users of the YouTube site or app worldwide can now engage in an extensive range of web gaming titles, and developers we've spoken to have seen great success with them.</p>
<p>Of course, being web-first, Phaser is an excellent choice for creating games for submission to the YouTube Playables content team. We have published a brand new YouTube Playables Template and a comprehensive tutorial to make that process as easy as possible. The template includes a complete game, our Playables SDK wrapper, and full documentation. It is now available directly from the Google web samples repository.</p>
<p>To help you get the most from our template, we've also written a detailed new tutorial that covers the SDK and the Test Suite and how to use them in depth. So now you have the perfect reason to enhance your Phaser games into compelling YouTube Playables and introduce them to millions of new gamers.</p>
<p><a target="_blank" href="https://phaser.io/tutorials/creating-youtube-playables-with-phaser">Read the YouTube Playables Tutorial</a></p>
<h2 id="heading-gloomyvania">🎮 Gloomyvania</h2>
<p><em>A nostalgic platformer filled with challenging enemies and classic arcade vibes.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/gloomyvania"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729429786146/5b0313d2-c94c-45a1-8cc9-244f7e888753.png" alt class="image--center mx-auto" /></a></p>
<p>Gloomyvania is a lovely homage to the classic NES Castlevania series. In this arcade platformer, you run and 'gun' to destroy a variety of creepy enemies as you explore the castle.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/gloomyvania">Play Gloomyvania</a></p>
<h2 id="heading-let-us-publish-your-phaser-games">💰 Let us publish your Phaser Games</h2>
<p><em>Got a Phaser game you’d like published? Get in touch!</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729430034579/ae6a4517-1df9-40b4-bfd4-5c4eac3ef84f.png" alt class="image--center mx-auto" /></p>
<p>At Phaser Studio, we’re all about empowering developers to create great games. By focusing on the framework and tools to allow this, we’ve seen thousands of games released over the years, many of which went on to critical and commercial success.</p>
<p>And we’ve noticed the publishing landscape is changing yet again. New platforms are opening up that introduce keen opportunities for the right games. And it’s something we’re deeply invested in.</p>
<p>So - if you’ve developed a Phaser game you feel would benefit from wider distribution to exciting new platforms, then we’d love to hear from you. Please email a link to your game or games portfolio to <a target="_blank" href="mailto:bizdev@phaser.io">bizdev@phaser.io</a> , and we’ll be in touch.</p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729430084156/da239e0f-3b90-4c73-82c8-2b573f5874c6.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-rich">👨‍💻 Rich</h2>
<p>When I sat down to write my Dev Log, I thought about all the really exciting things that had happened this week. Then, I realized I can’t talk about most of them yet! We sign NDAs with our partners for a reason - so I’ll just have to bottle it up until such time as we can shout about it. Back in the realm of things I can actually discuss, we are getting close to the release of several new products. Can talks about his Discord Activities tool in his Dev Log this issue and once we complete some more testing and documentation we will release version 1 of this. There are many cool things this tool will evolve to do in the future, but for now, it’ll be good to have the first release live.</p>
<p>I’ve also been working on the new documentation site with Zeke. This has been a huge amount of work, but it will be so worth it. We have a couple loose ends to tie up on Monday, and then we can make it live. The site is a combination of lots of things. It’s a replacement for our API Documentation that currently lives at newdocs.phaser.io - we have redone all of this, and it’s now easier to browse and search than before. We have also bought together lots of written content and authored pages and pages of new material. This includes guides that I’ve written, and we’re also using some of the fantastic work of Samme and RexRainbow, obviously with full permission and attribution. This revised content allows developers to read about concepts, internal systems, and ‘how things work’ in one single location without having to try and extract that all from the API docs, which isn’t even possible in many cases. The docs site even has an ‘AI Search’, so you can use normal language prompts to query the contents. Having this live will be massive and I cannot wait.</p>
<p>Remaining on the tutorial front, I also finished my <a target="_blank" href="https://phaser.io/news/2024/10/youtube-playables-phaser-tutorial">comprehensive tutorial</a> on creating YouTube Playables using Phaser. This was featured earlier in this newsletter, so I won’t go over it again here, suffice to say it was great to finally publish it. The tutorial comes with a feature-packed template and a full sample game. It was fun to actually work on a game again! and even more fun to then see it merged into the official Google repositories 😀 Working with the team at YouTube has been a great experience. We’re excited to see where that will evolve in the future.</p>
<p>This week I’ve also been working with the team at <a target="_blank" href="https://www.werplay.com/">Werplay</a>. They’ve years of experience creating amazing games, and as one of Phaser’s enterprise customers we are helping them build a playable ads template that will fit their specific requirements. Doing this has been a nice mental shift for me, and it has also led to some new features landing in the Phaser codebase that will benefit everyone, so a double-win! We create private Slack or Discord channels for our enterprise clients so they can get direct support from the team for their projects. If this is something that would interest you, please <a target="_blank" href="mailto:rich@phaser.io">drop me an email</a>.</p>
<p>In the coming days, we should have a new Technical Preview of Phaser Beam, the new docs site live, and the first release of the Discord Activities tool. Oh.. and just maybe something else pretty cool 😎</p>
<p>That’s it for now. This is yet another huge newsletter, so keep scrolling to read what the rest of the team has been doing — it’s pretty epic!</p>
<h2 id="heading-zeke-new-phaser-docs-site">👨‍💻 Zeke - New Phaser Docs Site</h2>
<p>This week was focused on adding the remaining documentation and cleaning up all previous documentation!</p>
<p>Documents added:</p>
<ul>
<li>Blend Mode, Blitter, Color, Container, Device, DOM Element, FX, Game, Group, Image, Layer, Light, Mask, Nine Slice, Particles, Plane, Render Texture, Rope, Scale Manager, Shader, Sprite, Text, Tile Sprite and Video.</li>
</ul>
<p>The clean-up has been completed by:</p>
<ul>
<li><p>going through and seeing if everything makes sense and is readable</p>
</li>
<li><p>spelling and grammatically correct</p>
</li>
<li><p>check links ensuring all are working and pointed to the right destination</p>
</li>
<li><p>checking examples ensuring the code actually works</p>
</li>
<li><p>standardized formatting on all pages on the site</p>
</li>
</ul>
<p>That's all for the updates this week. If everything goes according to plan, the new documentation site should be ready by the end of the week.</p>
<h2 id="heading-can-discord-activities-tooling">👨‍💻 Can - Discord Activities Tooling</h2>
<p>This week, I've made significant strides in finalizing the Discord Activities integration.</p>
<p><strong>Upgrade to Tauri v2</strong></p>
<p>I upgraded the project from Tauri v1 to v2. The biggest challenge was the new permission system for plugins, especially on macOS. It took more time than expected due to limited documentation. But rest assured, everything is now running smoothly!</p>
<p><strong>Streamlined Discord Developer Portal Access</strong></p>
<p>I've added a direct link to your Discord Developer Portal within the app. It fetches your Discord APP_ID and takes you straight to the URL mapping page. The generated proxy URL is auto-copied, just paste and save to profit!</p>
<p><strong>More Polishing</strong></p>
<p>To improve user experience, I've implemented alert boxes that inform you of any errors or successful events without disrupting your workflow.</p>
<p><strong>Almost There</strong></p>
<p>We're wrapping up the installer systems. With a few more tweaks, it will be ready for its first release!</p>
<p>Until then, happy coding everyone!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729431253039/06fadc80-59da-4bc4-b3e8-ee00760933ea.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-pete-box2d-physics">👨‍💻 Pete - Box2D Physics</h2>
<p>On Monday I tracked down some strange numbers in the dynamic tree, where it appeared to be faster if the tree balancing was always an even split. This was (of course) not the case, and eventually I found a nasty bug. The tumbler 1000 demo doubled in speed with this fix, so that was a lovely start to the week!</p>
<p>I continued to reduce the transient memory allocations, concentrating mostly on a structure called <code>b2ManifoldPoint</code> I managed to reduce it from over 5000 per world step to 0. The current design is using a handful of these objects which are allocated only once, when the world is first created. Running some long-term mobile tests following the tree fix and the reduced garbage accumulation, we now see a solid 60fps with 1000 boxes in the tumbler on iPhone 14 and 15. On iPhone 13 we regularly touch 60 fps but then it drops, I think there may still be work needed on the garbage for those older devices.</p>
<p>I've revisited the frame timing system and given it a capability to catch up a dropped frame or two if the previous frame was at or above the physics simulation fixed frame rate (typically 60 fps). This approach works to smooth out temporary glitches like we see on mobile, while it 'does something else', without getting into a death spiral where the catch-up frame is continually triggering another one.</p>
<p>More optimisations, more memory management changes... tumbler 1000 is no longer a useful test and I've stepped up to tumbler 1250 even on mobile devices.</p>
<p>A note about mobile devices: performance on iPhone is significantly better than on Android. Even the more powerful Android devices on BrowserStack are significantly slower than the older iPhones. I'm not sure how to rectify this. Everything is running well on both Android and iPhone, but on Android the timing values are almost double. My understanding (from a Tom's hardware phone comparison) is that the CPU should be entirely capable of keeping up, so maybe I'm hitting RAM too hard, or maybe there's another element at play. I'll continue to experiment and see if I can work out how to reach parity.</p>
<p>Later in the week I ran the full range of tests to make sure nothing had broken during my heavy handed optimisation passes. Three (out of 8) were broken, so I spent some time with github, reverting to older commits and retesting to isolate the commit that broke things. In this way I have located four 'silly' bugs (x instead of y, min instead max, that type of thing) and one extremely sneaky bug that was well hidden inside the manifold creation system. With these all fixed all my tests are running again, although I am facing an issue where things rarely and randomly explode upwards. I'm calling it the 'popcorn bug' and I'll dig into it next week (with plenty of salt).</p>
<p>I took two days to experiment with WASM via AssemblyScript. I'd love to squeeze a bit more speed out of this, and the code structure (being translated almost verbatim from the C original code) should be ideal. TLDR: it was not good. The long version: I had only a short period of time to perform the testing, so I chose a suitably quick goal: replace the AABB system with a drop-in 100% wasm system. The AABB (axis aligned bounding box) system is called a phenomenal amount, but it's only called from 30-40 unique places. It takes in tiny amounts of data, does some processing, then throws out tiny answers. It's almost a perfect test except that the work it does is minimal. Ideally we'd find a system with the other properties but which does some very grunty processing inside - e.g. pixel manipulation in-situ (the large amounts of data going in can be controlled by the wasm, and processing the data where it lies means we don't have to do slow conversions on the way out, plus pixel manipulations are often relatively expensive per-pixel).</p>
<p>After I'd built the entire system in AssemblyScript and compiled it to WASM, linked the modules, and modified the 30+ places that called AABB related functions, the time test came back 4x slower than JS alone. I put this down to a relatively high overhead switching from JS to WASM and back again... I'd read some internet discussions that downplayed this enormously, but I think I hadn't read deep enough or widely enough. On the basis of these results I'd say that you don't want to be calling out to WASM more than one or two times per frame, making the AABB possibly one of the worst test cases I could have chosen. I would like to revisit this issue, but before I do, I'll need to locate a more suitable function, with much heavier internal processing, only one or two calls per frame, and a suitable data format or data requirements. To do this properly substantial changes will need to be made to the data format used by the engine core functions. Changing the data format will require rewriting a lot of the code uses that data, and in a physics simulation almost all of the systems rely on the same fundamental world representation. Throwing the original C at emscriptem might be a quicker solution, although I expect there could be a host of other problems going in that direction.</p>
<p>Plans for next week:</p>
<ul>
<li><p>fix the 'popcorn' bug</p>
</li>
<li><p>make some new tests and demos stretching the engine and hunting for anything that's broken in there</p>
</li>
<li><p>add new helper functions to the growing collection and make sure there's a meaningful example for each one</p>
</li>
<li><p>polygon decomposition into triangle connected hulls would be lovely to have</p>
</li>
<li><p>think about the engine in gaming terms: what features will be needed, and which ones are particularly awkward in Phaser Box2D right now</p>
</li>
</ul>
<h2 id="heading-francisco-phaser-launcher">👨‍💻 Francisco - Phaser Launcher</h2>
<p>Hello, everyone!</p>
<p>I’ve been working on adding more features to Phaser Launcher and running internal tests to explore how we can create our own packages, allowing for greater flexibility such as the option to use TypeScript if desired (though this doesn’t mean we’ll be using it).</p>
<p>The packaging tests with Rust have been successful; we managed to build packages for small test projects. However, there’s still a lot of work to do in this area, so we’ll continue these experiments and revisit them in the future.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729431740696/b352cdf2-7118-416f-bb13-fa71e109ebe8.gif" alt class="image--center mx-auto" /></p>
<p>As for our initial code editor, we’ve already implemented several commands like copy, paste, and delete. The key to these commands is the structure I’ve developed to handle everything smoothly.</p>
<p>Thanks to the use of states, we’ve separated the state management of the file system, tabs, the contextual menu, and options like reserving files for copy-paste operations. Slowly but surely, our editor is taking shape.</p>
<p>We also have an internal roadmap for this tool, crafted by the great Richard, filled with interesting ideas that make this application a compelling option for those just starting with our powerful framework.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729431773297/01c912bd-b027-4b4a-ba69-d7b06cbe0fe8.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-arian-phaser-editor">👨‍💻 Arian - Phaser Editor</h2>
<p>Hello friends.</p>
<p>It's been a while since I last wrote here. In Florida, many of us had to prepare for the impact of Hurricane Milton and then deal with the damage it caused. However, this forced break has allowed me to take a break from the computer and recharge my batteries to do the next job: the map editor.</p>
<p>Having a tilemap editor built into Phaser Editor is a feature I've wanted for years, and we're finally working on it. Many of the games you make with Phaser are based on tilemaps, and I think this new tool will eventually replace the need to use third-party map editors, such as Tiled.</p>
<p>There is definitely a huge advantage to having a map editor built into the Scene Editor, since in many cases, levels not only use maps but also parallax backgrounds, images of the environment elements, character sprites, and now you can do all of this in a single tool and with immediate visual feedback.</p>
<p>A map editor is a tool with many features and use cases, so it will take time to develop. However, I believe that we will have a first version very soon. Here are some images of what we have done this week.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729431686228/60f1e049-976c-40c1-b604-f3c534682dec.gif" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h2>
<p><em>October 20th 2024, Ben Richards</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729430176635/5ac8c61a-6426-4e56-9223-0c6a5f65bea6.png" alt class="image--center mx-auto" /></p>
<p>This week, filters get up to speed. I've implemented several filters to check the system, and it's looking good. Let's talk about the changes you'll see in Phaser Beam when it comes to filters.</p>
<h2 id="heading-foundations">Foundations</h2>
<p>This has been a long time coming. Phaser Beam is built around a whole set of upgrades and changes that were always intended to make it easier to use filters. But it took a while to get everything ready for the new system, so I'm ecstatic that the design is finally working.</p>
<p>The <code>DrawingContext</code> forms the backbone of rendering in Beam, but it was actually designed to keep things consistent with filters. It holds a reference to a framebuffer, and all the settings such as blend modes, camera, scissor mode, etc. When we render, the DrawingContext applies all these settings to make sure everything is properly lined up.</p>
<p>The <code>WebGLGlobalWrapper</code> is a vital companion. It performs state management, ensuring that we always know what all the bindings in WebGL are set to. It also eliminates redundant calls: if we try to set a value that wouldn't change the state, we don't do anything. Thus the DrawingContext can track everything, but doesn't need to update everything.</p>
<p>As discussed in previous installments, I've also developed the <code>RenderFilters</code> object to substitute for the old FX component. This acts as a wrapper for a game object, via an internal Camera. It's the Camera that does most of the work when it comes to filters. The wrapper mainly just provides an extra transform matrix, necessary for separating the internal and external worlds of the Camera.</p>
<h2 id="heading-renderfilters-child-transforms">RenderFilters Child Transforms</h2>
<p>The short of it: the child wrapped by <code>RenderFilters</code> keeps its transform. The RenderFilters' internal camera snaps to the child when it's added. This has a number of consequences.</p>
<p>Why do we need to focus the internal camera on the child? Well, we want the child to appear just like a texture, not as an object oriented in the game world. There are actually two ways to ensure this. The first way is to remove all transforms from the object, returning it to the origin. The second is to transform the camera to focus on the object.</p>
<p>Of course, I tried the worst way first. I removed transforms from the object. In hindsight, this was fighting against the natural shape of rendering. It's just so much more confusing to try to map everything back to an un-transformed object.</p>
<p>Focusing the camera is much better. There are problems, though.</p>
<h3 id="heading-framebuffer-resizing">Framebuffer Resizing</h3>
<p>Depending on the size of the child object, a filter requests a specific size of framebuffer. But that could mean a whole lot of different sizes, across different objects and filters. Too many framebuffers could cause a crash.</p>
<p>We reduce framebuffer count by using a pool. Unused framebuffers can be resized to meet demand.</p>
<blockquote>
<p>It turns out it's important to manually delete framebuffer and renderbuffer objects when rebuilding them. WebGL's own garbage collection, if it exists, is inadequate to frequent resizing.</p>
</blockquote>
<p>But we don't want to resize if we don't have to. The resize operation can take half a millisecond or more, because it's creating a new framebuffer behind the scenes. In a 16 millisecond frame, that's a huge cost - just a dozen resizes are already eating half the frame.</p>
<p>So by default, we resize just once, when a child is added to a <code>RenderFilters</code> wrapper.</p>
<p>However, some objects change their size every frame. For example, a ParticleEmitter has bounds defined by its particles as they fly about. How can we deal with this?</p>
<p>I've added a flag to automatically resize every frame. However, because of the above reasons, this flag is disabled by default. It's not the best solution.</p>
<blockquote>
<p>I've also added a flag for running <code>preUpdate</code> on the child every frame. This flag is on by default, though, because <code>preUpdate</code> is necessary for all sorts of things, from particle movement to sprite animation.</p>
</blockquote>
<h3 id="heading-camera-focusing">Camera Focusing</h3>
<p>Rather than relying on automatic resizing, we can instead give the user the ability to set the size of the <code>RenderFilters</code>. I've added a <code>focus(x, y, width, height)</code> method. This focuses the internal camera such that the child is at <code>x, y</code> within a view sized to <code>width, height</code>.</p>
<p>For example, the troublesome ParticleEmitter can be set to draw to a screen-sized framebuffer, and positioned within that screen-sized view. If you know what you need the RenderFilters for, you can really customize the way it works.</p>
<p>It's also possible to manipulate both the camera and the child after the camera is focused. The system is flexible. Just be aware that the automatic focusing will affect the transforms and origin of the RenderFilters, and the camera perspective. The <code>focus</code> method is actually a wrapper around <code>setSize</code>, <code>setScroll</code> and <code>setOrigin</code> calls. But in most circumstances, I hope <code>focus</code> is the simpler choice!</p>
<p>This gives you more control over internal filter coverage than ever before.</p>
<h2 id="heading-camera-alpha-and-compositing-changes">Camera Alpha and Compositing Changes</h2>
<p>What should happen when you set <code>RenderFilters.alpha</code>? I think it should treat the RenderFilters as a texture, and change the alpha of that texture. If the alpha is 0.5, we should see the background behind the texture at 0.5.</p>
<p>That's not how Phaser 3 Pipelines handle alpha on cameras. There, camera alpha multiplies the alpha of every child being rendered by the camera. This means that objects blend together. If the alpha is 0.5, two objects overlapping will add to 0.75, and we would see the background behind them at just 0.25.</p>
<p>Here's an example of alpha on child objects. Observe how the text is bright in some places and dark in others, depending on the game objects behind it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729430664907/72fe2000-cd55-4f1a-870e-717eb52d10e6.png" alt /></p>
<p>And here's an example of alpha on the final composited texture. See how everything is the same level of brightness, because it's blended before alpha.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729430677397/40ecb620-d9ff-48dd-8504-1902c55dd963.png" alt /></p>
<p>In Beam, I've changed cameras to composite their children before applying alpha. This produces the more consistent results. Because filters run through a Camera, it also makes filters more consistent. Anything in a RenderFilters wrapper is composited to a framebuffer texture before alpha is applied.</p>
<p>This means you can use RenderFilters to <em>not</em> render filters at all! You can use it as a compositing tool, rendering several objects in a Container or Layer, then adjusting the alpha of the composite so you can't see one object through another. I think that's pretty useful.</p>
<h2 id="heading-auto-padding">Auto Padding</h2>
<p>Some filters (and FX before them) have effects that spread out beyond a single texel. For example, a blur wants to blur the <em>left</em> and the <em>right</em> together. But what happens when a texel is on the very edge of a texture?</p>
<p>Well, by default the blur cuts off, and you see a sharp edge. That's OK if the edge is on the edge of the screen, or is otherwise obscured. But if the edge is in clear view, it's pretty obvious.</p>
<p>So FX had padding added. This was a manual override to add room for extra spread. It was applied by the FX controller and affected every FX on the object.</p>
<p>Filters are more sophisticated. Instead of a manual padding value, each filter controller has its own padding override, which is a <code>Rectangle</code> describing the <code>left</code>, <code>top</code>, <code>right</code>, and <code>bottom</code> sides of the filter. By default they are all 0, so no padding is added. You can change these to any values necessary.</p>
<p>But if you set the override to <code>null</code>, the filter controller uses auto padding. This is coded into filters which have spread. It computes the necessary padding from the controller's settings. (And on objects without spread, it's still 0.)</p>
<p>This should take the guesswork out of padding filters!</p>
<p>You can also override padding to inset, removing the edges of the texture. This could be useful for trimming down a filtered object during the rendering sequence.</p>
<h2 id="heading-more-filters">More Filters</h2>
<p>A lot of this work was precipitated by discoveries made while converting FX into filters. We've got a small collection now!</p>
<h3 id="heading-pixelate">Pixelate</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729430694939/94488f76-5629-4d43-8dff-0d38de96e143.png" alt /></p>
<p>This is a mech walking through a forest. It looks very creepy in motion. I swear it's just a robot, though.</p>
<h3 id="heading-bokeh">Bokeh</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729430702921/b7e11db6-4ab7-46ac-9e5f-bb955f64dc1f.png" alt /></p>
<p>The classic Bokeh effect applied to a ParticleEmitter. This example used <code>RenderFilters.focus</code> to ensure that the particles were all rendered, and the emitter was at a particular place on screen, without running expensive resize operations.</p>
<h3 id="heading-tilt-shift">Tilt Shift</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729430710652/c7b4f7cd-d360-448b-81ec-48fe28891624.png" alt /></p>
<p>A variant Bokeh which blurs out the top and bottom of the screen.</p>
<h3 id="heading-blur">Blur</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729430720071/f19c992a-471c-42fd-b21c-962db13905b5.png" alt /></p>
<p>Blur, applied to the Phaser logo. This is the filter that really needs padding. Getting padding working correctly, for both internal and external filters, was a real mission, but it paid off.</p>
<h3 id="heading-displacement">Displacement</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729430729241/b96f3cb3-fc3c-4682-8597-efbfb228a1d7.png" alt /></p>
<p>Displacement uses one image as a source to warp another image. We've got an exciting enhancement for this one: it now supports normal maps! Previously, it used the red channel from the displacement map to drive the length of the vector. I've changed it to use red for X and green for Y. This allows you to warp the image in two directions at once. Put a filter on the input, and you could animate the warp!</p>
<h2 id="heading-next-up">Next Up</h2>
<p>My main objective is a Minimum Viable Product for filters. We're very close! All the filters listed above proved something different and vital. Pixelation tested axis-aligned filters, showing the difference between internal and external states. Bokeh tested filter padding. Blur tested composite filter operations, running several shader passes inside the filter. Displacement tested texture inputs to filter controllers.</p>
<p>I have just two more MVP tasks: Masks and Samplers. But you'll see more about those next week!</p>
<hr />
<h2 id="heading-share-your-content-with-18000-readers">Share your content with 18,000+ readers</h2>
<p>Created a game, tutorial, code snippet, video, or anything you feel Phaser World readers would like? Then please <a target="_blank" href="mailto:content@phaser.io">send it to us</a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1729430268077/674775dc-7af7-4ea3-9aac-ecdec23d0f97.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 201]]></title><description><![CDATA[Welcome to another packed issue of Phaser World! This week, we have a new release of Phaser and Phaser CE, two awesome games (one completely made with AI), and the teams' developer Logs to digest. Lots of fun stuff! Let’s dig in …
🌟 Phaser v3.86 Rel...]]></description><link>https://phaser.world/phaser-world-issue-201</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-201</guid><category><![CDATA[WebGL]]></category><category><![CDATA[Game Development]]></category><category><![CDATA[phaser]]></category><category><![CDATA[canvas]]></category><category><![CDATA[discord]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Mon, 14 Oct 2024 10:00:53 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728833105218/32d5020a-ba02-4824-84b6-c78f2dba3d1f.png" alt class="image--center mx-auto" /></p>
<p>Welcome to another packed issue of Phaser World! This week, we have a new release of Phaser <em>and</em> Phaser CE, two awesome games (one completely made with AI), and the teams' developer Logs to digest. Lots of fun stuff! Let’s dig in …</p>
<h2 id="heading-phaser-v386-released">🌟 Phaser v3.86 Released</h2>
<p><em>The latest version of Phaser is now available including important GPU memory fixes.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/phaser-v3860-released"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728833515291/bc3d7942-eacb-4a54-8229-7dbbbf4c8f57.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Phaser v3.86.0 is now available for download. This release is a seamless upgrade for any project using v3.85.x and is one we strongly recommend you all take. The full change log is available on GitHub, but the headline item is a fix in the way Render Textures are resized, which was causing Phaser 3.85 games to use significantly more texture memory than they should have been, leading to out-of-memory errors on some mobile devices. This fix reduces memory usage back down to 3.80 levels.</p>
<p>v3.85 also had an issue where black lines could appear between tightly packed sprites or tiles when you zoomed the Camera to a float (non-integer) zoom value. Upon investigation, we also uncovered a much longer-standing issue with the canvas renderer under similar circumstances. Both of these have been fixed in v3.86. Finally, we also fixed a severe run-time crash issue with the new EXPAND scale mode should you launch the game into a container or iframe with a horizontal or vertical width of zero. Please read the full Change Log on GitHub or npm.</p>
<p>All of the Phaser Templates for React, Vue, Discord Activities, etc., have been updated for v3.86, along with all the Phaser Editor templates, the Phaser Sandbox, and the create-game Phaser CLI app. Although there were only minimal documentation changes, the docs site is also fully current.</p>
<p><a target="_blank" href="https://phaser.io/download/release/v3.86.0">Download Phaser v3.86</a></p>
<h2 id="heading-spellstrife">🎮 Spellstrife</h2>
<p><em>Plants vs. Zombies meets Scrabble in this word spelling tactics rogue-like</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/spellstrife"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728833637070/549daf55-d4c5-4f7c-93b5-5ea9f0951172.png" alt class="image--center mx-auto" /></a></p>
<p>Spell words to summon monsters in a tactically deep turn-based battle system. Roguelike runs last about an hour each--choose your upgrades carefully as you climb the Spelltower with a variety of classes.</p>
<p>The starting letter of your word determines which of 26 unique monsters you will summon. Uncommon letters tend to be stronger, but each monster is useful in different scenarios. The length of the word determines the monster's HP and attack power.</p>
<p>You can also cast spells to manipulate your letter tiles or change the battlefield in your favor. Spellstrife is available to buy now on Steam and also has a demo version available. Developer Ben Coffman has done an excellent job of using Phaser to create a really novel blend of game genres and we wish him all the best for his release.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/spellstrife">View Spellstrife Trailer</a></p>
<h2 id="heading-suika-watermelon-game">🍉 Suika Watermelon game</h2>
<p><em>Create your own chart-topping suika clone with the full Phaser source code.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/suika-watermelon-game-source"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728833864349/fcb6c138-e3ee-4597-8c70-f8647aa4177f.png" alt class="image--center mx-auto" /></a></p>
<p>Long-time Phaser developer Emanuele Feronato has released the full source code to his Suika / Watermelon Phaser game. If you haven't seen it before, Suika is a Japanese puzzle game which combines elements of falling and merging puzzlers. It rose to glory recently with a series of games and apps using the same gameplay mechanic.</p>
<p>For $5 you get the full source code of the complete HTML5 "Watermelon Game" created using the Phaser 3.80.1 framework and Box2D physics engine powered by Planck.js, all written in TypeScript.</p>
<p>From the experience of more than 500 tutorials about Phaser framework, here is a complete Watermelon game which will make you learn game development using Phaser and TypeScript.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/suika-watermelon-game-source">Read more about the source bundle</a></p>
<h2 id="heading-phaser-ce-v2201-released">🌟 Phaser CE v2.20.1 Released</h2>
<p><em>The Community Edition of Phaser gets a new point release.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/phaser-ce-v2201-released"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728833979513/dc15affd-fd14-46f7-a283-669e19228b34.png" alt class="image--center mx-auto" /></a></p>
<p>Today, we released Phaser CE v2.20.1. Phaser CE is the 'Community Edition' of Phaser 2. It is no longer fully maintained by Phaser Studio but instead is looked after by the community.</p>
<p>This version includes the following changes:</p>
<ul>
<li><p>The canvases used for device capability checks and input hit testing are now created with <code>willReadFrequently: true</code>.</p>
</li>
<li><p>Fixed an error when a video loaded after the game was destroyed (#742).</p>
</li>
<li><p>Set <code>forceSingleUpdate</code> to <code>false</code> for better consistency in physics calculations.</p>
</li>
</ul>
<p>If you still use Phaser CE for legacy reasons, then be sure to upgrade to this new point release.</p>
<p><a target="_blank" href="https://phaser.io/download/release/v2.20.1">Download v2.20.1</a></p>
<h2 id="heading-setris">🎮 Setris</h2>
<p><em>This AI created game mixes the classic Tetris and crumbles it all into sand.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/setris"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728834045547/fd551b7d-639a-4118-a1d3-ae49945d747c.png" alt class="image--center mx-auto" /></a></p>
<p>Setris, or Sand Tetris, is a new twist on the classic original. As the Tetris blocks fall from the top, you can move and rotate them, but when they land, they turn into sand and crumble to pieces.</p>
<p>The sand falls convincingly down, and as more and more blocks crumble onto the playfield, it creates a glorious mess of sandy colors. If you can get a solid stretch of color touch from side to side, it will vanish - just like getting a whole row in Tetris does, causing the sand above it to slip into place and netting you some valuable points.</p>
<p>This is a fun and clever game. Even more remarkable is that it was created entirely using Rosebud AI. That's right. It was "prompted" together using their smart conversational game-making system, with Phaser powering it under the hood. Rosebud AI has recently left private beta, so anyone can register and try making games of their own. If you create something extraordinary, please let us know!</p>
<p><a target="_blank" href="https://play.rosebud.ai/games/ed0d3974-3d9b-4af5-a634-a7f75506e7b9">Play Setris</a></p>
<h2 id="heading-let-us-publish-your-phaser-games">💰 Let us publish your Phaser Games</h2>
<p><em>Got a Phaser game you’d like published? Get in touch!</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728834150565/50b4bafc-9509-4078-a1c1-f61a4462b73a.png" alt class="image--center mx-auto" /></p>
<p>At Phaser Studio, we’re all about empowering developers to create great games. By focusing on the framework and tools to allow this, we’ve seen thousands of games released over the years, many of which went on to critical and commercial success.</p>
<p>And we’ve noticed the publishing landscape is changing yet again. New platforms are opening up that introduce keen opportunities for the right games. And it’s something we’re deeply invested in.</p>
<p>So - if you’ve developed a Phaser game you feel would benefit from wider distribution to exciting new platforms, then we’d love to hear from you. Please email a link to your game or games portfolio to <a target="_blank" href="mailto:bizdev@phaser.io">bizdev@phaser.io</a> , and we’ll be in touch.</p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728834196976/13a206f6-8679-4a9b-b3a4-cd67200ed9c7.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-rich">👨‍💻 Rich</h2>
<p>Welcome to another update! This week has been a nice mixture of tasks for me, but the main thing I focused on is getting Phaser v3.86 released. This version contains some important fixes, making it essential for anyone using 3.85.</p>
<p>It was an interesting task tracking down the causes of the issues and brought home just how poor the debugging tools we have available as web game developers really are. Dev Tools does its best, but it really isn’t geared towards long-running or frequently updating processes. Given it was built for web devs making web sites, this isn’t really surprising, but it does highlight a truly massive hole in the market.</p>
<p>Team progress across all fronts continues at speed. Box2D is nearing completion, our Discord Activities tools are nearing a first release, Phaser Beam is very close to the end of its dev cycle, Phaser Editor is about to start venturing into tilemap territory, Phaser Launcher has nearly completed its R&amp;D stage, the docs site is very close to release, and of course the new website continues to be updated every day, with new features and fixes here and there. We’re also well into the development of our publishing system, which will allow you to easily host your games on our site via a simple drag-and-drop.</p>
<p>Also, thank you to those of you who responded last week to my call-out about having your Phaser games published by Phaser Studio. We’ve already started working with a small group of developers and are keen to see where this partnership takes us. If this is something you’re interested in, then drop me a line (rich at phaser.io), and we can talk more about it.</p>
<p>Finally, I took a little time one evening to play with Deno 2. If you haven’t seen the announcement video for it, then I strongly recommend it! The first 3 minutes are just golden 😀</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=d35SlRgVxT8">https://www.youtube.com/watch?v=d35SlRgVxT8</a></div>
<p> </p>
<p>The product itself is outstanding and great fun to use. What with this, VoidZero and Bun on the market, things are starting to get <em>really</em> interesting.</p>
<h2 id="heading-pete-box2d">👨‍💻 Pete - Box2D</h2>
<p><strong>Optimization and Performance Improvements in the Box2D Plugin</strong></p>
<ul>
<li><p>Continued the "Great GC Clean-up" (GGCC) to reduce object allocations and improve performance.</p>
</li>
<li><p>Reduced b2Vec2 allocations from 240,000 to less than 500 per world step for a 1000-object tumbler demo.</p>
</li>
<li><p>Eliminated b2Sweep object allocations by converting to a single constant at program start.</p>
</li>
<li><p>Modified b2Manifold and b2ManifoldPoint usage to avoid allocation.</p>
</li>
<li><p>Replaced b2StackAllocator with faster JS arrays.</p>
</li>
<li><p>Optimized time-critical code chunks using Claude AI and manual refinement.</p>
</li>
<li><p>Improved performance of the 750-object tumbler demo to run stably at 139-144 FPS in Chrome and 70 FPS in Firefox.</p>
</li>
<li><p>Achieved 1000-object simulation running at 139-144 FPS in Chrome desktop (the monitor refresh rate).</p>
</li>
</ul>
<p><strong>Memory Management</strong></p>
<ul>
<li>Investigated potential memory leaks and explored tracking methods like WeakSet, though with limited success.</li>
</ul>
<p><strong>Documentation and Helper Functions</strong></p>
<ul>
<li><p>Created documentation for Box2D 3.0 JS and helper functions.</p>
</li>
<li><p>Developed an example project demonstrating the library's capabilities.</p>
</li>
<li><p>Moved demo code from main.js into separate, more accessible files like fun_stuff.js.</p>
</li>
<li><p>Wrapped and documented toy features such as Guns, Spinners, and a Ragdoll class.</p>
</li>
</ul>
<p><strong>Simulation Behavior Improvements</strong></p>
<ul>
<li><p>Modified the world step mechanism to prevent FPS cascading failures during overload situations.</p>
</li>
<li><p>Implemented a new approach allowing FPS to drop when overworked, avoiding permanent catch-up scenarios.</p>
</li>
</ul>
<p><strong>Ongoing Optimization Efforts</strong></p>
<ul>
<li><p>Identified and optimized frequently called one-line functions like b2ContainsKey and b2AABB_Overlaps.</p>
</li>
<li><p>Reordered conditionals to reduce function call frequency in critical paths.</p>
</li>
<li><p>Optimized callback usage in inner loops, particularly for b2PairQueryCallback.</p>
</li>
<li><p>Restructured a central function to avoid an inefficient callback and optimised it for the most common case.</p>
</li>
<li><p>Created a reproducible test case: 1000 steps of a tumbler with 1000 objects.</p>
</li>
</ul>
<p><strong>Next Steps</strong></p>
<ul>
<li><p>Continue documentation efforts.</p>
</li>
<li><p>Prepare for team exploration and contribution in the coming week.</p>
</li>
<li><p>Consider further performance profiling and optimization techniques.</p>
</li>
</ul>
<p><strong>Wins for the Week</strong></p>
<ul>
<li><p>Dynamic memory allocation is sufficiently low that the GC time is almost irrelevant.</p>
</li>
<li><p>Tumbler 1000 execution time decreased from 12500 to 8500ms.</p>
</li>
<li><p>Improved understanding of systems in Box2D will help with further optimisations in the JS version.</p>
</li>
</ul>
<hr />
<h2 id="heading-francisco-phaser-launcher">👨‍💻 Francisco - Phaser Launcher</h2>
<p>Hello everyone,</p>
<p>This week I’ve been working on the Phaser Launcher tool and managed to add several new features. Now, you can open files, switch between tabs, focus on the editor, and even save the files you’re editing.</p>
<p>The editor now has full context of the selected file. Additionally, in the file view, files are automatically selected when the editor gains focus.</p>
<p>Creating files, creating folders, and minimizing everything works as expected. It’s incredible how many small tasks come with building an editor like this. Tasks such as selecting a file, checking its type, creating the corresponding tab, getting the language, fetching its content, displaying it in the editor with its own context—it all adds up. And if a tab is closed, the editor needs to check if it was in focus, select the next tab in line, and repeat the process all over again.</p>
<p>Step by step, our Phaser Launcher editor is growing into a tool that will become extremely useful for anyone who wants a fast and easy way to work with Phaser.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728834663842/2af143f2-457d-4b23-9cef-7ca251dd373f.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-can-discord-activities">👨‍💻 Can - Discord Activities</h2>
<p>This week, I made solid progress on our Phaser Discord Activity Launcher! The core features are now complete, allowing us to jump into the development server with just one click.</p>
<p>I started by running npm commands (make sure npm is installed on your system) and dynamically adjusting them based on the user's operating system. Thankfully, Tauri made this part a breeze, utilizing the "os" package and executing shell commands under the hood.</p>
<p>Next, I tackled command output handling essential for real-time feedback. Now, we can read every output buffer from npm, making it easy to filter relevant data on the fly. Regex came in clutch here (gotta love that dark magic), and it's working like a charm!</p>
<p>For the UI, I added a CSS loader to keep users entertained while all the heavy lifting happens behind the scenes. A bit more polishing is needed, without a doubt.</p>
<p>I’m hyped to finish this up and get it into your hands soon - can’t wait to see what you’ll build with it!</p>
<hr />
<h2 id="heading-takes-from-the-pixel-mines">Takes from the Pixel Mines</h2>
<p><em>October 14th 2024, Ben Richards</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728834736966/890c2f45-4f34-4030-889b-0dc0102052c4.png" alt class="image--center mx-auto" /></p>
<p>This week, I got a thing working! But what <em>is</em> that thing? Well, I don't know what to call it. Let me explain, and maybe you'll see where I'm coming from.</p>
<h2 id="heading-how-it-started">How It Started</h2>
<p>Originally, we called these things <strong>FX</strong>. They handle post-processing effects like blurs, pixelation, displacement, etc.</p>
<p>In previous weeks, I explained that I want to put these into a single wrapper around game objects, to improve clarity. It's good to know where the framebuffers are in your scene, because they can affect performance. I originally called this wrapper <code>Box</code>, but that was too generic. So I switched to calling it <code>RenderFX</code>.</p>
<blockquote>
<p>How many framebuffers is too many? In one way, I can't tell you, because of another way in which I <em>can</em> tell you.</p>
<p>I tested nesting RenderFX objects, one inside the other. Somewhere above 1024 nested levels, Chrome gave up and gave me <code>RangeError: Maximum call stack size exceeded</code>. This means there are just too many things inside each other for the JavaScript engine to handle. While it's possible to set browsers to have a larger call stack size, that's no good for games that are supposed to run on any device. So 1024 nested levels seems like a good "soft limit" for nesting.</p>
<p>This was not a WebGL error. Every object requires a new framebuffer, and an extra draw call. Performance did not drop under 60 frames per second during testing. Thus, we don't really know how this nesting affected GPU performance, because on my machine it is actually impossible to stress the GPU in this way. The CPU gives up before the GPU reaches its full potential.</p>
<p>I did do some performance profiling, though, and both CPU and GPU utilization were around 60% when the stack size was exceeded. Most of the GPU cost is probably spent on waiting for draw calls to be sent, rather than actually executing them. Overall, even though we can't reach full GPU utilization, it looks like drawing 1024 framebuffers is close to the limits of performance.</p>
</blockquote>
<h2 id="heading-how-its-going">How It's Going</h2>
<p>This week, I made several discoveries and decisions. Nothing changes my objectives, but it does change the way I think about them.</p>
<p>First, I decided that the things called <strong>FX</strong> should instead be called <strong>Filters</strong>. Post-processing effects are analogous to filters that you'd use in Photoshop, right? And "effects" extends to more than just filters - things like particles aren't filters, but would be called effects. So Filters seems best to me.</p>
<p>Then I took a long, hard look at the Camera. I realized two things: the Camera doesn't have enough transform power, and the Camera is where all filters live.</p>
<p>What kind of transform power does the Camera need? Ideally, it should have full transforms for <em>internal</em> and <em>external</em> sides. The <em>internal</em> transform dictates where in the world the camera is looking; more precisely, it is applied to anything rendering through that camera. The <em>external</em> transform dictates where the camera is placed in its parent context; this usually means "where it is drawn on the game canvas". Right now, Camera doesn't have a complete transform for either. Its position is external; its rotation is internal, and it has <code>scroll</code> and <code>zoom</code> properties for internal position and scale.</p>
<p>I'm not going to redefine the whole camera paradigm right now. But I do have some ideas for incremental upgrades. In addition, putting a Camera inside a RenderFX object provides it with a full external transform. This means that a camera can be <em>drawn rotated</em> at last.</p>
<p>Why should filters live only on the Camera? Because a camera is always involved in rendering. There's a camera inside a RenderTexture, and there's a camera inside my RenderFX implementation. Additionally, cameras in Phaser 3 can use FX. It's just a natural place for filters to reside.</p>
<p>After all this, I concluded that the RenderFX object was mostly just a wrapper around a Camera and a child (the game object you want to put filters over). It's necessary... but is it still a RenderFX if it doesn't even handle FX?</p>
<p>So after a week with RenderFX, I think I want to rename it to <code>RenderFilters</code>. I considered naming it after the camera, but that buries its main role: handling filters. However, it <em>can</em> be used to render cameras in new ways, such as rotating them.</p>
<p>Do the new names, <code>Filter</code> and <code>RenderFilters</code>, make sense?</p>
<h2 id="heading-a-new-quandary">A New Quandary</h2>
<p>So with all that sorted out, I implemented a system for rendering filters. And it works! I have a minimal implementation which can apply the Pixelate filter.</p>
<p>There's just one problem: I overestimated the old FX system, and now my system does something different.</p>
<p>Here's how Phaser 3 renders a certain test, with a rotating image, using PreFX:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728834958082/528b5125-9ec6-42e7-9555-7804cb650a34.png" alt /></p>
<p>And here's how Phaser Beam renders the same rotating image test:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728834967486/784ac14d-ffa8-42ad-b09d-37ace2334239.png" alt /></p>
<p>You can see that Beam has aligned the pixelation filter to the rotation of the image. But Phaser 3 has not.</p>
<p>Now, both of these are set to apply the FX/filter "internally", supposedly in the context of the texture/object rather than that of the world. To me, that means the axis of the filter should follow the camera view used to render the filter. If we instead applied the filter "externally", it should follow the main camera, as Phaser 3 has done.</p>
<p>Further, this is how I'm going to apply <strong>masks</strong> in Phaser Beam. A mask is just a filter which removes material. When it's "external", the mask will be applied in screen space; this is how masks currently work. When it's "internal", the mask will match the object's transformations; this is a much-requested feature, and in the Beam paradigm, it just works.</p>
<p>So I'm going to continue in this way. Does <em>that</em> make sense?</p>
<h2 id="heading-coming-up">Coming Up</h2>
<p>We're planning one final Technical Preview to test filters, or whatever they're called. Now that I'm actually implementing the filters, we're extremely close to completion. After that, it's time to integrate Beam with updates made to Phaser over the last year, and move forward with a full release. Very exciting! I'm looking forward to finally getting Beam, and all its enhancements to performance and quality and flexibility, into your hands.</p>
<hr />
<h2 id="heading-send-us-your-stuff">Send us your stuff!</h2>
<p>Created a game, tutorial, sandbox entry, video, or anything you feel Phaser World readers would like? Then please <a target="_blank" href="mailto:support@phaser.io">send it to us</a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728835071351/90534958-2e4f-46d8-8854-232fb79f5043.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 200]]></title><description><![CDATA[When Phaser World first started in 2015, we had no idea it would still be going nearly ten years later. Yet here we are with issue 200. Yes, there was a bit of a break around 2021, but aside from that, it has been a pretty epic journey so far. In Iss...]]></description><link>https://phaser.world/phaser-world-issue-200</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-200</guid><category><![CDATA[WebGL]]></category><category><![CDATA[canvas]]></category><category><![CDATA[phaser]]></category><category><![CDATA[Game Development]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Mon, 07 Oct 2024 11:28:26 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728243736579/aee282f0-99c0-4927-a305-945c90ab080c.png" alt class="image--center mx-auto" /></p>
<p>When Phaser World first started in 2015, we had no idea it would still be going nearly ten years later. Yet here we are with issue 200. Yes, there was a bit of a break around 2021, but aside from that, it has been a pretty epic journey so far. In <a target="_blank" href="https://phaser.io/newsletter/issue-001">Issue One,</a> I talked about the release of Phaser 2.4.4, and there was a tutorial telling you how to use Phaser with the Atom Text Editor (remember that?!) - oh, how times have changed. Let’s not dwell on the past. Instead, here is what has been happening recently.</p>
<h2 id="heading-the-new-phaser-website-is-live">🕸️ The new Phaser website is live!</h2>
<p><em>Out with the old and in with the shiny, glowy new!</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728248824770/eec79c28-86a4-4bc9-8a75-bb4419867e4a.png" alt class="image--center mx-auto" /></p>
<p>It took a lot of effort from the whole team, but the <a target="_blank" href="https://phaser.io">new Phaser website</a> is finally live! We had been stuck with the previous design for too long, so it was time to reboot it. Designer Simon Floter took our requirements and nailed the creation of something nice and modern, which kept the characters and charm we had built into the Phaser brand over the years. Then our site developer, John Pope, turned that into the site you see today, complete with all of the backend goodness that powers it all.</p>
<p>We also released our brand new <a target="_blank" href="https://phaser.io/examples/v3.85.0">Phaser Examples site</a>, which offers a much quicker way to search through our thousands of examples. It also has new features, such as downloading the entire example as a zip file, including all the source files if it’s a multi-file example.</p>
<p>As with all undertakings of this magnitude, plenty of work remains to be done. We need to make tweaks (especially for ultra-wide monitor users) and add new content, but overall, we’re thrilled with the changes. It would appear our visitors are, too, because our user registration rate has skyrocketed since the redesign's launch.</p>
<p>The new Phaser Documentation site is next up for release. Hopefully, we can announce it shortly.</p>
<h2 id="heading-kitchen-sorting">🎮 Kitchen Sorting</h2>
<p><em>Sort your zucchinis in this food themed puzzle game!</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/kitchen-sorting"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728244479492/9aba129e-d730-472b-935e-a124ce6d1284.png" alt class="image--center mx-auto" /></a></p>
<p>Kitchen Sorting is a lovely new puzzle game that challenges you to sort ingredients into correct jars before you add them to your delicious dish. Tap a jar to pick ingredients from the top, tap another jar to drop them in. Once a jar is filled, it's added to the pot and the meal gets closer to completion.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/kitchen-sorting">Play Kitchen Sorting</a></p>
<h2 id="heading-let-us-publish-your-phaser-games">💰 Let us publish your Phaser Games</h2>
<p><em>Got a Phaser game you’d like published? Get in touch!</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728247446387/8d327d3d-73b9-407a-a28b-9568ccfe4549.png" alt class="image--center mx-auto" /></p>
<p>At Phaser Studio, we’re all about empowering developers to create great games. By focusing on the framework and tools to allow this, we’ve seen thousands of games released over the years, many of which went on to critical and commercial success.</p>
<p>And we’ve noticed the publishing landscape is changing yet again. New platforms are opening up that introduce keen opportunities for the right games. And it’s something we’re deeply invested in.</p>
<p>So - if you’ve developed a Phaser game you feel would benefit from wider distribution to exciting new platforms, then we’d love to hear from you. Please email a link to your game or games portfolio to <code>bizdev@phaser.io</code> , and we’ll be in touch.</p>
<h2 id="heading-solitaire-tutorial-series">🌟 Solitaire Tutorial Series</h2>
<p><em>Scott Westover takes on Solitaire</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/scott-westover-takes-on-solitaire"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728245253796/e380911d-6d5b-4bb4-a52e-9dfb9b31b97d.png" alt class="image--center mx-auto" /></a></p>
<p>Scott Westover is back with another tutorial for a classic game. This time, he is building Solitaire. While Solitaire may not be the next summer blockbuster that you were planning to create, the foundational knowledge that you’ll gain while making it will allow you to create any kind of card game or deck builder in the future!</p>
<p><a target="_blank" href="https://phaser.io/news/2024/10/scott-westover-takes-on-solitaire">Watch the Solitaire Tutorial Video Series</a></p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728244714430/22d18b30-d0b5-41e1-befa-1b1612a78e39.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-rich">👨‍💻 Rich</h2>
<p>This week has been quite the rush. We kicked it off by finally releasing the new Phaser website. This was a monumental amount of work. You’d think building a new website would be pretty easy, yes? Perhaps for some projects, it is. But the Phaser site has so many moving parts and such a legacy to uphold it became a lot more challenging than we could ever have conceived. However, Simon, John, and Jean finally smashed it out of the park, and the new site went live early in the week.</p>
<p>Because it was so fresh, I didn’t announce it or mention it on the Phaser Discord. I just wanted to keep an eye on our regular organic traffic and try to catch issues as they popped up. Thankfully, they’ve been pretty minor. We still need to do some more layout tweaks for those <s>psychos</s> people who run their browsers full-screen on ultra-wide monitors 😀 (I mean, I love ultra wides, I have 3 of them side-by-side! But I never fullscreen my browser on one), but aside from this and a few other little CSS text sizing and footer tweaks it’s all pretty solid.</p>
<p>The result of the redesign on user conversions is pretty remarkable, too. The Phaser site has always enjoyed a good quantity of organic traffic. We average around 100k users a month and use Sentry to monitor and alert us to site issues, so if something does break, we get notified within minutes. Thankfully, nothing too gregarious happened! However, we saw a <em>significant</em> uptick in users registering and subscribing. We can attribute this purely to the redesign, as we did no marketing or announced the site on socials. So, that’s a massive win for everyone involved.</p>
<p>Aside from working on the site, I’ve also been busy with the new docs site and our partnership with Hashnode. We found a few critical issues in their service, which they promptly addressed, and we’re very hopeful that when they close off one large stopper for us in the coming days, that will be it! We can then do a final pass on the content, links, and layout and release the new Phaser docs site. It’s already much better than the current one and will have such a huge impact on developers’ lives that I cannot wait for it to be available. If all goes well, that should be this week. Fingers crossed!</p>
<h2 id="heading-francisco-phaser-launcher">👨‍💻 Francisco - Phaser Launcher</h2>
<p>This week, I've been working on organizing the code of the Phaser Launcher tool we had from our previous draft. While it was functional, it had several issues, such as difficulties opening large folders with many subfolders. Additionally, the lack of proper state management made it harder to know which folder was selected or which tab should be displayed.</p>
<p>In response, I reorganized the code and researched how to optimize the loading of large folders, which led me to implement lazy loading. This improvement significantly enhances the tool’s ability to handle large datasets efficiently. I also added internal state management, allowing the tool to track which elements have been added or selected.</p>
<p>Moreover, I started working on implementing a tab section, which is a key feature needed for the system, similar to how Visual Studio Code handles multiple files and views. This will be essential as the tool evolves to manage multiple file operations simultaneously.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728283503971/8d64774f-ab59-4b7b-b916-e54c7d2070bb.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-pete-box2d">👨‍💻 Pete - Box2D</h2>
<p>Over the past week, we've been on a whirlwind tour of optimization and refinement for our physics engine. We wrapped up the 'easy access' interfaces for the remaining joint types, giving developers useful tools to work with distance, wheel, prismatic, motor, and mouse joints. We then dove into a performance and stability comparison.</p>
<p>While our version showed excellent stability, we uncovered some performance issues, especially when dealing with numerous contacts. We discovered we were creating and destroying a staggering number of b2Vec2 objects per world step, triggering frequent garbage collection.</p>
<p>We noticed that we were still using <code>Object.seal()</code>. Removing this legacy safeguard doubled our performance - a pleasant surprise! We took a look at debug drawing performance, which proved to be a constant and minor factor. Comparing our JavaScript version to its C counterpart highlighted the challenges of garbage collection in JS.</p>
<p>This prompted us to roll up our sleeves and dive deep into optimizing object creation. We added instrumentation to track the biggest consumers of <code>b2Vec2</code> objects and began refactoring to reduce run-time object creation. b2Vec2 allocation has dropped significantly from 140k-240k per world step, to &lt; 25k. However, mobile performance is not good in longer runs, with frame rates declining substantially after an initial smooth performance of 60fps with 400 objects in a tumbling box test, which you can see below:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728248569317/9ac16e3f-bf1d-4f3f-90f0-eb791c8a2822.png" alt class="image--center mx-auto" /></p>
<p>Looking ahead to next week, we'll continue optimization, targeting other memory-hungry elements like <code>b2ManifoldPoint</code> and <code>b2ContactSim</code>. We're also gearing up for wider testing, which means we need to polish our 'easy access' interface and create some JS-specific documentation.</p>
<h2 id="heading-can-discord-activities-tools">👨‍💻 Can - Discord Activities Tools</h2>
<p>After updating our Discord templates and tutorials, I dived into our new tool, to get boring tasks from the devs as much as we can. The biggest struggle we identified is dealing with tunneling the project from the local, not having assets loaded properly, connecting client and server on the Discord itself.</p>
<p>It's my first time going with Tauri, so lot's of tinkering, research and of course failures going on behind of the scenes. I've came up with minimal working solution as you select your project folder, once its selected, the app will read your package.json to catch npm script commands in order to execute with just one click and it will filter the tunneling url you will need.</p>
<p>Idea is great, yet execution is not that great yet! Once the quirks are solved, we will be going much faster for a possible build! You can get the grisp of the idea from the app's screenshot, though it might change all over too, so don't look too close!</p>
<p>Till next week, keep your pixels quality everyone!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728296123824/75aece82-58dc-440b-85bf-30e52bd8ad5a.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-zeke-phaser-docs">👨‍💻 Zeke - Phaser Docs</h2>
<p>Hello and welcome to another weekly update on Phaser Documentation:</p>
<ol>
<li><p><code>Sound</code>. I discovered Web Audio API actually has an analyzer node feature that enables creation of audio visualisations. With some work, it’s entirely possible to make procedural rhythm-based games like Osu!, Beat Hazard or Piano Tiles in Phaser. Besides the usual audio playback and volume control, you can also play around with spatial audio to give a sense that some sounds are coming from a specific direction.</p>
</li>
<li><p><code>Mesh</code>. This Game Object allows you to add simple 3D objects into Phaser games. Import your 3D .obj files, apply some textures to it and voilà! Well, checkout the examples <a target="_blank" href="https://phaser.io/examples/v3.85.0/game-objects/mesh">mesh folder here</a> for more details. If you really want to try making a full fledged 3D game in Phaser, check out <a target="_blank" href="https://enable3d.io/">Enable3D</a>.</p>
</li>
<li><p><code>Animations</code>. One feature you may want to consider using is chained animation where you specify the animation that plays after an animation sequence ends. Think of using chain animations to create smooth transitions between different Game Object states such as from walking to running to jumping.</p>
</li>
<li><p><code>Timer</code> and <code>timeline</code>. Timers help you keep track of time, trigger time-based events and create complex timed sequences. One interesting feature is called time scale where you can manipulate a given time by scaling up or scaling down to increase or decrease the rate of change in time. Check out <a target="_blank" href="https://phaser.io/examples/v3.85.0/time/view/time-scale">this example</a> in the Phaser labs.</p>
</li>
<li><p><code>Display List</code>. Used to control the order that Game Objects are rendered in a Scene. A common way to use the Display List is to add Game Objects into Containers so it is rendered as a layer. Use this to sort the rendering order of different game elements such as the background, in-game objects, user interface and overlay menu.</p>
</li>
<li><p><code>Phaser.Utils.Array</code>. While JavaScript already comes with its own set of methods, Phaser adds on additional functionality commonly used in games. Some features I’ve found most useful are <code>Shuffle</code>, <code>GetRandom</code>, <code>RemoveBetween</code>, <code>Swap</code> and <code>CountAllMatching</code>. No more writing lines of code to create such features, Phaser does it in just a single line. Example: <code>Phaser.Utils.Array.Shuffle(array)</code> automatically shuffles all items in the given <code>array</code>. Check out our existing <a target="_blank" href="https://newdocs.phaser.io/docs/3.85.1/Phaser.Utils.Array">docs here</a> and <a target="_blank" href="https://phaser.io/examples/v3.85.0/utils/array">examples here</a>.</p>
</li>
</ol>
<hr />
<h1 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h1>
<p><em>October 7th, 2024 by Ben Richards</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728244787596/c9b11945-ffae-4b97-92b0-722bed7ece9f.png" alt class="image--center mx-auto" /></p>
<p>This week, I finished the DynamicTexture revamp, and finally got started on the new FX/masks system. We'll look at each of these in a bit more detail.</p>
<h2 id="heading-dynamictexture">DynamicTexture</h2>
<p>The finalized DynamicTexture (and RenderTexture) have a diminished instruction set. I've removed any need to manage render state; it all happens automatically now. Just call <code>render()</code> and it executes all the commands you've queued up.</p>
<p>The drawing commands are now reduced to the following:</p>
<ul>
<li><p><code>stamp</code> draws a configurable texture frame.</p>
</li>
<li><p><code>repeat</code> draws a texture frame using a spare TileSprite.</p>
</li>
<li><p><code>draw</code> draws a texture frame, game object, Group, DisplayList, or array.</p>
</li>
<li><p><code>erase</code> is like <code>draw</code> but it uses the ERASE blend mode to erase holes in the texture.</p>
</li>
<li><p><code>clear</code> clears the texture.</p>
</li>
<li><p><code>fill</code> fills a rectangle with color.</p>
</li>
<li><p><code>render</code> executes all commands in the queue.</p>
</li>
</ul>
<p>Several of these commands just draw texture frames directly, without creating a dedicated game object. I've <strong>changed the origin of texture drawing</strong> to make defaults more consistent. The origin defaults to (0.5, 0.5), the middle of the texture, instead of the top-left. This may change the way existing DynamicTexture uses render. It is now consistent with other game object positioning.</p>
<p>Several other commands have been removed. Now you don't have to worry about batching. Everything performs at maximum efficiency. This will also affect existing uses of DynamicTexture.</p>
<p>If you want to use DynamicTexture, either in a future release or if you routinely look at working branches of the Phaser repo, you'll need to make a few changes. Most of the removed commands can just be replaced with <code>draw</code>. If you're drawing a texture frame, and its coordinates have changed, you should be able to get the same results with <code>stamp(texture, frame, x, y, { originX: 0, originY: 0 })</code>. This will set the origin back to the top-left and get the previous behavior.</p>
<p>These revisions have made DynamicTexture more efficient. For example, Phaser 3 renders a DynamicTexture with two draw calls: one to render it to a temporary framebuffer, and another to flip it upside-down in the destination framebuffer. The new Phaser Beam renderer will use just one draw call, and one framebuffer, making it nominally twice as efficient! This doesn't necessarily mean twice as fast, because the repeated operations are in WebGL and typically run much faster than CPU code. And it doesn't mean memory usage is halved, because temporary framebuffers can be recycled, so there are typically only a few being passed around. But it does mean things are better.</p>
<h2 id="heading-renderfx">RenderFX</h2>
<p>I'm now working on the RenderFX object. This was previously referred to as "Box" until Rich reminded me that a box could be anything. I'm calling it RenderFX now, because that puts it next to RenderTexture, and that might help users associate the two types.</p>
<p>A RenderFX is a wrapper around another game object. It puts it into a framebuffer, and applies FX to it. This replaces the existing FX component on game objects. This does make it slightly more awkward to set up an object with FX; you need to make a RenderFX and put the object into it (which I'm making simple with automation functions), and you need to consider input and physics for the RenderFX instead of the original object.</p>
<p>However, this makes the number of RenderFX more clear. Because each RenderFX consumes resources (a few temporary framebuffers, and a few draw calls), it's a good idea to know how many you have in your scene. You can probably have hundreds without losing performance, but you do want to be careful. FX do lots of different render operations, so they are performance intensive.</p>
<p>Removing FX from other game objects also eliminates some inconsistencies. For example, a Container or Layer renders a list of child objects. But how do these children blend with other objects in the scene? Well, that depends on which framebuffer they're drawn to. And that framebuffer depends on whether FX is active on the collection.</p>
<p>Here's a diagram showing how things can differ. I've used a DynamicTexture to keep things simple, but it uses a framebuffer just like the FX system.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728244964732/a237ba11-1532-41a6-9273-c8f22d52175e.png" alt class="image--center mx-auto" /></p>
<blockquote>
<p>In the first example, two sprites are drawn with additive blending. They combine with the background and with each other.</p>
<p>In the second example, two sprites are drawn on a DynamicTexture. They do not have additive blending, so one overlaps the other.</p>
<p>In the third example, two sprites are drawn with additive blending, but this time they're drawn on a DynamicTexture. They combine with each other, but do not combine with the background, because the DynamicTexture itself does not have additive blending enabled. When they are drawn to the DynamicTexture (which has a transparent black background, thus additive blending has no effect), they turn into texels and have no memory of what blending mode was used to draw them.</p>
<p>In the fourth example, two sprites are drawn on a DynamicTexture. They do not have additive blending, but the DynamicTexture does. Again, one sprite overlaps the other, but now they combine with the background. This is because the finished DynamicTexture adds to the background.</p>
</blockquote>
<p>In Phaser 3, a Container draws directly to the background (as in the first example). Unless it has FX enabled, in which case it draws to a framebuffer (as in the third example). As you can see, this will produce different results! We don't want that to happen. In Phaser Beam, a Container or Layer will always draw to the background of the current DrawingContext. You can put it in a RenderFX to use a new DrawingContext with a new framebuffer.</p>
<p>RenderFX provides certainty around compositing. If something is inside a RenderFX, it will be drawn to another framebuffer. If not, it's drawn to the current drawing context. (There may be exceptions, such as disabling the framebuffer for a RenderFX if you want an object that only displays FX sometimes. This will be under your control, and remain predictable.)</p>
<p>This is why you want to understand where the framebuffers are in your game! They make a big difference.</p>
<h2 id="heading-next-week">Next Week</h2>
<p>More work on RenderFX! I've worked through a whole lot of logic to figure out the best approach, and I'm in the middle of putting things together. Once this gets going, it'll be amazing.</p>
<p>Let us know what you think of all this! I'm trying to keep things familiar, but we had to change a few pieces. I think it will all work much better when we're done.</p>
<hr />
<h2 id="heading-submit-your-content">Submit your content</h2>
<p>Created a game, tutorial, sandbox entry, video, or anything you feel Phaser World readers would like? Then please <a target="_blank" href="mailto:support@phaser.io">send it to us</a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1728244859639/fa5d4289-8873-4616-8a78-3ab349198c14.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 199]]></title><description><![CDATA[It’s been another busy week in the Phaser Studio offices. We’ve got a new release of Phaser Editor, great new tutorials and case studies to read, and, of course, new games to play. Plus, the team has been hard at work on lots of great projects - whic...]]></description><link>https://phaser.world/phaser-world-issue-199</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-199</guid><category><![CDATA[WebGL]]></category><category><![CDATA[phaser]]></category><category><![CDATA[canvas]]></category><category><![CDATA[Game Development]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Mon, 30 Sep 2024 16:32:47 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727709439458/c52a70b2-6514-476c-ae4f-0d0213742b0e.png" alt class="image--center mx-auto" /></p>
<p>It’s been another busy week in the Phaser Studio offices. We’ve got a new release of Phaser Editor, great new tutorials and case studies to read, and, of course, new games to play. Plus, the team has been hard at work on lots of great projects - which you can catch up on in this week’s extensive Developer Logs.</p>
<h2 id="heading-astrogon">🎮 Astrogon</h2>
<p><em>Play solo or against the world in this hardcore precision platformer.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/astrogon"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727709550574/5aff4ecb-5050-4826-b632-7a81e826330f.png" alt class="image--center mx-auto" /></a></p>
<p>We sadly missed this awesome game upon release, so we’re covering it now! Created by Kosmoon Studios, Astrogon is a dynamic arcade game in an intergalactic synthwave universe. Jump and dash your way between walls and obstacles. Avoid touching what will kill you, and reach the teleport portal. Get precise and strategic, or die. Then, create an evil challenging level for the rest of the world on Steam, Google Play, or the App Store.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/astrogon">Play Astrogon</a></p>
<h2 id="heading-phaser-editor-45-released">🌟 Phaser Editor 4.5 Released</h2>
<p><em>The latest version of Phaser Editor includes Monaco built-in, an updated JavaScript ESM template, refactored Script Nodes and new drag-drop project support.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/phaser-editor-v45-released"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727709709500/bea65a6c-19aa-439d-b623-eab5a695f4c0.png" alt class="image--center mx-auto" /></a></p>
<p>Today we published our weekly release of Phaser Editor. In 4.5 we continue to polish the details, to make the editor a simpler and more powerful tool for all users. This time we've got a new integrated editor, vastly improved handling of JavaScript ES Modules, new updates for Script Nodes and you can now even drag a whole project folder onto the Editor icon/window.</p>
<p>Read the <a target="_blank" href="https://phaser.io/news/2024/09/phaser-editor-v45-released">full release notes</a> for details about all of the improvements.</p>
<p>Subscribers can update to this version immediately. Just grab it from your account's Downloads page or pick ‘Check for Updates’ within Phaser Editor. If you don't have a subscription, we offer a <a target="_blank" href="https://phaser.io/trial">30-day trial</a>.</p>
<h2 id="heading-how-phaser-is-used-at-openforge">🚀 How Phaser is used at OpenForge</h2>
<p><em>Solving accessibility challenges with Phaser.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/openforge-solving-accessibility-challenges-with-phaser"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727710152694/fb987984-0f21-41dd-933a-1b7a3ca092e8.png" alt class="image--center mx-auto" /></a></p>
<p>Phaser is a natural choice for games, but you can also use it for apps. OpenForge, a top-rated mobile app development company specializing in mobile and web solutions since 2016, uses Phaser to build its product, StartupWars. OpenForge kindly agreed to talk about their experience using Phaser.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/openforge-solving-accessibility-challenges-with-phaser">Read the full OpenForge story</a></p>
<h2 id="heading-creating-phaser-games-for-rune">💎 Creating Phaser games for Rune</h2>
<p><em>Learn how to easily make a multiplayer Phaser game that can be enjoyed by millions of players on Rune.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/create-phaser-games-rune-platform"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727710279702/f6ef578b-dda3-4d4c-9672-2e83f4619995.png" alt class="image--center mx-auto" /></a></p>
<p>Phaser is perfect for single-player games since physics and collision happen on the client side. But what if you want to create a multiplayer game? Enter Rune, a social gaming app with millions of people playing HTML5-based games together across iOS and Android.</p>
<p>Their mission is to make mobile gaming more social and enable indie game developers to get their games into the hands of millions of players. By leveraging the Rune SDK, developers can add multiplayer capabilities to their Phaser games and get access to tons of new players by adding their app to the Rune platform. Now that's a win-win!</p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/create-phaser-games-rune-platform">Read the Phaser + Rune Tutorial</a></p>
<h2 id="heading-twitch-stream-hackathon">🎥 Twitch Stream Hackathon</h2>
<p><em>Use your Phaser skills to build an app for streamers.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/twitch-streamer-hackathon-2024"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727710462579/045b7038-1e92-4be8-9912-abc74af3b365.jpeg" alt class="image--center mx-auto" /></a></p>
<p>Twitch has announced a new hackathon, this time centered on building an app for streamers to collaborate with each other, their community, and enhance their streams. The goal is to build an application or Twitch Extension that uses Twitch authentication for application users, and the Twitch API or EventSub. For Phaser developers, two of the three submission categories stand out.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/twitch-streamer-hackathon-2024">Read the Twitch Streamer Hackathon article</a>.</p>
<h2 id="heading-ghosts-in-the-machine">👻 Ghosts in the Machine</h2>
<p><em>A thrilling, puzzle-based adventure that blurs the line between the steampunk world and the supernatural.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/ghosts-in-the-machine"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727710576392/91146081-82fa-4a0a-b239-3b2569c9b2ee.png" alt class="image--center mx-auto" /></a></p>
<p>The FocusFire team has released a great new Phaser game for GBJAM 12, a jam about making gameboy inspired games. In "Ghosts in the Machine," you find yourself as a restless ghost haunting a lonely mansion. Your mission is to scare away visitors as you outwit them on every stage with unique machines, traps, and, is that phonograph?</p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/ghosts-in-the-machine">Play Ghosts in the Machine</a></p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727710636932/7c552249-f07f-4af6-b704-968af0e0e9fc.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-rich">🧑‍💻 Rich</h2>
<p>Last week, someone emailed Phaser support, asking what the status of Phaser v4 was. That's a valid question. Even though I have covered this quite a few times now, there is still a lot of material out there talking about v4 development from several years ago. So I figured I'd use my reply as my entry this week so everyone can be crystal clear on what is and isn't going to happen in Q4 2024:</p>
<p>As you know, the current version of Phaser is v3.85.2. We have spent all year working on our brand-new renderer, Phaser Beam. This was a complete rewrite from scratch, built in a modern way, with outstanding performance and a reduced memory footprint. We expect to finish development of this within the next month. You can track the development of Phaser Beam through all of our weekly Phaser World issues. We've been writing about its features and evolution all year, so there's plenty of juicy meat to pick from the Dev Log bones if you're interested.</p>
<p>Once the initial version of Phaser Beam is finished, we plan to merge it with Phaser v3.85. We will make other improvements at the same time, but the core API will remain largely the same. The improvements will nearly all be rendering-related, and this merge will form the Phaser v4.0.0 release.</p>
<p>After Phaser v4 is out we will focus on what can be done to modernize the API, i.e. move fully to using ESM Modules, ES6 classes, etc. But our priority is getting our powerful new renderer in place, and to us, that is Phaser 4.</p>
<p>Anything you may have read in old Dev Logs from 2021/22 re: Phaser 4 is no longer applicable. While we could have carried on down that path, it made no sense. It would have forced every single Phaser developer to start again from ground-zero and would have been entirely incompatible with Phaser 3. Instead, we are favoring an incremental upgrade roadmap rather than a 'nuke it all from orbit and start afresh' approach, which would have benefited no one.</p>
<p>I hope everyone reading this can clearly see how busy we've been this year. From constant updates to Phaser and Phaser Editor, to stacks of new templates, tutorials, a brand new renderer and a new physics system. And we're not done yet. The new docs site is imminent, as is a brand new web-site - and of course the release of Phaser v4. It's been quite the journey so far, but stick around because things are about to get <em>really</em> interesting 😊</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727713850220/77fda7ff-8849-424b-a88d-873eac65d7da.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-pete-box2d">🧑‍💻 Pete - Box2D</h2>
<p>A short one this week: After finally fixing the bug that has been plaguing the box2d conversion (turned out to be 8 separate bugs spread through-out the code... or maybe it was just the last one, I wasn't going to put the other 7 back in to verify!) the project is moving forwards again at pace.</p>
<p>I've been expanding the <code>testWorld</code> with new features and more and more objects to stress test the code and get an idea of where the strengths and weaknesses lie. It's very good at joints and objects including compound objects. It slows down significantly when you get a large heap of things all touching but not asleep.</p>
<p>I believe this is because the color graph code was part of the threaded system and it's been disabled where it hasn't been outright removed. I think the concept of colour groups is a brilliant optimisation, and there's no reason why it wouldn't work to a worthwhile degree on a single thread and without SIMD instructions. We should definitely look at implementing something similar. I don't recommend wasting any more time trying to modify the original though, the SIMD instructions and support code is incredibly tricky to remove and it is also tangled in with the multi-threading support.</p>
<p>I've been converting all the bespoke code for each effect into a set of tidy wrapper functions. That is going smoothly, and there are many more we could add which will add value for users... we'll probably have to triage them eventually, although it could be made into a longer-term support effort based on request frequency.</p>
<p>At the end of the week I restored a bunch of the older demos so they will work with the new helper functions. There's a handy 'switch' at the bottom of main.js now which lets us switch between them. I also added an 'image circle' and an 'image capsule' draw function to the debug draw code. This lets us load images and fit them to those shapes, for more attractive looking demos. See the image below for an example.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727711059373/f3cf0552-5783-49c4-8668-b1f9ffa77cf3.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-francisco-phaser-launcher">🧑‍💻 Francisco - Phaser Launcher</h2>
<p>This week, I’ve been focusing on a new project that we believe will simplify the onboarding process for anyone interested in Phaser. The goal is to create something that lowers the barrier to entry, making it accessible for developers of all skill levels.</p>
<p>As part of this initiative, I’ve been testing Tauri’s potential to develop a lightweight editor. The idea is to allow users to load a folder directly into the editor and easily modify any JavaScript files they find. It’s a small but powerful tool that could greatly improve the workflow for developers working with Phaser.</p>
<p>The next step we’re aiming to test is generating a server with hot reload functionality, if possible. This would allow the tool to launch a small template with Phaser already installed, ready to work right out of the box. Thanks to everyone, and stay tuned to learn more about this exciting new tool!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727711404424/5ee4784b-7aa4-47f5-a769-d6e3b1c24f7a.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-zeke-phaser-docs">🧑‍💻 Zeke - Phaser Docs</h2>
<p>Hello and welcome to another weekly update on progress on the new Phaser Documentation site. This week I finished the following new sections:</p>
<ol>
<li>Maths functions</li>
</ol>
<p>The documentation includes different aspects of mathematical operations and utilities available. Here’s a brief summary:</p>
<ul>
<li><p>Basic Functions : Functions built on top of native JavaScript Math functions with its own Phaser.Math namespace to prevent conflicts. Used to calculate Average, Difference, Factorial, whether a number is even (IsEven) or is a power of 2 (`Pow2).</p>
</li>
<li><p>Minimum, Maximum : Functions to calculate a range of values between the minimum and maximum range.</p>
</li>
<li><p>Round To : Various rounding methods like CeilTo, FloorTo, RoundAwayFromZero, and RoundTo.</p>
</li>
<li><p>Distance : Calculate distance between points, including specialised methods like Chebyshev and Manhattan.</p>
</li>
<li><p>Angle : Calculate various angles and perform conversions between radians and degrees.</p>
</li>
<li><p>Random : Generate random values and vectors.</p>
</li>
<li><p>Color : Convert between different color formats, adjust color properties, and generate random colors.</p>
</li>
<li><p>Vector: Create and modify 2D, 3D and 4D vectors.</p>
</li>
<li><p>Curve : Creating and modifying curves and paths including lines, circles, ellipses, arcs, splines, and beziers.</p>
</li>
</ul>
<ol start="2">
<li>Geometry</li>
</ol>
<p>Phaser comes with an extensive set of Geometry classes which are used internally by the physics and input systems. This document includes:</p>
<ul>
<li><p>Geometry Classes : Listed the geometry classes on offer, including Circle, Ellipse, Line, Point, Polygon, Rectangle, Triangle, and the Mesh class.</p>
</li>
<li><p>Geometric Operations*: This includes:</p>
</li>
</ul>
<ul>
<li><p>Containment Checks : Check if a point is contained within various shapes.</p>
</li>
<li><p>Nearest Point : Find the nearest point on a shape to a given point.</p>
</li>
<li><p>Area and Perimeter : Calculate the area and perimeter of shapes.</p>
</li>
<li><p>Transformation** : Transform shapes by scaling, rotating, and translating.</p>
</li>
</ul>
<ul>
<li>Intersection Functions : Test whether one shape intersects another.</li>
</ul>
<ol start="3">
<li>Graphics</li>
</ol>
<p>How to draw primitive shapes in your game. Primitives include rectangles, circles, polygons, lines, arcs, curves and others. Graphics can be drawn using a specific line style, fill style or both. Here is a full list of shapes that can be drawn:</p>
<ul>
<li><p>Arc : Draws an arc shape with a specified start and end angle.</p>
</li>
<li><p>Circle : Draws a circle shape.</p>
</li>
<li><p>Curve : Draws a curved shape.</p>
</li>
<li><p>Ellipse : Draws an ellipse shape.</p>
</li>
<li><p>Grid : Draws a grid based on the width, height, cellWidth and cellHeight.</p>
</li>
<li><p>IsoBox : An 'isometric' rectangle where each face has a different fill color.</p>
</li>
<li><p>IsoTriangle : An 'isometric' triangle like a pyramid where each face has a different fill color.</p>
</li>
<li><p>Line : Draws a line between two points.</p>
</li>
<li><p>Polygon : Draws a polygon from a list of points.</p>
</li>
<li><p>Rectangle : Draws a rectangle shape.</p>
</li>
<li><p>Star : Draws a star shape with 5 points by default. You can control the number of points, the inner and outer radius.</p>
</li>
<li><p>Triangle : Draws an triangle shape.</p>
</li>
</ul>
<ol start="4">
<li>Tweens</li>
</ol>
<p>Tweens create smooth, time-based changes to object properties over a given duration of time. The documentation shows the following:</p>
<ul>
<li><p>Creating a Tween : How to create tweens, set target properties, easing functions, duration, repeat, yoyo, and other configurations. Tween Property Expressions : Shows different ways to set tween target properties, including direct value assignment, relative value changes, random value generation, using an array of values or setting object properties.</p>
</li>
<li><p>Tween Callbacks : Lists events where callback functions can be triggered.</p>
</li>
<li><p>Tween Configurations : Details properties that can be used in tweens such as delay, yoyo, ease, duration and more.</p>
</li>
<li><p>Easing Equations : A list of available easing functions that affect how a tween progresses.</p>
</li>
<li><p>Tween Controls : Methods to control tweens include: pause(), resume(), complete(), stop(), play(), restart(), seek(amount), remove() and destroy().</p>
</li>
<li><p>Tween States : Use isPlaying() and isPaused() to check current tween states.</p>
</li>
<li><p>Tween Chains : Create and manage tween chains by adding, removing, pausing, resuming, and restarting the chain.</p>
</li>
<li><p>Tween Events: A full list of events dispatched throughout the lifecycle of a tween.</p>
</li>
</ul>
<h2 id="heading-arian-phaser-editor">🧑‍💻 Arian - Phaser Editor</h2>
<p>Hello!</p>
<p>A new week, a new Phaser Editor release! Check out Phaser News because a new version of the editor may be available. For this latest release, we've focused on improving the experience for those who don't have much experience with web development yet. What does this mean? We've updated the project templates to be based only on plain JavaScript. These templates now use modules, which follow how JavaScript is programmed today.</p>
<p>Something else we've done to make JavaScript newbies more comfortable is to incorporate a more advanced JavaScript editor, based on Monaco, the main component that Visual Studio Code uses in its editors. With this update, you'll have a decent set of features to code your game directly in Phaser Editor. However, if you want to go a bit further and use a more advanced toolchain, such as web bundlers, TypeScript, etc... <a target="_blank" href="https://phaser.io/editor/docs/code-editor/vscode-compatibility">it would be best to use Visual Studio Code</a>. But if you're looking to get started with plain JavaScript, you're covered with Phaser Editor!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727711747489/c75dbc51-4dbe-4935-8bec-4e3f3dafe960.png" alt class="image--center mx-auto" /></p>
<p>Something else we've added this week is a new way to open a project in Phaser Editor. This involves dragging your project folder onto the editor icon to open the project. This works on macOS only.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727711767209/fb75b1b0-c8e2-4547-a4b7-49d9feb748d0.png" alt class="image--center mx-auto" /></p>
<p>Another alternative is to drag the folder onto the editor's start page. This works for all platforms.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727711780465/14932593-f23e-4021-b231-770afd2f24aa.png" alt class="image--center mx-auto" /></p>
<p>Keep in touch!</p>
<h2 id="heading-can-discord-activities">🧑‍💻 Can - Discord Activities</h2>
<p>Kia ora!</p>
<p>Exciting times — Discord has made <a target="_blank" href="https://discord.com/blog/build-where-the-world-plays">Activities</a> public for all! This opens up a fantastic opportunity to bring your Phaser games directly into the Discord ecosystem, for the millions of players. In response, we've updated our templates and working on an app to simplify publishing your games as Discord Activities. The biggest update was a breaking change for the previous versions, which is about setting our url paths as "./proxy" for all HTTP requests we make. All our templates are updated and works in local too.</p>
<p>We can't wait to see you all coming up with cool games that reaches out to millions, a new era for the HTML5 games!</p>
<p>We have #discord-activities channel on our Discord. Come and join us, share your inspirations, issues or how can we help you to make your workflow easier!</p>
<hr />
<h2 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h2>
<p>September 30th, 2024 by Ben Richards</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727711921476/68363f56-78a1-424d-aa8f-13f313ebdd02.png" alt class="image--center mx-auto" /></p>
<p>This week, I've been trimming <code>DynamicTexture</code> down to size. Its implementation under Beam will have a few changes, which I'm hoping will be convenient, but it's still worth explaining them.</p>
<ul>
<li><p>Command Buffer</p>
</li>
<li><p>Projection Matrix</p>
</li>
<li><p>Everything is GameObjects</p>
</li>
<li><p>Repeat is TileSprite</p>
</li>
<li><p>Camera Enabled</p>
</li>
<li><p>Canvas Too</p>
</li>
<li><p>Texture Trimming</p>
</li>
<li><p>50% Off</p>
</li>
</ul>
<p>DynamicTexture is an ordinary Texture, with built-in drawing tools so you can edit it at runtime. This is a great way to render accumulating visuals in a scene, such as damage on a battlefield, breaking holes in windows, or painting in the game world.</p>
<p>This post is mostly about WebGL rendering, because that's the focus of the new Beam renderer.</p>
<h3 id="heading-command-buffer">Command Buffer</h3>
<p>The DynamicTexture now uses a "command buffer" similar to <code>Graphics</code>. Instead of rendering whenever a drawing command is run, it puts the command in a buffer, along with all its parameters.</p>
<p>To execute the command buffer, call <code>DynamicTexture.render()</code>. This will immediately run all buffered commands. This is more efficient than piecemeal rendering, because it is almost exactly the same as a regular render pass. This allows us to use the same rendering systems, with all the optimizations and capabilities that entails.</p>
<p>The main difference is that there are no camera effects (background color, flash, fade, shake) in a DynamicTexture. These generally make no sense, because a DynamicTexture isn't animated.</p>
<p>Performance of the command buffer render is excellent. It works just like regular rendering, so you can estimate a rendering budget based on what you're rendering.</p>
<h3 id="heading-projection-matrix">Projection Matrix</h3>
<p>The projection matrix is a piece of linear algebra used to map from game world coordinates to WebGL texture coordinates. This is necessary because WebGL is <em>upside-down</em> compared to how we normally think about screen coordinates!</p>
<p>2D game world coordinates are [0, 0] at the top-left, and might extend to [1280, 720] at the bottom-right.</p>
<p>WebGL texture coordinates are [0, 1] at the top-left, and [1, 0] at the bottom-right. So [0, 0] is at the bottom-left. It's flipped upside-down compared to the game world! Also, it's always <em>square</em>, even if it's drawing an area with a high aspect ratio.</p>
<p>(WebGL clip coordinates are another thing again. These are how WebGL draws to the screen. Here, the top-left is [-1, 1], and the bottom-right is [1, -1]. Confusing? Yes! Phaser does this all in the background for you.)</p>
<p>The projection matrix lets us draw in WebGL without worrying about stretching things into a space 1 unit across. We can keep coordinates in a sensible world system, and convert them to WebGL space in the vertex shader.</p>
<p>Sound complicated? It is! We had to make some decisions about which space to prioritize. Here's what we've settled on for Beam:</p>
<ul>
<li><p>All textures and framebuffers have the top-left at [0, 0] in WebGL coordinates.</p>
</li>
<li><p>The main game canvas has the top-left at [0, 1] in WebGL coordinates.</p>
</li>
</ul>
<p>This means that texture coordinates are in an intuitive top-left system.</p>
<p>It also means that everything is upside-down from WebGL's perspective, so when rendering to the main game canvas, we flip the projection matrix upside-down to put it right-side up. As a side effect, all textures appear upside-down in debug tools. This doesn't matter because the projection matrix corrects everything.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727712084525/c306daba-14de-4f9f-93b2-5434fc9fddbf.png" alt class="image--center mx-auto" /></p>
<p>This is a new assertion for Phaser in Beam. Previously, this was <em>mostly</em> true: textures were upside-down, and the projection matrix is upside-down for the game canvas. But some systems didn't work that way. We're trying to make things simpler, so we're unifying coordinates. This could come back to bite us when I start work on FX shaders, so things could change; but I hope it works out.</p>
<h3 id="heading-everything-is-gameobjects">Everything is GameObjects</h3>
<p>Unification allows us to use standard rendering technology in more places. This brings us back to DynamicTexture, where we want to draw various items into a texture via a framebuffer.</p>
<p>Previously, we used various Pipelines to render textures to the framebuffer. These followed their own logic, separate to standard rendering.</p>
<p>With the command buffer, we take textures, apply them to a spare Stamp object, and render them with the regular rendering systems. This sounds simple, but it has some far-reaching consequences. Now, anything that can be rendered can also be rendered to a DynamicTexture, and will render exactly the same way.</p>
<p>This is part of a general drive towards <em>consistency</em>. Things should work the same wherever they are in the game.</p>
<h3 id="heading-repeat-is-tilesprite">Repeat is TileSprite</h3>
<p>A DynamicTexture has the <code>repeat</code> method, used to repeat a texture across a region. Because <em>everything is GameObjects</em>, we now render this by setting up a spare <code>TileSprite</code> object and rendering it.</p>
<p>This means the <code>repeat</code> method can take some extra parameters, allowing it to do everything TileSprite can do. The texture can be scrolled, scaled, and rotated. (Rotating TileSprites are new in Beam. Everything synergizes.)</p>
<h3 id="heading-dynamictexture-camera-enabled">DynamicTexture Camera Enabled</h3>
<p>DynamicTexture has always had a Camera. This was originally just for rendering, and didn't actually do anything. Now, the camera can transform, which gives you more freedom to draw as you want. Note that camera effects are not rendered, and Stamp objects (including all drawing operations with raw textures and frames) are unaffected by camera transforms.</p>
<h3 id="heading-canvas-too">Canvas Too</h3>
<p>All the changes to DynamicTexture work in the Canvas renderer too. This took a while to get working, mostly because I forgot that I was clearing my test texture, and spent too long trying to figure out why nothing was rendering. But the code was all running perfectly.</p>
<h3 id="heading-texture-trimming">Texture Trimming</h3>
<p>Here's another reason why consistency is good: it means we can keep complicated things to just one place, reducing the risk of mistakes.</p>
<p>Case in point: texture trimming was handled differently between Textures and GameObjects in DynamicTexture. But now that <em>everything is GameObjects</em>, the differences have disappeared.</p>
<p>What is texture trimming? It's a space-saving measure taken by texture packers. When packing several sprites into a single atlas, empty space around the edge of a sprite can be removed, and stored in the atlas data. When we come to use the sprite, we can make the GameObject the size of the original sprite; and then render just the smaller frame. The empty space around the edges is implicit.</p>
<p>Unfortunately, this means that a trimmed sprite doesn't have a single size. Here's a screenshot of me analyzing one particular example:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727712102725/7f4a8cb4-2ac6-4e03-95e9-b9754b1444a6.png" alt class="image--center mx-auto" /></p>
<p>You can see how the trimmed region (yellow) is offset from the original region (red). Other sprites overlap the original region, but because of trim, we don't render these overlaps.</p>
<p>But if we use the wrong size to render the image, it will appear somewhere we don't expect. For example, <code>DynamicTexture.draw(texture)</code> and <code>DynamicTexture.draw(gameObject)</code> had different results, even though they were using exactly the same texture:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727712114075/57ae87e6-1504-4b8a-8d3c-bf82070471cf.png" alt class="image--center mx-auto" /></p>
<p>However, because everything is GameObjects, in Beam they both render with the original frame margin:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727712124489/b8216390-4b06-46a8-9390-6e34a1225148.png" alt class="image--center mx-auto" /></p>
<p>This is a change from the way things originally worked, but it provides more consistency. I hope that makes things easier to work with!</p>
<h3 id="heading-50-off-functions">50% Off (Functions)</h3>
<p>We've added the new <code>render</code> method to DynamicTexture. However, because <em>everything is GameObjects</em>, we've also <em>removed</em> a whole lot of functionality from the class. (And by extension, those functions have also been removed from <code>RenderTexture</code> which wraps DynamicTexture.) Right now, it looks like about half the functions have been removed.</p>
<p>These functions were mostly batch-oriented. They allowed you to manually start batching, add objects to a batch, and render a batch. However, why should you need to do that? Batching is pretty technical, and as the engine designers, we should take care of that for you. So we did!</p>
<p>And that's why I went to all that effort over the course of this week. Now, all you have to do is order a DynamicTexture to draw some things, and we'll take care of the rest. As it should be.</p>
<h3 id="heading-coming-soon">Coming Soon</h3>
<p>I've still got some tidying up to do on DynamicTexture. After that, I'm finally moving on to the Box, my new design for handling FX, masks, and other framebuffer tasks. This should bring more of that delicious <em>consistency</em> to Phaser Beam. It's taken a while, but we're finally getting there, and I'm excited to put everything together!</p>
<hr />
<h2 id="heading-submit-your-content">Submit your Content</h2>
<p>Created a game, tutorial, sandbox entry, video, or anything you feel Phaser World readers would like? Then please <a target="_blank" href="mailto:support@phaser.io">send it to us</a>!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727712413829/66aa4631-35a1-46ca-8d4c-718a1e40984b.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 198]]></title><description><![CDATA[Welcome to another issue of Phaser World! It’s quite incredible to think that we’re closing in on 200 issues. That’s an awful lot of content over the years. And this issue is no exception! We’ve got videos, exclusive new tutorials, games, and, of cou...]]></description><link>https://phaser.world/phaser-world-issue-198</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-198</guid><category><![CDATA[WebGL]]></category><category><![CDATA[canvas]]></category><category><![CDATA[phaser]]></category><category><![CDATA[Game Development]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Mon, 23 Sep 2024 16:35:16 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727104722705/1e561d94-5afe-4e79-8490-f3e746d408ac.png" alt class="image--center mx-auto" /></p>
<p>Welcome to another issue of Phaser World! It’s quite incredible to think that we’re closing in on 200 issues. That’s an awful lot of content over the years. And this issue is no exception! We’ve got videos, exclusive new tutorials, games, and, of course, the Developer Logs.</p>
<h2 id="heading-phaser-2024-games-showreel">🎥 Phaser 2024 Games Showreel</h2>
<p>We’ve released another new video onto our fledgling YouTube channel. This time, a showreel of Phaser games to give you an idea of what it’s capable of when placed into talented hands!</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=9QtVOPuU5kw">https://www.youtube.com/watch?v=9QtVOPuU5kw</a></div>
<p> </p>
<h2 id="heading-hawaii-match-5"><strong>🎮 Hawaii Match 5</strong></h2>
<p><em>Enjoy over 4,000 levels of this addictive tropical puzzle adventure.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/hawaii-match-5"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727104810522/5626bd87-bb73-46c0-81e1-3ac795f9360c.jpeg" alt class="image--center mx-auto" /></a></p>
<p>SoftGames has released their latest game, Hawaii Match 5! Set in the stunning landscapes of a tropical paradise, this puzzle game will take you on a journey through dreamlike island scenes, packed with vibrant fruits and flowers. With over 4,000 levels, players are challenged to match five or more symbols to achieve goals and earn stars, all while managing limited moves.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/hawaii-match-5">Play Hawaii Match 5</a></p>
<h2 id="heading-phaser-editor-44-released"><strong>🌟</strong> Phaser Editor 4.4 Released</h2>
<p><em>The latest release includes enhanced Go To support, tighter integration with VS Code, built-in Live Chat and has been updated for Phaser v3.85.2</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/phaser-editor-v44-released"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727104962529/1db6578e-0dbd-497d-9896-ce35247c26fc.png" alt class="image--center mx-auto" /></a></p>
<p>It was only last week that we announced the 4.3 release, but we’ve added so many cool new features that we pushed out 4.4.</p>
<p>Included are new UI improvements, the ability to see animated sprites in real-time in the Scene Editor, buil-in Live Chat support (with a human, not a bot!), better Visual Studio Code integration, and updates for Phaser v3.85.2, which was also released last week.</p>
<p>Read the <a target="_blank" href="https://phaser.io/news/2024/09/phaser-editor-v44-released"><strong>full release notes</strong></a> for details about all of the improvements.</p>
<p>Subscribers can update to this version immediately. Just grab it from your account's Downloads page or pick ‘Check for Updates’ within Phaser Editor. If you don’t have a subscription, we offer a <a target="_blank" href="https://phaser.io/trial"><strong>30-day trial</strong></a>.</p>
<h2 id="heading-phaser-enterprise-plans">🚀 Phaser Enterprise Plans</h2>
<p>Does your company use Phaser as part of its development process? Then, you may want to consider a Phaser Enterprise plan. Benefits include:</p>
<ul>
<li><p>Access to your own private Slack / Discord channel with Phaser staff for direct technical support</p>
</li>
<li><p>30 minutes worth of 1:1 video calls per month for support or pair programming</p>
</li>
<li><p>Help porting your game/s from other platforms or systems to Phaser</p>
</li>
<li><p>Help with upgrading older Phaser 2 games to Phaser 3</p>
</li>
<li><p>Access to Phaser Editor, with SSO and on-premises versions available</p>
</li>
</ul>
<p>Interested? Please email Richard Davey (rich @ phaser.io) with further details about your company and we can take it from there.</p>
<h2 id="heading-making-phaser-games-for-ios-and-android">💻 Making Phaser games for iOS and Android</h2>
<p><em>Read this great exclusive new tutorial on using Phaser with Capacitor</em></p>
<p><a target="_blank" href="https://phaser.io/tutorials/bring-your-phaser-game-to-ios-and-android-with-capacitor"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727105757431/0ce30334-359a-45ee-9b0a-ee2354aa2471.png" alt class="image--center mx-auto" /></a></p>
<p>We have just published a new tutorial where you'll learn how to deploy your Phaser game to iOS and Android by wrapping it with Capacitor. We use an existing game, Starshake, as an example.</p>
<p>The tutorial features:</p>
<ul>
<li><p>Integrating Capacitor into your project, a cross-platform native runtime for web apps, to easily transform your Phaser game into a mobile app.</p>
</li>
<li><p><em>Changes to be more mobile-friendly, including touch controls, resizing the game for mobile devices, and adding safe area support.</em></p>
</li>
<li><p>Setting up live debugging on Android or iOS devices to display game changes immediately.</p>
</li>
<li><p>You can bring your Phaser game to mobile in just a few steps.</p>
</li>
</ul>
<p><a target="_blank" href="https://phaser.io/tutorials/bring-your-phaser-game-to-ios-and-android-with-capacitor">Read the tutorial here</a></p>
<h2 id="heading-3-new-tutorials">💻 3 New Tutorials!</h2>
<p><em>Here are three new tutorials from the community.</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727106765149/3364397e-5e24-4d8b-a849-dbcadd8a1e47.jpeg" alt class="image--center mx-auto" /></p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/making-a-game-in-1-one-month-with-phaser-and-ai">Making a game in 1 month with Phaser and AI</a>: Oleg Shabrov made a new take Vampire Survivors in a very unique manner, without a single line of JavaScript code!</p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/device-rotation-prompt-in-javascript">Device rotation prompt in JavaScript</a>: A small library that solves a big problem!</p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/connect-four-prototype-by-scott-westover">Connect Four Tutorial</a>: Phaser YouTuber Scott Westover returns with a classic puzzle game!</p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727106804915/4799c1fe-e15e-4abf-8a10-b8e507ab7863.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-rich"><strong>👨‍💻</strong> Rich</h2>
<p>Work on the new Phaser documentation site continues to take priority. This involves collating together a huge amount of resources, ensuring they are properly formatted and then generating the correct front-matter for every single file. It’s a huge task but the 3 of us are making good headway.</p>
<p>As I mentioned last issue, we’re using the Hashnode Docs service. Their system works by having TypeScript configuration files in each folder. These files are similar to JSON files, in that they map out the contents of the folder, the slugs, the sidebar content, nav links and so on. Working with them is quite tedious though. Not as tedious as working with JSON! But still lots of manual copy/paste work. It’s also quite easy to accidentally make a typo that leads to broken links or conflicting slugs.</p>
<p>As developers so often do when faced with a daunting task, I coded something to help. This took the form of a library that allows us to generate these config files programmatically. It also checks to ensure the files exist, have the correct extensions, have properly aligned slugs and so on. In short, we get to <em>code</em> the structure of our docs like this:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { Export, Guide, Link, Page, Section, SideBar } <span class="hljs-keyword">from</span> <span class="hljs-string">'./HashnodeDocs'</span>;

Guide(<span class="hljs-string">'Phaser'</span>, <span class="hljs-string">'phaser'</span>);

SideBar(<span class="hljs-string">'Phaser v3.85.2'</span>, <span class="hljs-string">'v3.85.2'</span>, <span class="hljs-literal">true</span>);

Section(<span class="hljs-string">'Getting Started'</span>, [
  Page(<span class="hljs-string">'what-is-phaser'</span>),
  Page(<span class="hljs-string">'installation'</span>),
  Page(<span class="hljs-string">'set-up-dev-environment'</span>),
  Page(<span class="hljs-string">'project-templates'</span>),
  Page(<span class="hljs-string">'make-a-game'</span>),
]);

Section(<span class="hljs-string">'Concepts'</span>, [
  Page(<span class="hljs-string">'scenes'</span>),
  Page(<span class="hljs-string">'game-objects'</span>),
  Page(<span class="hljs-string">'cameras'</span>),
  Page(<span class="hljs-string">'events'</span>),
  Page(<span class="hljs-string">'factories'</span>),
  Page(<span class="hljs-string">'plugins'</span>),
]);

Link(<span class="hljs-string">'Phaser Discord'</span>, <span class="hljs-string">'https://discord.gg/phaser'</span>);
Export();
</code></pre>
<p>Which, honestly, is a lot easier for us 😊</p>
<p>I also finished and published Phaser v3.85.2 last week. There wasn’t much in it, mostly just fixing a few high priority issues, but it was important to get it out fast.</p>
<p>We will stay on top of issues reported in GitHub but our focus, once the docs site is live, is building Phaser v4 with the new renderer inside of it. As I’ve said before, we want to keep the API as close to v3 as we can to ensure a seamless transition. After all, we’ve spent a year working on our incredible new renderer, so we want as many devs to use it as quickly as possible without having to abandon v3 projects to do so. Yes, we still want to transition to ES6/ESM internally, but it’s not essential for us to do this before getting v4 out.</p>
<h2 id="heading-francisco-phaser-docs"><strong>👨‍💻</strong> Francisco - Phaser Docs</h2>
<p>This week has been very productive in the development of scripts that automatically generate the Phaser API. One of the biggest improvements has been the restructuring of the code, moving from a rough draft (hardcode) to a much more organized and modular structure. This has not only made future modifications easier but also made the code more maintainable.</p>
<p>A key achievement was enabling the script to generate its own phaser.json file. This step is crucial as it allows me to keep the documentation automatically updated without having to manually regenerate this file using an external tool.</p>
<p>Additionally, I grouped functions, constants, and events, which significantly reduced the size of the documentation. In fact, the documentation size was reduced from about 50 MB to just 18 MB, making it lighter.</p>
<p>I also worked on the overall organization of the code, separating functions and migrating the rough draft JavaScript code (hardcode) to TypeScript, improving both readability and scalability of the project.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727107408502/852369e6-2c58-4ca4-b8ac-db41d1c5329e.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-arian-phaser-editor"><strong>👨‍💻</strong> Arian - Phaser Editor</h2>
<p>Hello friends! Last week we released a new version of Phaser Editor. It was a lightning release, which we worked on for about two weeks. The main feature of this new release is a new communication channel between editor customers and the Phaser Studio team. You will find an icon to open a chat window on the top right. In this window, you can contact us and we will respond as quickly as possible.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727107555183/33c69e54-4da2-42c1-ad0b-cfe716ddf718.png" alt class="image--center mx-auto" /></p>
<p>In addition, we implemented some other features such as a button to launch Visual Studio Code. If you press this button, Phaser Editor will open the project folder in Visual Studio Code, and if you are editing a scene or user component, the code for it will open in the popular Microsoft editor.</p>
<p>We also improved the dialog to open a scene. This improvement consists of, first, showing a button to launch the dialog, and second, we added a lot more content to the dialog, so that now you can quickly access not only scenes, but also user components, animations, and asset packs.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727107569897/1a30bae2-1338-43d3-82d3-a819a074f0f1.png" alt class="image--center mx-auto" /></p>
<p>This week we will be working on another lightning release of the editor, mainly dedicated to simplifying project templates and the use of script nodes.</p>
<p>See you soon!</p>
<h1 id="heading-zeke-phaser-docs"><strong>👨‍💻 Zeke - Phaser Docs</strong></h1>
<p>Hi there. Here’s the documentation I’ve been working on the past week.</p>
<p><strong>Camera</strong>: Did you know that Phaser has some amazing camera features available for use in your games? Check out our code lab for examples <a target="_blank" href="https://labs.phaser.io/index.html?dir=camera/&amp;q=%5D.*">here</a></p>
<ul>
<li><p>Multiple cameras. Having multiple cameras opens up the possibilities to create in-game minimaps and split screen games. From Defender (1981), Diablo, Age of Empire, these games include a minimap to help players keep track of their current position within the game world. Other games like Sonic the Hedgehog 2, Rock n’ Roll Racing and Mario Kart show how multiple cameras can make local co-op games fun.</p>
</li>
<li><p>Camera follows the player. Movement and zoom effects. Cameras can move (pan), zoom and even trigger shaking effects.</p>
</li>
<li><p>Camera fade in / out for scene transitions. Round pixels for crisp and clean pixel art games.</p>
</li>
<li><p>Shader effects. Check out the link above for all our current examples.</p>
</li>
</ul>
<p><strong>Loader</strong>: The Phaser Loader is responsible for loading all external game assets. Here’s a complete list of file types that you can use in-game: audio, binary, glsl, html, htmlTexture, image, json, script, spritesheet, svg, text, tilemapCSV, tilemapJSON and xml.</p>
<p><strong>Events</strong>: Events send signals to other systems that are listening to act on. For example, if the player clicks their mouse on your game, that will internally emit a sequence of events within Phaser. Or if the Loader finishes downloading a file, that will emit related events. The documentation provides examples for adding/removing event listeners, triggering events and creating custom event emitter classes.</p>
<p><strong>Renderer</strong>: The Renderer draws everything you see on the screen. Phaser comes with 2 built-in renderers: Canvas and WebGL. Phaser automatically queries the browser to see if it supports running WebGL to create a WebGL renderer, otherwise it uses Canvas.WebGL advantages:* Lights, shaders, sprite effects, tints <em>Mesh, Nine Slice, and Rope game objects</em> Better performance, usually Canvas 2d advantages:* Extra blend modes <em>Better performance for Canvas Texture and Text</em> Smaller build * Slightly faster startup and canvas resizing</p>
<p><strong>Caching</strong>: The Phaser internal Cache stores downloaded files for quick access. Files are stored using unique string-based keys. If the file uses the Loader, it will use the same key to store it in the Cache. The Phaser Cache is separate from the browser cache and only persists during the game session.</p>
<p><strong>Textures</strong>: Create and store textures with the Texture Manager. A Texture is made up of one or more Frames. Frames allow you to split a single Texture into different sections. Sprites can be assigned to show a texture with different frames at any time. Phaser supports Sprite Sheets with multiple frames of the same size or Texture Atlases that use a single large image that combines multiple images and data to create the frames for use. Phaser also allows Dynamic and Canvas Texture generation that can create Textures at runtime.</p>
<p><strong>Arcade physics</strong>: Used to create 'arcade' or 'retro' style games, Arcade Physics is a lightweight physics system that can only handle rectangle and circle collisions. It is ideal for platformers, top-down games and puzzle games as it’s very fast and easy to use, with lots of helper functions. If performance is your primary concern, consider using Arcade Physics.</p>
<p><strong>Matter physics</strong>: Based on an open-source third party physics library, Phaser comes bundled with a customised version of MatterJS. Matter Physics provides a more advanced 'full body' physics system and can be used to create complex physics shapes, polygons and compound bodies. It is also able to simulate behaviours that include constraints, joints, springs, soft body dynamics and more.</p>
<hr />
<h2 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h2>
<p><em>September 20th, 2024 by Ben Richards</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727107063474/c116d87e-8a36-4ccb-ab36-cbec6c871df5.png" alt class="image--center mx-auto" /></p>
<p>Last week, I talked a lot about implementing new framebuffer rendering techniques. Long story short, FX and masks become the domain of something called a Box, and framebuffers are only seen in a Box and DynamicTexture.</p>
<p>This week, I set about implementing those framebuffer systems. Much of this is still in progress, but I do have one thing to show off: the Stamp GameObject.</p>
<p>The <code>Stamp</code> GameObject is similar to an Image, except it ignores camera transforms. It doesn't just set them to zero - it doesn't even calculate camera transforms. This is different to the <code>scrollFactor</code> properties of other GameObjects, which reduces the amount by which camera scroll transforms the object. The Stamp also ignores camera zoom and rotation.</p>
<p>This is visible in the following image. Here, the background doesn't scroll as the camera moves, to create the impression of parallax; but it still rotates and zooms. But the bar at the bottom of the screen is a Stamp, so it doesn't rotate or zoom.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727107194017/050f9de4-fd04-4ed0-81f2-6866ef45b608.png" alt class="image--center mx-auto" /></p>
<p>Stamp also works properly with lighting. Lights are calculated in screen space, so the Stamp's position on the screen lines up perfectly. In the following example, we've moved the camera many screens away from the origin, but the car (a Stamp with a normal map) is still lit properly.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727107206274/f6644a20-49d5-4fbd-9814-4e16461e694c.png" alt class="image--center mx-auto" /></p>
<p>A Stamp has some limitations, however. It is just an Image. It can't play animations like a Sprite, or display repeating textures like a <code>TileSprite</code> or <code>Tilemap</code>.</p>
<p>To create complex camera-independent elements, such as an involved HUD or a background moving independently from the level, your best option is to create a whole new <code>Scene</code> and render it before or behind the game world. Cameras are not linked between Scenes, so you can build a HUD and leave it in place.</p>
<p>Light does not pass between Scenes, though, so a more complicated option is to use a <code>Container</code> which follows the camera in the same scene, and put your HUD in there. Like most things in game development, there are many ways to get results.</p>
<p>Of course, the main purpose of the Stamp is to simplify drawing a <code>DynamicTexture</code>. I'm in the middle of reorganizing the logic for this system now. Next week, we'll hopefully have a lot more to report!</p>
<hr />
<h2 id="heading-submit-your-content">Submit your Content</h2>
<p>Created a game, tutorial, sandbox entry, video, or anything you feel Phaser World readers would like? Then please send it to us! Email <a target="_blank" href="mailto:support@phaser.io">support@phaser.io</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727107259407/6e6aa67d-e366-4b11-878e-1f4f9e00f072.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Phaser World Issue 197]]></title><description><![CDATA[Welcome to issue 197 and a whole lot of fresh content this week. We will keep tweaking the layout as we get used to our new home on Hashnode, but overall, we’re really enjoying the expanded features this format offers.
This week, the team’s Dev Logs ...]]></description><link>https://phaser.world/phaser-world-issue-197</link><guid isPermaLink="true">https://phaser.world/phaser-world-issue-197</guid><category><![CDATA[WebGL]]></category><category><![CDATA[phaser]]></category><category><![CDATA[canvas]]></category><category><![CDATA[Game Development]]></category><dc:creator><![CDATA[Richard Davey]]></dc:creator><pubDate>Mon, 16 Sep 2024 12:00:52 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726420216935/28d8f869-9d09-42ba-a055-15c01b418128.png" alt class="image--center mx-auto" /></p>
<p>Welcome to issue 197 and a whole lot of fresh content this week. We will keep tweaking the layout as we get used to our new home on Hashnode, but overall, we’re really enjoying the expanded features this format offers.</p>
<p>This week, the team’s Dev Logs are back, so you can catch up with what we’ve been working on. We’ve also got new tutorials and a great game. Let’s dive in …</p>
<h2 id="heading-30-day-trial-subscription-available">😍 30-day Trial Subscription Available</h2>
<p>A <em>lot</em> of you asked for this, so we made it happen.</p>
<p>We now have a <a target="_blank" href="https://phaser.io/trial"><strong>30-day trial</strong> subscription</a> option available.</p>
<p>You can test out Phaser Editor v4 Desktop edition entirely unrestricted for 30 days. If you've never used Editor before, we strongly recommend reading our <a target="_blank" href="https://phaser.io/tutorials/first-steps-with-phaser-editor">starter tutorials</a> so you can appreciate what it is and what it isn't, all while learning how to use it.</p>
<p>You can use every feature and even build complete games. If you get stuck, please reach out to us in the ‘phaser-editor’ channel on our <a target="_blank" href="https://discord.gg/phaser">Discord server</a> or email support@phaser.io. We want you to appreciate how powerful Phaser Editor is, and we will help you get there as best we can.</p>
<p><a target="_blank" href="https://phaser.io/trial">View the trial subscription page</a>.</p>
<h2 id="heading-deep-space-survivor">🎮 Deep Space Survivor</h2>
<p><em>Survive massive amount of enemies in space in this top-down action auto-shooter.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/deep-space-survivor"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726430907044/bf121fd9-2161-480e-a6d0-b923bfc4b0fc.png" alt class="image--center mx-auto" /></a></p>
<p>Gnome Castle Games has taken the fan favorite Vampire Survivors and thrown it into deep space. Can you survive the onslaught of enemy ships in this top-down space auto-shooter?</p>
<p>In Deep Space Survivor, you try to survive the numerous enemy space ships that are trying to get you, blowing them up with unique weapons and powerups. Influenced by Vampire Survivors and Magic Survival, this game provides tons of action and roguelike elements.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/deep-space-survivor">Read more about Deep Space Survivor</a></p>
<h2 id="heading-phaser-editor-43-released">🌟 Phaser Editor 4.3 Released</h2>
<p><em>Enjoy new quality-of-life improvements, such as drag and drop asset management and UI updates in this latest release of Phaser Editor.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/phaser-editor-v43-released"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726418161079/0bf7412b-778c-4ecb-b1cd-0c8a94cb623e.png" alt class="image--center mx-auto" /></a></p>
<p>A brand-new version of Phaser Editor has been released. You’ll find a much quicker and easier way to add assets to your projects, UI improvements, updates to support Phaser v3.85, a super-handy new “Go To Scene” icon, and plenty more.</p>
<p>Read the <a target="_blank" href="https://phaser.io/news/2024/09/phaser-editor-v43-released">full release notes</a> for details about all of the improvements.</p>
<p>Subscribers can update to this version immediately. Just grab it from your account's Downloads page or pick ‘Check for Updates’ within Phaser Editor. If you don’t have a subscription, we offer a <a target="_blank" href="https://phaser.io/trial">30-day trial</a>.</p>
<h2 id="heading-interview-with-a-phaser-creator-ar0se">🎙️ Interview with a Phaser creator: Ar0se</h2>
<p><em>Learn more about the game Txtaria and how it came to be.</em></p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/meet-a-phaser-creator-ar0se"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726418614793/0145dda6-d7e5-4976-a867-0640ab14a8b9.png" alt class="image--center mx-auto" /></a></p>
<p>Ar0se caught our attention with her game Txtaria. The game is a platformer with an ASCII art style that gives it a mysterious look and feel. Ar0se agreed to tell us more about her story and the development behind Txtaria.</p>
<p><a target="_blank" href="https://phaser.io/news/2024/09/meet-a-phaser-creator-ar0se">Read the full interview here</a>.</p>
<h2 id="heading-3-new-tutorials">🎥 3 New Tutorials</h2>
<p><em>Here are three great new Phaser tutorials.</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726419869461/5264e1cb-bb54-4263-be82-28ba001e2595.png" alt class="image--center mx-auto" /></p>
<p>The <a target="_blank" href="https://phaser.io/news/2024/09/phaser-3-pac-man-tutorial-continues">Phaser 3 Pac-Man Tutorial</a> Continues. This time, it’s all about pathfinding.</p>
<p>Learn how to <a target="_blank" href="https://phaser.io/news/2024/09/learn-to-make-conveyor-belts-with-scott-westover">code a conveyor belt</a> effect in this new video from Scott Westover.</p>
<p>Emanuele Feronato has challenged himself to create 101 games. <a target="_blank" href="https://phaser.io/news/2024/09/emanuele-feronato-built-pushori-with-phaser-3">Pushori is the first one</a>, and it is complete with code.</p>
<hr />
<h1 id="heading-phaser-studio-developer-logs">Phaser Studio Developer Logs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726431017480/c7e97e8d-44ef-4946-9f0c-a389fd94d154.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-rich">👨‍💻 Rich</h2>
<p>It’s been a busy week in the Phaser Studio offices. I mean, we all work remotely, but things have been cooking up a storm in our respective offices. As usual, since we formed Phaser Studio, I’ve been spread across multiple projects every day of the week. Mostly, I’ve been focusing on our new documentation site with Zeke and Francisco. I wrote a huge amount of technical content, which is being turned into actual guides and maps of the internal systems. Plus, we’re updating the API documentation too. So, the new site will be a combination of getting started, core concepts, deep dives, flow diagrams, and the full API docs.</p>
<p>I’m happy to announce that we partnered with Hashnode to host the docs sites. This is a brand new service they’ve been working on, and we’re loving it so far. We get to create our docs as markdown and code in our own git repo, and they sync them to a beautifully presented site on every commit. We no longer need to worry about keeping our doc site tied to the current version of Phaser, as we’ve traditionally done. Instead, we can update and publish new site content whenever we like. I’ve wanted to do it for years, and we’re finally doing it!</p>
<p>We’ve also been planning out the product roadmap for the next three months. Our priorities are getting Phaser Beam complete and then merging it all into Phaser v4, getting the new physics system released (see Pete’s section below!), getting the docs site live, getting the new web site live, and, of course, constantly updating the Phaser Editor throughout all of this. Plus, there are a few other neat ideas in the works.</p>
<p>Amazingly, this will bring us to the end of 2024, which is quite a shocking realization in some regards. Of course, I’m incredibly pleased with what the team has achieved this year, and we’ve still got our most important quarter ever to go, but time does seem to be flying by. Anyway, read on to find out what the rest of the team has been doing. Spoiler: it’s pretty damn cool 😎</p>
<hr />
<h2 id="heading-pete-box2d">👨‍💻 Pete - Box2D</h2>
<p>I'm currently developing a Physics library for Phaser.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726429440657/c11428f2-132f-426b-a634-f32a41cc2efd.png" alt class="image--center mx-auto" /></p>
<p>The project? To convert the new and wonderful Box2D v3.0 from C to JS.</p>
<h3 id="heading-large-language-models">Large Language Models</h3>
<p>Work has progressed very quickly, largely thanks to Large Language Models (LLMs) like GPT 4o and Claude Sonnet performing the grunt work.</p>
<p>After a lengthy process of chopping the source code up into pieces small enough for the LLM to digest, then rearranging them so that each piece has enough context from the rest of the project to make sense, I was able to use the following system and user prompts to get a first draft for each piece of code:</p>
<p><strong>System:</strong> <em>you are an expert C and JS programmer, you will answer questions and fulfill requests accurately and concisely</em></p>
<p><strong>User:</strong> <em>please convert this code into JS (from C). Use the exact same labels. Comment out all macros like B2_ASSERT. Skip any code which is disabled by conditional compilation (permanently false, or using a debug flag). Where a data structure is used but not defined, assume that a similar JS structure will be used as an import. Export all functions that start with the characters b2. Where a type is used but not defined, assume that it will be available as a similar JS structure elsewhere in the project (e.g. b2_circleShape). Convert any typedef struct into a class.</em></p>
<h3 id="heading-problems">Problems</h3>
<p>Whilst far from perfect, the generated rough cut hugely reduced the amount of search and replace and routine editing for me. I don't think any file worked perfectly, but the errors tended to fall into categories which made them easier to address rapidly:</p>
<ul>
<li><p>missing imports. These show up during run-time testing - thorough testing is essential</p>
</li>
<li><p>missing conversion, more on this later</p>
</li>
<li><p>inconsistent type use. There were a lot of cases where instead of using classes like b2Vec2, the JS used generic objects instead. I used search to find these and manually replaced them. Search strings "= {" and "({ " gathered 90% of them</p>
</li>
<li><p>inconsistent code conversion. This was usually my fault in that I'd failed to provide enough context and the LLM 'made it up' resulting in pieces of code that didn't fit together via types or overall approach. Manual fixing was required, although in extreme cases I tailored the prompts specifically, changed the context, and pushed the file through again</p>
</li>
<li><p>pass-by-reference vs pass-by-value</p>
</li>
</ul>
<p>In attempting to fix the missing imports I ran into to module errors with repeated or looping dependency issues. I resolved them the lazy way by sticking to the C language design where 'header' files contain definitions, and 'source' files contain everything else. All files import only 'header' files, which avoids circular dependencies. It looks weird having '<em>include/constraint_graph_h.js</em>' <strong>and</strong> '<em>constraint_graph_c.js</em>' but it works. As it is close to the original C file structure, it also minimises the conversion required for this early stage development.</p>
<p>After fixing these widely prevalent import issues, other errors included typical LLM type nonsense where it seemed to forget what it was told to do:</p>
<p><strong>LLM:</strong> <code>class b2World { /* include JS conversion of the b2World structure here */ }</code></p>
<p><strong>Me:</strong> Hang on, that's literally all I asked YOU to do!</p>
<p>There were a lot of problems with pass-by-value conversion to pass-by-reference. Some of them were exceptionally hard to find, and I resorted to building identical demos in C and JS. I could step through both of them in parallel and compare the numbers at every step.</p>
<p>An early output comparison, C on the left, JS on the right. This was the first test where a falling box detected collision with a ground platform:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726421765665/e35c21a2-b97c-4946-800f-594d91750833.webp" alt class="image--center mx-auto" /></p>
<h3 id="heading-testing-the-conversion">Testing the Conversion</h3>
<p>My testing structure was created in the file main.js, which started as a list of 'unit test' type code snippets. I'd show the LLM a class definition then ask it to devise some unit tests to check the operation is correct. Creating and debugging these for all the major Box2D systems was a boring, slow, iterative process that took approximately 8 days. The LLM was helpful for creating ideas here, but it was very poor at creating the unit tests themselves. A large number of the early attempts were testing invalid calls or expecting unreasonable results. Eventually I used an LLM (Claude Sonnet) to suggest possible tests, then manually coded the ones which seemed to have merit. Getting close to the code at this point was very helpful for later understanding when deeper issues started to show up in the conversion running full demos.</p>
<p>At the end of this stage, I had working tests for all the major classes in the physics engine and was able to start building some demos - safe in the knowledge that the unit tests would catch most errors if I broke one thing while adjusting another.</p>
<h3 id="heading-shapes">Shapes!</h3>
<p>Now the fun part starts. I began with a single box landing on a static box 'ground'. In Box2D a box is a polygon type which is a fundamental element of nearly everything. We use them for ground platforms, stacks, and of course stress-test demos:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726429474498/6b29bc1c-36b5-4667-beff-1aa6fa042abb.png" alt class="image--center mx-auto" /></p>
<p>Additional shape types include circles, capsules, segments, and chain-segments. The chains are mostly used for platforms, and address issues with adjacent segments which will otherwise cause unwanted collisions for a shape sliding along on top of them.</p>
<p>Every shape type has bespoke collision and rectification functions for interaction with the other shapes, so this job was bigger than I had anticipated (5 more days) but did not require any modification to my process.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726429487737/e7fb415d-baed-4815-8d51-2680b2809bcc.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-joints">Joints!</h3>
<p>With all the basic shape types working, I moved on to the Joints. Starting with a Revolute Joint, I debugged my way through to a working ragdoll. I was relieved to find that the conversion was now largely stable and the remaining bugs were generally easy to fix when I'd located them. I continued to use the parallel build and compare approach, with a matching C demo for every JS demo.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726429498895/8002e2fa-49e1-4bcf-8cbf-0bc1f9817351.png" alt class="image--center mx-auto" /></p>
<p>After getting one joint type working, I moved on to distance, motor, mouse, prismatic, weld and wheel joints. My approach remained constant: take a C++ sample from the comprehensive range available in the Box2D repository, convert it into a JS test in main.js, run it and fix the obvious bugs, then compare the results both visually and numerically and dig deeper if necessary. Now that all of the joint types are working, I believe the only remaining systems are the Sensors and their related Events.</p>
<h3 id="heading-future-work">Future Work</h3>
<p>Going forward, the JS library is working but it is a very literal translation of the C. This makes for some strange looking and inefficient JS, which we must clean up and optimise. The API design is heavily orientated towards the C programming language and its quirks. It has a strong emphasis on avoiding memory allocation and release after initialisation. Given the conversion of typedef struct to classes for JavaScript, many of those design choices can be changed to make the library more familiar to JS developers. It will need to be integrated with Phaser eventually but initially we'd just like to have it available for Phaser projects to use. The original C makes very effective use of multitasking and SIMD instructions. It would be interesting to see if JS worker threads can be used effectively to regain some more of the speed of the original code.</p>
<p>You can see the results of the work so far in the <a target="_blank" href="https://www.youtube.com/watch?v=dHRxrb4h2M0">YouTube video</a> below:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=dHRxrb4h2M0">https://www.youtube.com/watch?v=dHRxrb4h2M0</a></div>
<p> </p>
<hr />
<h2 id="heading-can-phaser-nexus">👨‍💻 Can - Phaser Nexus</h2>
<p>Physics Particles! This week’s work on the Nexus particle system focused heavily on optimization and restructuring. I’ve been refining the code for particle presets, ensuring flexibility without sacrificing performance. The primary focus was on improving physics particles, both in terms of object creation and overall system efficiency. After several iterations, we were able to push the system to handle 5,000 DOM physics particles, maintaining 15-20fps on the M3 Max as the maximum limit at the moment, which is not too bad for the DOM! The biggest challenge was the initial load, as firing up all the particles at once created noticeable bottlenecks.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726422442805/6d89b516-7dad-49fa-9df1-e6a179eb3d85.gif" alt class="image--center mx-auto" /></p>
<p>The key breakthrough came from utilizing DocumentFragment to batch the particle initiation process. By grouping the creation and manipulation of particles before injecting them into the DOM, it significantly reduced the strain on performance during the initial setup phase. This approach proved essential in keeping frame rates more stable under heavy particle loads. These improvements are setting the stage for even more scalable particle systems in the future, with a solid balance between performance and complexity.</p>
<p>Until the next one, hope you all have high frame rates without drops!</p>
<hr />
<h2 id="heading-francisco-phaser-documentation">👨‍💻 Francisco - Phaser Documentation</h2>
<p>These past weeks I've been working on updating the Phaser documentation. On the current API Phaser docs site, a new path has been added that allows users to access the latest published version of Phaser by simply adding <code>latest</code> instead of the current version number. Try it out at the following link:</p>
<p><a target="_blank" href="https://newdocs.phaser.io/docs/latest/Phaser.Game">https://newdocs.phaser.io/docs/latest/Phaser.Game</a></p>
<p>I have also fixed several issues that our dear users reported to us, such as problems with certain links in the sidebar.</p>
<p><strong>Documentation: A New Awakening</strong></p>
<p>We’re also working on a brand-new documentation site too!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726422527927/4f577091-c2ff-4cfe-b596-b146d5a371c0.png" alt class="image--center mx-auto" /></p>
<p>Continuing with the documentation, but now something a little more exciting. I've been working on a new exporter for the Phaser documentation that will help us convert what we have in JSDocs to Markdown, making the documentation cleaner and easier to read. At this time, I can't reveal more about this project, but I'm sure Richard will announce something exciting in the future.</p>
<hr />
<h2 id="heading-zeke-phaser-documentation">👨‍💻 Zeke - Phaser Documentation</h2>
<p>Hi there 🙂</p>
<p>This week has been an exciting week as we begin migration and updating our current documentation to the Hashnode Docs platform. With the help of rexrainbow and samme, we're looking to create some solid documentation that is readable, simple to understand and loaded with example code.</p>
<p>My week was spent diving deep into Phaser documentation while examining documentation written by Rex and Sam. To kick things off, Richard led our team in discussing the new documentation structure and format with the goal of making it easy to maintain, scale and migrate (if the needs arises in the future).</p>
<p>My role involves reading through all 3 sets of documentation above, deciding what would be most helpful and merging each piece of writing into a single coherent document.</p>
<p>My thought process when putting together this documentation is as follows:</p>
<ol>
<li><p>What is the natural flow of thought a user might have when learning about this component?</p>
</li>
<li><p>How can some light narrative be weaved into the documentation to make it more readable?</p>
</li>
<li><p>Where can code examples be added to further clarify how each method, function or feature works?</p>
</li>
</ol>
<p>From reading through pages of documentation, Sam's writing style flows more naturally and is readable while Rex is more technical and goes deep into every property and method available. While different, both complement each other really well.</p>
<p>Here's what I've worked on this week:</p>
<ol>
<li><p>Phaser Scene. Richard has kindly written a proper introduction to all of Phaser's core components including the Scene that I have added to this piece of documentation. Following the structure of what Sam has written, more code examples and technical details were added from Rex's document.</p>
</li>
<li><p>Phaser Events. Sam provided a good fundamental explanation of how events work in Phaser and Rex provided comprehensive technical details to implement this is code. Rex also provided a more advanced implementation showing how to extend Phaser's EventEmitter to create your own custom event emitter class.</p>
</li>
<li><p>Phaser GameObject. The most detailed documentation worked on for the week with over 1200 lines of text and code. It covers the full usage of creating game objects, methods to change its properties, interactivity, rendering, data management, events, dealing with common problems and even creating custom game object classes. Sam provides the structure, flow and narrative while Rex injects solid code examples with detailed explanations.</p>
</li>
<li><p>Phaser Game. The heart of a Phaser game, all games start by creating an instance of the Phaser Game class. Sam shows you the fundamentals of creating a Phaser game instance and explains basic configuration properties. He also explains the differences between WebGL and Canvas rendering and how it could affect your game. I have also added Rex's global members in the Game class that includes the Scene Manager, Data Manager, Time, Game Config and Window size. Also included are details on how to pause/resume your game and handling browser events that affect gameplay.</p>
</li>
<li><p>Phaser Input. Only Rex's documentation was added here as Sam did not have documentation that deals solely with Input. Rex goes deep into explaning how interactivity works in Phaser. It includes touch / mouse input, keyboard input and how to create keyboard combo input, gamepad input and using the mouse wheel.</p>
</li>
</ol>
<p>Overall, it's been a productive week reading into various documentation, compiling and editing writings from 2 accomplished Phaser users, and thinking how to best present it to our fans and developers.</p>
<hr />
<h2 id="heading-arian-phaser-editor">👨‍💻 Arian - Phaser Editor</h2>
<p>Hello!</p>
<p>This week we finally released the new version of Phaser Editor. The team has also been working on a new Trial service for the editor, with which you can use the editor for 30 days. After the storm of a release comes the calm? Not in Phaser Studio! So we immediately got to work on the new release. Although we may have an interim release with some changes we've made as we're busy refreshing our studio image, and we're making promotional videos. For these videos I added some sugar to the editor. Here's what we've done:</p>
<p>A button to launch Visual Studio Code. If you're working on a scene, the code for that scene will also be displayed in Code.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726423203362/60f06e92-3c68-4fa1-a684-d676f7d127f6.png" alt class="image--center mx-auto" /></p>
<p>We've added commands to sort objects in the Tools Pane of the scene.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726423240321/2f44afbb-664c-4e8e-bc0c-7b8ec54ffcc4.png" alt class="image--center mx-auto" /></p>
<p>And what's even more exciting, you can now play sprite animations right in the scene, in real time!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726423250628/1a988341-5ac5-4be3-9353-59125ee7c818.gif" alt class="image--center mx-auto" /></p>
<p>For this mid-release we are evaluating a better way for you to contact us, directly from the editor. Stay tuned!</p>
<hr />
<h2 id="heading-tales-from-the-pixel-mines">Tales from the Pixel Mines</h2>
<p><em>September 16th 2024 by Ben Richards</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726423791416/ae37f50b-6a2d-49ff-a40f-1986e8dbaf35.png" alt class="image--center mx-auto" /></p>
<p>I have spent this week arguing with myself. It's been very productive.</p>
<p>Last week saw the release of <a target="_blank" href="https://phaser.io/news/2024/09/phaser-beam-technical-preview-4">Phaser Beam Technical Preview 4</a>. We've already gotten some good feedback just by letting people experiment with it. When the possibilities are endless, we can't find every edge case by ourselves!</p>
<p>This week, I've got two stories about arguing with myself. The first is about parallel shader compilation. The second is about framebuffers. These are technical, but cool.</p>
<h3 id="heading-parallel-shader-compilation">Parallel Shader Compilation</h3>
<p>I said I wouldn't work on this. Then I worked on it anyway. Let's not ask why; let's just look at what it does for you.</p>
<p>Shaders do all the rendering in WebGL. With the new shader factory system, we can deliver a wide range of shaders, optimized to the demands of the moment. However, every time we compile a new shader, we have to... <em>compile</em> it. That takes time.</p>
<p>That time will vary depending on device, but on my desktop, I find it takes 10-15ms. A full frame is 16.7ms, so a single new shader will eat most of a frame. Two new shaders will eat multiple frames, causing stutter as there's now no way for the frame to finish in time. And this gets worse with more complex scenarios, as we add more effects or rendering optimizations, or as you add detail to your games.</p>
<p>If only there were a way to keep on rendering while a shader compiles in the background.</p>
<p>There is! It's the <code>KHR_parallel_shader_compile</code> extension. With this, we can start a shader compiling, and efficiently poll WebGL to ask, 'Is it ready yet?'. If it's not ready, we can simply <em>skip</em> drawing with that shader.</p>
<p>So I've created the render config option <code>skipUnreadyShaders</code>. This is off by default. When activated, it enables the extension and stops doing stuttering, blocking checks of shader completion. This results in silky smooth frame rates even when multiple new shaders are compiled at once.</p>
<p>But there is a cost: an object that needs a shader won't render while the shader is compiling. This is typically almost unnoticeable, but that's not ideal.</p>
<p>Also, <code>KHR_parallel_shader_compile</code> is not presently available in all browsers. While Firefox may add the extension at some point, right now only Chromium and Webkit renderers appear to have it.</p>
<p>The best practice, whether we are using the extension or not, is to <em>pre-touch</em> shaders. That is, use the shader in an unobtrusive way before it's actually needed. Once it's been used, it will remain available in the render system, and there will be no further interruptions. You might do this on a loading screen, or as your main menu or titles load in.</p>
<p>But how do you know which shaders are going to be used? Unfortunately, that's a technical question that can only really be answered with comprehensive analysis of the shader factory system. The <em>practical</em> answer is, just be thorough. Pre-touch each type of game object, in the conditions that you expect it to be used. Include lighting and special effects. If you still observe pop-in, check exactly what you're doing and try to replicate it more thoroughly.</p>
<p>Pre-touching will ensure that everything is ready before you need it. It may only save a few frames, but that helps keep your games running smoothly. And it works now, even before the render config option is released.</p>
<h3 id="heading-framebuffers">Framebuffers</h3>
<p>The last big development for the Beam renderer is around framebuffers. We've been working towards this objective for months. It's not just a performance upgrade, or a few extra features; it's a whole rework of the system, making it more reliable, powerful, and flexible than ever before.</p>
<p>This is very important to get right, so of course, I've been arguing with myself all week. What is the best approach? How much do we keep the same, versus change or improve? Are the benefits clear? Etc etc.</p>
<p>We think we've come up with a pretty cool approach. None of this has been coded up yet, so consider it a work-in-progress subject to change without notice. But it's enough of a change that I want people to start thinking about it - if I'm doing something really unhelpful, I want to know!</p>
<h3 id="heading-the-new-approach">The New Approach</h3>
<p>Rather than explain how things work right now, which is complicated, I'll just propose what I want to do.</p>
<ul>
<li><p><code>DynamicTexture</code> uses a command queue and a manual render command.</p>
</li>
<li><p>A new <code>Stamp</code> object renders without reference to a Camera.</p>
</li>
<li><p>A new <code>Box</code> object wraps GameObjects in FX.</p>
</li>
</ul>
<h4 id="heading-dynamictexture-command-queue">DynamicTexture Command Queue</h4>
<p>The <code>DynamicTexture</code> is a Texture containing a framebuffer where you can make persistent drawing operations. This is used in the <code>RenderTexture</code> GameObject, and can also be used directly. It's convenient for composite graphics which don't need to update frequently.</p>
<p>We will use a command queue to render a DynamicTexture. This records all the draw operations you want to perform, then renders them all at once when you call <code>DynamicTexture.render()</code>. This is more efficient than drawing each operation as you make it, and can take advantage of the full render system, making drawing even more efficient and predictable.</p>
<p>In practice, you may never notice the command queue. You'll still just call commands like <code>stamp()</code> and <code>draw()</code> and <code>erase()</code>. You just need to call <code>render()</code> once you're done.</p>
<p>Commands like <code>beginDraw()</code> or <code>batchDraw()</code> will be removed, because you no longer need to consider how the renderer works. This removes the possibility of bugs, such as a missing <code>endDraw()</code> command or running batch commands without <code>beginDraw()</code>.</p>
<p>This makes DynamicTexture more reliable and straightforward to use, which we think is a good trade-off for one new <code>render()</code> command.</p>
<h4 id="heading-stamp-gameobject">Stamp GameObject</h4>
<p>The new <code>Stamp</code> object will be like an Image, but it ignores cameras. This is similar to how a DynamicTexture handles stamps already, but by becoming its own object, the Stamp can be more efficient. As well as being used in DynamicTexture operations, the Stamp can be added directly to your game scene. It could be useful for HUD elements or other purposes.</p>
<p>This is more efficient because cameras apply a transformation matrix to everything they see. Most of the game's performance budget goes on those matrices! By eliminating them, we improve performance. The Stamp isn't suited to many things in a game world, but if your camera never moves, it could be amazing.</p>
<h4 id="heading-box-gameobject">Box GameObject</h4>
<p>The new <code>Box</code> object is a wrapper around another GameObject. Its main purpose is to handle all the FX in the game.</p>
<p>A Box has two sides: 'inside' and 'outside'.</p>
<p>The 'inside' is the world inside the Box. The Box might be moving in the outside world, but the inside doesn't change. This is similar to the 'preFX' available on some GameObjects right now, but expanded from the concept of just affecting a texture. For example, we want lighting to still work inside the Box, as one of the more obvious rendering technologies that we're using. It doesn't work with preFX, because that technique takes control of rendering, rather than allowing objects to render as they wish.</p>
<p>The 'outside' is the Box in the world. Once the Box is positioned on the screen, 'outside' effects run in screen space. This is similar to the 'postFX' available on most GameObjects right now.</p>
<p>Why are we making this change? Why not let objects manage their own FX?</p>
<p>Well, this method makes it easier to compose a scene render graph. It's far quicker for us to develop new rendering technologies if everything is modular like this. And at your end, when you're developing a game, it's easier for you to see precisely where your game is using framebuffers. Just count the Boxes.</p>
<p>This modular approach to rendering should overcome some longstanding issues with flexibility. Where objects were once restricted in their use of blend modes or FX within Containers, we can now nest Boxes inside other collections, and be confident that they'll do the same thing at all levels of the scene hierarchy.</p>
<p>Speaking of Containers (and Layers), they now gain some predictability. Previously, if you added FX to these collections, it would change some aspects of the way they were blended with the scene. With Boxes, we can remove this multi-function rendering, and give you confidence that collections will always render exactly the same. You can still put a Collection in a Box to add FX to it.</p>
<p>This is a big change to FX, but we think it's going to make it easier to see how a game is put together. Each Box represents a framebuffer and a new set of WebGL calls, which can help you reason about game performance more easily. You can also see where your game is rendered to a framebuffer. And, of course, it makes complex hierarchies more reliable and flexible.</p>
<p>I argued with myself about every part of this design. (You should see the Discord logs. I really did argue with myself.) There are lots of ways to approach this problem, and I've looked at most of them! This seems to be the best.</p>
<h5 id="heading-masks">Masks</h5>
<p>In theory, I've spent most of 2024 working towards improving masks. Boxes with FX make it possible to do masks in a really powerful way, so that's great!</p>
<p>We intend to treat masks as FX, going forward. With the 'inside'/'outside' concept of a Box, we can make masks much more flexible. This is probably as simple as a shader which erases the masked region of the image.</p>
<p>Current mask behaviour is in screen-space. A mask FX in the 'outside' does exactly this. But how do we make a mask which follows an object? Just put the mask in the 'inside' of the Box instead.</p>
<p>And with masks as FX, we can do really cool things, like apply a mask in between other FX. Imagine: recolor an object, trim it with a mask, and apply bokeh blur to the trimmed result. This is how we want masks to work, and we're so close now!</p>
<h3 id="heading-next-week">Next Week</h3>
<p>Next week, I'll start getting this stuff working. The <code>DynamicTexture</code> is first on my agenda. And then I'll get to grips with the shiniest, shader-iest part of the whole render system, and work on FX and Boxes. Looking forward to it!</p>
<hr />
<h2 id="heading-submit-your-content">Submit your Content</h2>
<p>Created a game, tutorial, sandbox entry, video, or anything you feel Phaser World readers would like? Then please send it to us! Email <strong>support@phaser.io</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1726420142129/6151d800-9276-4641-bf4d-b62729bcdd95.png" alt class="image--center mx-auto" /></p>
<p>Until the next issue, happy coding!</p>
]]></content:encoded></item></channel></rss>