A full-stack Dart realtime game example

Related tags

Gaming game dart
Overview

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

You might also like...

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

Jan 2, 2023

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

Jan 8, 2023

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

Nov 28, 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 。 如何开始 自行编译

Dec 23, 2022
Owner
Eric Seidel
My dayjob is as @eseidelGoogle. This houses my free-time hacking.
Eric Seidel
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

Justin McCandless 56 Dec 30, 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

dev_allauddin 3 Feb 3, 2022
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

Pedro Gonçalves 3 Feb 17, 2022
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

Mohammed Hashim 20 Oct 10, 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

Shubham Kumar 2 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

null 20 Oct 23, 2022
Flutter Switch Game: Get Fun With Play This Game

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

Sermed Berwari 1 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!

Dubem Ezeagwu 1 Sep 1, 2022
Game Flutter Using Flame.It was for the Game Jam 2022

binarymemory Memory Binary Flame Flutter Game Jam Getting Started This project is a starting point for a Flutter application. A few resources to get y

Victor Manuel Lagunas Franco 2 Sep 7, 2022
A starter game in Flutter with all the bells and whistles of a mobile (iOS & Android) game

A starter game in Flutter with all the bells and whistles of a mobile (iOS & Android) game including the following features: sound music main menu scr

Samuel Abada 14 Dec 22, 2022