Logo Pierre Techer
ProjectsArticles
Frensh flag
English flag
Githubtecherpierre.pro@gmail.com

C Pong

A minimalist Pong game in C, developed with SDL2 to deepen my knowledge of low-level programming. This project focuses on understanding how a program works, while providing a simple local multiplayer gaming experience. A fun way to explore the fundamentals of low-level development.

Pong game screen

🎯 Why this project?

I chose to create this project to deepen my skills in C language and discover SDL2 library in more detail. After acquiring the basics of the language, I wanted to put my knowledge into practice in a concrete project, while exploring the graphical and interactive aspects that SDL2 offers. Recreating a simple and iconic game like Pong allowed me to focus on the logic of the code, event handling, and display, without being slowed down by excessive complexity.

📦 Features

  • 🎮 Player vs player: Two players can face off in real-time, each controlling their own paddle via the keyboard.
  • 🧱 Simple physics: The ball dynamically bounces off walls and paddles, making each exchange a little more unpredictable.
  • 🧮 Scoring system: When a player lets the ball pass, the opponent scores a point. The score is displayed on the screen to track the progress of the game.

🛠️Technologies used

  • 🔤 C: A low-level, fast, and demanding language, perfect for getting closer to the foundations of software development.
  • 🖥️ SDL2: A lightweight but powerful graphics library, ideal for handling windows, 2D graphics, and keyboard inputs.
  • ⚙️ Makefile: A simple but essential tool for automating the compilation of the project, launching the game, or cleaning up generated files.

💡Why choose the C language?

At first glance, C may seem very complex compared to other languages like Python or JavaScript. It offers rather basic features, imposes strict typing, sometimes tedious dependency management, and in some cases, even requires manual memory allocation. However, these constraints hide several major advantages, making C a particularly useful language when used in the right context.

1. ⚙️ Close to the hardware, far from abstraction

C is a language known for its speed and closeness to the system. It is commonly used in critical parts of a program, where performance is crucial and fine hardware control is required, such as in embedded systems, game engines, or OS kernels. While not necessary for a simple project like Pong, using C here allows exploring these low-level aspects and better understanding the foundations of system development.

2. 🔎 Understanding programming at its core

Learning C is about going back to the pure basics of programming: types, functions, pointers, memory... Each concept is manipulated explicitly, without unnecessary abstractions. In this sense, coding in C is not just about learning a language, but about understanding what a program truly is and how instructions interact with the system. This clarity makes it a valuable entry point to grasp the fundamental principles found in almost all modern languages.

3. 🧩 A language not so "complex"

Although it may seem daunting at first, C remains fundamentally simple. It offers few abstractions and focuses on a small number of key concepts: variables, types, functions, structures... In the absence of high-level features like classes, promises, or frameworks, you focus on the essentials. This ultimately makes it more predictable and easier to master when you want to write clear, structured code with no hidden magic.

📌 In short

C is particularly suited for contexts where performance and hardware control are essential. It also helps better understand the basics of programming, making it an excellent choice for learning or developing systems close to the hardware.

🎮 How to play the game

  1. Player 1 controls (left):
    • Use the W and S keys to move the paddle up and down.
  2. Player 2 controls (right):
    • Use the ↑ and ↓ keys to move the paddle up and down.
  3. Goal of the game:
    • The goal is to score points by sending the ball into the opponent's goal. Each time the ball touches the area behind a player, the opponent scores a point.
  4. Launch the game:
    • Clone the GitHub repository of the project.
    • To launch the game, make sure to install the necessary dependencies and use the command
make run