- Home /
Big dynamic universe in unity?
I am evaluating unity as an option to creating the game I would like to make.
What are the limitations on the size of the 'universe' in unity? If for instance I wanted different planets on which all NPC's are dynamically moving about/interacting with each other, is this possible in unity? I assume that would mean that I had multiple scenes with scripts running at the same time.
Also, what are the practical limitations on a single scene? How big can it be? How many npc's can be wandering about the scene on how big of a map?
I am aware that you can communicate with a web server to dynamically load scenes, however, I imagine there would be flaws with this method for a large dynamic game: your server code might not model the movement of the npc's the same as they would be moving about the landscape in a running scene in unity.
Answer by Tinus · Jun 15, 2010 at 11:59 AM
It's certainly possible.
However, it's not a matter of Unity being able to do it, it is a matter of you being able to do it. Doing large dynamic worlds of any kind means you need loads of level-of-detail, scaling, compression, streaming, etc.
The size of a scene is kind of limited by floating point precision. Travel really far from the center coordinate, and you'll start to see jittery behaviour. This can be remedied by building your own, more scalable coordinate system on top of Unity's system.
The amount of NPCs in a single scene all depends on how resource intensive a single npc is. Given a large number of fairly power-hungry npcs you will need to do some clever scaling, such as using simpler game logic and rendering for npcs that are far away.
The more of these systems you build, the bigger your game will be able to scale. But again, it's not up to Unity, it's mostly up to you. :)
10000 units is your soft cap on distances, you can fo further but then floating point errors become more apparent in the renderig and physics systems. There are ways around this though as Tinus suggests. I'm building somehin of a dynamic world and the asynchronous level load function is definitely handy.
A friend and I once worked on a Blitz3D space game and ran into the floating point distance limitation. We got around it in the end by basing the coord space on the player, so effectively the world moved around in player space rather than the other way around. Looked the same effectively, but it kept the floating point errors to the distant, un-noticeable horizon.
Would creating my own coordinate system on top of unity's system require the pro version?
Not at all, Unity Basic allows you to do it. Pro enables you to do some fancy post-processing and some other tricks, but in terms of game logic it offers exactly the same possibilities as Basic.
Novodantis' suggestion of moving the word around the player is a much-used solution. The forums have a bunch of threads with discussions on how to get it to work.
Answer by kohlditz · Jul 13, 2013 at 02:58 AM
For a large scale universe you'll need to use double precision instead, and then cast them to floats when you need to do graphics. This will give you accuracy of +/- 1 meter or so in full scale simulations of the solar system as far out as Pluto. It will fall apart at the galactic level.
It's against the terms of the license, but I bet you could use something like dotpeek (http://www.jetbrains.com/decompiler/) to reverse engineer the Vector3 class and then tweak it to use doubles. Hypothetically speaking, you'd be surprised at how much is represented with doubles internally.
If I was going to make a double precision version of Vector3, I'm sure it would only be an hour or twos work. Not that I would of course.
Your answer
Follow this Question
Related Questions
Procedurally generated 'space station' texture. Ideas? 0 Answers
Is it possible to dynamically add .fbx files to a unity project from a database during run time 1 Answer
How to make a mesh adjust its form around specific points 1 Answer
how to undo redo system implement on material.maintexture at runtime(InGame). 0 Answers
Dynamic spotlight always facing one way and not its GameObject's 0 Answers