Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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