A full-stack Dart realtime game example

Last update: Aug 9, 2022

dart_realtime_game

An example of using Dart and Flutter to build a realtime game.

Uses Dart for the full stack, shares code between client and server.

Uses a Entity Component System both for managing the game as well as for network transport.

I did not (yet) implement client interpolation or speculation, so the client only updates on server update pushes (currently 10 times per second).

This does not use any "game" frameworks, just draws directly to canvas. Most game frameworks I've found do not separate state from rendering, so I chose to write my own (very simple) rendering layer.

Usage

Developing locally

melos bootstrap # runs pub get for all packages

cd packages/server
dart run bin/serve.dart


cd packages/client
flutter run

I typically run the server from the terminal and the client from VS Code.

Building docker files locally

docker build -f .\dockerfiles\frontend.Dockerfile -t frontend . 
docker build -f .\dockerfiles\backend.Dockerfile -t backend .

Known issues

  • Server leaks 2 PhysicsComponents on hot-restart.
  • Server leaks player connections when players drop (leaving zombies).
  • Server spins even when no players are connected.

Things left on my TODO (no further development currently planned)

  • Make rendering layer interpolate from GameState.
  • Remove all uses of DateTime.now() and move clientTime to Duration.
  • Only time clientTime can be accessed is through tick callback elapsed.
  • Make WebSockets reconnect automatically.
  • Draw animation on mouse click.
  • Add ability to have players damage each other.
  • Fix rendering to draw centered around position.
  • Ability to set a color and name.
  • Abitilies triggered by keys/buttons.
  • Pickups/buffs which change something.
  • Add database to hold server state.
  • Make rendering fancier (e.g. walk cycle)
  • Add background tiles (like forest)
  • Switch to 3d frontend.

Inspirations

GitHub

https://github.com/eseidel/dart_realtime_game
You might also like...

Tic-tac-toe - A fun Tic Tac Toe game made with dart

Tic-tac-toe - A fun Tic Tac Toe game made with dart

Tic Tac Toe game app This is a tic tac toe game app with all dart facilities. Sc

Jul 26, 2022

Copying of the famous WORDLE game in dart using Flutter

Wordle Copia del famoso juego WORDLE en dart usando Flutter. Reglas Las palabras solo se pueden escribir en minusculas Al finalizar la palabra tienes

Jul 16, 2022

A Dwarf game made with Dart, Flutter and Flame

Dwart Generated by the Very Good CLI 🤖 Dwart game Getting Started 🚀 This project contains 3 flavors: development staging production To run the desir

Jun 11, 2022

An example Flutter app showing how to easily integrate with Flame games

space_burger A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Jun 4, 2021

A minimalist Flutter game engine

A minimalist Flutter game engine

A minimalistic Flutter game engine. English | 简体中文 | Polski | Русский About 1.0.0 Our goal is to release v1 soon. We are periodically launching RCs (r

Aug 18, 2022

How to build a Match-3 game, like Candy Crush, Bejeweled, FishDom… in Flutter.

How to build a Match-3 game, like Candy Crush, Bejeweled, FishDom… in Flutter.

flutter_crush How to build a Math-3 game, like Candy Crush, Bejeweled, FishDom… in Flutter. Source code of the article available on didierboelens.com

Aug 6, 2022

a tetris game powered by flutter. 使用flutter开发俄罗斯方块。

a tetris game powered by flutter. 使用flutter开发俄罗斯方块。

English introduction Please view README_EN Flutter俄罗斯方块 使用Flutter开发的俄罗斯方块游戏。支持 Android, iOS, Windows, mac, Linux 以及 web. 参考来源于 vue-tetris 。 如何开始 自行编译

Aug 15, 2022

Party Charades game created in Flutter.

Party Charades game created in Flutter.

Party Flutter Mobile party game implemented in Flutter framework. Its been heavily inspired by the Heads Up! game: Get a group of friends (at least 3

Aug 12, 2022

Cyberpunk-inspired puzzle game prototype created with Flutter and Flame #Hack20 #FlutterHackathon

Cyberpunk-inspired puzzle game prototype created with Flutter and Flame #Hack20 #FlutterHackathon

Ghost Rigger Prototype of a cyberpunk-inspired puzzle game set in a dystopian future: In the year 2078, the megacorporation Native Development Initiat

Aug 5, 2022

Related

An example of using InteractiveViewer to build a go game board
An example of using InteractiveViewer to build a go game board

Go An example of using InteractiveViewer to build a Go game board. Try the live demo. Usage Zoom using pinch on mobile or two-finger scroll on touchpa

Jun 4, 2022
An application cum Game-based App built using Flutter that compose a mind-tricked word game, Just for fun.

destini_challenge A new Flutter application. Getting Started This project is a starting point for a Flutter application. A few resources to get you st

Feb 3, 2022
M.U.D. Role-playing text-based game. A multiple-choice multiplayer interactive game developed on Flutter (Android, iOS, Windows, Web)
M.U.D. Role-playing text-based game. A multiple-choice multiplayer interactive game developed on Flutter (Android, iOS, Windows, Web)

Teia M.U.D. Role-playing text-based game. A multiple-choice multiplayer interactive game developed on Flutter (Android, iOS, Windows, Web). The main f

Feb 17, 2022
Warrior Runner - Game made with Flutter and Flame game engine
Warrior Runner - Game made with Flutter  and Flame game engine

Warrior Runner - Game made with Flutter Demo and Screenshot Flutter Version Used : 1.22.4 flame: 0.29.3 hive: 1.5.0-pre Learing Resources: Create a Mo

Aug 7, 2022
Snake-Game - A flutter based classic snake game with nothing just and just a feel to have play

snake_game This is a simple snake Game under development made with the help of y

Mar 22, 2022
Game characters ui - A redesign of a game characters app using flutter

Game characters ui - A redesign of a game characters app using flutter

Jul 30, 2022
Flutter Switch Game: Get Fun With Play This Game
Flutter Switch Game: Get Fun With Play This Game

switch_game A new Flutter project. Getting Started Try Swap red circle to green

Jun 17, 2022
A simple dice game built using Flutter, that allows users to engage in a dice game

A simple dice game built using Flutter, that allows users to engage in a dice game. Each player rolls the dice and the highest value number that you can make WINS!

Jun 15, 2022
The simple game known as Tic Tac Toe developed with Flutter and Dart language
The simple game known as Tic Tac Toe developed with Flutter and Dart language

tic_tac_toe A new Flutter project. Game Restarted : Getting Started This project is a starting point for a Flutter application. A few resources to get

Oct 15, 2021
An online version of the popular game four in a row, written in Flutter + Dart on the client and Rust on the server side.
An online version of the popular game four in a row, written in Flutter + Dart on the client and Rust on the server side.

Four in a Row - App An online version of the popular game four in a row, written in Flutter + Dart on the client and Rust on the server side. Download

Aug 12, 2022