I got stuck trying to make the asteroid field have density waves that would correspond to rings like what Saturn has. Spent 8 hours noobing around last weekend trying to figure out an algorithm. I managed to make a wave, but only while going in one direction. Basically the box that puts down the asteroids outside the screen would check for the Y coordinate and oscillate the density of asteroids between 2 values as Y increased. So as the ship was going up it would travel through denser and less dense regions.
I was stuck because I wanted to generate a whole ring system based on some equations. I hoped I would be able to figure something out eventually. Luckily I realized today that I only need a map with regions that would correspond to the rings and even interesting artifacts caused by gravitational interactions between moonlets and the particles of the ring. Then just need my "asteroid generator" to pop stuff into the game based on where it is on that map. So it could vary the density of asteroids based on location and create the illusion of traveling through a detailed ring system. :)
I do want to have gravity and basic orbital mechanics but I will have to cheat because no computer today would be able to handle a ring system actually made of billions of objects and realistically interacting with the planet they orbit.
The plan is to have a planet and gravity, and have the player in orbit. Then have the ring marked out as regions, and as the player orbits it generates and destroys the asteroids based on what region it is in. The asteroids are spawned with correct orbital velocity so when they enter the simulation and while they are in, they interact with the planet and it's gravity properly. Once they are offscreen they are popped out. I will use pooling so I won't have to constantly create and destroy objects, and I bought an asset that seems to be a way better gravity implementation than what I cooked up. Faster, and seems to be able to handle a lot more objects.
I want to make the ring system BIG. The dream is to have the same scale as Saturn's actual rings which would mean that with the relative velocities achievable within the game it would probably take months to traverse it to either get to the planet, or to get to the edge and try reach some larger moons. Being a 2D game it is a bit hard to avoid the rocks. :)
still need to tweak the engine and the health of other objects and I want to make the asteroids breakable. I will continue to work on the "environment" a bit longer. Now that I have figured out a way to make it less boring and more structured I am quite excited. :) I might even add a moonlet with weak gravity so we can have some landing action happening. :) I love lander type games. :)