Lets make a unity3d space game - Procedural Planets Update

1 year ago
24

Hello, and welcome to FiveTwoEightGames lab. It's been a while since our last video on Hubris Solaaris. I've been busy working on our NFT project: Food Fighters.

But it's time to get back to making some progress on our space title. I aim to bring Hubris Solaaris to the blockchain community by integrating NFTs into the game. But for now, i've decided to make a change to the planet generation.

In this video i'll go over what I've changed, and how i changed it.

If you watched the previous videos on the planet generation, you might remember i was going for a blocky style for the planets. And to be honest, i think it looks pants.

After playing with it, it just didn't feel right. I also had some concerns around the performance of the game and although fixing those performance issues would have been fairly trivial, it didn't feel like the right path for the game to continue down the square blocky planets path.

So, since I want the spaceships to be fairly realistic and since we're using mainly Unity Asset store assets for now, it's going to be much easier to go for a less stylized look for the planets.

By using planet prefabs that look more like, well, Planets, It means the look of the game should feel more consistent because the asset store has a lot more assets that blend with our space craft.

So let's take a look at where we left off.

You start the game in the main screen which transitions seamlessly into gameplay. Once you scan for local planets you can pick which one to travel to, from the list of scanned planets.

Since the last video i've added a flight controller so the player can now fly around using the game controller or keyboard. For mobile, we will have to add some UI controls for that at a later date.

So here you have this square planet thing, which honestly doesn't look like a planet at all. The scale doesn't feel epic enough and it just feels wrong.

So i headed over to the asset store and found quite a few planet assets. But the one that seemed to fit the most with what I need for Hubris Solaaris is, Next-Gen Planets one, by Nova Shade. I like how the planet prefabs are already setup and changing the configuration from the inspector is super easy. So i went with this.

The first thing i'll do here is add our planet prefabs as addressables. I'll name them according to the planet composition so we can easily select which planet to load and spawn at runtime.

Next, we need to make a few simple code changes.

The first is to add a new method on the planet factory. I'm not ready to delete the existing method yet, so we'll keep that code for now.

The new method is much more straight forward. It simply creates an instance of the addressable prefab at the specified position.

Next i need a new overloaded method on the game object factory. This method takes the prefab label, which we use as a postfix on the prefab name. This is so that we can distinguish between sprites, terrain and planet prefabs without loading all assets of a particular label.

Finally the last code change is to head over to the main menu code and change the code to call our new planet factory method.

Now let's run that and see what we get.

And of course it didn't work first time as I am using the planet name and not the planet composition to load the addressable. So let's fix that, and run it again.

So no errors, so lets fly towards the planet and see what it looks like.

And there we have it! a much better looking planet with very little effort.

Of course we may need to make some tweaks to this later and address some performance issues with the textures for mobile. But for now i'm happy with this change.

Thanks for watching, and join me in the next video for more progress on Hubris Solaaris.

Loading comments...