- Project 1: “Meteor Shower” (Components & Randomness)
- Project 2: “Brick Breaker” (Collision & Input)
- Project 3: “Top-Down Walker” (Camera & Zoom)
- Objective: Implement independent movement and aiming.
- Tasks:
- Use a
JoystickComponent(fromflame_joystickpackage) for movement. - Use
onPanUpdateon the right side of the screen to aim (rotate the player toward the touch point). - Spawn bullets (small components) from the player's position in the aim direction when a "Fire" button is held.
- Add targets that disappear when hit by bullets.
- Use a
- Hint: How do you convert a touch position (screen coordinates) to a world direction? (Hint:
camera.globalToLocal). - Resource: Flame
flame_joystickpackage docs.
- Objective: Manage two weapon slots and ammo.
- Tasks:
- Create a
WeaponDataclass (damage, fire rate, ammo capacity). - Give the player two
WeaponDataslots. A button toggles the active slot. - Shooting consumes ammo from the active weapon. When ammo is 0, the weapon cannot fire.
- Add a pickup that refills ammo or swaps a weapon.
- Create a
- Hint: Where should the weapon state live—on the player component, or in a separate "inventory" class? How does the UI read this state?
- Resource: Flame docs: Game Loop & State (how to structure game data).
-
Objective: Implement projectile and instant-hit attacks.
-
Tasks:
-
Bomb: Spawn a bomb component that arcs (simple physics) and creates an explosion (an area collision) after a timer.
-
Melee: On button press, check for enemies within a short radius using
HasCollisionDetectionor a simple distance check. -
Both attacks consume separate "bomb" and "melee" counters.
-
Hint: How can you use
TimerComponentfor the bomb fuse? For melee, is it easier to use a circle hitbox that is only active for a few frames? -
Resource: Flame docs: Effects & Timers.
- Objective: Load and switch between levels.
- Tasks:
- Install
flame_tiled. Create a simple map in the Tiled editor (platforms/obstacles). - Load it with
TiledComponent.load(). - Use object layers from Tiled to define spawn points for players and pickups.
- Add a way to switch between 3 different
.tmxfiles.
- Install
- Hint: How do you make the camera respect the map boundaries? What is a
Boundarycomponent? - Resource: Flame docs: Tiled.
- Objective: Send and receive raw data between two instances on your machine.
- Tasks:
- Create a simple Flutter app (no game) that sends a UDP packet to
127.0.0.1on a fixed port. - Listen on that port and print the received message.
- Send a serialized object (e.g., a
Mapencoded as JSON bytes) instead of a string.
- Create a simple Flutter app (no game) that sends a UDP packet to
- Hint: What is the difference between
RawDatagramSocket.bindandconnect? Why must you listen forRawSocketEvent.read? - Resource: Dart
RawDatagramSocketAPI docs.
- Objective: Sync one player's position to another device.
- Tasks:
- One instance is the Host (binds and listens). The other is the Client (sends its input to the host's IP).
- The host simulates both players. It sends back the authoritative positions 20 times per second.
- The client renders its own player immediately (for responsiveness) but renders the remote player using the received positions (with interpolation).
- Hint: Why does the client need to interpolate? What happens if you just snap to the received position? (Look up "snapshot interpolation").
- Resource: ENet Dart package (designed for Flame multiplayer). Also, the
mopongGitHub repo shows a minimal 2-device UDP/ZeroConf example.
- Objective: Automatically find a host on a local network without typing IPs.
- Tasks:
- Host broadcasts a "beacon" UDP packet to
255.255.255.255every second. - Client listens on that port and shows a list of discovered hosts.
- Connect to the selected host.
- Host broadcasts a "beacon" UDP packet to
- Hint: What are the Android/iOS permissions needed for local network access? (Android:
INTERNET,ACCESS_NETWORK_STATE,CHANGE_WIFI_MULTICAST_STATE; iOS:NSLocalNetworkUsageDescription). Remember: neither OS lets you enable the hotspot programmatically. - Resource:
nearby_connectionspackage (as a fallback that works over Bluetooth/Wi-Fi without a hotspot).
- Objective: Combine everything into a single loop.
- Tasks:
- Integrate the two-finger controls, weapons, bombs, melee, and inventory from Phase 2.
- Add the host-authoritative netcode from Phase 3.
- Use Tiled maps for the 3 arenas.
- Add a health bar (Flutter overlay widget listening to game state) and a lobby screen.
- Hint: Don't try to sync everything at 60Hz. Sync only inputs from clients to host, and snapshots (positions, health, ammo) from host to clients. Use a
FixedTimeStepin the host's game loop for consistency.
- Google Codelab: Introduction to Flame with Flutter (Covers GameWidget, game loop, components, collisions, effects, and state management).
- Official Flame Docs:
docs.flame-engine.org(Camera, Collision, Tiled, Effects). - Book: Flame Game Development (A project-based book with examples like Meteor Shower and Jump Between Tiles—use it for inspiration, not copy-paste).
- Multiplayer:
enetpackage,mopongrepo, and the DEV article on real-time multiplayer with Flame.
One final hint: When you get stuck, don't look for a full solution. Instead, search for the specific API name (e.g., camera.zoomTo, HasCollisionDetection, RawDatagramSocket). The official docs and the Flame examples folder on GitHub are your best debugging companions.