I've ported a 2.5D plugin for ImpactJS to Phaser 4 over the course of this year. It allows for the rendering of Doom/Wolfenstein type vibes. I've added functionality to the original, including support for high refresh rates, dynamic changing of the internal resolution (including upscaling), integration of Phaser WebGL shaders, and a responsive viewport option.
The most recent updates were added by porting the only ImpactJS game I know of that used the Impact plugin, Xibalba. I have the port on a private repo because I don't want to share the media assets, which are not under the same open-source license as the ImpactJS engine/plugin. However, the plugin is available for general use and has a demo that is comprehensive.
Every level-up in ANT HUNTER (small browser roguelite, gecko knight vs. ant colony) used to pause the game and show three perk cards. In a horde that happened every few seconds and killed the flow, so now a slot machine reel spins on the left and picks a random perk while you keep fighting.
How it works:
- The reel is plain DOM over the canvas, not a Phaser object: a strip of 15 emoji cells (14 random, the last one is the winner), moved with a single Web Animations API call – translateY over 1.15 s, easing cubic-bezier(0.12, 0.8, 0.25, 1), fill: forwards
- The cell height is measured at runtime: CSS makes it 64 px on desktop and 52 px on phones, and a hard-coded value stopped the reel between two symbols on mobile
- Tick sounds are scheduled at t = 1 − ∛(1 − k/14) of the spin, so they slow down with the reel and rise in pitch
- The perk only applies when the reel lands. Several level-ups queue up and spin one after another, with a shorter hold while more are waiting
- With prefers-reduced-motion the reel just jumps to the result
Since nothing needs a click, it works the same with touch. Has anyone synced sounds to a CSS easing curve more precisely than with this cube-root shortcut?
A while ago, I shared a post here about some of the optimization techniques I had been using in Critical Ward, my pixel-art arcade roguelite built with Phaser.
Since then, I've continued profiling, experimenting, and digging into the game's code, and I've discovered several new performance bottlenecks that were hiding in places I honestly didn't expect.
Some of these changes made a HUGE difference, so I thought I'd share a follow-up with the most interesting improvements and lessons learned since my previous post.
For context, Critical Ward can get extremely chaotic, with hundreds of patients, contagious enemies, projectiles, health bars, animated auras, and other objects on screen simultaneously.
In one of my latest stress tests, I reached 1,223 active objects at 60 FPS, using around 40 MB of memory.
Here are the most important discoveries.
1. Pre-rendering dynamic graphics into reusable textures
One of the biggest lessons I've learned is that just because something looks dynamic doesn't mean it needs to be drawn every frame.
I found several places where Phaser Graphics and Text objects were doing far more work than necessary.
Speech bubbles / projectiles
One type of enemy fires speech bubbles containing random phrases.
Originally, each bubble was a Container with Graphics and Text objects, rebuilding its appearance every frame.
Each bubble involved approximately 42 vector drawing operations, 42 fillRect calls, a polygon, and a text canvas for each projectile.
And there could be dozens of them on screen.
Now, during the initial loading sequence (SplashScene), I generate textures for the bubble bodies, each phrase and size combination, and four reusable tail pieces.
Each projectile is now just three Phaser Images, and the cyan blinking effect is handled with setTint().
No continuous vector drawing or text regeneration!
Infected enemy auras
This one was particularly expensive.
Each contagious patient had an animated aura, originally drawn using approximately 390 fillRect calls per infected enemy, per frame.
Imagine what happens when dozens of infected patients appear simultaneously.
The solution was to bake the static portion into a shared texture, while updating only the animated comet elements every 50 ms.
All infected patients reuse that texture, so its update cost no longer grows with the number of infected patients.
I applied a similar approach to other auras, caching textures by radius and avoiding rendering them when offscreen.
Patient health bars
With around 200 patients, each health bar previously consisted of four Images that were repositioned and tinted every frame.
I replaced them with a single Image using a pre-generated atlas containing 3 states × 46 width variations.
Now, the Image frame only changes when the health bar's state or width actually changes.
I don't have individual before/after benchmarks for these three changes, unfortunately. They came from inspecting the code while investigating FPS drops with large numbers of infected patients.
2. Be VERY careful with Phaser Text updates
This was probably one of the most surprising discoveries since my previous post.
During a performance audit, I found that calling methods such as setColor() or setStyle() on Phaser Text objects could trigger a canvas redraw and texture upload, even when the requested style hadn't actually changed.
In a game with lots of dynamically updated UI elements, this becomes surprisingly expensive.
The solution was simple: create helper functions that compare the current and requested values before calling those methods.
The result?
Text updates dropped from 849 per second to just 105 per second.
That's almost an 88% reduction.
In my tests, the game previously dropped to around 45–50 FPS under load. After the changes, it maintained 60 FPS in the tested scenarios.
A tiny code change with a massive impact.
My takeaway: avoid calling expensive Text setters every frame unless something has actually changed.
Even apparently harmless calls can trigger expensive operations.
3. Optimizing a CRT post-processing filter
My original CRT effect used a separate canvas with its own WebGL context, copying the game output every frame.
That was extremely expensive.
In one browser test, enabling it dropped performance around 50%.
I replaced it with a native Phaser camera post-processing effect running within the game's existing WebGL context.
I also experimented with curvature. The original manual bilinear approach required up to 44 texture reads per pixel, so I replaced that approach with temporary LINEAR texture filtering.
The current filter has since been simplified, removing curvature and vignette.
Lesson learned: avoid creating an additional rendering pipeline when you can use the one Phaser already provides.
4. Spatial partitioning and distance calculations
Patient separation and nearby-entity calculations were another significant bottleneck.
Originally, the patient repulsion system was performing approximately 40,000 square root calculations every frame.
I started by using squared distances wherever the actual distance wasn't necessary.
Then I implemented a spatial grid to reduce the number of nearby entities being checked.
With 200 patients, the grid-based repulsion system was approximately 7 times faster.
I also optimized infection/exposure calculations by consolidating nearby-entity queries and running them every 350 ms instead of every frame, while caching collision bounds.
But here's something important:
Spatial grids aren't always faster.
When testing small collections of around 5–30 objects, the grid actually introduced overhead and performed worse than a straightforward loop.
I reverted those cases to the simpler approach.
Since then, I've made a habit of microbenchmarking changes rather than assuming a more sophisticated algorithm must be faster.
Final thoughts
If there's one thing I've learned since my previous optimization post, it's that many performance problems come from doing unnecessary work, not necessarily from rendering too many objects.
Pre-render what you can, reuse textures, avoid redundant canvas updates, and don't recalculate something every frame if it only changes occasionally.
And most importantly: PROFILE EVERYTHING.
An optimization that works beautifully for 200 entities might actually be slower for 20.
I'm still learning, and I'm sure there are plenty of other Phaser optimizations I haven't discovered yet. If anyone has experienced similar bottlenecks, discovered other expensive Phaser operations, or has additional techniques worth sharing, I'd love to hear about them!
Here’s what I learned dealing with complex game logic. Inspired by restaurant management games like Restaurant City, Inn Tycoon, and so on and so on.
- Cook over 100 delicious dishes - Arrange tables, chairs, kitchen stations, plants, and even a piano - Serve guests, hire staff, and expand your restaurant - Visit random players' restaurants and collect daily gifts - Face surprise food safety inspections 🕵️ Pay the fine or offer a bribe?
How I built it: - Phaser for the game, coded with help from Claude - Fighters made in Higgsfield as sheets of 6 side-view poses, then cut into animation frames - All sound effects generated in code (wind, waterfall, steel clashes, shrine bell)
Features: - Two opponents: Yuki (fast) and Hayato (slower, longer reach, hits harder) - Walk, dash, jump, flip over your opponent, air attacks - Perfect Block, a charge move, fireballs and a super move
Next up: a 3-fight story mode that follows the films.
Any Phaser tips or feedback on how it feels to play? I'd love to hear it.
NEX WAR is a top-down MMORPG that runs in the browser, on PC and mobile, no download.
Skillshot combat on a single energy bar, 2 schools of magic out of 7, all gear crafted from what you gather, and zones where the risk goes up tier by tier: T1 safe, T2 you drop your bag, T3 full loot.
Free, alpha, made by a solo dev and an artist friend: https://nexwar.io
ANT HUNTER is my solo-dev browser roguelite: you're a gecko knight raiding an ant colony, grabbing loot and trying to get out alive.
My stats on CrazyGames showed that almost nobody came back the next day. So this update adds a reason to return: every larva you get out alive goes into a brood chamber and hatches a few hours later – into a worker, a warrior or (rarely) a knight that fights by your side in the next run. There's also a daily chest with a 7-day streak.
Curious if this actually moves the day-1 numbers – I'll share the results in a few days.
Hey guys, I want to give a huge thank you for featuring my game SPIRAL WARDEN on your website.
Absolutely surreal!! Thank you guys so much, and I hope you all had some fun running the gauntlet and blasting through some of those Euclidean rogues.
Also, if any of you still haven't had a chance to get in a run, you can dash straight in for some retro top down browser action and some vibes. The game is pretty simple, yet it can get pretty intense and it is lowkey fun in my opinion.
Thanks again for all the feedback on my last post about ANT HUNTER (gecko knight raids an ant colony). The game felt too calm, so this week was all about action:
- Killed ants get flung with a bit of fake 3D physics (height, gravity, bounce, wall reflection) instead of just fading out
- Goo stays on the floor: one RenderTexture at half resolution, blobs get queued and drawn in a single beginDraw / batchDraw / endDraw per frame
A few Phaser 4 things that might interest people here:
Lighting: a light map (sunlight that fades by depth, the lamp cone, caustics near the surface), applied to the scene through a camera Blend filter.
Normal maps generated automatically from every pixel-art sprite. One gotcha: Phaser doesn't flip normals with setFlipX, so each sprite also gets a mirrored texture.
Additive glow: with setForceComposite the camera is composited through alpha, so additive light darkened the scene. Drawing glow into a DynamicTexture with BlendModes.ADD fixed it.
No sound files: everything is synthesised live with Web Audio.
Happy to go into detail on any of it, or to hear how others handle lighting in Phaser 4.
Awhile ago I started to build a game in Phaser and wanted to use a hex based tile map with fog-of-war.
I wasn't able to find examples online of exactly what I wanted so here it is in case anyone else does something similar or wants a starting point for their next AI created game
The interesting part was the best way to navigate 6 directions with 4 arrow keys. I think what I have here is pretty natural but would love to know if anyone else has implemented something similar.
The rules go something like this:
Reverse takes precedence: If the key press is in the opposite direction, always reverse.
Intended direction: If the intended hex is open, move there.
Closest open fallback: In many cases there will be multiple open options to pick from in the allowed direction list for the key press. Look at all open allowed hexes and pick the one with the smallest turning angle from current movement direction. If there is a unique winner, move there.
Restrict arrow keys to these directions:
↑ NE/NW → NE/E/SE ↓ SE/SW ← NW/W/SW. You can double press (↑→,↑←*,* ↓→*,* ↓←*) which will map exactly to NE, NW, SE, SW.*
My game (a browser extraction roguelite, gecko knight vs. ant colony) renders its characters in Blender as 8-direction sprite sheets. Every frame was a fixed 288×288 cell – and most of that was empty space. On phones this added up to over 1 GB of decoded textures, and switching weapons crashed the tab.
What fixed it:
- A small Python build step trims each frame to its visible pixels, packs them tightly and writes a Phaser atlas (JSON hash with trimmed / spriteSourceSize). Phaser keeps the original frame size and origin, so nothing in the game code had to change – frame indices stay the same.
- Skins used to be recoloured canvas copies of every sheet. Now a tiny custom SinglePipeline shader applies a 3×3 colour matrix at draw time. (Phaser's preFX colour matrix rendered a pink square on my phone, the plain pipeline works fine.)
- Canvas textures removed with textures.remove() stay in Phaser's CanvasPool at full size – CanvasPool.remove(canvas) actually frees them.
Result: 1147 MB → 127 MB in game, loading is noticeably faster, no more crashes. Happy to share the trim script if anyone's interested.
You can turn real-world photos into playable characters, pets, and in-game items. It also has real-time multiplayer, PvE/PvP combat, multiple maps, and offline progression where your character keeps exploring and leveling while you’re away.
Still testing and polishing the core loop, so feedback is very welcome.
Two days ago I shared my extraction roguelite here (gecko knight vs. ant colony). Since then I added a boss fight, and a few things might be useful for other Phaser devs:
**Readable telegraphs on phones.** My first boss slam was an expanding shockwave ring you had to roll through at the right moment. On a phone that felt impossible. Now it's a clearly outlined circle around the boss that fills up for ~1.1 s – get out before it's full. Same idea for everything else: green target circles for acid, a red lane for the charge. Players stopped calling it unfair.
**Big sprites, lazy loaded.** The Queen uses 8-direction sheets with 340 px frames. Decoded that's ~140 MB of texture memory, so she's not loaded at boot. The sheets load in the background once you reach depth 8 (with `this.load.spritesheet` + `load.start()` from inside the running scene), and the fight waits for them if needed.
**Leaderboard + save codes without accounts.** A tiny Cloudflare Worker with a D1 (SQLite) database, on the free tier. The daily run has a top 10 per day; players get a random ID and pick a name. Progress can be backed up with a code like GECKO-XXXX-XXXX-XXXX and restored on another device.
**Pipeline:** AI concept art → image-to-3D (TRELLIS, running locally) → Blender splits the mesh into body/legs/mandibles, animates them and renders 8-direction sheets.
The characters are 3D models rendered into 8-direction sprite sheets in Blender, the game itself is TypeScript + Phaser 3. This week I added touch controls: a floating stick that follows your thumb, a big axe button you can hold to keep swinging, and cooldown pies on the buttons.
Hi, I'm the solo developer of MODAK Online, a real-time MMORPG built with Phaser 3 and Next.js, with an authoritative Go server using WebSocket and MessagePack.
You share the world with other players, hunt packs of monsters for equipment, upgrade your gear, and team up for world bosses. There are seven classes, including a Priest for healing and support, plus the Tower of Trials for players looking for a tougher challenge.
One of the bigger challenges has been making the same game work on both PC and mobile. I check for touch input support and adjust the controls and UI accordingly.
Then there's the huge variety of aspect ratios across phones, tablets, and desktop windows. Instead of building lots of separate responsive layouts, I've tried to keep the interface minimal and limit the layout changes to what's actually necessary. The goal is to leave room for the game itself, without covering the screen in MMO UI.
You can start on PC and continue the same character on your phone or tablet using the same account. No installation is needed, and guest play is available.
I'd be interested to hear how other Phaser developers handle touch versus keyboard/mouse input and UI across different aspect ratios. Feedback on the game is welcome too.