Open mikesmith-23 opened 1 month ago
This sounds good to me. To make life easier, I would probably assume that you're going to clear and repaint the whole screen for each iteration of your game loop. It will probably be a bit slow, but you are right: we don't have libraries like ncurses here, so the alternative is manually sending escape codes to the terminal to selectively modify character cells (probably a decent amount of work on top of an already large project).
Will you be working with a teammate?
Command: The "pong" command will run a terminal-based version of the classic Atari game Pong, providing users with an interactive experience within the terminal. Players will control paddles using keyboard inputs, aiming to keep the ball in play as it bounces back and forth across the screen.
Plan:
Implementation: The pong command will launch a text-based version of Pong, rendering the paddles, ball, and boundary in the terminal. The paddles will be controlled by the arrow keys (or alternative keys if necessary), while the ball will move at a constant speed, bouncing off both the walls and paddles.
Difficulty Modes: Flags will be added to adjust the difficulty by altering the ball's speed and refresh rate.
-e
(easy - default mode): A slower refresh rate and reduced ball speed for beginner players.-m
(medium): Moderate ball speed and refresh rate, providing a balanced challenge.-h
(hard): Fast ball speed and high refresh rate, creating a more challenging gameplay experience.Key Input: Players will use keyboard input to move the paddles up or down. A key concern here is ensuring that the OS supports the necessary library calls to handle real-time keypresses, such as reading arrow key input or using an alternative method for key control if the OS lacks arrow key support.
Game Logic: The game will continue until one player scores a set number of points or quits the game by pressing a designated key. Scoring will be displayed in the terminal, and the game will reset after each round.
Future Enhancements:
-mp
) for two-player gameplay, where one player controls each paddle using separate keys.Files to be Added/Modified:
user/pong.c: Create the main implementation of the Pong game, including functions to handle game logic, key inputs, and difficulty modes.
Makefile: Modify to include
pong.c
so that it is compiled with the rest of the OS commands.kernel/syscall.h: Review and ensure that system calls related to handling real-time input or refreshing the terminal are properly defined here if necessary.
kernel/syscall.c: Modify to ensure any new system calls are properly handled in the system call table.
user/user.h: Add function prototypes for the Pong game's system calls or utility functions for input handling and screen refresh.
Concerns: To achieve the desired cursor logic in the terminal, this might involve calling third-party libraries (which might not be feasible -- being that we haven't covered this in class yet).