TetriC — architectural layout and system interface preview
SystemsEngineering Case Study

TetriC

A modular, console-based multiplayer Tetris game built in C for a university Software Engineering project. Features single-player, local two-player, and socket-based network multiplayer over TCP.

Windows C11 Console Game & Winsock2 Multiplayer
Role & ScopeDeveloper / Systems Project
Target DomainSystems · Production
Core RuntimeC, Socket Programming, Game Development
Operational & Architectural Invariants:
Windows Winsock2 (ws2_32) networkingFrame-accurate terminal game loopRaw ANSI terminal escape code rendering

The Problem

Implementing real-time interactive multiplayer in a resource-constrained terminal environment requires strict frame timing, low-latency socket networking, and cross-platform terminal I/O handling in pure C.

Technical Approach

Built a modular ANSI terminal game engine in C11 with matrix-based collision detection, non-blocking keyboard input, and Windows Winsock2 TCP socket networking for multiplayer matches.

TetriC Multiplayer Terminal Session (2-Player TCP Socket)

tetric-network-multiplayer — posix-tcp-socket
┌── PLAYER 1 (Local) ──┐        ┌── PLAYER 2 (Remote) ─┐
│ SCORE: 01420  LVL: 04 │        │ SCORE: 01180  LVL: 04 │
│ [■][■]                │        │          [■][■]       │
│ [■][■]        NEXT: Z │  TCP   │          [■][■]       │
│                      ───PACKET──>                     │
│       [■][■][■][■]    │  PORT  │    [■][■][■]          │
│ [■][■][■][■][■][■][■] │  8080  │ [■][■][■][■][■][■][■] │
└───────────────────────┘        └───────────────────────┘
[CLIENT] Sent BOARD_UPDATE payload (200 bytes) | Frame latency: sync ok

Terminal representation of the non-blocking matrix rendering and network packet synchronization.

Key Highlights & Architecture

  • Console-based Tetris implemented in pure C with matrix rotation and collision algorithms
  • Local two-player and socket-based network multiplayer over TCP
  • Dynamic score progression, levels, and persistent high score leaderboards

Engineering Challenges

  • Synchronizing piece drop ticks and line clears between two separate network machines without gameplay jitter.
  • Handling ANSI terminal escape codes and screen buffering cleanly in the Windows console environment without tearing.

Key Engineering Decisions

  • Non-blocking I/O with select(): Enabled concurrent handling of player keypresses and incoming network socket packets.
  • Compact Binary Network Protocol: Encoded board states and line-clear events into lightweight fixed-size binary structs.
Architecture Decision Records (ADRs)

Trade-Off Analysis & Architectural Rationale

✓
Decision Made

Non-blocking select() Event Loop

✕
Alternative Rejected

Multi-threaded blocking socket reads

Why It Won (Technical Rationale)

Ensures game tick updates and keyboard inputs are never stalled by delayed network packets.

Trade-Off Accepted

Requires state machine handling of partial packet reads across socket buffers.

Result & Outcome

Successfully created and demonstrated a responsive, network-capable terminal Tetris game for a university Software Engineering project.

Technologies & Tools

CSocket ProgrammingGame DevelopmentMultiplayerAlgorithms