Ah yes, the Pong Game. Every aspiring game developer has to try their hand at this at some point. My first time writing Pong was in Intro to C++ in high school, some twenty years ago (my first attempt at AI programming? perhaps!)
This was the first project in Rapid Game Development, and a great reality check for the rest of the semester. I came into the class having spent the summer working on a side project of my own, during which time I spent days refining my program’s architecture, refactoring and rewriting as it became clear that some things just didn’t belong where they ended up. To try and avoid this, I painstakingly planned out the Pong game, worrying about putting the wrong components in the wrong class. As a result, the game, while pleasingly architected and coded in a fairly minimalist way, is kind of boring! Maybe that’s an inherent limitation of the form, but this was a great lesson in how important it is to focus on iterating on gameplay features by actually building and playing them as soon as possible.
The ball is using the Unity physics engine for collisions, which can lead to the occasional janky or strange movement; I don’t think I leaned on the Unity physics engine as heavily as I did here for the rest of the semester as a result.
The UI is using the new Unity UI Toolkit, which is complete overkill but still worth knowing as well as the (eventually) outgoing UI tools.
Input is also handled using the new Unity Input System (both examples of overcomplicating this project due to beginning-of-the-semester-optimism).
As usual, I’m using ScriptableObject Events for much of the inter-script communication (such as New Game, Pause, Game Over, etc.) and an Animation Curve plus a timer on the Bumper’s local transform position to “fire” the bumper. (I decided against posting the code for this on GitHub since it’s nothing fancy or complicated.)
Phasellus non ante ac dui sagittis volutpat. Curabitur a quam nisl. Nam est elit, congue et quam id, laoreet consequat erat. Aenean porta placerat efficitur. Vestibulum et dictum massa, ac finibus turpis.