Skip to content

vyavdoshenko/dragonfly-for-fun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dragonfly for fun

Games & Demos powered by Dragonfly Lua scripting.

All game logic runs as Lua scripts inside Dragonfly — a modern, Redis-compatible in-memory data store. The Python clients just send EVAL and render the result. The database IS the game engine.

Prerequisites

  • Docker
  • Python 3.8+

Start Dragonfly

docker run -d --name dragonfly -p 6379:6379 docker.dragonflydb.io/dragonflydb/dragonfly

Install dependencies

pip install -r requirements.txt

Examples

1. Snake (Multiplayer)

A multiplayer snake game. Each player connects from a separate terminal. Dragonfly handles all game logic — movement, collisions, food spawning — in a single atomic Lua script.

# Terminal 1:
python3 examples/snake.py alice

# Terminal 2 (optional — join the same game):
python3 examples/snake.py bob

Controls: Arrow keys / WASD to move, Q to quit, R to respawn when dead.

Snake

2. Game of Life

Conway's Game of Life. The entire simulation (birth, death, survival) runs inside Dragonfly. The client renders the universe using braille characters for high-resolution output.

python3 examples/game_of_life.py

Press Ctrl+C to stop.

Game of Life

3. Doom Fire

The classic DOOM PSX fire effect. Fire physics are computed inside Dragonfly and rendered with true-color ANSI output.

python3 examples/doom_fire.py

Press Ctrl+C to stop.

Doom Fire

Connecting to a remote Dragonfly instance

All examples accept optional host and port arguments:

python3 examples/snake.py alice 192.168.1.10 6379
python3 examples/game_of_life.py 192.168.1.10 6379
python3 examples/doom_fire.py 192.168.1.10 6379

License

See LICENSE.

About

Games & Demos powered by Dragonfly Lua scripting.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors