Inspiration

To create a project that is procedural generation.

What it does

Random generation of solar systems that consist of 1 to 9 planets, the first being the sun and the rest orbiting the sun. There is movement involved, with the WASD keys for going up, left, down, right respectively. There is also a reset camera key on space bar.

How I built it

We as a team built our project first with a set range of 1280 by 720 pixels. With one solar system object in the center or at the origin 0,0 which is the top left of the screen. We then created planets after a general creation of the solar system. Movement of the orbits were made based on a random speed and a random distance between the first planet and each planet. We did include offsets for most of our random generation in order for the orbits to avoid collisions. We also created another class called stars for effects that we can see as we move. The way we implemented movement was that all objects would move to the left as we hold the right movement key.

Challenges I ran into

A huge challenge we ran into was the generation, spacing, and loading/despawning objects when out of frame. We solved the issue of loading and despawning by stopping the rotation of solar system objects and cut the display when out of range of the frame plus some buffer zone. Generation was accomplished by using division and modules, so every set distance, that we can change, a new solar system cannot be generated if one was already generated near it. Some problems still occur, but less frequently. Since there is random generation, there is some orbit overlaps.

Accomplishments that I'm proud of

We did this project strategically, but there are definitely improvements that can be made. One thing that we tried to do was have chunks with solar systems and load them based on frame size and a chunk length buffer. In the end, we completed the project with a constant random generation of solar systems.

What I learned

I personally learned a bunch about JavaScript which I was not fluent in yet. I practiced a lot on randomization and how to do the common works in JavaScript such as making classes, constructors, and other functions.

What's next for Space Program Alpha, Random Universes

The next phase that needs to be completed is chunk generations with distance based solar systems. This means that we have a changing distance from one solar system until we load another.

Built With

Share this project:

Updates