Being able to simulate an n-body problem in real time.

What it does

Space invaders, but all the projectiles have mass and interact with each other.

How we built it

We used pygame for all the graphics, and computed the gravity, speed, and position using numpy. Numpy provides us with the FFT and matrix operations tools we need.

Challenges we ran into

  • Learning game development
  • Performing 2D FFT
  • Divergence for numerical integrals, conservation
  • Meeting Performance constraints (target 60FPS)

Accomplishments that we're proud of

  • Running n-body in real time using particle mesh simulation
  • Polishing the final product

What we learned

  • 2D FFT is hard to get right
  • n-body can be done in real time

What's next for Space Invaders n-body

  • Add collisions between particles
  • Make them merge in a way that conserves momentum
  • Make their size relate to their mass
  • Add a slider to modify gravitational constant
  • Add a versus mode and a score system
  • Optimize the code using GPU computing
  • Improve accuracy in force calculation (possible, but necessary?)

Built With

Share this project: