# How do I randomly generate solar systems with a star and planets

**URL:** <https://forums.unrealengine.com/t/how-do-i-randomly-generate-solar-systems-with-a-star-and-planets/455679>\
**Category:** Asset Creation\
**Tags:** planet, random, orbit, unreal-engine, name, question\
**Created:** [September 20, 2019, 4:06am UTC](https://forums.unrealengine.com/t/how-do-i-randomly-generate-solar-systems-with-a-star-and-planets/455679 "2019-09-20T04:06:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![UsualSpace](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UsualSpace](https://forums.unrealengine.com/u/UsualSpace)\
**Post date:** [September 20, 2019, 4:06am UTC](https://forums.unrealengine.com/t/how-do-i-randomly-generate-solar-systems-with-a-star-and-planets/455679/1 "2019-09-20T04:06:38Z")

</div>

Here is everything I want help with in this post:

1. I want to be able to randomly generate planets arranged in a solar system with a sun in the middle and a limited amount of planets in each solar system(I want to generate multiple during runtime).

2. I would like each planet to belong to an orbit that moves around the center point(the sun, which would be an actor). I would like each orbit to be different, some perfect circles, ellipticals, some slanted, some that make the planet go in the opposite direction, some the get super close to the sun and then shoot out into space until it gets close again, yknow, variety.

3. I would like each star to have a random but not too random( not something like dhfbhddjiskszjajdh 5) name and each planet be randomly named or named after their star. I want the name to be changeable by the player and to have a star map that shows each each solar system that you can travel to. Basically like no mans sky mechanics and galaxia.

Please do not direct me to the marketplace or any downloads or plugins unless there is absolutely no other way. Also, suppose I have already created planet actors. And finally, I would like all of this to be in blueprints. Thank you for taking time to help me if you do.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 20, 2019, 10:23am UTC](https://forums.unrealengine.com/t/how-do-i-randomly-generate-solar-systems-with-a-star-and-planets/455679/2 "2019-09-20T10:23:02Z")

</div>

You’re basically asking someone to design an entire game for you 🙂

The planet and sun part is not too bad, but the stars is a whole other thing.

In BP, each planet would have to know which sun it is to orbit around and can then contain the code to do this in a ‘random’ manner. You could spawn each solar system based on the total size of the collision box so you don’t get overlapping systems.

But for the stars, you can’t fill the map with stars, it will never run. So you probably have to use a picture of stars, but it is possible to zoom in on some areas, and there you will find a solar system.

---

<div class="post-metadata">

**Author:** ![UsualSpace](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UsualSpace](https://forums.unrealengine.com/u/UsualSpace)\
**Post date:** [September 20, 2019, 2:46pm UTC](https://forums.unrealengine.com/t/how-do-i-randomly-generate-solar-systems-with-a-star-and-planets/455679/3 "2019-09-20T14:46:00Z")

</div>

Ok sorry if I was asking a lot. What if it wasn’t random. I’ll change the question to: how can I get an actor to revolve around an object of my choosing at a set speed?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 20, 2019, 2:58pm UTC](https://forums.unrealengine.com/t/how-do-i-randomly-generate-solar-systems-with-a-star-and-planets/455679/4 "2019-09-20T14:58:46Z")

</div>

Well, that bit’s not too bad, and once done, the angle and shape could probably be randomized fairly easily. How many planets per solar system? 10-20 or hundreds?

---

<div class="post-metadata">

**Author:** ![UsualSpace](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UsualSpace](https://forums.unrealengine.com/u/UsualSpace)\
**Post date:** [September 20, 2019, 3:00pm UTC](https://forums.unrealengine.com/t/how-do-i-randomly-generate-solar-systems-with-a-star-and-planets/455679/5 "2019-09-20T15:00:14Z")

</div>

Probably like max 4. I can adjust it later but for now 4 is the max

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 20, 2019, 7:54pm UTC](https://forums.unrealengine.com/t/how-do-i-randomly-generate-solar-systems-with-a-star-and-planets/455679/6 "2019-09-20T19:54:18Z")

</div>

So I made this:

![287942-system.gif](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/9/b/59bb782f6f403b41e0b161b74d4d9a324469fa25.gif)

I’ve attached the code in text files ( you just open the text file, copy all and paste into the BP sheet ).

[link text][2]  
[link text][3]

The vars in the main BP are:

![287946-vars.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/e/9/1e9a0c802d20530e7d9106d854560a19ba43f920.jpeg)

It’s a little clunky but works pretty well. One limitation is the planets are a fixed distance apart.

If you can’t get it working, tell me, and I’ll give you a project link.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 20, 2019, 7:54pm UTC](https://forums.unrealengine.com/t/how-do-i-randomly-generate-solar-systems-with-a-star-and-planets/455679/7 "2019-09-20T19:54:58Z")

</div>

( PS, the BP contains no meshes, everything is spawned, planets are random sized and move at random speeds ).

---

<div class="post-metadata">

**Author:** ![UsualSpace](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UsualSpace](https://forums.unrealengine.com/u/UsualSpace)\
**Post date:** [September 20, 2019, 10:10pm UTC](https://forums.unrealengine.com/t/how-do-i-randomly-generate-solar-systems-with-a-star-and-planets/455679/8 "2019-09-20T22:10:52Z")

</div>

Thank you so much.
