Hex Sweeper: My First Attempt at a Phaser.js Game

After 15 years of web development, I finally decided to scratch my game dev itch. I was already using Claude Code in my professional work and it seemed like a great way to see how it handled something outside my comfort zone in the world of game dev, which I know nothing about. My ultimate fantasy is to build a 4X game at some point, so the question was where to even start. I wanted something as simple as Minesweeper but with hex tiles. Hence, Hex Sweeper.

Play Hex Sweeper

I originally considered Pixi.js, but after a bit of research decided to go with Phaser since it looked like a fuller framework and not just a graphics library. This ended up being the right choice and I had a basic hex tile demo using tilemapTiledJSON up within an hour. The Scene logic was also intuitive and made it easy to wire things up quickly.

Once the grid was rendering, the next challenge was wrapping my head around how Phaser organizes things. Scenes are the core unit of structure. I split things into a Board scene and a Menu scene which gave me cleaner separation between gameplay and UI state.

Coming from web development did have its advantages though. Ultimately it's JavaScript, so the entire toolchain, build process, npm, deployment, asset loading, is all standard JS project stuff. This let me dive right into working on the game without having to pick up any new skills on that front. I've also been heavily exposed to TypeScript which in game dev feels like more of a must have than in web development. There are a lot of constants and settings that get passed around that you'll want to enforce, and this becomes obvious just thinking about larger games.

I went for a pure Phaser graphics layout. No HTML overlays, no DOM elements. Everything rendered through Phaser's drawing API. This was by far the most tedious part of the project. Coming from modern CSS where you flex, grid, and gap your way to a layout, building UI in Phaser felt like constructing a DOM from scratch. Pixel calculations for every placement. Button states for click, hover, active, all manually wired up. I had two button sets for difficulty and grid size, a timer, and a score display. Not much, but each element needed its own positioning logic and state handling. Even with a minimal interface it took significant tinkering to get things feeling right.

Drawing the assets was actually the most relaxing part. Basic SVG images assembled into sprite sheets for the hex tiles, flags, and bombs. All made in Figma, which was quick for simple geometric shapes. Nothing complex, but it was a nice change of pace from logic work.

Even on a game this small, the code started getting messy. Game logic, rendering, and input handling all tangled together inside the scenes. I didn't bother refactoring since the scope was small enough to ship as-is, but it was clear the next game would need some proper separation. An engine layer for game logic, scenes as controllers that listen for events and coordinate, and dedicated view code for rendering.

Claude was a mixed bag. It was great at setting up specific things like buttons and tilemaps to get something going quickly. But when I started asking architectural questions, like whether it's better to organize things one way or another, it seemed to just look at my codebase, pick up a few keywords, and add to the slop. It has a hard time proposing structure or architecture and instead just tries to go with what you already have, which makes it tough when you're looking for fundamentally better organization.

Towards the end I started asking it about refactoring into a cleaner engine/view separation. It seemed to contradict itself and never really landed on a clear approach. After some separate research and thinking on my own it became pretty obvious what the right structure was, but it wasn't something Claude was able to get to on its own. For the architecture stuff I had to drive it myself and just let Claude handle the implementation.

Ultimately it was a lot of fun making a game and being able to play it in just a few days felt very satisfying. Looking forward to making my next game soon.




© Gamesanova 2026 | Privacy