how do i make a gravity like system for planets

I wouldn’t try to do an n-body physics simulation, it takes a lot of work on the integrator to make it stable over time. Take a look at Kepler’s law.