Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emmanuel_Delgado: PongRL Week 1 #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RandomCyberCoder
Copy link

Code Exploration
Pong/_Pong.cs
This seems to be the master class that contains all the constants. It also seems that the GameCache class will hold the data for one frame of the game. The GameHelpers class seems to be for updating the ball and players position

_Pong.cs :GameConstants, hold important constants
_Pong.cs :GameCache, hold data of a frame of the game or values to be used during the game
_Pong.cs: RIGHT_PADDLE_X_POSITION, the right paddle’s fixed x position
_Pong.cs: LEFT_PADDLE_X_POSITION, the left paddle’s fixed x position
_Pong.cs: RIGHT_PADDLE_CONTROLS, right paddle controls
_Pong.cs: LEFT_PADDLE_CONTROLS, left paddle controls

pong/GamePlayer/_Pong-GamePlayer.cs
Defines the partial classes that will be essential for the data of the player, how the player will be controlled, and a playercontroller class which I'm unsure of.

_Pong-GamePlayer.cs: PlayerData, class to hold player data
_Pong-GamePlayer.cs: PlayerControls, how the player will be controlled
_Pong-GamePlayer.cs: Player, class that holds all player information

Pong/Ball/_Pong-Ball.cs
Holds classes for how we define a one opponent scoring a goal on the other opponent. The header file also seems to have the class for the how the ball’s collision will be handled

_Pong-Ball.cs: PongBall, how when the ball hits a paddle
_Pong-Ball.cs: BallGoal, hold data for when one opponent scores a goal

Pong/GameManager.cs
Holds the game logic and has a function to start the game. This file also seems to store information of each frame for the player and the ball. Also displays the score of the game

GameManager.cs: Start(), sets the values for the speed of ball and player. Also initializes the player objects and ball object
GameManager.cs: Update(), updates the player and ball every frame of the game
GameManager.cs: GameCache.{variables}, sets the values for the speeds, and max angles the ball can have

Pong/GamePlayer/Player.cs
Contains the player class which will initialize the player with its data, the controls for that player, and its scoreboard. Also, it has functions to update the player, set the player’s opponent, and the dimensions of the player

Player.cs: playerData, hold data of the player
Player.cs: scoreboard, holds the score of the player
Player.cs: opponent, opponent of the player
Player.cs: Player(), constructor of the player
Player.cs: Opponent(), set the player’s opponent
Player.cs: Update(), function that will be used to update the player’s information each frame
Player.cs: ScorePoint(), determines if the player scored the point, seems like this will be use for the RL agent later on

Pong/Ball/PongBall.cs
The class controls how the ball will behave depending on if a player scored a goal or if the ball hit a player’s opponent

PongBall.cs: attacker, last player that touched the ball, helps us determine who scores a goal
PongBall.cs: OnScore, what should happen if a goal is scored
PongBall.cs: OnRebound, what should happen if the player hits the ball back
PongBall.cs: PongBall(), holds the logic for what should happen if goal is made of player hits ball back
PongBall.cs: SetAttacker(), sets the player who last touched the ball
PongBall.cs: DestroyBall(), destroys the ball when the player scores a goal to allow it to be reset

Testing
Modified the BALL_Y-MAX_DERIVIATIVE in the _Pong.cs header file. Increasing the value seemed to have a slight change in the velocity of the ball. I also noticed that increasing the value to high seemed to have the effect of the ball suddenly not moving.
Modified playerSpeeedVP in GameManager.cs. This seemed to affect how fast I could move the paddles. However, the speed the paddles moved didn’t seem to differ much when I changed the values. I set it to zero and the paddles still moved so I’m not to sure what this controls
Modified the function PlayerControls in _pong-GamePlayer.cs to reverse the controls of the player. I found that the KeyCode type stores the button that the player will use to control the paddles.

Documentation
_Pong-GamePlayer.cs
_Pong.cs
_Pong-Ball.cs

Player.cs
GameManager.cs
PongBall.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant