Our team was inspired by playful and engaging teaching moments that inspired us to study physics in the first place. We hope this game will make learning about special and general relativity fun and accessible to all.
What it does
Galactic pong introduces relativistic effects to the game of pong, providing a fun and engaging way to learn about special and general relativity. Paddles undergo length contraction when moving at close to the speed of light, making it harder to hit the ball. In addition to this, players can place black holes in the field of play which will bend space and time and affect the trajectory of the pong ball. Due to the gravitational pull of the black holes, both the ball and the paddle will undergo time dilation and the flow of their time will appear slow relative to observers at rest relative to the field of play. The relative flows of time are visualized in the three clocks located on the top left of the screen. The gravitational constant and the speed of light of the universe can be varied using sliders found on the bottom left of the screen. Modifying these parameters not only changes the difficulty of the game, but demonstrates the relationship these universal constants have with relativistic effects.
To play the game and read more about the theoretical background of our project, check out our website.
How we built it
The game was developed on p5.js. The equations of motion of the ball were based on the Einstein-Infeld-Hoffmann equation which describes the dynamics of point masses under mutual gravitational influence. The equation of motion was simplified by assuming the mass of the ball to be negligible and then solved numerically directly in p5.js.
The website was developed on React.js and the game's soundtrack was composed by our teammate Mark Daniel during the 24 hours of the hackathon on Logic Pro X.
Challenges we ran into
The challenges we had with this project were:
- Physics: The original game of pong has very straightforward, semi-realistic physics. When determining the necessary relativistic corrections, we struggled to balance realism and game playability. The compromises we made are seen in the paddles, which are immovable in the x direction but not in the y direction, and the black holes, which affect the ball, but not each other. When calculating the time dilation for the ball and player, we struggled to consolidate the effects of Special and General relativity. We consulted with Alex Mamaev on this problem. The ball and player clock speeds depend on their distances to not just one black hole, but multiple; combining these effects presented another challenge.
- Implementation: While p5.js greatly simplified the implementation of the animation, our team’s lack of experience with it slowed us down.
- Workflow: Bringing our game to life on the website was laborious and tedious.
Accomplishments that we're proud of
- We are most proud of how fun the game is to play. Being able to add additional black holes and change the universal constants with sliders in real time keeps the game exciting each round.
- We are proud of the realism of our game. We add relativistic corrections making for extremely accurate dynamics.
- We are proud of how we were able to implement the game in such a short time frame. Coding games is hard!
What we learned
- Relativity: Numerically solving for relativistic corrections gave insight into which terms of the Einstein-Infeld-Hoffmann equation dominate.
- P5.js game development: p5.js offers a great environment for making games and simulations. Getting our hands dirty with its mechanics was rewarding.
What's next for Galactic Pong
In the future, we would like to add some additional functionality to further emphasize the effect of relativity. This includes adding a contour plot representing the changing gravitational potential of the black holes with relativistic corrections and a “radio” feature where players can tune into a radio station from the frame of reference of either the ball, the paddle, or the resting observer. The playback of the radio will be dependent on the relative flow of time in that frame of reference, offering players a more immersive way of experiencing the effects of time dilation.