Skip to content

PixelWars is a collaborative pixel art battlefield powered by Deno, WebSockets, and Telegram authentication. Users can join the game, draw pixels on a shared canvas, and watch the artwork evolve in real time.

Notifications You must be signed in to change notification settings

xecut-me/pixelwars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎨 pixelwars.xecut.me

PixelWars is a collaborative pixel art battlefield powered by Deno, WebSockets, and Telegram authentication.
Users can join the game, draw pixels on a shared canvas, and watch the artwork evolve in real time.


πŸš€ Features

  • Shared Canvas: A global pixel board where all connected users can draw.
  • Real-Time Updates: WebSocket-based synchronization between all players.
  • Access Control:
    • Read-Only for guests.
    • Read-Write for authenticated users (via Telegram bot).
  • Persistence: Pixel state is stored in /data/pixels.bin and periodically snapshotted.
  • Auto-Reconnect: Clients reconnect if the WebSocket drops.
  • Telegram Integration:
    • Bot checks membership in a Telegram group.
    • Provides unique secret_token links for verified users.
    • Guests are redirected to a group invite link.

πŸ“¦ Installation

Requirements

1. Clone the repository

git clone https://github.com/your-username/pixelwars.git
cd pixelwars

2. Set environment variable

Create a .env file:

PIXELWARS_API_KEY=your-telegram-bot-token

3. Run with Docker Compose

docker-compose up -d

The service will be available at http://localhost:8080.


πŸ›  Development (without Docker)

You can run directly with Deno if you prefer:

deno run --allow-all main.js

πŸ“‚ Project Structure

.
β”œβ”€β”€ Dockerfile         # Container setup (Deno runtime)
β”œβ”€β”€ docker-compose.yml # Orchestration + persistence
β”œβ”€β”€ main.js            # Main server & client logic
└── README.md          # This file

πŸ–ΌοΈ How It Works

  1. Open the canvas in your browser:

    http://localhost:8080
    
  2. By default, you are in read-only mode. To draw pixels:

    • Start a private chat with the Telegram bot: @pixelwars_xecut_bot.

    • If you’re a member of the group, the bot gives you a unique access link:

      http://pixelwars.xecut.me/?secret_token=xxxx-xxxx-xxxx
      
    • Open the link β†’ you’re now in read-write mode.

  3. Draw pixels with your mouse or touchscreen.


πŸ”’ Security

  • All pixel modifications require a valid secret_token.
  • Tokens are bound to Telegram users.
  • Server runs under a non-root user (deno:deno) with no-new-privileges.

About

PixelWars is a collaborative pixel art battlefield powered by Deno, WebSockets, and Telegram authentication. Users can join the game, draw pixels on a shared canvas, and watch the artwork evolve in real time.

Resources

Stars

Watchers

Forks