EpicPong24 – [24h00] Project Finished!

I finished the project! It has been a long 24h but I’m really happy with the result. Here are some notes about the game and learning lessons from this project :

Game :

  • There are currently 6 Level. Each time you finish a level, you get some EXP point. You can do a level over and over.
  • You can use EXP to buy paddle size, speed and more life. Cost are exponential thought.
  • Saddly, I didn’t have time to implement level unlock(i.e, lvl 2 is unlocked after finishing lvl1). I also didn’t have time to show the EXP reiceved after you won a game.
  • The pink trail renderer is pretty ugly. I didn’t have time to learn how to make it better but decided to let it like that.
  • There are a couple of level design I didn’t have the time to try. I built the last 3 level under 20 minutes. I also want to experiment adding more balls and more AI paddle (I.e : Need to beat 3 different paddle in their own small part of the level to win it). Those two will need a bit of modification on the AI.
  • I slept 4h tonight and woke up 1h30 before the end. It’s incredible how of a difference polishing can do. I added a lot of small things in the 1h30 and game is pretty decent now.


  • I need to centralize my datas more than I do. I tried to do it in the end with LevelManager.
  • I put all my script on __GameManager’s GameObject and it is getting confusing. I should put more script on the respective GameObject.
  • OnCollisionEnter and OnTriggerEnter are two functions I need to study more. I understand how they differ now but I’ll have to play with it a bit to understand how to make it work perfectly(i.e : Need rigidbody, collision working or not, ect…)
  • Next time, I’ll take the first hour to define class structures to avoid it getting all messed up. I think it is pretty good now. Some things could definitly be better, but I felt like things were encapsulated and I could modify thing locally pretty easily.

Links : 

EpicPong24 Repository on GitHub

EpicPong24 WebPlayer

[24h] - Menu

Fig1 – In-Game menu

[24h] - In-Game

FIG2 – In-Game Level 6

EpicPong24 – [7h30] We (finally) have a pong!

Finally, the basic pong system is working!

This took way more time that I thought (which is normal, I guess?). Two things gave me a lot of trouble :

– Everything is procedurally generated and I want to make sure I’ll be ready when I’ll add many levels, walls and balls.

– I’m using rigidbody for the physics. However, Pong has a different physic for the paddle. The farther you are from the middle, the steeper the angle of the ball will be after the contact. I initially tried to use OnCollisionEnter() or OnCollisionExit() and change the velocity of the ball myself. However, it often led to the ball going in and out of the pad and some other strange behavior. This is probably related to the way I handled the ContactPoints. I’ll have to look into it in more detail.

I finally decided to set my paddle to “is trigger” which prevented it to interact with the Ball’s rigidbody. I then used the following code with OnTriggerEnter() :

(Sorry for the unformatted code, I didn’t find how to copy-paster it formatted in WordPress. If anyone know, I would be really happy to hear from you)

// Change ball direction when it collide with pads.
 void OnTriggerEnter(Collider _Collided)
 GameObject _PadCollided = _Collided.gameObject;
 float _contactDeltaY;
 float _contactRatio;
 float _contactRatioPI;
 float _velMagnitude;
 float _newVelX;
 float _newVelY;

 // Calculate the ratio between the size of the paddle and the point being hit on the paddle
 _contactDeltaY = transform.position.y - _PadCollided.transform.position.y; // Distance on the Y axis between the pad center and the ball center
 _contactRatio = _contactDeltaY/_PadCollided.transform.localScale.y*2; // (-1,1) Ratio between the contactDeltaY and the half-length of the paddle.
 _contactRatioPI = limitAngle*_contactRatio*3.141592654f/2; // Ratio of PI to use for new velocity calculation

_velMagnitude = rigidbody.velocity.magnitude; // Magnitude of the velocity to keep it constant

 _newVelX = _velMagnitude*Mathf.Cos (_contactRatioPI); // New velocity in X axis
 _newVelY = _velMagnitude*Mathf.Sin (_contactRatioPI); // New velocity in Y axis

 // Update the ball velocity
 if(transform.rigidbody.velocity.x < 0.0f)
 rigidbody.velocity = new Vector3(_newVelX, _newVelY, 0.0f);
 else if(transform.rigidbody.velocity.x > 0.0f)
 rigidbody.velocity = new Vector3(-_newVelX, _newVelY, 0.0f);

And it works really smoothly!
I added a small point counter and a way to reinitialize the ball to the middle. The game is now playable!

For the next update :

o I’ll add different level and a way to generate them easily

o I’ll add a stat class for the player.

This will allow to modify all of the paddle attribute easily. The goal afterward, is to have the player gain Exp while doing the level. Player will have the possibility to tune its paddle with the level he gained. Further level will be harder and require more skill. Still a lot of work to do but it goes fairly well! Now, time to go eat something!! Updated repository and webplayer :

EpicPong24 Repository on GitHub

EpicPong24 WebPlayer

EpicPong24 – [2h30] We (almost) have a pong!

Hey, first update, 2h30 In.

I have basic pong working. It took me a while because I create all the wall, pad and ball from script. This will allow me for more control later on.

I decided to use Unity’s rigidbody physics to simplify the process. I’m not yet sure if it is a good decision. It bring some problem. For example, the ball angle won’t change depending on where it hit the pad, this isn’t how physic work. However, this is how pong work and it give more control to the player. I’ll have to find a way to make this work.

AI jitter a bit. I’ll have to make it look smoother. I will also need to add movement limit for pads.

Something else that gave me trouble is the bounciness. It is the first time I use any materials. I tweaked it to work as I want but we’ll see. Anyway, here are the updated links :

EpicPong24 Repository on GitHub

EpicPong24 WebPlayer

[2h30] - Basic Movements

EpicPong24 – Remake of Pong in 24H

Since I couldn’t make it for Ludum Dare this week-end, I decided to give myself a little challenge. I’ll give myself 24h hours straight to remake a classical, Pong. However, my goal is to make it EPIC.

The project will start from scratch at the time of this post, 8h00 (UTC-5), and will end tomorrow morning at 8h00.

I won’t use any Plugin or downloaded Assets. I will write everything myself with a little bit of help from my friend google.

I will keep the GitHub and the WebPlayer updated often through the day. If you only see a cube in the middle of the screen, that was just the initial commit to setup the GitHub/WebPlayer.I’ll make a post on the first update.

Links :

EpicPong24 Repository on GitHub

EpicPong24 WebPlayer

Feedback would be greatly appreciated during the project! Now time to code, stay tuned!