I Built a 3D Game in Flutter - With No Game Engine
Everyone says the same thing: Flutter is for apps, not games. So I decided to find out where that's actually true - by building a 3D endless runner in Flutter. From scratch. No Unity, no Unreal, no game engine at all. Just Dart and Flutter's own rendering stack. It runs in your browser right now: โถ๏ธ Play it live (desktop, keyboard controls - A / D to switch lanes, Space to jump). Here's how it works, and what building it taught me about how far Flutter can actually go.
The stack: Flutter GPU + flutter_scene
The whole thing sits on two pieces most Flutter developers have never touched:
- Flutter GPU - a low-level rendering API that talks almost directly to the GPU through Impeller (the engine that replaced Skia). This is what makes real-time 3D possible at all.
- flutter_scene - a higher-level 3D scene API on top of Flutter GPU. It gives you the building blocks a game needs: a scene graph of nodes, a perspective camera, meshes, and glTF model loading.
You build a tree of nodes, point a camera at it, and render it every frame inside a normal Flutter widget. That last part still surprises me - the 3D world is just a CustomPaint-style surface living inside an otherwise ordinary Flutter app.
Faking an infinite world with a handful of objects
An "endless" runner obviously can't build an endless world - you'd run out of memory in seconds. The trick is object pooling: you keep a small pool of track segments and obstacles, and as they scroll past the camera behind the player, you recycle them back to the front with new positions. The player never actually moves forward. The world moves toward the player, and a fixed number of segments cycle forever. Same idea for obstacles and coins. It means the game runs at a constant, tiny memory footprint - which is exactly what keeps it smooth on weaker devices.
The parts that were genuinely hard
Collision that feels fair. Detecting a collision is easy. Making it feel right is not. Too strict and the player rages at hits that "clearly missed." Too loose and it feels cheap. Most of the tuning time went into the hit-boxes and the exact frame timing, not the math.
The camera. A perspective camera that follows an endless track has to sell speed and depth without making the player motion-sick. Small changes to field-of-view and follow distance completely change how fast the game feels at the same actual speed.
Swapping the primitive for a real model. The player started life as a literal spinning cube. Importing a real glTF model meant wrestling with scale, orientation, and lighting until it sat in the world correctly instead of floating sideways in the dark.
The bug that flipped the world upside down. One inverted axis, and the entire scene rendered mirrored - obstacles coming from the wrong direction, the track pointing the wrong way. Three hours of staring. The fix was a single line.
That's build-in-public for you: I get to show you the wins and the facepalms.
So - is Flutter for games?
For a AAA title? No. That's not what this experiment was about. But for real-time 3D, running cross-platform (mobile, desktop, and the web build you just played) from a single Dart codebase - it went much further than "Flutter is only for apps" would ever suggest.
The fastest way to learn a tool's real limits is to take it somewhere it "isn't meant to go." I'm building this in public, one increment at a time - collision, scoring, a start menu, a persistent leaderboard, particle effects. The code is all here: github.com/saqrelfirgany/flutter-scene-runner. If you've pushed Flutter somewhere it "wasn't meant to go," I'd love to hear about it in the comments. And if you want to follow the build, this is part 1 of the series. ๐
Ahmed ElFirgany - Mobile Expert | Flutter ยท Android Native ยท iOS Native | Expanding into Backend (PHP ยท Laravel) | performance & Clean Architecture; building a 3D game in Flutter. Let's connect:
- ๐ผ LinkedIn - linkedin.com/in/ahmed-elfirgany
- ๐ป GitHub - github.com/saqrelfirgany
- ๐ฎ Play the game (live) - saqrelfirgany.github.io/flutter-scene-runner
- ๐ฆ X - @saqrelfirgany
- ๐ฌ WhatsApp - wa.me/201025592065
- โ๏ธ saq**********@gmail.com
Comments
No comments yet. Start the discussion.