Castle Defense: A Flutter Game Powered by FlameEngine

Flutter

The Idea

I’ve always been fascinated by motion-controlled games, simple mechanics that feel physical and responsive.

Castle Defense is a Flutter-made tower defense where you use your Samsung S Pen as the controller :

  • Tilt the stylus to move a crosshair on screen (using the S Pen’s gyro sensors).
  • Press the S Pen button to fire projectiles on incoming enemies.
  • Defend your castle from waves of attackers, upgrade your defenses, and survive as long as possible!

It’s inspired by retro classics like Duck Hunt and Missile Command — re-imagined with modern tools.

Design and Gameplay

The game uses a minimalist pixel-art style.
Enemies spawn in waves, and each successful hit earns money you can use for buying and upgrading defenses.

Each wave increases the tension slightly, forcing the player to adapt. The challenge comes not from complexity, but from timing and pacing. I focused on how small loops create engagement: each wave leads to action, action leads to reward, and reward feeds into upgrades that prepare you for the next round. This “feedback cycle” keeps the gameplay satisfying even with minimal elements on screen.

I used Flame, the Flutter game engine, for entity management, physics, and rendering.

Animated Main menu of the v.1.0.0
Gameplay with the S Pen

Results

  • The spen_remote plugin proved stable and fast enough for real-time motion input.
  • Flutter handled 60 FPS gameplay easily, even on mid-range Samsung devices.
  • Integrating hardware input opened new creative possibilities like using a stylus as a motion controller in a mobile game.

A side experiment showcasing a fully playable proof-of-concept, and demonstrating how Flutter can handle custom input devices and real-time graphics.

What’s Next ?

I plan to expand Castle Defense with:

  • Local Leaderboards and achievements
  • More weapon types and special abilities
  • More upgrades
  • Unit troups on field
  • An open-source release for the Flutter community

If you’re a Flutter developer curious about using native hardware in your projects, check out spen_remote, and stay tuned for the Castle Defense demo releases