---
title: "Real-Time WebSocket Tetris on WIZnet Pico — Fully Embedded HTML5 Game Server"
url: "https://maker.wiznet.io/matthew/projects/real-time-websocket-tetris-on-wiznet-pico--fully-embedded-html5-game-server/"
markdown_url: "https://maker.wiznet.io/matthew/projects/real-time-websocket-tetris-on-wiznet-pico--fully-embedded-html5-game-server/md"
type: "WCC: WIZnet Created Content"
author: "matthew"
author_url: "https://maker.wiznet.io/matthew/"
original_author: "Matthew"
published: "2025-06-26"
language: "en"
likes: 0
views: 4188
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Real-Time WebSocket Tetris on WIZnet Pico — Fully Embedded HTML5 Game Server

> Real-time Tetris server on WIZnet Pico using WebSocket and embedded HTML5. Just connect to the board's IP in a browser and start playing instantly!

Original author: Matthew

## Documents and links

- [Tetris C/C++ Source](https://github.com/wiznetmaker/Tetris-Game-on-WIZnet-Pico-with-WebSocket-based-HTTP-Server/tree/main/tetris) (code)

## Article

## 🕹️ Introduction

This project brings a nostalgic game—Tetris—into embedded networking using WIZnet's Ethernet chip and RP2040. No need for Wi-Fi or internet—just plug an Ethernet cable into your PC and start playing Tetris directly in your web browser, powered by a fully embedded web server on the WIZnet Pico board.

---

## 🔌 How It Works

This project uses the WIZnet W6300-EVB-Pico2 board (or compatible WIZnet Pico boards) as a fully self-hosted web server. When you power the board and connect it directly to your PC via Ethernet, it serves a playable HTML+JavaScript Tetris game—no router, no internet, and no external software needed.

The embedded HTTP server handles requests and streams the game using WebSocket-style communication, updating the board in real-time via JSON.

---

## 🎮 How to Play

You can enjoy Tetris in just a few simple steps:

**Connect via Ethernet:** Plug the board directly into your PC using an Ethernet cable.

**Access the Game:** Open your browser and visit `http://192.168.11.200`.

**Play Instantly:** The Tetris game loads in your browser—play using your keyboard!

The embedded board hosts all files (HTML/JS) and handles live key inputs via WebSocket-like TCP communication.

---

## 🛠️ Hardware & Setup

**Board:** WIZnet W6300-EVB-Pico2 (or any WIZnet-supported RP2040 board)

**Connection:** Ethernet cable from board to PC (no router required)

**Power:** USB connection for power and serial debugging

**No Internet or external server required**

---

## 🧠 Firmware Overview

This project is built with:

**Pico SDKWIZnet ioLibrary Driver** for W6300

**Custom **`**tetris_logic.c**` for game state and rendering

**Embedded WebSocket-like handler** for real-time browser input/output

**Precompiled HTML/JavaScript** included as C headers using `xxd`

The game responds to input like `"left"`, `"right"`, `"rotate"` via JSON over TCP, updating the game board in real time.

---

## ✨ Highlights

✅ **No internet required**: Fully local browser experience

✅ **Built-in server**: HTML, JS, and WebSocket-like handler all embedded

✅ **Plug-and-play**: Just connect and open the browser

✅ **Playable from any modern browser**

✅ **Optimized for WIZnet Pico C SDK**: Seamless integration

## ✅ Results

With the firmware flashed and the board powered, Tetris loads instantly in your browser. You can play with arrow keys, and the game state updates in real time. The WebSocket-style implementation allows smooth gameplay without needing complex browser/server negotiation.

[Embedded media](https://www.youtube.com/embed/hQ6AhSYDweU)

🧾 Conclusion

This project is a fun yet powerful demonstration of how embedded devices like WIZnet’s Ethernet-enabled RP2040 boards can host real-time applications like games entirely from onboard memory—no internet, router, or external hardware. It's a proof of concept that embedded systems can be fun, interactive, and nostalgic.

You can build on this foundation to add scores, multiple pages, or even multiplayer in the future!

---

Source: https://maker.wiznet.io/matthew/projects/real-time-websocket-tetris-on-wiznet-pico--fully-embedded-html5-game-server/
