Skip to content

Chaotic-Legend/Pong

Repository files navigation

Static Badge GitHub top language

Pong | Project Touchstone

How to make PONG in Godot 4 for beginners by Kaan Alpar (GitHub)

This video tutorial offers a beginner-friendly guide to developing a modern 2D Pong game in the Godot Engine, walking viewers through the key systems needed to create responsive paddle controls and a competitive gameplay loop. It introduces and applies key concepts, including node-based scene organization, collision setup, input mapping, paddle movement, ball physics, scoring system, UI elements, and game reset conditions. This tutorial also covers essential gameplay features, including implementing ball movement, handling paddle interactions, managing score updates, programming the computer opponent, and incorporating sound effects to enhance feedback during bounces and scoring. It also served as the foundation for completing a structured implementation task on Feather, with the project integrated into the wider development workflow supporting the Handshake AI Project Touchstone initiative.

Assets

Pong Assets by Kaan Alpar (GameDev.tv)

Sprite Asset

Create a Godot task

What application is this task for?
Godot

Task prompt

First, enter the task prompt and any relevant reference files (e.g., docs, diagrams, sketches, photos, schematics).

Tasks should sound like what a manager might give a skilled but junior employee: high-level guidance with some leeway on executional details, but with very clear success metrics. What a good outcome looks like must be very clear and easy to understand.

Include any relevant reference files (docs, diagrams, sketches, photos, schematics, etc) needed for someone to complete this task.

Reminder on the difference between reference and starting state files:

  • Reference files: anything the Employee should look at or read while completing the project that does not need to be directly loaded into the application ('please make something that looks like XYZ image')
  • Starting state files (upload below): anything that the Employee would need to load into their workspace to complete the task ('here is the existing file you should adapt')

Task prompt (ask the Employee)
We are beginning development of a modern 2D Ping Pong arcade game that emphasizes precise timing, spatial awareness, and competitive reflexes to create a clear and engaging gameplay experience. Your task is to design and implement a complete system for two players and a bouncing ball, using two short, white, rectangular, vertical paddles and a small white square ball. You will organize the scene hierarchy and configure object relationships to support structured gameplay interactions, ensuring paddles, ball physics, scoring zones, UI elements, and game states are properly layered and consistently managed. This system should establish the foundations for movement, collision behavior, scoring, and match progression. The game system must prioritize responsiveness, clarity, and consistency by incorporating well-structured keyboard input handling, accurate collision detection, and a stable locked camera system that maintains a clear view of the entire playfield at all times. All visual assets, including paddles, ball, UI elements, and level boundaries, must render sharply and clearly without distortion, preserving strong visual clarity throughout gameplay. A white dashed line should divide the center of the playfield, and pressing the E key should toggle a solid predictive trajectory line that visualizes the ball's path after a paddle hit. The game environment and all menu screens must use a completely black background to ensure high contrast with gameplay elements. The completed game system must support the following behaviors:

  • The paddles move up and down with the W and S keys and the arrow keys, and stop when released.
  • The ball always starts at the center and gradually increases speed after each paddle bounce.
  • The ball plays one of two random beep sounds when it bounces from walls and paddles.
  • The game resets when pressing the R, restoring all gameplay states, positions, and UI elements.
  • The score increases by one point when the ball enters either goal zone, triggering a win sound effect.
  • The main menu is titled "PING PONG" at the center top with three vertically stacked mode buttons.
  • The game supports three separate modes: "Player 1 vs COM," "Player 1 vs Player 2," and "COM vs COM."
  • Pressing the Q key enables debug mode with ball control using the U/H/J/K keys and hides the trajectory line.
  • Pressing the P key pauses the game with a centered "PAUSED" label, and pressing it again resumes the game.
  • Pressing the Escape key returns to the main menu or closes the game when pressing it from the main menu.
  • The game includes a 10-point win condition that triggers a new round and resets the score.

Collision and scoring systems must reliably detect interactions between the ball, paddles, walls, and goal zones, ensuring correct score updates and consistent ball resets after each point. Sound feedback should be event-driven, with collision and scoring events triggering appropriate audio cues without delay. Computer opponent behavior must follow a predictable tracking system that maintains fairness while still providing a consistent challenge across different matchups. Game state management must support complete resets that restore gameplay flow, including score state, ball positioning, and match progression logic. UI systems must dynamically transition between menu and gameplay states, ensuring clear separation between the title screen, mode selection interface, and active match display. All additional systems, such as pause control, debug functionality, trajectory visualization, and menu navigation, must integrate cleanly into a unified state structure without disrupting core gameplay mechanics. This structure must remain modular and extensible, supporting future expansion of game modes, enhanced opponent logic, and additional rule variations while preserving consistent physics, input responsiveness, and state behavior across all gameplay scenarios.

Which of the following best fits this task?
Task from scratch

How long would you anticipate an 'Employee' to complete this task? (in hours)
3

Starting state

Please describe and include below any information about the starting state of this project:

  • Existing work to be modified
  • Other assets or other inputs the Employee needs to bring to be able to complete this task

Reminder on the difference between the starting state and the reference files:

  • Starting state files: anything that the Employee would need to load into their workspace to complete the task ('here is the existing file you should adapt')
  • Reference files (upload above): anything the Employee should look at or read while completing the project that does not need to be directly loaded into the application ('please make something that looks like XYZ image')

Starting state description
The starting state file will begin with a newly created 2D Godot project with no gameplay systems, scenes, scripts, or visual assets other than the default setup. The only external resources included are a small set of audio files supplied in a ZIP archive, intended solely to support in-game feedback. These audio assets are sound effects for ball collisions with paddles and walls, and a distinct sound effect for when the ball reaches a goal area to score a point. The Employee is responsible for designing and implementing a complete Ping Pong-style game from the ground up, using only the provided audio assets for feedback, which includes constructing all required scenes, nodes, scripts, collision systems, player and computer paddle behavior, ball physics, scoring logic, UI elements, and game flow management such as round resets and win conditions. All visual elements, including paddles, ball, background, UI text, and lines, must be created programmatically or using basic shapes within the engine, without relying on any external visual asset files.

Overall context

Finally, include context on this task and why it is realistic and representative of real-life work:

  • Why is this a reasonable task for a manager to ask a junior-level employee to do?
  • Is there a larger project it might be a part of?

Task context
This task is a realistic and appropriate assignment for a junior-level developer, as it focuses on implementing the core mechanics of a classic 2D Ping Pong-style game. It involves building fundamental systems, including ball physics, paddle movement for both player and computer control, collision detection, scoring conditions, and round reset logic. The work requires applying essential programming and problem-solving skills to translate design requirements into interactive gameplay, while integrating audio feedback, input handling, and game state management into a cohesive experience using only provided sound assets. This type of task reflects common real-world development practices, where developers are responsible for constructing gameplay systems from minimal starting resources, organizing scenes and logic, and implementing reusable, maintainable code in a structured way. It could serve as part of a larger project focused on developing a complete arcade-style game framework and improving it with consistent computer behavior, additional game modes, enhanced UI elements, and expanded interface systems. By building these core systems, the task creates a flexible foundation for future improvements and new features, leading to a more modern, creative, and enjoyable Ping Pong game.

Rubric Items

  1. The paddles, level background, and level elements all appear sharp.
  • Run the main scene and observe that the player paddles, level background, and level elements all appear sharp and clear.
  • The task prompt requires that all player paddles, level background, and level elements remain visually sharp and clear.
  1. The player characters are short, white, rectangular, vertical paddles.
  • Run the main scene and observe that the player characters appear as short, white, rectangular, vertical paddles.
  • The task prompt requires that the player characters appear as short, white, rectangular, vertical paddles.
  1. The game environment and menu background are completely black.
  • Run the main scene and observe that the game environment and menu background are completely black during gameplay.
  • The task prompt requires that the game environment and menu background be completely black during gameplay.
  1. The player characters collide with the environment, ball, and walls.
  • Run the main scene and move the player characters up and down to confirm there is a collision with the ball and the level's border walls.
  • The task prompt requires functional collision bodies for the player characters to interact correctly with all level environment elements.
  1. The camera displays the player paddles accurately during gameplay.
  • Run the main scene and move the player paddles up and down to confirm that the camera accurately displays the entire game.
  • The task prompt requires a camera to maintain a consistent locked view of the gameplay to display the player paddles and ball.
  1. The paddles can move up and down and stop when input is released.
  • Run the main scene, move the paddles up and down with the W and S keys and arrow keys, then release the keys to confirm they stop.
  • The task requires using the arrow keys and the W and S keys for movement, stopping the players upon releasing the keyboard input.
  1. The bouncing ball can play two different beep sound effects randomly.
  • Run the main scene, allowing the ball to hit the walls and paddles, and observe that two different beep sound effects play randomly.
  • The task prompt requires that the ball can collide with the walls and paddles and trigger two different beep sound effects randomly.
  1. The game fully resets when the player presses the R key, restoring all gameplay elements and objects to their starting state.
  • Run the main scene, press the R key during gameplay to confirm the game, ball, paddles, score, and visual elements reset completely.
  • The task prompt requires a full game reset triggered by the R key, restoring all game objects and state to their starting conditions.
  1. The ball is a small, white, square object that always starts in the center and gradually increases speed after each paddle bounce.
  • Run the main scene and observe a small white square ball starting at the center, and gradually increasing speed after each paddle hit.
  • The task prompt requires a small white square ball that begins at the center and gradually increases speed after each paddle hit.
  1. The score system tracks both players and increases the counter by one when scoring a goal, and triggers a win sound effect.
  • Run the main scene and observe that when the ball enters a goal area, the player's score label increases and a win sound plays.
  • The task prompt requires a scoring system that increments player scores on goals and plays a win sound effect upon scoring.
  1. The main menu displays the title "PING PONG" in a large font at the top center with three vertically stacked mode selection buttons.
  • Run the main scene and observe a main menu with the title "PING PONG" centered at the top and three stacked buttons in the middle.
  • The task prompt requires a main menu titled "PING PONG" in a large font with three vertically stacked buttons for mode selection.
  1. The game includes three selectable game modes to experience: "Player 1 vs. COM," "Player 1 vs. Player 2," and "COM vs. COM."
  • Run the main scene and switch between modes to confirm that the gameplay changes for single-player, multiplayer, and COM vs COM.
  • The task prompt requires three separate game modes: player vs. computer, player vs. player, and computer vs. computer gameplay.
  1. The computer opponent is programmed with consistent behavior, reaction time, and ball tracking, and remains fairly beatable by the player.
  • Run the main scene and play against the computer to confirm it follows predictable movement patterns and can be defeated.
  • The task prompt requires a computer opponent with consistent behavior that provides a fair and beatable challenge to the player.
  1. A white dashed line divides the game area, and pressing the E key displays a solid predictive line showing the bounce path of the ball.
  • Run the main scene to observe the dashed center line, then press E to show a solid line that predicts the ball's path after a paddle hit.
  • The task prompt requires a white dashed divider line and a toggleable predictive trajectory solid line activated with the E key.
  1. Pressing the Q key enables debug mode and ball control using UHJK keys, hides the trajectory line, and pressing reset exits the debug mode.
  • Run the main scene, press Q to activate debug mode, use UHJK keys to control the ball, and verify the line disappears until reset.
  • The task prompt requires a debug mode toggled by Q that enables manual ball control and hides the predicted trajectory line.
  1. A "PAUSED" label appears in the center when pressing the P key, and pressing the P key again or the R key resumes or resets the game.
  • Run the main scene, press the P key to show a "PAUSED" label, then press the P key again or the R key to resume or reset gameplay.
  • The task prompt requires a pause system that displays a central label and allows resumption or a reset after pressing the P or R key.
  1. Pressing the Escape key during gameplay returns to the main menu, and pressing the Escape key again in the main menu closes the game.
  • Run the main scene and press Escape during gameplay to return to the menu, then press Escape again to close the application.
  • The task prompt requires Escape key functionality to return to the main menu and close the game from the main menu.
  1. Left and right detectors detect the ball and goals, award points correctly, and reset the ball to the center to continue playing.
  • Run the main scene and observe that when the ball enters either goal, the correct player scores, and the ball resets to the center.
  • The task prompt requires a detection zone for each side, which updates scoring and resets the ball position after each goal.
  1. The game supports a 10-point win condition, starting a new round when a player first reaches more than 10 points during gameplay.
  • Run the main scene and play until a player exceeds 10 points to observe that the match ends, and a new game round begins.
  • The task prompt requires a win condition that triggers when a player reaches more than 10 points, restarting the match flow.

Godot - https://feather.openai.com/tasks/2c3fb90e-2060-4bb6-be0d-ae689196f568/stage/prompt_creation - Awaiting response.

About

Create a Godot task: How to make PONG in Godot 4 for beginners

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors