In short, this is my Pong clone so far. AI needs tweaking, I will get to that soon. 

(AI updated and is better balanced)

https://medium.com/@tmaurodot/building-a-single-player-pong-clone-in-unity-step-...

How to Play Single-Player Pong

  • Start: Click “Play” on the menu screen (scores 0, timer “Time: 60”).
  • Round Begins: Gameplay music starts, ball resets with a 2-second countdown (“2” to “1”), then launches.
  • Control Paddle: Use W (up) and S (down) keys for the left paddle.
  • Catch Ball: Hold Spacebar to catch the ball on hit, release to throw it right.
  • Score: Get the ball past the AI’s right paddle (Player scores), AI scores if it passes your left paddle.
  • AI Paddle: Right paddle follows the ball, may catch and release it leftward.
  • Audio: Hear paddle hit sounds; music switches between menu and gameplay.
  • Round Ends: Timer hits 0, gameplay stops, scores stay visible.
  • View Scores: 10-second countdown (“10” to “1”) shows before reset.
  • Reset: Scores clear, menu music plays, “Play” button returns—click to restart.


How to Play Single-Player Pong: Step-by-Step Guide

Welcome to Single-Player Pong! This guide will walk you through how to play the game, compete against the AI, and enjoy the unique features like catching the ball and round-based gameplay. Let’s get started!

Step 1: Start the Game

  • Launch the Game: Open the game in Unity or your built executable.
  • Menu Screen: You’ll see a “Play” button in the center, scores at 0 (top left and right), and a timer showing “Time: 60” (top center). Menu music will play in the background.
  • Action: Click the “Play” button to begin a round.

Step 2: Begin the Round

  • Round Start: The “Play” button disappears, gameplay music starts, and the ball resets to the center.
  • Countdown: Watch the center of the screen for a 2-second countdown (“2” then “1”) before the ball launches in a random direction.
  • Timer: The top timer starts counting down from 60 seconds (or the set round duration), indicating how long the round lasts.

Step 3: Control Your Paddle

  • Player Paddle: You control the left paddle.
  • Movement: Use the W key to move up and S key to move down (or Up/Down arrow keys). The paddle stays within the top and bottom walls.
  • Catch the Ball: Hold the Spacebar when the ball hits your paddle to catch it. Release the Spacebar to throw the ball rightward (with some vertical speed based on your paddle’s movement).
  • Goal: Hit the ball past the AI’s paddle on the right to score.

Step 4: Understand the AI Paddle

  • AI Paddle: The right paddle is controlled by the computer.
  • Behavior: It follows the ball’s vertical position to block your shots. Occasionally (50% chance), it catches the ball on contact and releases it leftward after 0.5–2 seconds.
  • Challenge: Try to outmaneuver the AI to score points!

Step 5: Score Points

  • Scoring:
    • If the ball passes the AI’s paddle and hits the right goal, you (Player) gain 1 point (top-left score updates).
    • If the ball passes your paddle and hits the left goal, the AI gains 1 point (top-right score updates).
  • Ball Reset: After each score, the ball returns to the center, pauses for a 2-second countdown (“2” to “1”), then launches again, keeping the round going.

Step 6: Listen to Audio Cues

  • Music: Gameplay music plays during the round, switching to menu music when the round ends.
  • Sound Effects: Hear a “ping” sound each time the ball hits a paddle, adding to the classic Pong feel.

Step 7: End the Round

  • Round Duration: The round ends when the timer reaches “Time: 0” (after 60 seconds or your set duration).
  • End Screen:
    • Gameplay music stops, and the ball resets with its 2-second countdown.
    • Your final scores (Player vs. AI) remain visible.
    • A countdown text appears below the center, ticking down from “10” to “1” over 10 seconds, showing how long until the game resets.

Step 8: View Final Scores and Restart

  • Score Display: For 10 seconds after the round, check your final scores (e.g., Player: 5, AI: 3) to see who won.
  • Reset: After the 10-second countdown ends:
    • Scores reset to 0.
    • Menu music resumes.
    • The “Play” button reappears.
  • Next Round: Click “Play” again to start a new round and keep the challenge going!

Tips for Success

  • Master the Catch: Use the Spacebar strategically to catch and release the ball at the right moment to throw off the AI.
  • Stay Alert: The ball speeds up slightly each time it hits a paddle, so keep your reflexes sharp.
  • Outsmart the AI: Move your paddle to trick the AI into missing the ball.

UPDATES Star Date 3/18/2025

Summary of Updates

  1. Initial Setup (Pong Clone Basics):
    • Created a single-player Pong game with a player paddle (left, W/S keys), AI paddle (right), and one ball.
    • Added scoring (player vs. AI), paddle hit SFX, and basic ball reset with a 2-second countdown.
  2. End-Game Display:
    • Added a 10-second delay after the round ends (timer hits 0) to show final scores before resetting to the menu.
    • Included a countdown text (10 to 1) during this delay for visual feedback.
  3. Player Instructions:
    • Provided a step-by-step guide for end users: start round, control paddle (W/S, Spacebar to catch), score points, pause/resume, adjust volume.
  4. AI Paddle Improvements:
    • Fixed AI paddle issues:
      • Prevented upward-only movement when catching; now moves randomly (up/down) while holding.
      • Eliminated rapid shaking by updating movement direction every 0.5–1.5 seconds.
    • AI tracks the closest uncaught ball with two-ball setup.
  5. Screen Shake:
    • Added a 0.3-second screen shake (0.1 magnitude) when a score is made, triggered in IncreasePlayerScore/IncreaseAIScore.
  6. Scoring SFX:
    • Added an AudioSource (scoreSFX) to play a sound (e.g., “ding”) alongside the screen shake when scoring.
  7. Volume Slider & Pause Button:
    • Added a UI Slider to adjust music volume (menu and gameplay) from 0 to 1, always accessible.
    • Added a Pause Button to toggle gameplay (freeze with Time.timeScale = 0, resume with 1), shown only during rounds.
  8. Two Balls:
    • Replaced single ball with a Ball[] balls array (size 2) in PongGameManager and AIPaddle.
    • Both balls reset and launch on round start; AI tracks the closest uncaught ball.
    • Fixed premature round start by removing ResetBall() from Ball.cs’s Start(), controlled by PongGameManager.
  9. Stuck Ball Handling:
    • Added dual stuck mechanics:
      • 3 Seconds: Ball redirects with a new random direction if stuck (velocity < 0.1).
      • 5 Seconds: Ball resets to center with countdown if still stuck.
    • Logic only runs when isRoundActive is true, preserving menu state.
  10. Menu Restoration:
    • Fixed game starting on launch by initializing balls as stopped (isKinematic = true) in Ball.cs’s Start(), launching only when StartRound() sets isRoundActive = true.

That’s it! You’re ready to enjoy Single-Player Pong. Have fun bouncing the ball, scoring points, and beating the AI in this modern twist on a classic game!


Published 15 days ago
StatusReleased
PlatformsHTML5
AuthorMauroDot
GenreAction
Made withUnity

Leave a comment

Log in with itch.io to leave a comment.