A pong table might seem quite sound
But beware, as it starts to go ‘round
The forces, fictitious
Can be quite pernicious
Your ball might end up on the ground...

Inspiration

Ever played pong and thought "This is fun, but it would be so much better if I was in a frame where fictitious forces arise and I have to change my intuition about the laws of motion?" Here's your chance to test out that thought!

"Coriolis", "Centrifugal", "Azimuthal". You've probably heard these words and been like "who cares?" Well, YOU should! You live in a rotating reference frame. The centrifugal force makes gravity weaker at the equator, and the Coriolis force makes hurricanes spin in different directions in the North and South hemispheres. Granted, if you're ever caught in a hurricane, your first thought will probably not be oh, the direction of this wind is due to the rotation of the Earth. So you might not build much intuition from a hurricane.

Thankfully, you don't have to wait for a hurricane or travel to Florida to study fictitious forces. We've brought it right to your virtual doorstep!

What it does

We created a two-player game of pong where you have a paddle (technically, you are the paddle) on a rotating turntable. If you let the ball fall off the table, you lose! You're constrained to travel along the ring of the circle and you can't hit the ball twice in a row. First one to make it to 10 points wins. You also get fun power-ups which appear randomly around the track, such as your paddle getting wider or your opponent's speed suddenly increasing. The whole thing is set to soothing relaxing music that will give you peace of mind.

How we built it

We used PyGame, a library which allows us to create fully featured games and multimedia programs in python. We used classes built on top of existing PyGame classes, as well as some of our own, to make our game versatile and easy to modify. We used Euler integration to turn the equations of fictitious accelerations into position and velocity vectors.

Challenges we ran into

We had trouble with coordinate transformations. PyGame operates in Cartesian coordinates with the origin being the top left corner. But we wanted a polar coordinate system centred in the middle of the screen. Constraining the motion of the players to be around the centre was quite difficult, as was implementing our power-ups. We've also never created User Interfaces before so that presented quite a challenge.

Accomplishments that we're proud of

We're very proud that the physics of the rotating system works so well, and that the game is fun to play. But don't just take our word for it, try it out yourself! Instructions and all relevant files are on our GitHub repo.

What we learned

Physics is easy, coding is hard. New respect for software engineers!

What's next for Pong-Inertial

We had a lot of fun building this game and we'd really like to make it better. We want to add a single-player mode where you get to play against an AI that was trained using reinforcement learning (fancy word). We'd also like to add more forces, by implementing potentials which can further confuse the player. We have the framework for it already, unfortunately we didn't have time to fully succeed at this. Give us a break, we're tired.

Built With

Share this project:

Updates