I’m wanting to create a space game where you can fly anywhere, and I believe the way I have to do it is to generate content around the player as they go, like in Minecraft, anyone familiar with how this is done? What is the underlying concept on how this works and how data is managed?
Thanks TechDeveloper, any other advice on this? I would prefer to try and design it myself with some help, haven’t been able to find any books or decent sites from Goggle on the subject…
Yes, you can basically create terrain tiles around your player as they move through the game-world. The World Streamer asset will do this for you with separate scenes actually, where it streams in terrain tiles from a bunch of different scenes, and pieces them together (loading/unloading them) depending on the position of the player. But even World Streamer has it’s flaws and limitations.
One of the hard parts though, is that you start getting weird physics behavior the further you get away from your world’s “origin” due to floating point precision errors in Unity. So this makes creating an infinite world really annoying, as you have to adjust for this big problem (physics behavior starts breaking down at a certain distance from the origin etc…) So, you have to “reset” your world origin to your player’s position, every so often, in order to fix the floating point precision problem by giving Unity calculations it can actually handle.
It’s actually not super hard to do this yourself, it’s just that getting Unity to perform well with an infinite world is actually kind of hard to do (as usual with Unity). However, the World Streamer asset is a quick way to do it. I still have large Garbage Collection CPU spikes using World Streamer though, so it’s not perfect either.
Once Unity upgrades/fixes it’s extremely inefficient Garbage Collection system, making an infinite world in Unity will become a lot easier. But performance and garbage collection issues have been with Unity for years and years, so I’m not holding my breath on that one.
Hi Vanz,
I think. First have to design the world/level without thinking of procedural/automatic generation of levels. Iterate till it becomes fun game. Next step is procedural/automatic generation.
Infinite world can be a made using multiple scene. Multi scene management is different story. Making the World of Firewatch (In this gcd video she talked about how they managed their world little bit).
Sebastian Lague have good procedural mesh generation tutorials.
Use multiple cameras. Keep all of the distant (far away) things in a separate layer (call it something like DistantSpace or DeepSpace) and render that using one camera, and then use your main camera to render only the near objects. You may even want to periodically bake the distant view camera content into a skybox cubemap for more performance.
If you are not going to land on planets, then you can place all of the planets in the DistantSpace/DeepSpace layer. If you are going to land on planets, then you will need to come up with a strategy for determining when to move a planet between the two cameras. The exact strategy with vary depending on what your core gameplay loop is. It will be up to you to experiment with how you transition content between cameras during landings and takeoffs.
I been designing large worlds for decades and I still use World Streamer as it saves time, time is money…For the time you spend, you could of saved money and time else where and you will have a better understanding…
I had the same attitude, I can make this and that myself…and realized after working on alot myself, it took me hours, then weeks, then months then years… Now I can make this stuff in days and weeks… with my experience and with the right assets…I worked for AAA companies and I make tools for them and art which is like an asset too…So they use this type of stuff as well, because time is money…
It can be , but after making hundreds of games with large worlds, its better off using some form of streaming like World Streamer, or loading and unloading tiles such as Map Magic does…
I think its good idea to develop the system on your own if you want to. Mostly if its some project where you need to have full control over how everything works and works specificaly for your needs. I would at least try to put few days into it and see where you can get with it. If nothing else, you will learn something new and thats always a good thing. But if you get to a point you can see it would take you two months, its probably better idea to grab some plugin which can do it for you.
Btw, for the generation of large worlds and issues with calculations when too far from world origin, you can make the player static and move the world around him.